foxygit / doom Log in
commit cc0cc9fb0c806f6533dca794b1e829a626323d8b
Author:     Simon Howard <fraggle@gmail.com>
AuthorDate: Fri Sep 11 16:54:06 2009 +0000
Commit:     Simon Howard <fraggle@gmail.com>
CommitDate: Fri Sep 11 16:54:06 2009 +0000

    Implement the fine tuning field, based on research.

    Subversion-branch: /branches/opl-branch
    Subversion-revision: 1664
---
 src/i_oplmusic.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/i_oplmusic.c b/src/i_oplmusic.c
index 643f67c5..8cb833a2 100644
--- a/src/i_oplmusic.c
+++ b/src/i_oplmusic.c
@@ -839,6 +839,14 @@ static unsigned int FrequencyForVoice(opl_voice_t *voice)

     freq_index = 64 + 32 * voice->note + voice->channel->bend;

+    // If this is the second voice of a double voice instrument, the
+    // frequency index can be adjusted by the fine tuning field.
+
+    if (voice->current_instr_voice != 0)
+    {
+        freq_index += (voice->current_instr->fine_tuning / 2) - 64;
+    }
+
     // The first 7 notes use the start of the table, while
     // consecutive notes loop around the latter part.