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

@@ -28,6 +28,7 @@
* Deprecate `visualizer_fifo_path` in favor of `visualizer_data_source`.
* Don't run volume changing actions if there is no mixer.
* Do not loop after sending a database update command to Mopidy.
* Deprecate `visualizer_sync_interval` configuration option.
# ncmpcpp-0.8.2 (2018-04-11)
* Help screen: fixed display of EoF keycode

View File

@@ -52,6 +52,10 @@
## format "44100:16:2"
## }
##
## If the visualization on occasion diverges from the audio output, please set
## 'buffer_time' parameter of your audio output in mpd.conf to '100000' (100ms)
## or less to prevent that from happening.
##
## Note: If you're using Mopidy, an address of a udpsink gstreamer's output is
## also accepted. For example, the following section in mopidy.conf:
##
@@ -68,8 +72,8 @@
#
##
## Note: Below parameter is needed for ncmpcpp to determine which output
## provides data for visualizer and thus allow syncing between visualization and
## sound as currently there are some problems with it.
## provides data for visualizer and reset it at the beginning of visualization
## to synchronize with audio.
##
#
#visualizer_output_name = Visualizer feed

View File

@@ -88,10 +88,6 @@ Name of output that provides data for visualizer. Needed to keep sound and visua
.B visualizer_in_stereo = yes/no
Should be set to 'yes', if fifo output's format was set to 44100:16:2.
.TP
.B visualizer_sync_interval = SECONDS
Try synchronizing visualization with audio every N seconds by flushing the FIFO
output. A value of 0 disables it, use only when necessary.
.TP
.B visualizer_type = spectrum/wave/wave_filled/ellipse
Defines default visualizer type (spectrum is available only if ncmpcpp was compiled with fftw support).
.TP

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;

View File

@@ -272,6 +272,16 @@ bool Configuration::read(const std::vector<std::string> &config_paths, bool igno
}
return adjust_path(v);
});
p.add<void>("visualizer_sync_interval", nullptr, "", [](std::string v) {
if (!v.empty())
{
deprecated("visualizer_sync_interval",
"0.10",
"set 'buffer_time' parameter of your MPD audio output to '100000' "
"(100ms) or lower if you experience synchronization issues "
"between audio and visualization");
}
});
// keep the same order of variables as in configuration file
p.add("ncmpcpp_directory", &ncmpcpp_directory, "~/.ncmpcpp/", adjust_directory);
@@ -290,14 +300,6 @@ bool Configuration::read(const std::vector<std::string> &config_paths, bool igno
p.add("visualizer_data_source", &visualizer_data_source, "/tmp/mpd.fifo", adjust_path);
p.add("visualizer_output_name", &visualizer_output_name, "Visualizer feed");
p.add("visualizer_in_stereo", &visualizer_in_stereo, "yes", yes_no);
p.add("visualizer_sync_interval", &visualizer_sync_interval, "0",
[](std::string v) {
unsigned sync_interval = verbose_lexical_cast<unsigned>(v);
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,
#ifdef HAVE_FFTW3_H
"spectrum"

View File

@@ -52,7 +52,7 @@ struct Column
struct Configuration
{
Configuration()
: playlist_disable_highlight_delay(0), visualizer_sync_interval(0)
: playlist_disable_highlight_delay(0)
{ }
bool read(const std::vector<std::string> &config_paths, bool ignore_errors);
@@ -198,7 +198,6 @@ struct Configuration
boost::regex::flag_type regex_type;
boost::posix_time::seconds playlist_disable_highlight_delay;
boost::posix_time::seconds visualizer_sync_interval;
double locked_screen_width_part;