aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorVitaly Novichkov <admin@wohlnet.ru>2018-04-11 00:40:55 +0300
committerVitaly Novichkov <admin@wohlnet.ru>2018-04-11 00:40:55 +0300
commita074c7f2163def562a78ebf4c75e412580dd3118 (patch)
treeae8c0a7d5006516036f0a8f3cf7c8ed21bf3e7c9 /src
parente81541bc74e2083afba8a38ab364e98b39c32b70 (diff)
downloadlibADLMIDI-a074c7f2163def562a78ebf4c75e412580dd3118.tar.gz
libADLMIDI-a074c7f2163def562a78ebf4c75e412580dd3118.tar.bz2
libADLMIDI-a074c7f2163def562a78ebf4c75e412580dd3118.zip
Changed logic of CC-74 Brightness
to affect sound only between 0 and 64 like real XG synthesizers affect sound only between 0 and 64.
Diffstat (limited to 'src')
-rw-r--r--src/adlmidi.cpp7
-rw-r--r--src/adlmidi_midiplay.cpp10
-rw-r--r--src/adlmidi_private.hpp1
3 files changed, 18 insertions, 0 deletions
diff --git a/src/adlmidi.cpp b/src/adlmidi.cpp
index 4744903..df00706 100644
--- a/src/adlmidi.cpp
+++ b/src/adlmidi.cpp
@@ -200,6 +200,13 @@ ADLMIDI_EXPORT void adl_setScaleModulators(ADL_MIDIPlayer *device, int smod)
play->opl.ScaleModulators = play->m_setup.ScaleModulators;
}
+ADLMIDI_EXPORT void adl_setFullRangeBrightness(struct ADL_MIDIPlayer *device, int fr_brightness)
+{
+ if(!device) return;
+ MIDIplay *play = reinterpret_cast<MIDIplay *>(device->adl_midiPlayer);
+ play->m_setup.fullRangeBrightnessCC74 = fr_brightness;
+}
+
ADLMIDI_EXPORT void adl_setLoopEnabled(ADL_MIDIPlayer *device, int loopEn)
{
if(!device) return;
diff --git a/src/adlmidi_midiplay.cpp b/src/adlmidi_midiplay.cpp
index 901e6ea..7911adc 100644
--- a/src/adlmidi_midiplay.cpp
+++ b/src/adlmidi_midiplay.cpp
@@ -727,6 +727,7 @@ MIDIplay::MIDIplay(unsigned long sampleRate):
//m_setup.SkipForward = 0;
m_setup.loopingIsEnabled = false;
m_setup.ScaleModulators = -1;
+ m_setup.fullRangeBrightnessCC74 = false;
m_setup.delay = 0.0;
m_setup.carry = 0.0;
m_setup.tick_skip_samples_delay = 0;
@@ -1544,6 +1545,15 @@ void MIDIplay::NoteUpdate(uint16_t MidCh,
bool is_percussion = (MidCh == 9) || Ch[MidCh].is_xg_percussion;
uint8_t brightness = is_percussion ? 127 : Ch[MidCh].brightness;
+ if(!m_setup.fullRangeBrightnessCC74)
+ {
+ // Simulate post-High-Pass filter result which affects sounding by half level only
+ if(brightness >= 64)
+ brightness = 127;
+ else
+ brightness *= 2;
+ }
+
switch(opl.m_volumeScale)
{
case OPL3::VOLUME_Generic:
diff --git a/src/adlmidi_private.hpp b/src/adlmidi_private.hpp
index 312f462..8e5f060 100644
--- a/src/adlmidi_private.hpp
+++ b/src/adlmidi_private.hpp
@@ -792,6 +792,7 @@ public:
//unsigned int SkipForward;
bool loopingIsEnabled;
int ScaleModulators;
+ bool fullRangeBrightnessCC74;
double delay;
double carry;