aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt2
-rw-r--r--README.md4
-rw-r--r--include/adlmidi.h10
-rw-r--r--src/adlmidi.cpp9
-rw-r--r--src/adlmidi_midiplay.cpp11
-rw-r--r--src/adlmidi_midiplay.hpp1
-rw-r--r--utils/midiplay/adlmidiplay.cpp8
7 files changed, 42 insertions, 3 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index a22fadf..3bdc3c5 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,5 +1,5 @@
cmake_minimum_required (VERSION 3.2)
-project (libADLMIDI VERSION 1.5.0 LANGUAGES C CXX)
+project (libADLMIDI VERSION 1.5.1 LANGUAGES C CXX)
include(GNUInstallDirs)
include(CheckCCompilerFlag)
diff --git a/README.md b/README.md
index 1d669b2..d4cf7c1 100644
--- a/README.md
+++ b/README.md
@@ -178,6 +178,9 @@ To build that example you will need to have installed SDL2 library.
* Add support of MIDI Format 2 files
# Changelog
+## 1.5.1 dev
+ * Added an ability to disable the automatical arpeggio
+
## 1.5.0.1 2020-10-11
* Fixed an incorrect timer processing when using a real-time interface
@@ -305,4 +308,3 @@ To build that example you will need to have installed SDL2 library.
## 1.0.0 2015-10-10
* First release of library
-
diff --git a/include/adlmidi.h b/include/adlmidi.h
index 86a5715..2b68509 100644
--- a/include/adlmidi.h
+++ b/include/adlmidi.h
@@ -30,7 +30,7 @@ extern "C" {
#define ADLMIDI_VERSION_MAJOR 1
#define ADLMIDI_VERSION_MINOR 5
-#define ADLMIDI_VERSION_PATCHLEVEL 0
+#define ADLMIDI_VERSION_PATCHLEVEL 1
#define ADLMIDI_TOSTR_I(s) #s
#define ADLMIDI_TOSTR(s) ADLMIDI_TOSTR_I(s)
@@ -549,6 +549,14 @@ extern ADLMIDI_DECLSPEC void adl_setScaleModulators(struct ADL_MIDIPlayer *devic
extern ADLMIDI_DECLSPEC void adl_setFullRangeBrightness(struct ADL_MIDIPlayer *device, int fr_brightness);
/**
+ * @brief Enable(1) or Disable(0) the automatical arpeggio system
+ *
+ * @param device Instance of the library
+ * @param aaEn 0 - disabled, 1 - enabled
+ */
+extern ADLMIDI_DECLSPEC void adl_setAutoArpeggio(struct ADL_MIDIPlayer *device, int aaEn);
+
+/**
* @brief Enable or disable built-in loop (built-in loop supports 'loopStart' and 'loopEnd' tags to loop specific part)
* @param device Instance of the library
* @param loopEn 0 - disabled, 1 - enabled
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;
diff --git a/utils/midiplay/adlmidiplay.cpp b/utils/midiplay/adlmidiplay.cpp
index 211a762..e6e75aa 100644
--- a/utils/midiplay/adlmidiplay.cpp
+++ b/utils/midiplay/adlmidiplay.cpp
@@ -403,6 +403,7 @@ int main(int argc, char **argv)
" will be combined into one\n"
" --solo <track> Selects a solo track to play\n"
" --only <track1,...,trackN> Selects a subset of tracks to play\n"
+ " -na Disable the auto-arpeggio\n"
#ifndef HARDWARE_OPL3
" -fp Enables full-panning stereo support\n"
" --emu-nuked Uses Nuked OPL3 v 1.8 emulator\n"
@@ -483,6 +484,7 @@ int main(int argc, char **argv)
bool recordWave = false;
int loopEnabled = 1;
#endif
+ int autoArpeggioEnabled = 1;
#ifndef HARDWARE_OPL3
int emulator = ADLMIDI_EMU_NUKED;
@@ -540,6 +542,8 @@ int main(int argc, char **argv)
else if(!std::strcmp("-nl", argv[2]))
loopEnabled = 0; //Enable loop
#endif
+ else if(!std::strcmp("-na", argv[2]))
+ autoArpeggioEnabled = 0; //Enable auto-arpeggio
#ifndef HARDWARE_OPL3
else if(!std::strcmp("--emu-nuked", argv[2]))
@@ -639,6 +643,8 @@ int main(int argc, char **argv)
adl_setLoopEnabled(myDevice, recordWave ? 0 : loopEnabled);
#endif
+ adl_setAutoArpeggio(myDevice, autoArpeggioEnabled);
+
#ifdef DEBUG_TRACE_ALL_EVENTS
//Hook all MIDI events are ticking while generating an output buffer
if(!recordWave)
@@ -842,6 +848,8 @@ int main(int argc, char **argv)
std::fprintf(stdout, "\n");
}
+ std::fprintf(stdout, " - Automatic arpeggion is turned %s\n", autoArpeggioEnabled ? "ON" : "OFF");
+
std::fprintf(stdout, " - File [%s] opened!\n", musPath.c_str());
flushout(stdout);