adafruit / circuitpython

CircuitPython - a Python implementation for teaching coding with microcontrollers
https://circuitpython.org
Other
4.12k stars 1.22k forks source link

Fix error with NULL sample handling in `audiofilters.Filter`. #9787

Closed relic-se closed 2 weeks ago

relic-se commented 3 weeks ago

Fixed mishandling of NULL sample within get_buffer method (used by audiosample api) of the newly added audiofilters.Filter class in 9.2.0. The error would occur when either no sample was loaded (ie: .play(...)) or .stop() was called when feeding into another audiosample object. See https://github.com/adafruit/circuitpython/issues/9778 for more details and examples.

The method now feeds "silence" audio data into the output buffer and prevents an infinite while loop.