support user-defined interval between syncing visualizer and audio outputs

master
Andrzej Rybczak 16 years ago
parent 4bd9e9af79
commit be732f2f9d
  1. 10
      doc/config
  2. 3
      doc/ncmpcpp.1
  3. 7
      src/settings.cpp
  4. 1
      src/settings.h
  5. 3
      src/visualizer.cpp

@ -47,6 +47,16 @@
#visualizer_output_name = ""
#
##
## Note: Below parameter defines how often ncmpcpp
## has to "synchronize" visualizer and audio outputs.
## 30 seconds is optimal value, but if you experience
## synchronization problems, set it to lower value.
## Keep in mind that sane values start with >=10.
##
#
#visualizer_sync_interval = "30"
#
##
## Note: To enable spectrum frequency visualization
## you need to compile ncmpcpp with fftw3 support.
##

@ -78,6 +78,9 @@ Path to mpd fifo output. This is needed to make music visualizer work (note that
.B visualizer_output_name = NAME
Name of output that provides data for visualizer. Needed to keep sound and visualization in sync.
.TP
.B visualizer_sync_interval = SECONDS
Defines interval between syncing visualizer and audio outputs.
.TP
.B visualizer_type = spectrum/wave
Defines default visualizer type (spectrum is available only if ncmpcpp was compiled with fftw support).
.TP

@ -386,6 +386,7 @@ void NcmpcppConfig::SetDefaults()
regex_type = 0;
lines_scrolled = 2;
search_engine_default_search_mode = 0;
visualizer_sync_interval = 30;
selected_item_suffix_length = 0;
now_playing_suffix_length = 0;
# ifdef HAVE_LANGINFO_H
@ -1002,6 +1003,12 @@ void NcmpcppConfig::Read()
search_engine_default_search_mode = mode;
}
}
else if (cl.find("visualizer_sync_interval") != std::string::npos)
{
unsigned interval = StrToInt(v);
if (interval)
visualizer_sync_interval = interval;
}
else if (cl.find("song_window_title_format") != std::string::npos)
{
if (!v.empty())

@ -240,6 +240,7 @@ struct NcmpcppConfig
unsigned lines_scrolled;
unsigned search_engine_default_search_mode;
unsigned visualizer_sync_interval;
size_t selected_item_suffix_length;
size_t now_playing_suffix_length;

@ -111,9 +111,10 @@ void Visualizer::Update()
return;
}
if (itsOutputID != -1 && Global::Timer.tv_sec > itsTimer.tv_sec+120)
if (itsOutputID != -1 && Global::Timer.tv_sec > itsTimer.tv_sec+Config.visualizer_sync_interval)
{
Mpd.DisableOutput(itsOutputID);
usleep(50000);
Mpd.EnableOutput(itsOutputID);
gettimeofday(&itsTimer, 0);
}

Loading…
Cancel
Save