foxygit / doom Log in
commit 56a6af426972ed2a334ae7001d19854aca964a75
Author:     Simon Howard <fraggle@gmail.com>
AuthorDate: Sun Oct 11 21:47:07 2009 +0000
Commit:     Simon Howard <fraggle@gmail.com>
CommitDate: Sun Oct 11 21:47:07 2009 +0000

    Don't apply base note offset if the instrument is a fixed note
    instrument. This should stop the ugly bleeping from the electric snare
    on E1M2.

    Subversion-branch: /branches/opl-branch
    Subversion-revision: 1715
---
 src/i_oplmusic.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/i_oplmusic.c b/src/i_oplmusic.c
index cd331897..d32a163e 100644
--- a/src/i_oplmusic.c
+++ b/src/i_oplmusic.c
@@ -701,10 +701,15 @@ static unsigned int FrequencyForVoice(opl_voice_t *voice)

     note = voice->note;

-    // Apply note offset:
+    // Apply note offset.
+    // Don't apply offset if the instrument is a fixed note instrument.

     gm_voice = &voice->current_instr->voices[voice->current_instr_voice];
-    note += (signed short) SHORT(gm_voice->base_note_offset);
+
+    if ((voice->current_instr->flags & GENMIDI_FLAG_FIXED) == 0)
+    {
+        note += (signed short) SHORT(gm_voice->base_note_offset);
+    }

     // Avoid possible overflow due to base note offset: