Mercurial > repos > blastem
comparison pico_pcm.c @ 2434:2ee25a487e2b
Fix some Pico ADPCM behaviors
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Thu, 08 Feb 2024 20:44:44 -0800 |
parents | 18816c5c11d4 |
children | b8d894f7f9dc |
comparison
equal
deleted
inserted
replaced
2433:2907c3312423 | 2434:2ee25a487e2b |
---|---|
99 if (pcm->scope) { | 99 if (pcm->scope) { |
100 scope_add_sample(pcm->scope, pcm->scope_channel, (pcm->output >> shift) * 32, 0); | 100 scope_add_sample(pcm->scope, pcm->scope_channel, (pcm->output >> shift) * 32, 0); |
101 } | 101 } |
102 #endif | 102 #endif |
103 render_put_mono_sample(pcm->audio, (pcm->output >> shift) * 32); | 103 render_put_mono_sample(pcm->audio, (pcm->output >> shift) * 32); |
104 if (pcm->ctrl & PCM_RESET) { | |
105 //Anpanman Pico: Waku Waku Pan Koujou seems to expect the BUSY/RESET flag | |
106 //to be set for a while after reset | |
107 if (pcm->counter) { | |
108 pcm->counter--; | |
109 continue; | |
110 } else { | |
111 pcm->ctrl &= ~PCM_RESET; | |
112 } | |
113 } | |
114 /* | |
115 Unclear what this bit is actually supposed to do | |
116 But some games expect ADPCM to work with it cleared | |
117 Anpanman Pico: Waku Waku Pan Koujou sets the ctrl reg to $6040 | |
104 if (!(pcm->ctrl & PCM_ENABLED)) { | 118 if (!(pcm->ctrl & PCM_ENABLED)) { |
105 continue; | 119 continue; |
106 } | 120 }*/ |
107 if (pcm->counter) { | 121 if (pcm->counter) { |
108 pcm->counter--; | 122 pcm->counter--; |
109 } else if (pcm->samples) { | 123 } else if (pcm->samples) { |
110 pcm->samples--; | 124 pcm->samples--; |
111 uint8_t sample; | 125 uint8_t sample; |
170 // V: volume, probably attenuation value since converter defaults to "0" | 184 // V: volume, probably attenuation value since converter defaults to "0" |
171 void pico_pcm_ctrl_write(pico_pcm *pcm, uint16_t value) | 185 void pico_pcm_ctrl_write(pico_pcm *pcm, uint16_t value) |
172 { | 186 { |
173 if (value & PCM_RESET) { | 187 if (value & PCM_RESET) { |
174 pico_pcm_reset(pcm); | 188 pico_pcm_reset(pcm); |
175 } | 189 pcm->counter = 2; |
176 pcm->ctrl &= 0x8000; | 190 } |
177 pcm->ctrl |= value & ~PCM_RESET; | 191 pcm->ctrl = value; |
178 //TODO: update low-pass filter | 192 //TODO: update low-pass filter |
179 } | 193 } |
180 | 194 |
181 void pico_pcm_data_write(pico_pcm *pcm, uint16_t value) | 195 void pico_pcm_data_write(pico_pcm *pcm, uint16_t value) |
182 { | 196 { |