diff options
author | Wohlstand <admin@wohlnet.ru> | 2025-04-10 04:51:11 +0300 |
---|---|---|
committer | Wohlstand <admin@wohlnet.ru> | 2025-04-10 04:51:11 +0300 |
commit | 1461b257ccc6ab7976f8bcf4178b4101af8c809a (patch) | |
tree | a23c2ab25a5af5c1a53c749ee70f956677810741 | |
parent | 4c884ea82336550866756c4421b9d72e87052742 (diff) | |
download | libADLMIDI-1461b257ccc6ab7976f8bcf4178b4101af8c809a.tar.gz libADLMIDI-1461b257ccc6ab7976f8bcf4178b4101af8c809a.tar.bz2 libADLMIDI-1461b257ccc6ab7976f8bcf4178b4101af8c809a.zip |
adlmidi_opl3: Fixed the dead loop when tone comes lower than zero
-rw-r--r-- | README.md | 1 | ||||
-rw-r--r-- | src/adlmidi_opl3.cpp | 3 |
2 files changed, 4 insertions, 0 deletions
@@ -198,6 +198,7 @@ To build that example you will need to have installed SDL2 library. * Added an ability to manually specify the chip type (OPL2 or OPL3) at the DOS version of MIDI player. * Added an automatical detection of OPL2 or OPL3 chip depending on the BLASTER environment variable's value at the DOS version of MIDI player. * Added Nuked OPL2 and OPL3 Low-Level emulators (Kept disabled by default because they are too heavy for ordinary processors). + * Fixed a dead loop that might happen when final tone gets lower than zero. ## 1.5.1 2022-10-31 * Added an ability to disable the automatical arpeggio diff --git a/src/adlmidi_opl3.cpp b/src/adlmidi_opl3.cpp index be84203..5690721 100644 --- a/src/adlmidi_opl3.cpp +++ b/src/adlmidi_opl3.cpp @@ -1058,6 +1058,9 @@ void OPL3::noteOn(size_t c1, size_t c2, double tone) // Hertz range: 0..131071 double hertz; + if(tone < 0.0) + tone = 0.0; // Lower than 0 is impossible! + // Use different frequency formulas in depend on a volume model switch(m_volumeScale) { |