aboutsummaryrefslogtreecommitdiff
path: root/src/adlmidi.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/adlmidi.cpp')
-rw-r--r--src/adlmidi.cpp156
1 files changed, 85 insertions, 71 deletions
diff --git a/src/adlmidi.cpp b/src/adlmidi.cpp
index 12d0e68..7f75b6e 100644
--- a/src/adlmidi.cpp
+++ b/src/adlmidi.cpp
@@ -21,6 +21,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "adlmidi_midiplay.hpp"
#include "adlmidi_private.hpp"
/* Unify MIDI player casting and interface between ADLMIDI and OPNMIDI */
@@ -112,13 +113,14 @@ ADLMIDI_EXPORT int adl_setNumChips(ADL_MIDIPlayer *device, int numChips)
else if(play->m_setup.numFourOps < -1)
play->m_setup.numFourOps = -1;
- if(!play->m_synth.setupLocked())
+ OPL3 &synth = *play->m_synth;
+ if(!synth.setupLocked())
{
- play->m_synth.m_numChips = play->m_setup.numChips;
+ synth.m_numChips = play->m_setup.numChips;
if(play->m_setup.numFourOps < 0)
adlCalculateFourOpChannels(play, true);
else
- play->m_synth.m_numFourOps = static_cast<uint32_t>(play->m_setup.numFourOps);
+ synth.m_numFourOps = static_cast<uint32_t>(play->m_setup.numFourOps);
play->partialReset();
return 0;
}
@@ -141,7 +143,7 @@ ADLMIDI_EXPORT int adl_getNumChipsObtained(struct ADL_MIDIPlayer *device)
return -2;
MidiPlayer *play = GET_MIDI_PLAYER(device);
assert(play);
- return (int)play->m_synth.m_numChips;
+ return (int)play->m_synth->m_numChips;
}
ADLMIDI_EXPORT int adl_setBank(ADL_MIDIPlayer *device, int bank)
@@ -171,8 +173,9 @@ ADLMIDI_EXPORT int adl_setBank(ADL_MIDIPlayer *device, int bank)
return -1;
}
+ OPL3 &synth = *play->m_synth;
play->m_setup.bankId = static_cast<uint32_t>(bankno);
- play->m_synth.setEmbeddedBank(play->m_setup.bankId);
+ synth.setEmbeddedBank(play->m_setup.bankId);
play->applySetup();
return 0;
@@ -203,7 +206,7 @@ ADLMIDI_EXPORT int adl_reserveBanks(ADL_MIDIPlayer *device, unsigned banks)
return -1;
MidiPlayer *play = GET_MIDI_PLAYER(device);
assert(play);
- OPL3::BankMap &map = play->m_synth.m_insBanks;
+ OPL3::BankMap &map = play->m_synth->m_insBanks;
map.reserve(banks);
return (int)map.capacity();
}
@@ -220,7 +223,7 @@ ADLMIDI_EXPORT int adl_getBank(ADL_MIDIPlayer *device, const ADL_BankId *idp, in
MidiPlayer *play = GET_MIDI_PLAYER(device);
assert(play);
- OPL3::BankMap &map = play->m_synth.m_insBanks;
+ OPL3::BankMap &map = play->m_synth->m_insBanks;
OPL3::BankMap::iterator it;
if(!(flags & ADLMIDI_Bank_Create))
@@ -273,7 +276,7 @@ ADLMIDI_EXPORT int adl_removeBank(ADL_MIDIPlayer *device, ADL_Bank *bank)
MidiPlayer *play = GET_MIDI_PLAYER(device);
assert(play);
- OPL3::BankMap &map = play->m_synth.m_insBanks;
+ OPL3::BankMap &map = play->m_synth->m_insBanks;
OPL3::BankMap::iterator it = OPL3::BankMap::iterator::from_ptrs(bank->pointer);
size_t size = map.size();
map.erase(it);
@@ -287,7 +290,7 @@ ADLMIDI_EXPORT int adl_getFirstBank(ADL_MIDIPlayer *device, ADL_Bank *bank)
MidiPlayer *play = GET_MIDI_PLAYER(device);
assert(play);
- OPL3::BankMap &map = play->m_synth.m_insBanks;
+ OPL3::BankMap &map = play->m_synth->m_insBanks;
OPL3::BankMap::iterator it = map.begin();
if(it == map.end())
@@ -304,7 +307,7 @@ ADLMIDI_EXPORT int adl_getNextBank(ADL_MIDIPlayer *device, ADL_Bank *bank)
MidiPlayer *play = GET_MIDI_PLAYER(device);
assert(play);
- OPL3::BankMap &map = play->m_synth.m_insBanks;
+ OPL3::BankMap &map = play->m_synth->m_insBanks;
OPL3::BankMap::iterator it = OPL3::BankMap::iterator::from_ptrs(bank->pointer);
if(++it == map.end())
@@ -383,14 +386,15 @@ ADLMIDI_EXPORT int adl_setNumFourOpsChn(ADL_MIDIPlayer *device, int ops4)
return -1;
}
+ OPL3 &synth = *play->m_synth;
play->m_setup.numFourOps = ops4;
- if(!play->m_synth.setupLocked())
+ if(!synth.setupLocked())
{
if(play->m_setup.numFourOps < 0)
adlCalculateFourOpChannels(play, true);
else
- play->m_synth.m_numFourOps = static_cast<uint32_t>(play->m_setup.numFourOps);
- play->m_synth.updateChannelCategories();
+ synth.m_numFourOps = static_cast<uint32_t>(play->m_setup.numFourOps);
+ synth.updateChannelCategories();
}
return 0;
@@ -411,7 +415,7 @@ ADLMIDI_EXPORT int adl_getNumFourOpsChnObtained(struct ADL_MIDIPlayer *device)
return -2;
MidiPlayer *play = GET_MIDI_PLAYER(device);
assert(play);
- return (int)play->m_synth.m_numFourOps;
+ return (int)play->m_synth->m_numFourOps;
}
@@ -420,13 +424,14 @@ ADLMIDI_EXPORT void adl_setPercMode(ADL_MIDIPlayer *device, int percmod)
if(!device) return;
MidiPlayer *play = GET_MIDI_PLAYER(device);
assert(play);
+ OPL3 &synth = *play->m_synth;
play->m_setup.rhythmMode = percmod;
- if(!play->m_synth.setupLocked())
+ if(!synth.setupLocked())
{
- play->m_synth.m_rhythmMode = play->m_setup.rhythmMode < 0 ?
- (play->m_synth.m_insBankSetup.adLibPercussions) :
+ synth.m_rhythmMode = play->m_setup.rhythmMode < 0 ?
+ (synth.m_insBankSetup.adLibPercussions) :
(play->m_setup.rhythmMode != 0);
- play->m_synth.updateChannelCategories();
+ synth.updateChannelCategories();
}
}
@@ -435,13 +440,14 @@ ADLMIDI_EXPORT void adl_setHVibrato(ADL_MIDIPlayer *device, int hvibro)
if(!device) return;
MidiPlayer *play = GET_MIDI_PLAYER(device);
assert(play);
+ OPL3 &synth = *play->m_synth;
play->m_setup.deepVibratoMode = hvibro;
- if(!play->m_synth.setupLocked())
+ if(!synth.setupLocked())
{
- play->m_synth.m_deepVibratoMode = play->m_setup.deepVibratoMode < 0 ?
- play->m_synth.m_insBankSetup.deepVibrato :
+ synth.m_deepVibratoMode = play->m_setup.deepVibratoMode < 0 ?
+ synth.m_insBankSetup.deepVibrato :
(play->m_setup.deepVibratoMode != 0);
- play->m_synth.commitDeepFlags();
+ synth.commitDeepFlags();
}
}
@@ -450,7 +456,7 @@ ADLMIDI_EXPORT int adl_getHVibrato(struct ADL_MIDIPlayer *device)
if(!device) return -1;
MidiPlayer *play = GET_MIDI_PLAYER(device);
assert(play);
- return play->m_synth.m_deepVibratoMode;
+ return play->m_synth->m_deepVibratoMode;
}
ADLMIDI_EXPORT void adl_setHTremolo(ADL_MIDIPlayer *device, int htremo)
@@ -458,13 +464,14 @@ ADLMIDI_EXPORT void adl_setHTremolo(ADL_MIDIPlayer *device, int htremo)
if(!device) return;
MidiPlayer *play = GET_MIDI_PLAYER(device);
assert(play);
+ OPL3 &synth = *play->m_synth;
play->m_setup.deepTremoloMode = htremo;
- if(!play->m_synth.setupLocked())
+ if(!synth.setupLocked())
{
- play->m_synth.m_deepTremoloMode = play->m_setup.deepTremoloMode < 0 ?
- play->m_synth.m_insBankSetup.deepTremolo :
+ synth.m_deepTremoloMode = play->m_setup.deepTremoloMode < 0 ?
+ synth.m_insBankSetup.deepTremolo :
(play->m_setup.deepTremoloMode != 0);
- play->m_synth.commitDeepFlags();
+ synth.commitDeepFlags();
}
}
@@ -473,7 +480,7 @@ ADLMIDI_EXPORT int adl_getHTremolo(struct ADL_MIDIPlayer *device)
if(!device) return -1;
MidiPlayer *play = GET_MIDI_PLAYER(device);
assert(play);
- return play->m_synth.m_deepTremoloMode;
+ return play->m_synth->m_deepTremoloMode;
}
ADLMIDI_EXPORT void adl_setScaleModulators(ADL_MIDIPlayer *device, int smod)
@@ -482,11 +489,12 @@ ADLMIDI_EXPORT void adl_setScaleModulators(ADL_MIDIPlayer *device, int smod)
return;
MidiPlayer *play = GET_MIDI_PLAYER(device);
assert(play);
+ OPL3 &synth = *play->m_synth;
play->m_setup.scaleModulators = smod;
- if(!play->m_synth.setupLocked())
+ if(!synth.setupLocked())
{
- play->m_synth.m_scaleModulators = play->m_setup.scaleModulators < 0 ?
- play->m_synth.m_insBankSetup.scaleModulators :
+ synth.m_scaleModulators = play->m_setup.scaleModulators < 0 ?
+ synth.m_insBankSetup.scaleModulators :
(play->m_setup.scaleModulators != 0);
}
}
@@ -507,7 +515,7 @@ ADLMIDI_EXPORT void adl_setLoopEnabled(ADL_MIDIPlayer *device, int loopEn)
MidiPlayer *play = GET_MIDI_PLAYER(device);
assert(play);
#ifndef ADLMIDI_DISABLE_MIDI_SEQUENCER
- play->m_sequencer.setLoopEnabled(loopEn != 0);
+ play->m_sequencer->setLoopEnabled(loopEn != 0);
#else
ADL_UNUSED(loopEn);
#endif
@@ -519,7 +527,7 @@ ADLMIDI_EXPORT void adl_setSoftPanEnabled(ADL_MIDIPlayer *device, int softPanEn)
return;
MidiPlayer *play = GET_MIDI_PLAYER(device);
assert(play);
- play->m_synth.m_softPanning = (softPanEn != 0);
+ play->m_synth->m_softPanning = (softPanEn != 0);
}
/* !!!DEPRECATED!!! */
@@ -529,13 +537,14 @@ ADLMIDI_EXPORT void adl_setLogarithmicVolumes(struct ADL_MIDIPlayer *device, int
return;
MidiPlayer *play = GET_MIDI_PLAYER(device);
assert(play);
+ OPL3 &synth = *play->m_synth;
play->m_setup.logarithmicVolumes = (logvol != 0);
- if(!play->m_synth.setupLocked())
+ if(!synth.setupLocked())
{
if(play->m_setup.logarithmicVolumes)
- play->m_synth.setVolumeScaleModel(ADLMIDI_VolumeModel_NativeOPL3);
+ synth.setVolumeScaleModel(ADLMIDI_VolumeModel_NativeOPL3);
else
- play->m_synth.setVolumeScaleModel(static_cast<ADLMIDI_VolumeModels>(play->m_synth.m_volumeScale));
+ synth.setVolumeScaleModel(static_cast<ADLMIDI_VolumeModels>(synth.m_volumeScale));
}
}
@@ -545,13 +554,14 @@ ADLMIDI_EXPORT void adl_setVolumeRangeModel(struct ADL_MIDIPlayer *device, int v
return;
MidiPlayer *play = GET_MIDI_PLAYER(device);
assert(play);
+ OPL3 &synth = *play->m_synth;
play->m_setup.volumeScaleModel = volumeModel;
- if(!play->m_synth.setupLocked())
+ if(!synth.setupLocked())
{
if(play->m_setup.volumeScaleModel == ADLMIDI_VolumeModel_AUTO)//Use bank default volume model
- play->m_synth.m_volumeScale = (OPL3::VolumesScale)play->m_synth.m_insBankSetup.volumeModel;
+ synth.m_volumeScale = (OPL3::VolumesScale)synth.m_insBankSetup.volumeModel;
else
- play->m_synth.setVolumeScaleModel(static_cast<ADLMIDI_VolumeModels>(volumeModel));
+ synth.setVolumeScaleModel(static_cast<ADLMIDI_VolumeModels>(volumeModel));
}
}
@@ -561,7 +571,7 @@ ADLMIDI_EXPORT int adl_getVolumeRangeModel(struct ADL_MIDIPlayer *device)
return -1;
MidiPlayer *play = GET_MIDI_PLAYER(device);
assert(play);
- return play->m_synth.getVolumeScaleModel();
+ return play->m_synth->getVolumeScaleModel();
}
ADLMIDI_EXPORT int adl_openBankFile(struct ADL_MIDIPlayer *device, const char *filePath)
@@ -675,8 +685,9 @@ ADLMIDI_EXPORT const char *adl_chipEmulatorName(struct ADL_MIDIPlayer *device)
#ifndef ADLMIDI_HW_OPL
MidiPlayer *play = GET_MIDI_PLAYER(device);
assert(play);
- if(!play->m_synth.m_chips.empty())
- return play->m_synth.m_chips[0]->emulatorName();
+ OPL3 &synth = *play->m_synth;
+ if(!synth.m_chips.empty())
+ return synth.m_chips[0]->emulatorName();
#else
return "Hardware OPL3 chip on 0x330";
#endif
@@ -708,8 +719,9 @@ ADLMIDI_EXPORT int adl_setRunAtPcmRate(ADL_MIDIPlayer *device, int enabled)
{
MidiPlayer *play = GET_MIDI_PLAYER(device);
assert(play);
+ OPL3 &synth = *play->m_synth;
play->m_setup.runAtPcmRate = (enabled != 0);
- if(!play->m_synth.setupLocked())
+ if(!synth.setupLocked())
play->partialReset();
return 0;
}
@@ -763,7 +775,7 @@ ADLMIDI_EXPORT double adl_totalTimeLength(struct ADL_MIDIPlayer *device)
return -1.0;
MidiPlayer *play = GET_MIDI_PLAYER(device);
assert(play);
- return play->m_sequencer.timeLength();
+ return play->m_sequencer->timeLength();
#else
ADL_UNUSED(device);
return -1.0;
@@ -777,7 +789,7 @@ ADLMIDI_EXPORT double adl_loopStartTime(struct ADL_MIDIPlayer *device)
return -1.0;
MidiPlayer *play = GET_MIDI_PLAYER(device);
assert(play);
- return play->m_sequencer.getLoopStart();
+ return play->m_sequencer->getLoopStart();
#else
ADL_UNUSED(device);
return -1.0;
@@ -791,7 +803,7 @@ ADLMIDI_EXPORT double adl_loopEndTime(struct ADL_MIDIPlayer *device)
return -1.0;
MidiPlayer *play = GET_MIDI_PLAYER(device);
assert(play);
- return play->m_sequencer.getLoopEnd();
+ return play->m_sequencer->getLoopEnd();
#else
ADL_UNUSED(device);
return -1.0;
@@ -805,7 +817,7 @@ ADLMIDI_EXPORT double adl_positionTell(struct ADL_MIDIPlayer *device)
return -1.0;
MidiPlayer *play = GET_MIDI_PLAYER(device);
assert(play);
- return play->m_sequencer.tell();
+ return play->m_sequencer->tell();
#else
ADL_UNUSED(device);
return -1.0;
@@ -822,7 +834,7 @@ ADLMIDI_EXPORT void adl_positionSeek(struct ADL_MIDIPlayer *device, double secon
MidiPlayer *play = GET_MIDI_PLAYER(device);
assert(play);
play->realTime_panic();
- play->m_setup.delay = play->m_sequencer.seek(seconds, play->m_setup.mindelay);
+ play->m_setup.delay = play->m_sequencer->seek(seconds, play->m_setup.mindelay);
play->m_setup.carry = 0.0;
#else
ADL_UNUSED(device);
@@ -838,7 +850,7 @@ ADLMIDI_EXPORT void adl_positionRewind(struct ADL_MIDIPlayer *device)
MidiPlayer *play = GET_MIDI_PLAYER(device);
assert(play);
play->realTime_panic();
- play->m_sequencer.rewind();
+ play->m_sequencer->rewind();
#else
ADL_UNUSED(device);
#endif
@@ -851,7 +863,7 @@ ADLMIDI_EXPORT void adl_setTempo(struct ADL_MIDIPlayer *device, double tempo)
return;
MidiPlayer *play = GET_MIDI_PLAYER(device);
assert(play);
- play->m_sequencer.setTempo(tempo);
+ play->m_sequencer->setTempo(tempo);
#else
ADL_UNUSED(device);
ADL_UNUSED(tempo);
@@ -877,7 +889,7 @@ ADLMIDI_EXPORT const char *adl_metaMusicTitle(struct ADL_MIDIPlayer *device)
return "";
MidiPlayer *play = GET_MIDI_PLAYER(device);
assert(play);
- return play->m_sequencer.getMusicTitle().c_str();
+ return play->m_sequencer->getMusicTitle().c_str();
#else
ADL_UNUSED(device);
return "";
@@ -892,7 +904,7 @@ ADLMIDI_EXPORT const char *adl_metaMusicCopyright(struct ADL_MIDIPlayer *device)
return "";
MidiPlayer *play = GET_MIDI_PLAYER(device);
assert(play);
- return play->m_sequencer.getMusicCopyright().c_str();
+ return play->m_sequencer->getMusicCopyright().c_str();
#else
ADL_UNUSED(device);
return "";
@@ -906,7 +918,7 @@ ADLMIDI_EXPORT size_t adl_metaTrackTitleCount(struct ADL_MIDIPlayer *device)
return 0;
MidiPlayer *play = GET_MIDI_PLAYER(device);
assert(play);
- return play->m_sequencer.getTrackTitles().size();
+ return play->m_sequencer->getTrackTitles().size();
#else
ADL_UNUSED(device);
return 0;
@@ -920,7 +932,7 @@ ADLMIDI_EXPORT const char *adl_metaTrackTitle(struct ADL_MIDIPlayer *device, siz
return "";
MidiPlayer *play = GET_MIDI_PLAYER(device);
assert(play);
- const std::vector<std::string> &titles = play->m_sequencer.getTrackTitles();
+ const std::vector<std::string> &titles = play->m_sequencer->getTrackTitles();
if(index >= titles.size())
return "INVALID";
return titles[index].c_str();
@@ -939,7 +951,7 @@ ADLMIDI_EXPORT size_t adl_metaMarkerCount(struct ADL_MIDIPlayer *device)
return 0;
MidiPlayer *play = GET_MIDI_PLAYER(device);
assert(play);
- return play->m_sequencer.getMarkers().size();
+ return play->m_sequencer->getMarkers().size();
#else
ADL_UNUSED(device);
return 0;
@@ -962,7 +974,7 @@ ADLMIDI_EXPORT Adl_MarkerEntry adl_metaMarker(struct ADL_MIDIPlayer *device, siz
MidiPlayer *play = GET_MIDI_PLAYER(device);
assert(play);
- const std::vector<MidiSequencer::MIDI_MarkerEntry> &markers = play->m_sequencer.getMarkers();
+ const std::vector<MidiSequencer::MIDI_MarkerEntry> &markers = play->m_sequencer->getMarkers();
if(index >= markers.size())
{
marker.label = "INVALID";
@@ -992,8 +1004,8 @@ ADLMIDI_EXPORT void adl_setRawEventHook(struct ADL_MIDIPlayer *device, ADL_RawEv
return;
MidiPlayer *play = GET_MIDI_PLAYER(device);
assert(play);
- play->m_sequencerInterface.onEvent = rawEventHook;
- play->m_sequencerInterface.onEvent_userData = userData;
+ play->m_sequencerInterface->onEvent = rawEventHook;
+ play->m_sequencerInterface->onEvent_userData = userData;
#else
ADL_UNUSED(device);
ADL_UNUSED(rawEventHook);
@@ -1022,8 +1034,8 @@ ADLMIDI_EXPORT void adl_setDebugMessageHook(struct ADL_MIDIPlayer *device, ADL_D
play->hooks.onDebugMessage = debugMessageHook;
play->hooks.onDebugMessage_userData = userData;
#ifndef ADLMIDI_DISABLE_MIDI_SEQUENCER
- play->m_sequencerInterface.onDebugMessage = debugMessageHook;
- play->m_sequencerInterface.onDebugMessage_userData = userData;
+ play->m_sequencerInterface->onDebugMessage = debugMessageHook;
+ play->m_sequencerInterface->onDebugMessage_userData = userData;
#endif
}
@@ -1273,7 +1285,7 @@ ADLMIDI_EXPORT int adl_playFormat(ADL_MIDIPlayer *device, int sampleCount,
// setup.SkipForward -= 1;
//else
{
- if((player->m_sequencer.positionAtEnd()) && (setup.delay <= 0.0))
+ if((player->m_sequencer->positionAtEnd()) && (setup.delay <= 0.0))
break;//Stop to fetch samples at reaching the song end with disabled loop
ssize_t leftSamples = left / 2;
@@ -1290,16 +1302,17 @@ ADLMIDI_EXPORT int adl_playFormat(ADL_MIDIPlayer *device, int sampleCount,
//fill buffer with zeros
int32_t *out_buf = player->m_outBuf;
std::memset(out_buf, 0, static_cast<size_t>(in_generatedPhys) * sizeof(out_buf[0]));
- unsigned int chips = player->m_synth.m_numChips;
+ OPL3 &synth = *player->m_synth;
+ unsigned int chips = synth.m_numChips;
if(chips == 1)
{
- player->m_synth.m_chips[0]->generate32(out_buf, (size_t)in_generatedStereo);
+ synth.m_chips[0]->generate32(out_buf, (size_t)in_generatedStereo);
}
else if(n_periodCountStereo > 0)
{
/* Generate data from every chip and mix result */
for(size_t card = 0; card < chips; ++card)
- player->m_synth.m_chips[card]->generateAndMix32(out_buf, (size_t)in_generatedStereo);
+ synth.m_chips[card]->generateAndMix32(out_buf, (size_t)in_generatedStereo);
}
/* Process it */
@@ -1380,14 +1393,15 @@ ADLMIDI_EXPORT int adl_generateFormat(struct ADL_MIDIPlayer *device, int sampleC
//fill buffer with zeros
int32_t *out_buf = player->m_outBuf;
std::memset(out_buf, 0, static_cast<size_t>(in_generatedPhys) * sizeof(out_buf[0]));
- unsigned int chips = player->m_synth.m_numChips;
+ OPL3 &synth = *player->m_synth;
+ unsigned int chips = synth.m_numChips;
if(chips == 1)
- player->m_synth.m_chips[0]->generate32(out_buf, (size_t)in_generatedStereo);
+ synth.m_chips[0]->generate32(out_buf, (size_t)in_generatedStereo);
else if(n_periodCountStereo > 0)
{
/* Generate data from every chip and mix result */
for(unsigned card = 0; card < chips; ++card)
- player->m_synth.m_chips[card]->generateAndMix32(out_buf, (size_t)in_generatedStereo);
+ synth.m_chips[card]->generateAndMix32(out_buf, (size_t)in_generatedStereo);
}
/* Process it */
if(SendStereoAudio(sampleCount, in_generatedStereo, out_buf, gotten_len, out_left, out_right, format) == -1)
@@ -1428,7 +1442,7 @@ ADLMIDI_EXPORT int adl_atEnd(struct ADL_MIDIPlayer *device)
return 1;
MidiPlayer *play = GET_MIDI_PLAYER(device);
assert(play);
- return (int)play->m_sequencer.positionAtEnd();
+ return (int)play->m_sequencer->positionAtEnd();
#else
ADL_UNUSED(device);
return 1;
@@ -1442,7 +1456,7 @@ ADLMIDI_EXPORT size_t adl_trackCount(struct ADL_MIDIPlayer *device)
return 0;
MidiPlayer *play = GET_MIDI_PLAYER(device);
assert(play);
- return play->m_sequencer.getTrackCount();
+ return play->m_sequencer->getTrackCount();
#else
ADL_UNUSED(device);
return 0;
@@ -1456,7 +1470,7 @@ ADLMIDI_EXPORT int adl_setTrackOptions(struct ADL_MIDIPlayer *device, size_t tra
return -1;
MidiPlayer *play = GET_MIDI_PLAYER(device);
assert(play);
- MidiSequencer &seq = play->m_sequencer;
+ MidiSequencer &seq = *play->m_sequencer;
unsigned enableFlag = trackOptions & 3;
trackOptions &= ~3u;
@@ -1497,7 +1511,7 @@ ADLMIDI_EXPORT int adl_setTriggerHandler(struct ADL_MIDIPlayer *device, ADL_Trig
return -1;
MidiPlayer *play = GET_MIDI_PLAYER(device);
assert(play);
- MidiSequencer &seq = play->m_sequencer;
+ MidiSequencer &seq = *play->m_sequencer;
seq.setTriggerHandler(handler, userData);
return 0;
#else