Mercurial > repos > blastem
comparison rf5c164.c @ 2302:0343f0d5add0
Fix libretro build for real
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Sun, 12 Mar 2023 20:03:35 -0700 |
parents | 9ead0fe69d9b |
children | c76c81c21ae5 |
comparison
equal
deleted
inserted
replaced
2301:d30ea441b92e | 2302:0343f0d5add0 |
---|---|
152 } | 152 } |
153 sample *= pcm->channels[pcm->cur_channel].regs[ENV]; | 153 sample *= pcm->channels[pcm->cur_channel].regs[ENV]; |
154 int16_t left = (sample * (pcm->channels[pcm->cur_channel].regs[PAN] >> 4)) >> 5; | 154 int16_t left = (sample * (pcm->channels[pcm->cur_channel].regs[PAN] >> 4)) >> 5; |
155 int16_t right = (sample * (pcm->channels[pcm->cur_channel].regs[PAN] & 0xF)) >> 5; | 155 int16_t right = (sample * (pcm->channels[pcm->cur_channel].regs[PAN] & 0xF)) >> 5; |
156 //printf("chan %d, raw %X, sample %d, left %d, right %d, ptr %X (raw %X)\n", pcm->cur_channel, pcm->channels[pcm->cur_channel].sample, sample, left, right, pcm->channels[pcm->cur_channel].cur_ptr >> 11, pcm->channels[pcm->cur_channel].cur_ptr); | 156 //printf("chan %d, raw %X, sample %d, left %d, right %d, ptr %X (raw %X)\n", pcm->cur_channel, pcm->channels[pcm->cur_channel].sample, sample, left, right, pcm->channels[pcm->cur_channel].cur_ptr >> 11, pcm->channels[pcm->cur_channel].cur_ptr); |
157 #ifndef IS_LIB | |
157 if (pcm->scope) { | 158 if (pcm->scope) { |
158 scope_add_sample(pcm->scope, pcm->channels[pcm->cur_channel].scope_channel, sample, pcm->channels[pcm->cur_channel].trigger); | 159 scope_add_sample(pcm->scope, pcm->channels[pcm->cur_channel].scope_channel, sample, pcm->channels[pcm->cur_channel].trigger); |
159 } | 160 } |
161 #endif | |
160 pcm->left += left; | 162 pcm->left += left; |
161 pcm->right += right; | 163 pcm->right += right; |
164 #ifdef IS_LIB | |
165 } | |
166 #else | |
162 } else if (pcm->scope) { | 167 } else if (pcm->scope) { |
163 scope_add_sample(pcm->scope, pcm->channels[pcm->cur_channel].scope_channel, 0, 0); | 168 scope_add_sample(pcm->scope, pcm->channels[pcm->cur_channel].scope_channel, 0, 0); |
164 } | 169 } |
170 #endif | |
165 write_if_not_sounding(pcm); | 171 write_if_not_sounding(pcm); |
166 CHECK; | 172 CHECK; |
167 case 10: | 173 case 10: |
168 //refresh? | 174 //refresh? |
169 //does refresh happen at the same rate when sounding disabled? warning in sega docs suggests maybe not | 175 //does refresh happen at the same rate when sounding disabled? warning in sega docs suggests maybe not |
244 } | 250 } |
245 } | 251 } |
246 | 252 |
247 void rf5c164_enable_scope(rf5c164* pcm, oscilloscope *scope) | 253 void rf5c164_enable_scope(rf5c164* pcm, oscilloscope *scope) |
248 { | 254 { |
255 #ifndef IS_LIB | |
249 static const char *names[] = { | 256 static const char *names[] = { |
250 "Richo #1", | 257 "Richo #1", |
251 "Richo #2", | 258 "Richo #2", |
252 "Richo #3", | 259 "Richo #3", |
253 "Richo #4", | 260 "Richo #4", |
259 pcm->scope = scope; | 266 pcm->scope = scope; |
260 for (int i = 0; i < 8; i ++) | 267 for (int i = 0; i < 8; i ++) |
261 { | 268 { |
262 pcm->channels[i].scope_channel = scope_add_channel(scope, names[i], 50000000 / (pcm->clock_step * 96)); | 269 pcm->channels[i].scope_channel = scope_add_channel(scope, names[i], 50000000 / (pcm->clock_step * 96)); |
263 } | 270 } |
271 #endif | |
264 } | 272 } |
265 | 273 |
266 void rf5c164_serialize(rf5c164* pcm, serialize_buffer *buf) | 274 void rf5c164_serialize(rf5c164* pcm, serialize_buffer *buf) |
267 { | 275 { |
268 save_int32(buf, pcm->cycle); | 276 save_int32(buf, pcm->cycle); |