# HG changeset patch # User Michael Pavone # Date 1707365003 28800 # Node ID 18816c5c11d42970d7f545e1e2b32fd1a50a2080 # Parent 61c0bfe1088712c1b74bb0820d28efb542aa93ac Fix Pico ADPCM decoding and get relative volume approximately correct diff -r 61c0bfe10887 -r 18816c5c11d4 pico_pcm.c --- 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; }