aboutsummaryrefslogtreecommitdiff
path: root/src/adlmidi_midiplay.cpp
diff options
context:
space:
mode:
authorWohlstand <admin@wohlnet.ru>2024-05-11 00:00:33 +0300
committerWohlstand <admin@wohlnet.ru>2024-05-11 00:00:33 +0300
commit63141d11132fedfd63860fc42e16de1f48312e01 (patch)
tree1f264994af81ece8bb1d78c5313d7818c64ff883 /src/adlmidi_midiplay.cpp
parent759de2665f6cfecffc074c48b5caa56b7a1d1deb (diff)
downloadlibADLMIDI-63141d11132fedfd63860fc42e16de1f48312e01.tar.gz
libADLMIDI-63141d11132fedfd63860fc42e16de1f48312e01.tar.bz2
libADLMIDI-63141d11132fedfd63860fc42e16de1f48312e01.zip
Initial implementation of Serial support
+ refactor of the MIDI play, making separated loop functions instead the mess of everything in one single loop function.
Diffstat (limited to 'src/adlmidi_midiplay.cpp')
-rw-r--r--src/adlmidi_midiplay.cpp30
1 files changed, 28 insertions, 2 deletions
diff --git a/src/adlmidi_midiplay.cpp b/src/adlmidi_midiplay.cpp
index 2ce2ed0..8af0674 100644
--- a/src/adlmidi_midiplay.cpp
+++ b/src/adlmidi_midiplay.cpp
@@ -76,6 +76,13 @@ MIDIplay::MIDIplay(unsigned long sampleRate):
m_setup.emulator = adl_getLowestEmulator();
m_setup.runAtPcmRate = false;
+#ifdef ADLMIDI_ENABLE_HW_SERIAL
+ m_setup.serial = false;
+ m_setup.serialName = std::string();
+ m_setup.serialBaud = 0;
+ m_setup.serialProtocol = 0;
+#endif
+
m_setup.PCM_RATE = sampleRate;
m_setup.mindelay = 1.0 / (double)m_setup.PCM_RATE;
m_setup.maxdelay = 512.0 / (double)m_setup.PCM_RATE;
@@ -155,7 +162,7 @@ void MIDIplay::applySetup()
else
adlCalculateFourOpChannels(this, true);
- synth.reset(m_setup.emulator, m_setup.PCM_RATE, this);
+ chipReset();
m_chipChannels.clear();
m_chipChannels.resize(synth.m_numChannels);
@@ -169,7 +176,7 @@ void MIDIplay::partialReset()
realTime_panic();
m_setup.tick_skip_samples_delay = 0;
synth.m_runAtPcmRate = m_setup.runAtPcmRate;
- synth.reset(m_setup.emulator, m_setup.PCM_RATE, this);
+ chipReset();
m_chipChannels.clear();
m_chipChannels.resize((size_t)synth.m_numChannels);
resetMIDIDefaults();
@@ -193,6 +200,21 @@ void MIDIplay::resetMIDI()
caugh_missing_banks_percussion.clear();
}
+void MIDIplay::chipReset()
+{
+ Synth &synth = *m_synth;
+
+#ifdef ADLMIDI_ENABLE_HW_SERIAL
+ if(m_setup.serial)
+ {
+ synth.resetSerial(m_setup.serialName, m_setup.serialBaud, m_setup.serialProtocol);
+ return;
+ }
+#endif
+
+ synth.reset(m_setup.emulator, m_setup.PCM_RATE, this);
+}
+
void MIDIplay::resetMIDIDefaults(int offset)
{
Synth &synth = *m_synth;
@@ -252,7 +274,11 @@ void MIDIplay::TickIterators(double s)
updateVibrato(s);
updateArpeggio(s);
+
#if !defined(ADLMIDI_AUDIO_TICK_HANDLER)
+# ifndef ADLMIDI_DISABLE_MIDI_SEQUENCER
+ s *= m_sequencer->getTempoMultiplier(); // Glide will follow the tempo
+# endif
updateGlide(s);
#endif
}