changeset 522:6a14c5a95648

Adjust PSG and YM-2612 volume to be closer to the real console
author Michael Pavone <pavone@retrodev.com>
date Tue, 11 Feb 2014 12:52:28 -0800
parents 7565ec2ac652
children 450c7745379a
files psg.c ym2612.c
diffstat 2 files changed, 6 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/psg.c	Tue Feb 11 12:45:43 2014 -0800
+++ b/psg.c	Tue Feb 11 12:52:28 2014 -0800
@@ -74,7 +74,7 @@
 	}
 }
 
-#define PSG_VOL_DIV 6
+#define PSG_VOL_DIV 14
 
 //table shamelessly swiped from PSG doc from smspower.org
 int16_t volume_table[16] = {
--- a/ym2612.c	Tue Feb 11 12:45:43 2014 -0800
+++ b/ym2612.c	Tue Feb 11 12:52:28 2014 -0800
@@ -232,7 +232,8 @@
 	}
 }
 
-#define YM_VOLUME_DIVIDER 2
+#define YM_VOLUME_MULTIPLIER 2
+#define YM_VOLUME_DIVIDER 3
 #define YM_MOD_SHIFT 1
 
 #define TIMER_A_MAX 1023
@@ -455,7 +456,7 @@
 					if (value & 0x2000) {
 						value |= 0xC000;
 					}
-					dfprintf(debug_file, "channel %d output: %d\n", channel, value / YM_VOLUME_DIVIDER);
+					dfprintf(debug_file, "channel %d output: %d\n", channel, (value * YM_VOLUME_MULTIPLIER) / YM_VOLUME_DIVIDER);
 				}
 			}
 			//puts("operator update done");
@@ -485,10 +486,10 @@
 					fwrite(&value, sizeof(value), 1, context->channels[i].logfile);
 				}
 				if (context->channels[i].lr & 0x80) {
-					context->audio_buffer[context->buffer_pos] += value / YM_VOLUME_DIVIDER;
+					context->audio_buffer[context->buffer_pos] += (value * YM_VOLUME_MULTIPLIER) / YM_VOLUME_DIVIDER;
 				}
 				if (context->channels[i].lr & 0x40) {
-					context->audio_buffer[context->buffer_pos+1] += value / YM_VOLUME_DIVIDER;
+					context->audio_buffer[context->buffer_pos+1] += (value * YM_VOLUME_MULTIPLIER) / YM_VOLUME_DIVIDER;
 				}
 			}
 			context->buffer_pos += 2;