From aeee6260ae4b7c4f6f4907cf1251fd1569cc03b1 Mon Sep 17 00:00:00 2001 From: Adam Lederer Date: Thu, 29 Aug 2024 23:28:22 -0700 Subject: [PATCH] fix absorb instrument bug: octave set to -1 when most recent 'note' was OFF/REL/=== --- src/gui/editing.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/gui/editing.cpp b/src/gui/editing.cpp index 8a49f4ecf..bd2776cd9 100644 --- a/src/gui/editing.cpp +++ b/src/gui/editing.cpp @@ -1846,8 +1846,11 @@ void FurnaceGUI::doAbsorbInstrument() { } // absorb most recent octave (i.e. set curOctave such that the "main row" (QWERTY) of - // notes will result in an octave number equal to the previous note). - if (!foundOctave && pat->data[i][0] != 0) { + // notes will result in an octave number equal to the previous note). make sure to + // skip "special note values" like OFF/REL/=== and "none", since there won't be valid + // octave values + unsigned char note=pat->data[i][0]; + if (!foundOctave && note!=0 && note!=100 && note!=101 && note!=102) { foundOctave=true; // decode octave data (was signed cast to unsigned char)