Toggle the fifo output once if synchronization is disabled
This commit is contained in:
@@ -112,7 +112,8 @@ void Visualizer::switchTo()
|
||||
SwitchTo::execute(this);
|
||||
w.clear();
|
||||
SetFD();
|
||||
m_timer = boost::posix_time::from_time_t(0);
|
||||
// negative infinity to toggle output in update() at least once
|
||||
m_timer = boost::posix_time::neg_infin;
|
||||
drawHeader();
|
||||
memset(m_sample_buffer.data(), 0, m_sample_buffer.size()*sizeof(int16_t));
|
||||
# ifdef HAVE_FFTW3_H
|
||||
@@ -160,15 +161,12 @@ void Visualizer::update()
|
||||
memcpy(sdata_end - data, temp_sdata, data);
|
||||
}
|
||||
|
||||
if (Config.visualizer_sync_interval > boost::posix_time::seconds(0))
|
||||
if (m_output_id != -1 && Global::Timer - m_timer > Config.visualizer_sync_interval)
|
||||
{
|
||||
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;
|
||||
}
|
||||
Mpd.DisableOutput(m_output_id);
|
||||
usleep(50000);
|
||||
Mpd.EnableOutput(m_output_id);
|
||||
m_timer = Global::Timer;
|
||||
}
|
||||
|
||||
void (Visualizer::*draw)(int16_t *, ssize_t, size_t, size_t);
|
||||
|
||||
@@ -282,8 +282,9 @@ bool Configuration::read(const std::vector<std::string> &config_paths, bool igno
|
||||
p.add("visualizer_sync_interval", &visualizer_sync_interval, "0",
|
||||
[](std::string v) {
|
||||
unsigned sync_interval = verbose_lexical_cast<unsigned>(v);
|
||||
if (sync_interval > 0)
|
||||
lowerBoundCheck<unsigned>(sync_interval, 10);
|
||||
if (sync_interval == 0)
|
||||
sync_interval = std::numeric_limits<unsigned>::max();
|
||||
lowerBoundCheck<unsigned>(sync_interval, 10);
|
||||
return boost::posix_time::seconds(sync_interval);
|
||||
});
|
||||
p.add("visualizer_type", &visualizer_type, "wave");
|
||||
|
||||
Reference in New Issue
Block a user