diff options
author | Wohlstand <admin@wohlnet.ru> | 2020-09-10 01:51:48 +0300 |
---|---|---|
committer | Wohlstand <admin@wohlnet.ru> | 2020-09-10 01:51:48 +0300 |
commit | fcd50f3d31dcc94ebcaf1f5a86f811973462bb57 (patch) | |
tree | a68acf49b89640c0319bcac110515301742002bc | |
parent | 5f0940a32541ca2de5441e3b4171cb25ff462f4d (diff) | |
download | libADLMIDI-fcd50f3d31dcc94ebcaf1f5a86f811973462bb57.tar.gz libADLMIDI-fcd50f3d31dcc94ebcaf1f5a86f811973462bb57.tar.bz2 libADLMIDI-fcd50f3d31dcc94ebcaf1f5a86f811973462bb57.zip |
Fixed an accuracy of Win9X frequency model
-rw-r--r-- | src/adlmidi_midiplay.cpp | 21 | ||||
-rw-r--r-- | src/adlmidi_opl3.cpp | 2 |
2 files changed, 17 insertions, 6 deletions
diff --git a/src/adlmidi_midiplay.cpp b/src/adlmidi_midiplay.cpp index ad9ccde..0776a05 100644 --- a/src/adlmidi_midiplay.cpp +++ b/src/adlmidi_midiplay.cpp @@ -297,7 +297,7 @@ static inline double s_9xFreq(double noteD, double bendD) bendMsb = (bend >> 7) & 0x7F; bendLsb = (bend & 0x7F); - bend = bendMsb << 9 | bendLsb << 2; + bend = (bendMsb << 9) | (bendLsb << 2); bend = (int16_t)(uint16_t)(bend + 0x8000); octave = note / 12; @@ -1655,14 +1655,25 @@ int64_t MIDIplay::calculateChipChannelGoodness(size_t c, const MIDIchannel::Note // Rate channel with a releasing note if(s < 0 && chan.users.empty()) { + bool isSame = (chan.recent_ins == ins); s -= 40000; + // If it's same instrument, better chance to get it when no free channels - if(chan.recent_ins == ins && synth.m_musicMode == Synth::MODE_CMF) - s = 0; // Re-use releasing channel with the same instrument + if(synth.m_musicMode == Synth::MODE_CMF) + { + if(isSame) + s = 0; // Re-use releasing channel with the same instrument + } else if(synth.m_volumeScale == Synth::VOLUME_HMI) + { s = 0; // HMI doesn't care about the same instrument - else if(chan.recent_ins == ins) - s = -koff_ms; // Wait until releasing sound will complete + } + else + { + if(isSame) + s = -koff_ms; // Wait until releasing sound will complete + } + return s; } diff --git a/src/adlmidi_opl3.cpp b/src/adlmidi_opl3.cpp index b4d116b..5a44c13 100644 --- a/src/adlmidi_opl3.cpp +++ b/src/adlmidi_opl3.cpp @@ -452,7 +452,7 @@ void OPL3::noteOn(size_t c1, size_t c2, double hertz) // Hertz range: 0..131071 mul_offset++; } - ftone = octave + static_cast<uint32_t>(hertz + 0.5); + ftone = octave + static_cast<uint32_t>(hertz /*+ 0.5*/); uint32_t chn = g_channelsMap[cc1]; const adldata &patch1 = m_insCache[c1]; const adldata &patch2 = m_insCache[c2 < m_insCache.size() ? c2 : 0]; |