shorepine / amy

AMY - A high-performance fixed-point Music synthesizer librarY for microcontrollers
https://shorepine.github.io/amy/
MIT License
184 stars 11 forks source link

pcm.c,amy.c: Fix looping in PCM samples. #129

Closed dpwe closed 2 months ago

dpwe commented 2 months ago

The core problem was using PCM_INDEX_FRAC_BITS when it needed to be PCM_INDEX_BITS.

But in the process of trying to figure out how it worked, I think I found a bug with hold_and_modify() continually re-asserting the msynth[osc].feedback field which was being used by pcm_note_off() to indicate when a looping sample should be allowed to play out.

Added a new test, TestPcmLoop, to verify continued correct operation.

bwhitman commented 2 months ago

👷‍♂️