support user-defined interval between syncing visualizer and audio outputs
This commit is contained in:
10
doc/config
10
doc/config
@@ -47,6 +47,16 @@
|
|||||||
#visualizer_output_name = ""
|
#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
|
## Note: To enable spectrum frequency visualization
|
||||||
## you need to compile ncmpcpp with fftw3 support.
|
## 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
|
.B visualizer_output_name = NAME
|
||||||
Name of output that provides data for visualizer. Needed to keep sound and visualization in sync.
|
Name of output that provides data for visualizer. Needed to keep sound and visualization in sync.
|
||||||
.TP
|
.TP
|
||||||
|
.B visualizer_sync_interval = SECONDS
|
||||||
|
Defines interval between syncing visualizer and audio outputs.
|
||||||
|
.TP
|
||||||
.B visualizer_type = spectrum/wave
|
.B visualizer_type = spectrum/wave
|
||||||
Defines default visualizer type (spectrum is available only if ncmpcpp was compiled with fftw support).
|
Defines default visualizer type (spectrum is available only if ncmpcpp was compiled with fftw support).
|
||||||
.TP
|
.TP
|
||||||
|
|||||||
@@ -386,6 +386,7 @@ void NcmpcppConfig::SetDefaults()
|
|||||||
regex_type = 0;
|
regex_type = 0;
|
||||||
lines_scrolled = 2;
|
lines_scrolled = 2;
|
||||||
search_engine_default_search_mode = 0;
|
search_engine_default_search_mode = 0;
|
||||||
|
visualizer_sync_interval = 30;
|
||||||
selected_item_suffix_length = 0;
|
selected_item_suffix_length = 0;
|
||||||
now_playing_suffix_length = 0;
|
now_playing_suffix_length = 0;
|
||||||
# ifdef HAVE_LANGINFO_H
|
# ifdef HAVE_LANGINFO_H
|
||||||
@@ -1002,6 +1003,12 @@ void NcmpcppConfig::Read()
|
|||||||
search_engine_default_search_mode = mode;
|
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)
|
else if (cl.find("song_window_title_format") != std::string::npos)
|
||||||
{
|
{
|
||||||
if (!v.empty())
|
if (!v.empty())
|
||||||
|
|||||||
@@ -240,6 +240,7 @@ struct NcmpcppConfig
|
|||||||
|
|
||||||
unsigned lines_scrolled;
|
unsigned lines_scrolled;
|
||||||
unsigned search_engine_default_search_mode;
|
unsigned search_engine_default_search_mode;
|
||||||
|
unsigned visualizer_sync_interval;
|
||||||
|
|
||||||
size_t selected_item_suffix_length;
|
size_t selected_item_suffix_length;
|
||||||
size_t now_playing_suffix_length;
|
size_t now_playing_suffix_length;
|
||||||
|
|||||||
@@ -111,9 +111,10 @@ void Visualizer::Update()
|
|||||||
return;
|
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);
|
Mpd.DisableOutput(itsOutputID);
|
||||||
|
usleep(50000);
|
||||||
Mpd.EnableOutput(itsOutputID);
|
Mpd.EnableOutput(itsOutputID);
|
||||||
gettimeofday(&itsTimer, 0);
|
gettimeofday(&itsTimer, 0);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user