diff options
-rw-r--r-- | include/adlmidi.h | 6 | ||||
-rw-r--r-- | src/adlmidi_opl3.cpp | 23 | ||||
-rw-r--r-- | src/adlmidi_opl3.hpp | 6 |
3 files changed, 31 insertions, 4 deletions
diff --git a/include/adlmidi.h b/include/adlmidi.h index 4df321d..91356d9 100644 --- a/include/adlmidi.h +++ b/include/adlmidi.h @@ -113,7 +113,11 @@ enum ADLMIDI_VolumeModels /*! Logarithmic volume scale, used in Apogee Sound System. */ ADLMIDI_VolumeModel_APOGEE = 4, /*! Aproximated and shorted volume map table. Similar to general, but has less granularity. */ - ADLMIDI_VolumeModel_9X = 5 + ADLMIDI_VolumeModel_9X = 5, + /*! DMX model with a fixed bug of AM voices */ + ADLMIDI_VolumeModel_DMX_Fixed = 6, + /*! Apogee model with a fixed bug of AM voices*/ + ADLMIDI_VolumeModel_APOGEE_Fixed = 7, }; /** diff --git a/src/adlmidi_opl3.cpp b/src/adlmidi_opl3.cpp index d0f3953..68825bd 100644 --- a/src/adlmidi_opl3.cpp +++ b/src/adlmidi_opl3.cpp @@ -564,6 +564,7 @@ void OPL3::touchNote(size_t c, break; case Synth::VOLUME_DMX: + case Synth::VOLUME_DMX_FIXED: { volume = (channelVolume * channelExpression * m_masterVolume) / 16129; volume = (DMX_volume_mapping_table[volume] + 1) << 1; @@ -572,6 +573,7 @@ void OPL3::touchNote(size_t c, break; case Synth::VOLUME_APOGEE: + case Synth::VOLUME_APOGEE_FIXED: { volume = 0; midiVolume = (channelVolume * channelExpression * m_masterVolume / 16129); @@ -627,7 +629,9 @@ void OPL3::touchNote(size_t c, { tlCar -= volume / 2; } - else if(m_volumeScale == Synth::VOLUME_APOGEE && mode <= 1) + else if((m_volumeScale == Synth::VOLUME_APOGEE || + m_volumeScale == Synth::VOLUME_APOGEE_FIXED) && + mode <= 1) { // volume = ((64 * (velocity + 0x80)) * volume) >> 15; do_modulator = do_ops[mode][ 0 ] || m_scaleModulators; @@ -646,7 +650,10 @@ void OPL3::touchNote(size_t c, // to not work properly on AM instruments // The fix of this bug is just replacing of tlCar with tmMod // in this formula - tlMod = (midiVolume * tlCar) >> 15; + if(m_volumeScale == Synth::VOLUME_APOGEE_FIXED) + tlMod = (midiVolume * tlMod) >> 15; + else + tlMod = (midiVolume * tlCar) >> 15; tlMod ^= 63; } @@ -891,6 +898,14 @@ void OPL3::setVolumeScaleModel(ADLMIDI_VolumeModels volumeModel) case ADLMIDI_VolumeModel_9X: m_volumeScale = OPL3::VOLUME_9X; break; + + case ADLMIDI_VolumeModel_DMX_Fixed: + m_volumeScale = OPL3::VOLUME_DMX_FIXED; + break; + + case ADLMIDI_VolumeModel_APOGEE_Fixed: + m_volumeScale = OPL3::VOLUME_APOGEE_FIXED; + break; } } @@ -909,6 +924,10 @@ ADLMIDI_VolumeModels OPL3::getVolumeScaleModel() return ADLMIDI_VolumeModel_APOGEE; case OPL3::VOLUME_9X: return ADLMIDI_VolumeModel_9X; + case OPL3::VOLUME_DMX_FIXED: + return ADLMIDI_VolumeModel_DMX_Fixed; + case OPL3::VOLUME_APOGEE_FIXED: + return ADLMIDI_VolumeModel_APOGEE_Fixed; } } diff --git a/src/adlmidi_opl3.hpp b/src/adlmidi_opl3.hpp index a12069e..185c5d3 100644 --- a/src/adlmidi_opl3.hpp +++ b/src/adlmidi_opl3.hpp @@ -145,7 +145,11 @@ public: //! Apoge Sound System volume scaling model VOLUME_APOGEE, //! Windows 9x driver volume scale table - VOLUME_9X + VOLUME_9X, + //! DMX model with a fixed bug of AM voices + VOLUME_DMX_FIXED, + //! Apogee model with a fixed bug of AM voices + VOLUME_APOGEE_FIXED, } m_volumeScale; //! Reserved |