diff options
-rw-r--r-- | src/screens/visualizer.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/screens/visualizer.cpp b/src/screens/visualizer.cpp index 72c42f87..937b963e 100644 --- a/src/screens/visualizer.cpp +++ b/src/screens/visualizer.cpp @@ -678,6 +678,17 @@ void Visualizer::Clear() { w.clear(); std::fill(m_rendered_samples.begin(), m_rendered_samples.end(), 0); + + // Discard any lingering data from the data source. + if (m_fifo >= 0) + { + ssize_t bytes_read; + do + bytes_read = read(m_fifo, m_incoming_samples.data(), + sizeof(int16_t) * m_incoming_samples.size()); + while (bytes_read > 0); + } + } void Visualizer::ToggleVisualizationType() |