Merge branch 'main' of codeberg.org:cool-tech-zone/tangara-fw

custom
jacqueline 8 months ago
commit d94c32d615
  1. 9
      src/drivers/pcm_buffer.cpp
  2. 1
      src/tangara/audio/track_queue.cpp

@ -66,10 +66,17 @@ IRAM_ATTR auto PcmBuffer::receive(std::span<int16_t> dest, bool isr)
auto PcmBuffer::clear() -> void { auto PcmBuffer::clear() -> void {
while (!isEmpty()) { while (!isEmpty()) {
size_t bytes_cleared; size_t bytes_cleared = 0;
void* data = xRingbufferReceive(ringbuf_, &bytes_cleared, 0); void* data = xRingbufferReceive(ringbuf_, &bytes_cleared, 0);
if (data) {
vRingbufferReturnItem(ringbuf_, data); vRingbufferReturnItem(ringbuf_, data);
received_ += bytes_cleared / sizeof(int16_t); received_ += bytes_cleared / sizeof(int16_t);
} else {
// Defensively guard against looping forever if for some reason the
// buffer isn't draining.
ESP_LOGW(kTag, "PcmBuffer not draining");
break;
}
} }
} }

@ -290,6 +290,7 @@ auto TrackQueue::finish() -> void {
auto TrackQueue::clear() -> void { auto TrackQueue::clear() -> void {
{ {
const std::unique_lock<std::shared_mutex> lock(mutex_); const std::unique_lock<std::shared_mutex> lock(mutex_);
position_ = 0;
playlist_.clear(); playlist_.clear();
opened_playlist_.reset(); opened_playlist_.reset();
if (shuffle_) { if (shuffle_) {

Loading…
Cancel
Save