Make fps of the visualizer configurable and set it to 60 by default
This commit is contained in:
@@ -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 = ●▮
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user