Mercurial > repos > blastem
diff pico_pcm.c @ 2432:18816c5c11d4
Fix Pico ADPCM decoding and get relative volume approximately correct
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Wed, 07 Feb 2024 20:03:23 -0800 |
parents | 61c0bfe10887 |
children | 2ee25a487e2b |
line wrap: on
line diff
--- a/pico_pcm.c Tue Feb 06 21:47:11 2024 -0800 +++ b/pico_pcm.c Wed Feb 07 20:03:23 2024 -0800 @@ -78,7 +78,7 @@ }; static const int state_delta[16] = {-1, -1, 0, 0, 1, 2, 2, 3, -1, -1, 0, 0, 1, 2, 2, 3}; int16_t ret = sample_delta[(*state << 4) + sample]; - int diff = state_delta[*state]; + int diff = state_delta[sample]; if (diff >= 0 || *state > 0) { *state += diff; if (*state > 15) { @@ -97,10 +97,10 @@ int16_t shift = pcm->ctrl & PCM_VOLUME; #ifndef IS_LIB if (pcm->scope) { - scope_add_sample(pcm->scope, pcm->scope_channel, (pcm->output >> shift) * 128, 0); + scope_add_sample(pcm->scope, pcm->scope_channel, (pcm->output >> shift) * 32, 0); } #endif - render_put_mono_sample(pcm->audio, (pcm->output >> shift) * 128); + render_put_mono_sample(pcm->audio, (pcm->output >> shift) * 32); if (!(pcm->ctrl & PCM_ENABLED)) { continue; }