shithub: choc

Download patch

ref: eb2291030ae0f1e005a6014193fdfeaa796a913a
parent: fe96ae292d2b0e67020d77493ae366360cd93ec8
author: Simon Howard <[email protected]>
date: Mon Aug 31 18:50:28 EDT 2009

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

--- a/src/i_oplmusic.c
+++ b/src/i_oplmusic.c
@@ -495,7 +495,7 @@
 
     // 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 @@
 
     // 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);