aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVitaly Novichkov <admin@wohlnet.ru>2018-03-24 22:41:44 +0300
committerVitaly Novichkov <admin@wohlnet.ru>2018-03-24 22:41:44 +0300
commitb303421864dc1cb2c48962e195dace6cdf7c4dc4 (patch)
tree9df016eb21ed3247e14a1f5a77e72cd6ea91a37d
parenta72d1f2efd0fe7dc259c318a39b1a67b5d188dd0 (diff)
downloadlibADLMIDI-b303421864dc1cb2c48962e195dace6cdf7c4dc4.tar.gz
libADLMIDI-b303421864dc1cb2c48962e195dace6cdf7c4dc4.tar.bz2
libADLMIDI-b303421864dc1cb2c48962e195dace6cdf7c4dc4.zip
Added ability to disable MUS and XMI converters and MIDI Sequencer
-rw-r--r--CMakeLists.txt28
-rw-r--r--README.md26
-rw-r--r--src/adlmidi.cpp76
-rw-r--r--src/adlmidi_load.cpp16
-rw-r--r--src/adlmidi_midiplay.cpp26
-rw-r--r--src/adlmidi_private.hpp18
6 files changed, 177 insertions, 13 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index e380bd7..1f2a9cf 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -43,6 +43,9 @@ option(WITH_GENADLDATA "Build and run full rebuild of embedded banks cache"
option(WITH_GENADLDATA_COMMENTS "Enable comments in generated ADLDATA cache file" OFF)
option(USE_DOSBOX_EMULATOR "Use DosBox emulator" OFF)
option(WITH_CPP_EXTRAS "Build with support for C++ extras (features are can be found in 'adlmidi.hpp' header)" OFF)
+option(WITH_MIDI_SEQUENCER "Build with embedded MIDI sequencer. Disable this if you want use library in real-time MIDI drivers or plugins.)" ON)
+option(WITH_MUS_SUPPORT "Build with support for DMX MUS files)" ON)
+option(WITH_XMI_SUPPORT "Build with support for AIL XMI files)" ON)
option(libADLMIDI_STATIC "Build static library of libADLMIDI" ON)
option(libADLMIDI_SHARED "Build shared library of libADLMIDI" OFF)
@@ -118,10 +121,24 @@ list(APPEND libADLMIDI_SOURCES
${libADLMIDI_SOURCE_DIR}/src/adlmidi_midiplay.cpp
${libADLMIDI_SOURCE_DIR}/src/adlmidi_opl3.cpp
${libADLMIDI_SOURCE_DIR}/src/adlmidi_private.cpp
- ${libADLMIDI_SOURCE_DIR}/src/adlmidi_mus2mid.c
- ${libADLMIDI_SOURCE_DIR}/src/adlmidi_xmi2mid.c
)
+if(WITH_MUS_SUPPORT AND WITH_MIDI_SEQUENCER)
+ list(APPEND libADLMIDI_SOURCES
+ ${libADLMIDI_SOURCE_DIR}/src/adlmidi_mus2mid.c
+ )
+else()
+ add_definitions(-DADLMIDI_DISABLE_MUS_SUPPORT)
+endif()
+
+if(WITH_XMI_SUPPORT AND WITH_MIDI_SEQUENCER)
+ list(APPEND libADLMIDI_SOURCES
+ ${libADLMIDI_SOURCE_DIR}/src/adlmidi_xmi2mid.c
+ )
+else()
+ add_definitions(-DADLMIDI_DISABLE_XMI_SUPPORT)
+endif()
+
if(NOT DJGPP AND NOT MSDOS)
if(USE_DOSBOX_EMULATOR)
add_definitions(-DADLMIDI_USE_DOSBOX_OPL)
@@ -143,6 +160,10 @@ else()
add_definitions(-DDISABLE_EMBEDDED_BANKS)
endif()
+if(NOT WITH_MIDI_SEQUENCER)
+ add_definitions(-DADLMIDI_DISABLE_MIDI_SEQUENCER)
+endif()
+
if(NOT WITH_CPP_EXTRAS)
add_definitions(-DADLMIDI_DISABLE_CPP_EXTRAS)
endif()
@@ -387,7 +408,10 @@ message("WITH_EMBEDDED_BANKS = ${WITH_EMBEDDED_BANKS}")
message("WITH_GENADLDATA = ${WITH_GENADLDATA}")
message("WITH_GENADLDATA_COMMENTS = ${WITH_GENADLDATA_COMMENTS}")
message("USE_DOSBOX_EMULATOR = ${USE_DOSBOX_EMULATOR}")
+message("WITH_MIDI_SEQUENCER = ${WITH_MIDI_SEQUENCER}")
message("WITH_CPP_EXTRAS = ${WITH_CPP_EXTRAS}")
+message("WITH_MUS_SUPPORT = ${WITH_MUS_SUPPORT}")
+message("WITH_XMI_SUPPORT = ${WITH_XMI_SUPPORT}")
message("libADLMIDI_STATIC = ${libADLMIDI_STATIC}")
message("libADLMIDI_SHARED = ${libADLMIDI_SHARED}")
message("EXAMPLE_SDL2_AUDIO = ${EXAMPLE_SDL2_AUDIO}")
diff --git a/README.md b/README.md
index 4bf5efd..6aa209d 100644
--- a/README.md
+++ b/README.md
@@ -72,15 +72,20 @@ sudo make install
You need to make in the any IDE a library project and put into it next files
(or include those files into subfolder of your exist project instead if you want to use it statically):
+### Useful macros
+* `ADLMIDI_DISABLE_XMI_SUPPORT` - Disables XMI to MIDI converter
+* `ADLMIDI_DISABLE_MUS_SUPPORT` - Disables MUS to MIDI converter
+* `ADLMIDI_DISABLE_MIDI_SEQUENCER` - Completely disables built-in MIDI sequencer.
+* `ADLMIDI_USE_DOSBOX_OPL` - Enables DosBox 0.74 OPL3 emulator to be used. Nuked OPL3 is used by default if macro is not defined.
+* `DISABLE_EMBEDDED_BANKS` - Disables usage of embedded banks. Use it to use custom-only banks.
+
### Public header (include)
* adlmidi.h - Library Public API header, use it to control library
* adlmidi.hpp - Public additional C++ API header, optional
### Internal code (src)
* adldata.hh - bank structures definition
-* adlmidi_mus2mid.h - MUS2MID converter header
* adlmidi_private.hpp - header of internal private APIs
-* adlmidi_xmi2mid.h - XMI2MID converter header
* dbopl.h - DOSBOX OPL Emulation header
* fraction.hpp - Fraction number handling
* nukedopl3.h - Nuked OPL3 Emulation header
@@ -89,13 +94,22 @@ You need to make in the any IDE a library project and put into it next files
* adlmidi.cpp - code of library
* adlmidi_load.cpp - Source of file loading and parsing processing
* adlmidi_midiplay.cpp - MIDI event sequencer
-* adlmidi_mus2mid.c - MUS2MID converter source
* adlmidi_opl3.cpp - OPL3 chips manager
* adlmidi_private.cpp - some internal functions sources
-* adlmidi_xmi2mid.c - XMI2MID converter source
* dbopl.cpp - DOSBOX OPL Emulation code (used when `ADLMIDI_USE_DOSBOX_OPL` macro is defined)
* nukedopl3.c - Nuked OPL3 Emulation code (used by default, disabled when `ADLMIDI_USE_DOSBOX_OPL` macro is defined)
+#### MUS2MIDI converter
+To remove MUS support, define `ADLMIDI_DISABLE_MUS_SUPPORT` macro and remove those files:
+* adlmidi_mus2mid.h - MUS2MID converter header
+* adlmidi_mus2mid.c - MUS2MID converter source
+
+#### XMI2MIDI converter
+To remove XMI support, define `ADLMIDI_DISABLE_XMI_SUPPORT` macro and remove those files:
+* adlmidi_xmi2mid.h - XMI2MID converter header
+* adlmidi_xmi2mid.c - XMI2MID converter source
+
+
**Important**: Please use DosBox emulator on mobile devices because it requires small CPU power. Nuked OPL synthesizer is very accurate (compared to real OPL3 chip), but it requires much more power device and is high probability your device will lag and playback will be choppy.
**Tip 1**: If you want to work with custom WOPL banks without using of embedded banks, you can create them by using [OPL3 Bank Editor](https://github.com/Wohlstand/OPL3BankEditor) where also included some WOPL examples, or you are able to save any other bank as WOPL.
@@ -118,6 +132,10 @@ To build that example you will need to have installed SDL2 library.
* Add support of MIDI Format 2 files (FL Studio made MIDI-files are wired and opening of those files making lossy of tempo and some meta-information events)
# Changelog
+## 1.3.2 dev
+ * Added ability to disable MUS and XMI converters
+ * Added ability to disable embedded MIDI sequencer to use library as RealTime synthesizer only or use any custom MIDI sequencer plugins.
+
## 1.3.1 2017-12-16
* Added Real-Time MIDI API (MIDI event functions and adl_generate() to generate PCM between of event rows) which allows you to implement plugin for media players or even a real time MIDI playing driver.
* Fixed some bugs
diff --git a/src/adlmidi.cpp b/src/adlmidi.cpp
index d40db53..e878354 100644
--- a/src/adlmidi.cpp
+++ b/src/adlmidi.cpp
@@ -272,6 +272,7 @@ ADLMIDI_EXPORT int adl_openFile(ADL_MIDIPlayer *device, const char *filePath)
if(device && device->adl_midiPlayer)
{
MIDIplay *play = reinterpret_cast<MIDIplay *>(device->adl_midiPlayer);
+#ifndef ADLMIDI_DISABLE_MIDI_SEQUENCER
play->m_setup.tick_skip_samples_delay = 0;
if(!play->LoadMIDI(filePath))
{
@@ -281,6 +282,10 @@ ADLMIDI_EXPORT int adl_openFile(ADL_MIDIPlayer *device, const char *filePath)
return -1;
}
else return 0;
+#else
+ play->setErrorString("ADLMIDI: MIDI Sequencer is not supported in this build of library!");
+ return -1;
+#endif //ADLMIDI_DISABLE_MIDI_SEQUENCER
}
ADLMIDI_ErrorString = "Can't load file: ADL MIDI is not initialized";
@@ -292,6 +297,7 @@ ADLMIDI_EXPORT int adl_openData(ADL_MIDIPlayer *device, const void *mem, unsigne
if(device && device->adl_midiPlayer)
{
MIDIplay *play = reinterpret_cast<MIDIplay *>(device->adl_midiPlayer);
+#ifndef ADLMIDI_DISABLE_MIDI_SEQUENCER
play->m_setup.tick_skip_samples_delay = 0;
if(!play->LoadMIDI(mem, static_cast<size_t>(size)))
{
@@ -301,6 +307,10 @@ ADLMIDI_EXPORT int adl_openData(ADL_MIDIPlayer *device, const void *mem, unsigne
return -1;
}
else return 0;
+#else
+ play->setErrorString("ADLMIDI: MIDI Sequencer is not supported in this build of library!");
+ return -1;
+#endif //ADLMIDI_DISABLE_MIDI_SEQUENCER
}
ADLMIDI_ErrorString = "Can't load file: ADL MIDI is not initialized";
return -1;
@@ -348,7 +358,11 @@ ADLMIDI_EXPORT const char *adl_getMusicTitle(struct ADL_MIDIPlayer *device)
MIDIplay *play = reinterpret_cast<MIDIplay *>(device->adl_midiPlayer);
if(!play)
return "";
+ #ifndef ADLMIDI_DISABLE_MIDI_SEQUENCER
return play->musTitle.c_str();
+ #else
+ return "";
+ #endif
}
ADLMIDI_EXPORT void adl_close(struct ADL_MIDIPlayer *device)
@@ -375,49 +389,71 @@ ADLMIDI_EXPORT double adl_totalTimeLength(struct ADL_MIDIPlayer *device)
{
if(!device)
return -1.0;
+ #ifndef ADLMIDI_DISABLE_MIDI_SEQUENCER
return reinterpret_cast<MIDIplay *>(device->adl_midiPlayer)->timeLength();
+ #else
+ return -1.0;
+ #endif
}
ADLMIDI_EXPORT double adl_loopStartTime(struct ADL_MIDIPlayer *device)
{
if(!device)
return -1.0;
+ #ifndef ADLMIDI_DISABLE_MIDI_SEQUENCER
return reinterpret_cast<MIDIplay *>(device->adl_midiPlayer)->getLoopStart();
+ #else
+ return -1.0;
+ #endif
}
ADLMIDI_EXPORT double adl_loopEndTime(struct ADL_MIDIPlayer *device)
{
if(!device)
return -1.0;
+ #ifndef ADLMIDI_DISABLE_MIDI_SEQUENCER
return reinterpret_cast<MIDIplay *>(device->adl_midiPlayer)->getLoopEnd();
+ #else
+ return -1.0;
+ #endif
}
ADLMIDI_EXPORT double adl_positionTell(struct ADL_MIDIPlayer *device)
{
if(!device)
return -1.0;
+ #ifndef ADLMIDI_DISABLE_MIDI_SEQUENCER
return reinterpret_cast<MIDIplay *>(device->adl_midiPlayer)->tell();
+ #else
+ return -1.0;
+ #endif
}
ADLMIDI_EXPORT void adl_positionSeek(struct ADL_MIDIPlayer *device, double seconds)
{
if(!device)
return;
+ #ifndef ADLMIDI_DISABLE_MIDI_SEQUENCER
reinterpret_cast<MIDIplay *>(device->adl_midiPlayer)->seek(seconds);
+ #endif
}
ADLMIDI_EXPORT void adl_positionRewind(struct ADL_MIDIPlayer *device)
{
if(!device)
return;
+ #ifndef ADLMIDI_DISABLE_MIDI_SEQUENCER
reinterpret_cast<MIDIplay *>(device->adl_midiPlayer)->rewind();
+ #endif
}
ADLMIDI_EXPORT void adl_setTempo(struct ADL_MIDIPlayer *device, double tempo)
{
if(!device || (tempo <= 0.0))
return;
+ #ifndef ADLMIDI_DISABLE_MIDI_SEQUENCER
reinterpret_cast<MIDIplay *>(device->adl_midiPlayer)->setTempo(tempo);
+ #endif
}
@@ -425,7 +461,11 @@ ADLMIDI_EXPORT const char *adl_metaMusicTitle(struct ADL_MIDIPlayer *device)
{
if(!device)
return "";
+ #ifndef ADLMIDI_DISABLE_MIDI_SEQUENCER
return reinterpret_cast<MIDIplay *>(device->adl_midiPlayer)->musTitle.c_str();
+ #else
+ return "";
+ #endif
}
@@ -433,24 +473,37 @@ ADLMIDI_EXPORT const char *adl_metaMusicCopyright(struct ADL_MIDIPlayer *device)
{
if(!device)
return "";
+ #ifndef ADLMIDI_DISABLE_MIDI_SEQUENCER
return reinterpret_cast<MIDIplay *>(device->adl_midiPlayer)->musCopyright.c_str();
+ #else
+ return "";
+ #endif
}
ADLMIDI_EXPORT size_t adl_metaTrackTitleCount(struct ADL_MIDIPlayer *device)
{
if(!device)
return 0;
+#ifndef ADLMIDI_DISABLE_MIDI_SEQUENCER
return reinterpret_cast<MIDIplay *>(device->adl_midiPlayer)->musTrackTitles.size();
+#else
+ return 0;
+#endif
}
ADLMIDI_EXPORT const char *adl_metaTrackTitle(struct ADL_MIDIPlayer *device, size_t index)
{
if(!device)
return 0;
+#ifndef ADLMIDI_DISABLE_MIDI_SEQUENCER
MIDIplay *play = reinterpret_cast<MIDIplay *>(device->adl_midiPlayer);
if(index >= play->musTrackTitles.size())
return "INVALID";
return play->musTrackTitles[index].c_str();
+#else
+ (void)device; (void)index;
+ return "NOT SUPPORTED";
+#endif
}
@@ -458,12 +511,17 @@ ADLMIDI_EXPORT size_t adl_metaMarkerCount(struct ADL_MIDIPlayer *device)
{
if(!device)
return 0;
+#ifndef ADLMIDI_DISABLE_MIDI_SEQUENCER
return reinterpret_cast<MIDIplay *>(device->adl_midiPlayer)->musMarkers.size();
+#else
+ return 0;
+#endif
}
ADLMIDI_EXPORT Adl_MarkerEntry adl_metaMarker(struct ADL_MIDIPlayer *device, size_t index)
{
struct Adl_MarkerEntry marker;
+ #ifndef ADLMIDI_DISABLE_MIDI_SEQUENCER
MIDIplay *play = reinterpret_cast<MIDIplay *>(device->adl_midiPlayer);
if(!device || !play || (index >= play->musMarkers.size()))
{
@@ -479,6 +537,12 @@ ADLMIDI_EXPORT Adl_MarkerEntry adl_metaMarker(struct ADL_MIDIPlayer *device, siz
marker.pos_time = mk.pos_time;
marker.pos_ticks = (unsigned long)mk.pos_ticks;
}
+ #else
+ (void)device; (void)index;
+ marker.label = "NOT SUPPORTED";
+ marker.pos_time = 0.0;
+ marker.pos_ticks = 0;
+ #endif
return marker;
}
@@ -531,6 +595,7 @@ inline static void SendStereoAudio(int &samples_requested,
ADLMIDI_EXPORT int adl_play(ADL_MIDIPlayer *device, int sampleCount, short *out)
{
+ #ifndef ADLMIDI_DISABLE_MIDI_SEQUENCER
#ifdef ADLMIDI_HW_OPL
(void)device;
(void)sampleCount;
@@ -633,6 +698,9 @@ ADLMIDI_EXPORT int adl_play(ADL_MIDIPlayer *device, int sampleCount, short *out)
return static_cast<int>(gotten_len);
#endif
+ #else
+ return 0;
+ #endif //ADLMIDI_DISABLE_MIDI_SEQUENCER
}
@@ -720,22 +788,30 @@ ADLMIDI_EXPORT int adl_generate(struct ADL_MIDIPlayer *device, int sampleCount,
ADLMIDI_EXPORT double adl_tickEvents(struct ADL_MIDIPlayer *device, double seconds, double granuality)
{
+#ifndef ADLMIDI_DISABLE_MIDI_SEQUENCER
if(!device)
return -1.0;
MIDIplay *player = reinterpret_cast<MIDIplay *>(device->adl_midiPlayer);
if(!player)
return -1.0;
return player->Tick(seconds, granuality);
+#else
+ return -1.0;
+#endif
}
ADLMIDI_EXPORT int adl_atEnd(struct ADL_MIDIPlayer *device)
{
+#ifndef ADLMIDI_DISABLE_MIDI_SEQUENCER
if(!device)
return 1;
MIDIplay *player = reinterpret_cast<MIDIplay *>(device->adl_midiPlayer);
if(!player)
return 1;
return (int)player->atEnd;
+#else
+ return 1;
+#endif
}
ADLMIDI_EXPORT void adl_panic(struct ADL_MIDIPlayer *device)
diff --git a/src/adlmidi_load.cpp b/src/adlmidi_load.cpp
index c67076b..03206bc 100644
--- a/src/adlmidi_load.cpp
+++ b/src/adlmidi_load.cpp
@@ -23,8 +23,14 @@
#include "adlmidi_private.hpp"
-#include "adlmidi_mus2mid.h"
-#include "adlmidi_xmi2mid.h"
+#ifndef ADLMIDI_DISABLE_MIDI_SEQUENCER
+# ifndef ADLMIDI_DISABLE_MUS_SUPPORT
+# include "adlmidi_mus2mid.h"
+# endif//MUS
+# ifndef ADLMIDI_DISABLE_XMI_SUPPORT
+# include "adlmidi_xmi2mid.h"
+# endif//XMI
+#endif //ADLMIDI_DISABLE_MIDI_SEQUENCER
uint64_t MIDIplay::ReadBEint(const void *buffer, size_t nbytes)
{
@@ -339,6 +345,7 @@ tryAgain:
return true;
}
+#ifndef ADLMIDI_DISABLE_MIDI_SEQUENCER
bool MIDIplay::LoadMIDI(const std::string &filename)
{
fileReader file;
@@ -412,6 +419,7 @@ riffskip:
fr.seek(7 - static_cast<long>(HeaderSize), SEEK_CUR);
is_GMF = true;
}
+ #ifndef ADLMIDI_DISABLE_MUS_SUPPORT
else if(std::memcmp(HeaderBuf, "MUS\x1A", 4) == 0)
{
// MUS/DMX files (Doom)
@@ -444,6 +452,8 @@ riffskip:
//Re-Read header again!
goto riffskip;
}
+ #endif //ADLMIDI_DISABLE_MUS_SUPPORT
+ #ifndef ADLMIDI_DISABLE_XMI_SUPPORT
else if(std::memcmp(HeaderBuf, "FORM", 4) == 0)
{
if(std::memcmp(HeaderBuf + 8, "XDIR", 4) != 0)
@@ -482,6 +492,7 @@ riffskip:
//Re-Read header again!
goto riffskip;
}
+ #endif //ADLMIDI_DISABLE_XMI_SUPPORT
else if(std::memcmp(HeaderBuf, "CTMF", 4) == 0)
{
opl.dynamic_instruments.clear();
@@ -761,3 +772,4 @@ riffskip:
ch.resize(opl.NumChannels);
return true;
}
+#endif //ADLMIDI_DISABLE_MIDI_SEQUENCER
diff --git a/src/adlmidi_midiplay.cpp b/src/adlmidi_midiplay.cpp
index 432785f..ea3b1fe 100644
--- a/src/adlmidi_midiplay.cpp
+++ b/src/adlmidi_midiplay.cpp
@@ -133,6 +133,8 @@ void MIDIplay::AdlChannel::AddAge(int64_t ms)
}
}
+#ifndef ADLMIDI_DISABLE_MIDI_SEQUENCER
+
MIDIplay::MidiEvent::MidiEvent() :
type(T_UNKNOWN),
subtype(T_UNKNOWN),
@@ -250,7 +252,9 @@ void MIDIplay::MidiTrackRow::sortEvents(bool *noteStates)
events.insert(events.end(), controllers.begin(), controllers.end());
events.insert(events.end(), anyOther.begin(), anyOther.end());
}
+#endif //ADLMIDI_DISABLE_MIDI_SEQUENCER
+#ifndef ADLMIDI_DISABLE_MIDI_SEQUENCER
bool MIDIplay::buildTrackData()
{
fullSongTimeLength = 0.0;
@@ -687,10 +691,13 @@ bool MIDIplay::buildTrackData()
return true;
}
+#endif
+
MIDIplay::MIDIplay(unsigned long sampleRate):
- cmf_percussion_mode(false),
- fullSongTimeLength(0.0),
+ cmf_percussion_mode(false)
+#ifndef ADLMIDI_DISABLE_MIDI_SEQUENCER
+ , fullSongTimeLength(0.0),
postSongWaitDelay(1.0),
loopStartTime(-1.0),
loopEndTime(-1.0),
@@ -699,6 +706,7 @@ MIDIplay::MIDIplay(unsigned long sampleRate):
loopStart(false),
loopEnd(false),
invalidLoop(false)
+#endif
{
devices.clear();
@@ -781,7 +789,7 @@ uint64_t MIDIplay::ReadVarLenEx(uint8_t **ptr, uint8_t *end, bool &ok)
return result;
}
-
+#ifndef ADLMIDI_DISABLE_MIDI_SEQUENCER
double MIDIplay::Tick(double s, double granularity)
{
s *= tempoMultiplier;
@@ -816,6 +824,7 @@ double MIDIplay::Tick(double s, double granularity)
return CurrentPositionNew.wait;
}
+#endif
void MIDIplay::TickIteratos(double s)
{
@@ -825,6 +834,8 @@ void MIDIplay::TickIteratos(double s)
UpdateArpeggio(s);
}
+#ifndef ADLMIDI_DISABLE_MIDI_SEQUENCER
+
void MIDIplay::seek(double seconds)
{
if(seconds < 0.0)
@@ -930,6 +941,7 @@ void MIDIplay::setTempo(double tempo)
{
tempoMultiplier = tempo;
}
+#endif
void MIDIplay::realTime_ResetState()
{
@@ -1608,7 +1620,7 @@ void MIDIplay::NoteUpdate(uint16_t MidCh,
Ch[MidCh].activenotes.erase(i);
}
-
+#ifndef ADLMIDI_DISABLE_MIDI_SEQUENCER
bool MIDIplay::ProcessEventsNew(bool isSeek)
{
if(CurrentPositionNew.track.size() == 0)
@@ -1720,7 +1732,9 @@ bool MIDIplay::ProcessEventsNew(bool isSeek)
return true;//Has events in queue
}
+#endif
+#ifndef ADLMIDI_DISABLE_MIDI_SEQUENCER
MIDIplay::MidiEvent MIDIplay::parseEvent(uint8_t **pptr, uint8_t *end, int &status)
{
uint8_t *&ptr = *pptr;
@@ -1924,6 +1938,7 @@ MIDIplay::MidiEvent MIDIplay::parseEvent(uint8_t **pptr, uint8_t *end, int &stat
return evt;
}
+#endif
const std::string &MIDIplay::getErrorString()
{
@@ -1935,7 +1950,7 @@ void MIDIplay::setErrorString(const std::string &err)
errorStringOut = err;
}
-
+#ifndef ADLMIDI_DISABLE_MIDI_SEQUENCER
void MIDIplay::HandleEvent(size_t tk, const MIDIplay::MidiEvent &evt, int &status)
{
if(hooks.onEvent)
@@ -2092,6 +2107,7 @@ void MIDIplay::HandleEvent(size_t tk, const MIDIplay::MidiEvent &evt, int &statu
}
}
}
+#endif
long MIDIplay::CalculateAdlChannelGoodness(unsigned c, const MIDIchannel::NoteInfo::Phys &ins, uint16_t) const
{
diff --git a/src/adlmidi_private.hpp b/src/adlmidi_private.hpp
index 9ff18e6..8b2bf19 100644
--- a/src/adlmidi_private.hpp
+++ b/src/adlmidi_private.hpp
@@ -577,6 +577,7 @@ public:
void AddAge(int64_t ms);
};
+#ifndef ADLMIDI_DISABLE_MIDI_SEQUENCER
/**
* @brief MIDI Event utility container
*/
@@ -701,6 +702,7 @@ public:
PositionNew(): began(false), wait(0.0), absTimePosition(0.0), track()
{}
};
+#endif//ADLMIDI_DISABLE_MIDI_SEQUENCER
struct Setup
{
@@ -751,6 +753,8 @@ private:
char ____padding[7];
std::vector<AdlChannel> ch;
+
+#ifndef ADLMIDI_DISABLE_MIDI_SEQUENCER
std::vector<std::vector<uint8_t> > TrackData;
PositionNew CurrentPositionNew, LoopBeginPositionNew, trackBeginPositionNew;
@@ -764,13 +768,16 @@ private:
double loopStartTime;
//! Loop end time
double loopEndTime;
+#endif
//! Local error string
std::string errorString;
//! Local error string
std::string errorStringOut;
+#ifndef ADLMIDI_DISABLE_MIDI_SEQUENCER
//! Pre-processed track data storage
std::vector<MidiTrackQueue > trackDataNew;
+#endif
//! Missing instruments catches
std::set<uint8_t> caugh_missing_instruments;
@@ -779,6 +786,7 @@ private:
//! Missing percussion banks catches
std::set<uint16_t> caugh_missing_banks_percussion;
+#ifndef ADLMIDI_DISABLE_MIDI_SEQUENCER
/**
* @brief Build MIDI track data from the raw track data storage
* @return true if everything successfully processed, or false on any error
@@ -793,12 +801,14 @@ private:
* @return Parsed MIDI event entry
*/
MidiEvent parseEvent(uint8_t **ptr, uint8_t *end, int &status);
+#endif//ADLMIDI_DISABLE_MIDI_SEQUENCER
public:
const std::string &getErrorString();
void setErrorString(const std::string &err);
+#ifndef ADLMIDI_DISABLE_MIDI_SEQUENCER
std::string musTitle;
std::string musCopyright;
std::vector<std::string> musTrackTitles;
@@ -812,6 +822,7 @@ public:
loopEnd,
invalidLoop; /*Loop points are invalid (loopStart after loopEnd or loopStart and loopEnd are on same place)*/
char ____padding2[2];
+#endif
OPL3 opl;
int16_t outBuf[1024];
@@ -840,6 +851,7 @@ public:
bool LoadBank(const void *data, size_t size);
bool LoadBank(fileReader &fr);
+#ifndef ADLMIDI_DISABLE_MIDI_SEQUENCER
bool LoadMIDI(const std::string &filename);
bool LoadMIDI(const void *data, size_t size);
bool LoadMIDI(fileReader &fr);
@@ -851,6 +863,7 @@ public:
* @return desired number of seconds until next call
*/
double Tick(double s, double granularity);
+#endif
/**
* @brief Process extra iterators like vibrato or arpeggio
@@ -858,6 +871,7 @@ public:
*/
void TickIteratos(double s);
+#ifndef ADLMIDI_DISABLE_MIDI_SEQUENCER
/**
* @brief Change current position to specified time position in seconds
* @param seconds Absolute time position in seconds
@@ -898,6 +912,7 @@ public:
* @param tempo Tempo multiplier: 1.0 - original tempo. >1 - faster, <1 - slower
*/
void setTempo(double tempo);
+#endif//ADLMIDI_DISABLE_MIDI_SEQUENCER
/* RealTime event triggers */
void realTime_ResetState();
@@ -936,8 +951,11 @@ private:
MIDIchannel::activenoteiterator i,
unsigned props_mask,
int32_t select_adlchn = -1);
+
+#ifndef ADLMIDI_DISABLE_MIDI_SEQUENCER
bool ProcessEventsNew(bool isSeek = false);
void HandleEvent(size_t tk, const MidiEvent &evt, int &status);
+#endif
// Determine how good a candidate this adlchannel
// would be for playing a note from this instrument.