diff options
author | Simon Howard | 2009-08-30 23:55:43 +0000 |
---|---|---|
committer | Simon Howard | 2009-08-30 23:55:43 +0000 |
commit | c887c9804b07ffc2d56fc4ab31ed1aa1486fd5c4 (patch) | |
tree | 1984dbea2d88c23e8fbee231f38a58bc77418439 | |
parent | 01cebf1373d482f3dca1eb9706a6b85595e83ea1 (diff) | |
download | chocolate-doom-c887c9804b07ffc2d56fc4ab31ed1aa1486fd5c4.tar.gz chocolate-doom-c887c9804b07ffc2d56fc4ab31ed1aa1486fd5c4.tar.bz2 chocolate-doom-c887c9804b07ffc2d56fc4ab31ed1aa1486fd5c4.zip |
Use fixed note on instruments with the fixed note flag set.
Subversion-branch: /branches/opl-branch
Subversion-revision: 1649
-rw-r--r-- | src/i_oplmusic.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/i_oplmusic.c b/src/i_oplmusic.c index f70e085d..8a416f57 100644 --- a/src/i_oplmusic.c +++ b/src/i_oplmusic.c @@ -48,7 +48,7 @@ #define GENMIDI_NUM_INSTRS 128 #define GENMIDI_HEADER "#OPL_II#" -#define GENMIDI_FLAG_FIXED 0x0000 /* fixed pitch */ +#define GENMIDI_FLAG_FIXED 0x0001 /* fixed pitch */ #define GENMIDI_FLAG_2VOICE 0x0002 /* double voice (OPL3) */ typedef struct @@ -701,6 +701,9 @@ static void NoteOnEvent(opl_track_data_t *track, midi_event_t *event) return; } + voice->channel = channel; + voice->note = note; + // Program the voice with the instrument data: SetVoiceInstrument(voice, &instrument->opl2_voice); @@ -710,14 +713,16 @@ static void NoteOnEvent(opl_track_data_t *track, midi_event_t *event) WriteRegister(OPL_REGS_LEVEL + voice->op2, volume_mapping_table[volume]); - // Play the note. + // Fixed pitch? - voice->channel = channel; - voice->note = note; + if ((instrument->flags & GENMIDI_FLAG_FIXED) != 0) + { + note = instrument->fixed_note; + } // Write the frequency value to turn the note on. - voice->freq = FrequencyForNote(voice->note); + voice->freq = FrequencyForNote(note); WriteRegister(OPL_REGS_FREQ_1 + voice->index, voice->freq & 0xff); WriteRegister(OPL_REGS_FREQ_2 + voice->index, (voice->freq >> 8) | 0x20); |