kopia lustrzana https://github.com/raspberrypi/pico-extras
Free audio buffer on audio_i2s_set_enabled(false) (#58)
rodzic
4a2bd2999f
commit
71590f2a9f
|
@ -367,6 +367,12 @@ void audio_i2s_set_enabled(bool enabled) {
|
||||||
|
|
||||||
if (enabled) {
|
if (enabled) {
|
||||||
audio_start_dma_transfer();
|
audio_start_dma_transfer();
|
||||||
|
} else {
|
||||||
|
// if there was a buffer in flight, it will not be freed by DMA IRQ, let's do it manually
|
||||||
|
if (shared_state.playing_buffer) {
|
||||||
|
give_audio_buffer(audio_i2s_consumer, shared_state.playing_buffer);
|
||||||
|
shared_state.playing_buffer = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pio_sm_set_enabled(audio_pio, shared_state.pio_sm, enabled);
|
pio_sm_set_enabled(audio_pio, shared_state.pio_sm, enabled);
|
||||||
|
|
Ładowanie…
Reference in New Issue