diff options
author | Simon Howard | 2009-08-31 22:50:28 +0000 |
---|---|---|
committer | Simon Howard | 2009-08-31 22:50:28 +0000 |
commit | eb2291030ae0f1e005a6014193fdfeaa796a913a (patch) | |
tree | d08e6f556178122d6abfdd591d4cc435c4091055 /src | |
parent | fe96ae292d2b0e67020d77493ae366360cd93ec8 (diff) | |
download | chocolate-doom-eb2291030ae0f1e005a6014193fdfeaa796a913a.tar.gz chocolate-doom-eb2291030ae0f1e005a6014193fdfeaa796a913a.tar.bz2 chocolate-doom-eb2291030ae0f1e005a6014193fdfeaa796a913a.zip |
Perform volume mapping on note and channel volumes before multiplying
them. This gives voice volume values that are almost identical to
Doom's.
Subversion-branch: /branches/opl-branch
Subversion-revision: 1653
Diffstat (limited to 'src')
-rw-r--r-- | src/i_oplmusic.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/i_oplmusic.c b/src/i_oplmusic.c index ab64505c..74a76b00 100644 --- a/src/i_oplmusic.c +++ b/src/i_oplmusic.c @@ -495,7 +495,7 @@ static void SetOperatorVolume(genmidi_op_t *op, unsigned int volume, // The volume value to use in the register: - reg_volume = ((op_volume * volume_mapping_table[volume]) / 128); + reg_volume = (op_volume * volume) / 128; reg_volume = (0x3f - reg_volume) | op->scale; // Update the register, if necessary: @@ -519,7 +519,8 @@ static void SetVoiceVolume(opl_voice_t *voice, unsigned int volume) // Multiply note volume and channel volume to get the actual volume. - full_volume = (voice->note_volume * voice->channel->volume) / 127; + full_volume = (volume_mapping_table[voice->note_volume] + * volume_mapping_table[voice->channel->volume]) / 127; SetOperatorVolume(&opl_voice->carrier, full_volume, voice->op2, &voice->carrier_volume); |