Deprecate visualizer_sync_interval

This commit is contained in:
Andrzej Rybczak
2020-12-18 15:15:05 +01:00
parent c51b27d401
commit 4709cc6b6d
7 changed files with 26 additions and 27 deletions

View File

@@ -103,8 +103,14 @@ void Visualizer::switchTo()
SwitchTo::execute(this);
Clear();
OpenDataSource();
// negative infinity to toggle output in update() at least once
m_timer = boost::posix_time::neg_infin;
// Disable and enable FIFO to get rid of the difference between audio and
// visualization.
if (m_output_id != -1)
{
Mpd.DisableOutput(m_output_id);
usleep(50000);
Mpd.EnableOutput(m_output_id);
}
drawHeader();
# ifdef HAVE_FFTW3_H
GenLogspace();
@@ -136,14 +142,6 @@ void Visualizer::update()
if (m_source_fd < 0)
return;
if (m_output_id != -1 && Global::Timer - m_timer > Config.visualizer_sync_interval)
{
Mpd.DisableOutput(m_output_id);
usleep(50000);
Mpd.EnableOutput(m_output_id);
m_timer = Global::Timer;
}
// PCM in format 44100:16:1 (for mono visualization) and
// 44100:16:2 (for stereo visualization) is supported.
ssize_t bytes_read = read(m_source_fd, m_incoming_samples.data(),

View File

@@ -87,7 +87,6 @@ private:
void (Visualizer::*drawStereo)(const int16_t *, const int16_t *, ssize_t, size_t);
int m_output_id;
boost::posix_time::ptime m_timer;
int m_source_fd;
std::string m_source_location;