aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md1
-rw-r--r--src/adlmidi_opl3.cpp3
2 files changed, 4 insertions, 0 deletions
diff --git a/README.md b/README.md
index d390d0d..f6a3541 100644
--- a/README.md
+++ b/README.md
@@ -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)
{