Mercurial > repos > blastem
comparison psg.c @ 2305:6aca1734d573
Merge
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Wed, 15 Mar 2023 19:28:11 -0700 |
parents | 0343f0d5add0 |
children | f6213de4224c |
comparison
equal
deleted
inserted
replaced
2304:b3832f73444f | 2305:6aca1734d573 |
---|---|
21 context->pan = 0xFF; | 21 context->pan = 0xFF; |
22 } | 22 } |
23 | 23 |
24 void psg_enable_scope(psg_context *context, oscilloscope *scope, uint32_t master_clock) | 24 void psg_enable_scope(psg_context *context, oscilloscope *scope, uint32_t master_clock) |
25 { | 25 { |
26 #ifndef IS_LIB | |
26 context->scope = scope; | 27 context->scope = scope; |
27 static const char *names[] = { | 28 static const char *names[] = { |
28 "PSG #1", | 29 "PSG #1", |
29 "PSG #2", | 30 "PSG #2", |
30 "PSG #3", | 31 "PSG #3", |
32 }; | 33 }; |
33 for (int i = 0; i < 4; i++) | 34 for (int i = 0; i < 4; i++) |
34 { | 35 { |
35 context->scope_channel[i] = scope_add_channel(scope, names[i], master_clock / context->clock_inc); | 36 context->scope_channel[i] = scope_add_channel(scope, names[i], master_clock / context->clock_inc); |
36 } | 37 } |
38 #endif | |
37 } | 39 } |
38 | 40 |
39 void psg_free(psg_context *context) | 41 void psg_free(psg_context *context) |
40 { | 42 { |
41 render_free_source(context->audio); | 43 render_free_source(context->audio); |
144 pan_left <<= 1; | 146 pan_left <<= 1; |
145 pan_right <<= 1; | 147 pan_right <<= 1; |
146 } else { | 148 } else { |
147 value = 0; | 149 value = 0; |
148 } | 150 } |
151 #ifndef IS_LIB | |
149 if (context->scope) { | 152 if (context->scope) { |
150 scope_add_sample(context->scope, context->scope_channel[i], value, trigger[i]); | 153 scope_add_sample(context->scope, context->scope_channel[i], value, trigger[i]); |
151 } | 154 } |
155 #endif | |
152 } | 156 } |
153 value = 0; | 157 value = 0; |
154 if (context->noise_out) { | 158 if (context->noise_out) { |
155 value = volume_table[context->volume[3]]; | 159 value = volume_table[context->volume[3]]; |
156 if (context->pan & pan_left) { | 160 if (context->pan & pan_left) { |
158 } | 162 } |
159 if (context->pan & pan_right) { | 163 if (context->pan & pan_right) { |
160 right_accum += value; | 164 right_accum += value; |
161 } | 165 } |
162 } | 166 } |
167 #ifndef IS_LIB | |
163 if (context->scope) { | 168 if (context->scope) { |
164 scope_add_sample(context->scope, context->scope_channel[3], value, trigger[3]); | 169 scope_add_sample(context->scope, context->scope_channel[3], value, trigger[3]); |
165 } | 170 } |
171 #endif | |
166 | 172 |
167 render_put_stereo_sample(context->audio, left_accum, right_accum); | 173 render_put_stereo_sample(context->audio, left_accum, right_accum); |
168 | 174 |
169 context->cycles += context->clock_inc; | 175 context->cycles += context->clock_inc; |
170 } | 176 } |