Skip to content

Commit b384bea

Browse files
Flush OutputBuffer
Add function to flush the outputbuffer
1 parent 1b3df6a commit b384bea

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

lib/audio_output/src/OutputBuffer.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,4 +100,14 @@ class OutputBuffer
100100
}
101101
xSemaphoreGive(m_semaphore);
102102
}
103+
104+
void flush()
105+
{
106+
// flush all samples in the outputbuffer
107+
xSemaphoreTake(m_semaphore, portMAX_DELAY);
108+
m_read_head = 0;
109+
m_write_head = 0;
110+
m_available_samples = 0;
111+
xSemaphoreGive(m_semaphore);
112+
}
103113
};

0 commit comments

Comments
 (0)