diff options
-rw-r--r-- | CHANGELOG.md | 1 | ||||
-rw-r--r-- | doc/config | 2 | ||||
-rw-r--r-- | doc/ncmpcpp.1 | 3 | ||||
-rw-r--r-- | src/screens/visualizer.cpp | 11 | ||||
-rw-r--r-- | src/settings.cpp | 10 | ||||
-rw-r--r-- | src/settings.h | 1 |
6 files changed, 20 insertions, 8 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 82b76aea..d6770748 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,7 @@ `visualizer_spectrum_hz_max` options to a configuration file for controlling the look of the new spectrum visualizer. * Add `visualizer_autoscale` option to a configuration file. +* Add `visualizer_fps` option to a configuration file (60 by default). * Allow for editing multiple titles in the Tag Editor. * Allow setting `visualizer_sync_interval` to 0 (a new default) to disable synchronization attempts. @@ -84,6 +84,8 @@ ## #visualizer_type = wave # +#visualizer_fps = 60 +# #visualizer_autoscale = no # #visualizer_look = ●▮ diff --git a/doc/ncmpcpp.1 b/doc/ncmpcpp.1 index bf937baa..bfeeb3d9 100644 --- a/doc/ncmpcpp.1 +++ b/doc/ncmpcpp.1 @@ -100,6 +100,9 @@ Defines visualizer's look (string has to be exactly 2 characters long: first one .B visualizer_color = COLORS Comma separated list of colors to be used in music visualization. .TP +.B visualizer_fps = FPS +The amount of frames per second for the visualizer. +.TP .B visualizer_autoscale = yes/no Automatically scale visualizer size. .TP diff --git a/src/screens/visualizer.cpp b/src/screens/visualizer.cpp index ea28d0b2..b8ef20c3 100644 --- a/src/screens/visualizer.cpp +++ b/src/screens/visualizer.cpp @@ -52,7 +52,6 @@ Visualizer *myVisualizer; namespace { -const size_t fps = 30; const uint32_t MIN_DFT_SIZE = 14; // toColor: a scaling function for coloring. For numbers 0 to max this function @@ -159,7 +158,7 @@ void Visualizer::update() if (Config.visualizer_autoscale) { - m_auto_scale_multiplier += 1.0/fps; + m_auto_scale_multiplier += 1.0/Config.visualizer_fps; for (auto &sample : m_sample_buffer) { double scale = std::numeric_limits<int16_t>::min(); @@ -206,7 +205,7 @@ void Visualizer::update() int Visualizer::windowTimeout() { if (m_fifo >= 0 && Status::State::player() == MPD::psPlay) - return 1000/fps; + return 1000/Config.visualizer_fps; else return Screen<WindowType>::windowTimeout(); } @@ -599,12 +598,12 @@ void Visualizer::SetVisualizationType() switch (Config.visualizer_type) { case VisualizerType::Wave: - m_read_samples = std::max(44100 / fps, w.getWidth()); + m_read_samples = std::max(44100 / Config.visualizer_fps, w.getWidth()); draw = &Visualizer::DrawSoundWave; drawStereo = &Visualizer::DrawSoundWaveStereo; break; case VisualizerType::WaveFilled: - m_read_samples = std::max(44100 / fps, w.getWidth()); + m_read_samples = std::max(44100 / Config.visualizer_fps, w.getWidth()); draw = &Visualizer::DrawSoundWaveFill; drawStereo = &Visualizer::DrawSoundWaveFillStereo; break; @@ -616,7 +615,7 @@ void Visualizer::SetVisualizationType() break; # endif // HAVE_FFTW3_H case VisualizerType::Ellipse: - m_read_samples = 44100 / fps; + m_read_samples = 44100 / Config.visualizer_fps; draw = &Visualizer::DrawSoundEllipse; drawStereo = &Visualizer::DrawSoundEllipseStereo; break; diff --git a/src/settings.cpp b/src/settings.cpp index 177a38cb..30efb500 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -293,12 +293,18 @@ bool Configuration::read(const std::vector<std::string> &config_paths, bool igno boundsCheck<std::wstring::size_type>(result.size(), 2, 2); return result; }); + p.add("visualizer_fps", &visualizer_fps, + "60", [](std::string v) { + uint32_t result = verbose_lexical_cast<uint32_t>(v); + boundsCheck<uint32_t>(result, 30, 144); + return result; + }); p.add("visualizer_autoscale", &visualizer_autoscale, "no", yes_no); p.add("visualizer_spectrum_smooth_look", &visualizer_spectrum_smooth_look, "yes", yes_no); p.add("visualizer_spectrum_dft_size", &visualizer_spectrum_dft_size, "3", [](std::string v) { - uint32_t result = verbose_lexical_cast<uint32_t>(v); - boundsCheck<uint32_t>(result, 1, 5); + auto result = verbose_lexical_cast<size_t>(v); + boundsCheck<size_t>(result, 1, 5); return result + 11; }); p.add("visualizer_spectrum_gain", &visualizer_spectrum_gain, diff --git a/src/settings.h b/src/settings.h index c171a9b1..a3f923ce 100644 --- a/src/settings.h +++ b/src/settings.h @@ -82,6 +82,7 @@ struct Configuration std::string lastfm_preferred_language; std::wstring progressbar; std::wstring visualizer_chars; + size_t visualizer_fps; bool visualizer_autoscale; bool visualizer_spectrum_smooth_look; uint32_t visualizer_spectrum_dft_size; |