aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorWohlstand <admin@wohlnet.ru>2021-01-24 21:40:00 +0300
committerWohlstand <admin@wohlnet.ru>2021-01-24 21:40:00 +0300
commitc375ab993e3eb4c04e5407580c03891d3c30baf8 (patch)
tree66e4e92b1c4ea5cdc3aea2e48fe1df840b5258a1 /src
parent831964b94a4c5abcf4e4e3c223bdbb2e02bbcfca (diff)
downloadlibADLMIDI-c375ab993e3eb4c04e5407580c03891d3c30baf8.tar.gz
libADLMIDI-c375ab993e3eb4c04e5407580c03891d3c30baf8.tar.bz2
libADLMIDI-c375ab993e3eb4c04e5407580c03891d3c30baf8.zip
Added an ability to disable auto-arpeggio
Backported from libOPNMIDI
Diffstat (limited to 'src')
-rw-r--r--src/adlmidi.cpp9
-rw-r--r--src/adlmidi_midiplay.cpp11
-rw-r--r--src/adlmidi_midiplay.hpp1
3 files changed, 21 insertions, 0 deletions
diff --git a/src/adlmidi.cpp b/src/adlmidi.cpp
index 55d9b05..c62c2cb 100644
--- a/src/adlmidi.cpp
+++ b/src/adlmidi.cpp
@@ -551,6 +551,15 @@ ADLMIDI_EXPORT void adl_setFullRangeBrightness(struct ADL_MIDIPlayer *device, in
play->m_setup.fullRangeBrightnessCC74 = (fr_brightness != 0);
}
+ADLMIDI_EXPORT void adl_setAutoArpeggio(ADL_MIDIPlayer *device, int aaEn)
+{
+ if(!device)
+ return;
+ MidiPlayer *play = GET_MIDI_PLAYER(device);
+ assert(play);
+ play->m_setup.enableAutoArpeggio = (aaEn != 0);
+}
+
ADLMIDI_EXPORT void adl_setLoopEnabled(ADL_MIDIPlayer *device, int loopEn)
{
#ifndef ADLMIDI_DISABLE_MIDI_SEQUENCER
diff --git a/src/adlmidi_midiplay.cpp b/src/adlmidi_midiplay.cpp
index 9517dd0..9e2e437 100644
--- a/src/adlmidi_midiplay.cpp
+++ b/src/adlmidi_midiplay.cpp
@@ -91,6 +91,7 @@ MIDIplay::MIDIplay(unsigned long sampleRate):
//m_setup.SkipForward = 0;
m_setup.scaleModulators = -1;
m_setup.fullRangeBrightnessCC74 = false;
+ m_setup.enableAutoArpeggio = true;
m_setup.delay = 0.0;
m_setup.carry = 0.0;
m_setup.tick_skip_samples_delay = 0;
@@ -1503,6 +1504,9 @@ void MIDIplay::killOrEvacuate(size_t from_channel,
{
uint16_t cs = static_cast<uint16_t>(c);
+ if(!m_setup.enableAutoArpeggio)
+ break; // Arpeggio disabled completely
+
if(c >= maxChannels)
break;
if(c == from_channel)
@@ -1726,6 +1730,13 @@ void MIDIplay::updateArpeggio(double) // amount = amount of time passed
Synth &synth = *m_synth;
+ if(!m_setup.enableAutoArpeggio) // Arpeggio was disabled
+ {
+ if(m_arpeggioCounter != 0)
+ m_arpeggioCounter = 0;
+ return;
+ }
+
#if 0
const unsigned desired_arpeggio_rate = 40; // Hz (upper limit)
# if 1
diff --git a/src/adlmidi_midiplay.hpp b/src/adlmidi_midiplay.hpp
index 2190102..ecf4d1c 100644
--- a/src/adlmidi_midiplay.hpp
+++ b/src/adlmidi_midiplay.hpp
@@ -526,6 +526,7 @@ public:
//unsigned int SkipForward;
int scaleModulators;
bool fullRangeBrightnessCC74;
+ bool enableAutoArpeggio;
double delay;
double carry;