foxygit / doom Log in
commit fe96ae292d2b0e67020d77493ae366360cd93ec8
Author:     Simon Howard <fraggle@gmail.com>
AuthorDate: Mon Aug 31 18:33:36 2009 +0000
Commit:     Simon Howard <fraggle@gmail.com>
CommitDate: Mon Aug 31 18:33:36 2009 +0000

    Dont program an instrument if it is already set.

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

diff --git a/src/i_oplmusic.c b/src/i_oplmusic.c
index 51a609d9..ab64505c 100644
--- a/src/i_oplmusic.c
+++ b/src/i_oplmusic.c
@@ -445,6 +445,13 @@ static void SetVoiceInstrument(opl_voice_t *voice, genmidi_instr_t *instr)
     genmidi_voice_t *data;
     unsigned int modulating;

+    // Instrument already set for this channel?
+
+    if (voice->current_instr == instr)
+    {
+        return;
+    }
+
     voice->current_instr = instr;
     data = &instr->opl2_voice;