changeset 2246:0e927fce8941

Fix bug in PSG oscilloscope output
author Michael Pavone <pavone@retrodev.com>
date Thu, 24 Nov 2022 00:43:10 -0800
parents d220305e81b9
children 08a16de0e4cb
files psg.c
diffstat 1 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/psg.c	Wed Nov 23 09:36:42 2022 -0800
+++ b/psg.c	Thu Nov 24 00:43:10 2022 -0800
@@ -131,7 +131,7 @@
 		int16_t left_accum = 0, right_accum = 0;
 		uint8_t pan_left = 0x10, pan_right = 0x1;
 
-		int16_t value = 0;
+		int16_t value;
 		for (int i = 0; i < 3; i++) {
 			if (context->output_state[i]) {
 				value = volume_table[context->volume[i]];
@@ -143,6 +143,8 @@
 				}
 				pan_left <<= 1;
 				pan_right <<= 1;
+			} else {
+				value = 0;
 			}
 			if (context->scope) {
 				scope_add_sample(context->scope, context->scope_channel[i], value, trigger[i]);