Mercurial > repos > blastem
comparison psg.c @ 2246:0e927fce8941
Fix bug in PSG oscilloscope output
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Thu, 24 Nov 2022 00:43:10 -0800 |
parents | 0d1d5dccdd28 |
children | 74112041b2c7 |
comparison
equal
deleted
inserted
replaced
2245:d220305e81b9 | 2246:0e927fce8941 |
---|---|
129 } | 129 } |
130 | 130 |
131 int16_t left_accum = 0, right_accum = 0; | 131 int16_t left_accum = 0, right_accum = 0; |
132 uint8_t pan_left = 0x10, pan_right = 0x1; | 132 uint8_t pan_left = 0x10, pan_right = 0x1; |
133 | 133 |
134 int16_t value = 0; | 134 int16_t value; |
135 for (int i = 0; i < 3; i++) { | 135 for (int i = 0; i < 3; i++) { |
136 if (context->output_state[i]) { | 136 if (context->output_state[i]) { |
137 value = volume_table[context->volume[i]]; | 137 value = volume_table[context->volume[i]]; |
138 if (context->pan & pan_left) { | 138 if (context->pan & pan_left) { |
139 left_accum += value; | 139 left_accum += value; |
141 if (context->pan & pan_right) { | 141 if (context->pan & pan_right) { |
142 right_accum += value; | 142 right_accum += value; |
143 } | 143 } |
144 pan_left <<= 1; | 144 pan_left <<= 1; |
145 pan_right <<= 1; | 145 pan_right <<= 1; |
146 } else { | |
147 value = 0; | |
146 } | 148 } |
147 if (context->scope) { | 149 if (context->scope) { |
148 scope_add_sample(context->scope, context->scope_channel[i], value, trigger[i]); | 150 scope_add_sample(context->scope, context->scope_channel[i], value, trigger[i]); |
149 } | 151 } |
150 } | 152 } |