diff sms.c @ 1796:51417bb557b6

Configurable gain for overall output and individual components
author Michael Pavone <pavone@retrodev.com>
date Sat, 23 Mar 2019 17:18:10 -0700
parents 6e4faa10f9ee
children 49f65d240299 2d462aa78349
line wrap: on
line diff
--- a/sms.c	Sat Mar 23 00:05:37 2019 -0700
+++ b/sms.c	Sat Mar 23 17:18:10 2019 -0700
@@ -569,6 +569,13 @@
 	io_keyboard_up(&sms->io, scancode);
 }
 
+static void set_gain_config(sms_context *sms)
+{
+	char *config_gain;
+	config_gain = tern_find_path(config, "audio\0psg_gain\0", TVAL_PTR).ptrval;
+	render_audio_source_gaindb(sms->psg->audio, config_gain ? atof(config_gain) : 0.0f);
+}
+
 static void config_updated(system_header *system)
 {
 	sms_context *sms = (sms_context *)system;
@@ -620,6 +627,8 @@
 	sms->psg = malloc(sizeof(psg_context));
 	psg_init(sms->psg, sms->master_clock, 15*16);
 	
+	set_gain_config(sms);
+	
 	sms->vdp = init_vdp_context(0);
 	sms->vdp->system = &sms->header;