settings: deprecate visualizer_sample_multiplier
This commit is contained in:
1
NEWS
1
NEWS
@@ -12,6 +12,7 @@ ncmpcpp-0.8 (????-??-??)
|
|||||||
* When an attempt to write tags fails, show detailed error message.
|
* When an attempt to write tags fails, show detailed error message.
|
||||||
* Support for fetching lyrics for selected items in background was added.
|
* Support for fetching lyrics for selected items in background was added.
|
||||||
* Application will now exit if stdin is closed.
|
* Application will now exit if stdin is closed.
|
||||||
|
* Configuration variable 'visualizer_sample_multiplier' was deprecated and will be removed in 0.9.
|
||||||
|
|
||||||
ncmpcpp-0.7.7 (2016-10-31)
|
ncmpcpp-0.7.7 (2016-10-31)
|
||||||
* Fixed compilation on 32bit platforms.
|
* Fixed compilation on 32bit platforms.
|
||||||
|
|||||||
@@ -471,9 +471,6 @@
|
|||||||
#def_key "m"
|
#def_key "m"
|
||||||
# move_selected_items_up
|
# move_selected_items_up
|
||||||
#
|
#
|
||||||
#def_key "m"
|
|
||||||
# set_visualizer_sample_multiplier
|
|
||||||
#
|
|
||||||
#def_key "n"
|
#def_key "n"
|
||||||
# move_sort_order_down
|
# move_sort_order_down
|
||||||
#
|
#
|
||||||
|
|||||||
@@ -71,12 +71,6 @@
|
|||||||
#visualizer_in_stereo = yes
|
#visualizer_in_stereo = yes
|
||||||
#
|
#
|
||||||
##
|
##
|
||||||
## Multiply received samples by given value. Very
|
|
||||||
## useful for proper visualization of quiet music.
|
|
||||||
##
|
|
||||||
#visualizer_sample_multiplier = 1
|
|
||||||
#
|
|
||||||
##
|
|
||||||
## Note: Below parameter defines how often ncmpcpp
|
## Note: Below parameter defines how often ncmpcpp
|
||||||
## has to "synchronize" visualizer and audio outputs.
|
## has to "synchronize" visualizer and audio outputs.
|
||||||
## 30 seconds is optimal value, but if you experience
|
## 30 seconds is optimal value, but if you experience
|
||||||
|
|||||||
@@ -82,9 +82,6 @@ Name of output that provides data for visualizer. Needed to keep sound and visua
|
|||||||
.B visualizer_in_stereo = yes/no
|
.B visualizer_in_stereo = yes/no
|
||||||
Should be set to 'yes', if fifo output's format was set to 44100:16:2.
|
Should be set to 'yes', if fifo output's format was set to 44100:16:2.
|
||||||
.TP
|
.TP
|
||||||
.B visualizer_sample_multiplier = NUMBER
|
|
||||||
Multiply received samples by given value. Very useful for proper visualization of quiet music.
|
|
||||||
.TP
|
|
||||||
.B visualizer_sync_interval = SECONDS
|
.B visualizer_sync_interval = SECONDS
|
||||||
Defines interval between syncing visualizer and audio outputs.
|
Defines interval between syncing visualizer and audio outputs.
|
||||||
.TP
|
.TP
|
||||||
|
|||||||
@@ -2355,32 +2355,6 @@ void ToggleVisualizationType::run()
|
|||||||
# endif // ENABLE_VISUALIZER
|
# endif // ENABLE_VISUALIZER
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SetVisualizerSampleMultiplier::canBeRun()
|
|
||||||
{
|
|
||||||
# ifdef ENABLE_VISUALIZER
|
|
||||||
return myScreen == myVisualizer;
|
|
||||||
# else
|
|
||||||
return false;
|
|
||||||
# endif // ENABLE_VISUALIZER
|
|
||||||
}
|
|
||||||
|
|
||||||
void SetVisualizerSampleMultiplier::run()
|
|
||||||
{
|
|
||||||
# ifdef ENABLE_VISUALIZER
|
|
||||||
using Global::wFooter;
|
|
||||||
|
|
||||||
double multiplier;
|
|
||||||
{
|
|
||||||
Statusbar::ScopedLock slock;
|
|
||||||
Statusbar::put() << "Set visualizer sample multiplier: ";
|
|
||||||
multiplier = fromString<double>(wFooter->prompt());
|
|
||||||
lowerBoundCheck(multiplier, 0.0);
|
|
||||||
Config.visualizer_sample_multiplier = multiplier;
|
|
||||||
}
|
|
||||||
Statusbar::printf("Visualizer sample multiplier set to %1%", multiplier);
|
|
||||||
# endif // ENABLE_VISUALIZER
|
|
||||||
}
|
|
||||||
|
|
||||||
void ShowSongInfo::run()
|
void ShowSongInfo::run()
|
||||||
{
|
{
|
||||||
mySongInfo->switchTo();
|
mySongInfo->switchTo();
|
||||||
@@ -2807,7 +2781,6 @@ void populateActions()
|
|||||||
insert_action(new Actions::SetSelectedItemsPriority());
|
insert_action(new Actions::SetSelectedItemsPriority());
|
||||||
insert_action(new Actions::ToggleOutput());
|
insert_action(new Actions::ToggleOutput());
|
||||||
insert_action(new Actions::ToggleVisualizationType());
|
insert_action(new Actions::ToggleVisualizationType());
|
||||||
insert_action(new Actions::SetVisualizerSampleMultiplier());
|
|
||||||
insert_action(new Actions::ShowSongInfo());
|
insert_action(new Actions::ShowSongInfo());
|
||||||
insert_action(new Actions::ShowArtistInfo());
|
insert_action(new Actions::ShowArtistInfo());
|
||||||
insert_action(new Actions::ShowLyrics());
|
insert_action(new Actions::ShowLyrics());
|
||||||
|
|||||||
@@ -142,7 +142,6 @@ enum class Type
|
|||||||
SetSelectedItemsPriority,
|
SetSelectedItemsPriority,
|
||||||
ToggleOutput,
|
ToggleOutput,
|
||||||
ToggleVisualizationType,
|
ToggleVisualizationType,
|
||||||
SetVisualizerSampleMultiplier,
|
|
||||||
ShowSongInfo,
|
ShowSongInfo,
|
||||||
ShowArtistInfo,
|
ShowArtistInfo,
|
||||||
ShowLyrics,
|
ShowLyrics,
|
||||||
@@ -1217,16 +1216,6 @@ private:
|
|||||||
virtual void run() override;
|
virtual void run() override;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct SetVisualizerSampleMultiplier: BaseAction
|
|
||||||
{
|
|
||||||
SetVisualizerSampleMultiplier()
|
|
||||||
: BaseAction(Type::SetVisualizerSampleMultiplier, "set_visualizer_sample_multiplier") { }
|
|
||||||
|
|
||||||
private:
|
|
||||||
virtual bool canBeRun() override;
|
|
||||||
virtual void run() override;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct ShowSongInfo: BaseAction
|
struct ShowSongInfo: BaseAction
|
||||||
{
|
{
|
||||||
ShowSongInfo(): BaseAction(Type::ShowSongInfo, "show_song_info") { }
|
ShowSongInfo(): BaseAction(Type::ShowSongInfo, "show_song_info") { }
|
||||||
|
|||||||
@@ -140,7 +140,16 @@ std::shared_ptr<Actions::BaseAction> parseActionLine(const std::string &line, F
|
|||||||
size_t i = 0;
|
size_t i = 0;
|
||||||
for (; i < line.size() && !isspace(line[i]); ++i) { }
|
for (; i < line.size() && !isspace(line[i]); ++i) { }
|
||||||
if (i == line.size()) // only action name
|
if (i == line.size()) // only action name
|
||||||
result = Actions::get_(line);
|
{
|
||||||
|
if (line == "set_visualizer_sample_multiplier")
|
||||||
|
{
|
||||||
|
warning("action 'set_visualizer_sample_multiplier' is deprecated"
|
||||||
|
" and will be removed in 0.9");
|
||||||
|
result = Actions::get_(Actions::Type::Dummy);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
result = Actions::get_(line);
|
||||||
|
}
|
||||||
else // there is something else
|
else // there is something else
|
||||||
{
|
{
|
||||||
std::string action_name = line.substr(0, i);
|
std::string action_name = line.substr(0, i);
|
||||||
@@ -694,7 +703,6 @@ void BindingsConfiguration::generateDefaults()
|
|||||||
{
|
{
|
||||||
bind(k, Actions::Type::MoveSortOrderUp);
|
bind(k, Actions::Type::MoveSortOrderUp);
|
||||||
bind(k, Actions::Type::MoveSelectedItemsUp);
|
bind(k, Actions::Type::MoveSelectedItemsUp);
|
||||||
bind(k, Actions::Type::SetVisualizerSampleMultiplier);
|
|
||||||
}
|
}
|
||||||
if (notBound(k = stringToKey("n")))
|
if (notBound(k = stringToKey("n")))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -339,7 +339,6 @@ void write_bindings(NC::Scrollpad &w)
|
|||||||
# if defined(ENABLE_VISUALIZER) && defined(HAVE_FFTW3_H)
|
# if defined(ENABLE_VISUALIZER) && defined(HAVE_FFTW3_H)
|
||||||
key_section(w, "Music visualizer");
|
key_section(w, "Music visualizer");
|
||||||
key(w, Type::ToggleVisualizationType, "Toggle visualization type");
|
key(w, Type::ToggleVisualizationType, "Toggle visualization type");
|
||||||
key(w, Type::SetVisualizerSampleMultiplier, "Set visualizer sample multiplier");
|
|
||||||
# endif // ENABLE_VISUALIZER && HAVE_FFTW3_H
|
# endif // ENABLE_VISUALIZER && HAVE_FFTW3_H
|
||||||
|
|
||||||
mouse_section(w, "Global");
|
mouse_section(w, "Global");
|
||||||
|
|||||||
@@ -177,13 +177,12 @@ NC::Buffer buffer(const std::string &v)
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
void deprecated(const char *option, double version_removal)
|
void deprecated(const char *option, double version_removal)
|
||||||
{
|
{
|
||||||
std::cerr << "WARNING: " << option
|
std::cerr << "WARNING: Variable '" << option
|
||||||
<< " is deprecated and will be removed in " << version_removal << "\n";
|
<< "' is deprecated and will be removed in "
|
||||||
|
<< version_removal << "\n";
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -191,6 +190,11 @@ bool Configuration::read(const std::vector<std::string> &config_paths, bool igno
|
|||||||
{
|
{
|
||||||
option_parser p;
|
option_parser p;
|
||||||
|
|
||||||
|
p.add<void>("visualizer_sample_multiplier", nullptr, "", [](std::string v) {
|
||||||
|
if (!v.empty())
|
||||||
|
deprecated("visualizer_sample_multiplier", 0.9);
|
||||||
|
});
|
||||||
|
|
||||||
// keep the same order of variables as in configuration file
|
// keep the same order of variables as in configuration file
|
||||||
p.add("ncmpcpp_directory", &ncmpcpp_directory, "~/.ncmpcpp/", adjust_directory);
|
p.add("ncmpcpp_directory", &ncmpcpp_directory, "~/.ncmpcpp/", adjust_directory);
|
||||||
p.add("lyrics_directory", &lyrics_directory, "~/.lyrics/", adjust_directory);
|
p.add("lyrics_directory", &lyrics_directory, "~/.lyrics/", adjust_directory);
|
||||||
@@ -207,12 +211,6 @@ bool Configuration::read(const std::vector<std::string> &config_paths, bool igno
|
|||||||
p.add("visualizer_fifo_path", &visualizer_fifo_path, "/tmp/mpd.fifo", adjust_path);
|
p.add("visualizer_fifo_path", &visualizer_fifo_path, "/tmp/mpd.fifo", adjust_path);
|
||||||
p.add("visualizer_output_name", &visualizer_output_name, "Visualizer feed");
|
p.add("visualizer_output_name", &visualizer_output_name, "Visualizer feed");
|
||||||
p.add("visualizer_in_stereo", &visualizer_in_stereo, "yes", yes_no);
|
p.add("visualizer_in_stereo", &visualizer_in_stereo, "yes", yes_no);
|
||||||
p.add("visualizer_sample_multiplier", &visualizer_sample_multiplier, "1",
|
|
||||||
[](std::string v) {
|
|
||||||
double multiplier = verbose_lexical_cast<double>(v);
|
|
||||||
lowerBoundCheck(multiplier, 0.0);
|
|
||||||
return multiplier;
|
|
||||||
});
|
|
||||||
p.add("visualizer_sync_interval", &visualizer_sync_interval, "30",
|
p.add("visualizer_sync_interval", &visualizer_sync_interval, "30",
|
||||||
[](std::string v) {
|
[](std::string v) {
|
||||||
unsigned sync_interval = verbose_lexical_cast<unsigned>(v);
|
unsigned sync_interval = verbose_lexical_cast<unsigned>(v);
|
||||||
|
|||||||
@@ -183,7 +183,6 @@ struct Configuration
|
|||||||
boost::posix_time::seconds playlist_disable_highlight_delay;
|
boost::posix_time::seconds playlist_disable_highlight_delay;
|
||||||
boost::posix_time::seconds visualizer_sync_interval;
|
boost::posix_time::seconds visualizer_sync_interval;
|
||||||
|
|
||||||
double visualizer_sample_multiplier;
|
|
||||||
double locked_screen_width_part;
|
double locked_screen_width_part;
|
||||||
|
|
||||||
size_t selected_item_prefix_length;
|
size_t selected_item_prefix_length;
|
||||||
|
|||||||
@@ -148,29 +148,24 @@ void Visualizer::update()
|
|||||||
}
|
}
|
||||||
|
|
||||||
const ssize_t samples_read = data/sizeof(int16_t);
|
const ssize_t samples_read = data/sizeof(int16_t);
|
||||||
if (Config.visualizer_sample_multiplier == 1.0)
|
m_auto_scale_multiplier += 1.0/fps;
|
||||||
{
|
std::for_each(buf, buf+samples_read, [this](int16_t &sample) {
|
||||||
m_auto_scale_multiplier += 1.0/fps;
|
|
||||||
std::for_each(buf, buf+samples_read, [this](int16_t &sample) {
|
|
||||||
double scale = std::numeric_limits<int16_t>::min();
|
double scale = std::numeric_limits<int16_t>::min();
|
||||||
scale /= sample;
|
scale /= sample;
|
||||||
scale = fabs(scale);
|
scale = fabs(scale);
|
||||||
if (scale < m_auto_scale_multiplier)
|
if (scale < m_auto_scale_multiplier)
|
||||||
m_auto_scale_multiplier = scale;
|
m_auto_scale_multiplier = scale;
|
||||||
});
|
});
|
||||||
}
|
|
||||||
std::for_each(buf, buf+samples_read, [this](int16_t &sample) {
|
std::for_each(buf, buf+samples_read, [this](int16_t &sample) {
|
||||||
int32_t tmp = sample;
|
int32_t tmp = sample;
|
||||||
if (Config.visualizer_sample_multiplier != 1.0)
|
if (m_auto_scale_multiplier <= 50.0) // limit the auto scale
|
||||||
tmp *= Config.visualizer_sample_multiplier;
|
tmp *= m_auto_scale_multiplier;
|
||||||
else if (m_auto_scale_multiplier <= 50.0) // limit the auto scale
|
if (tmp < std::numeric_limits<int16_t>::min())
|
||||||
tmp *= m_auto_scale_multiplier;
|
sample = std::numeric_limits<int16_t>::min();
|
||||||
if (tmp < std::numeric_limits<int16_t>::min())
|
else if (tmp > std::numeric_limits<int16_t>::max())
|
||||||
sample = std::numeric_limits<int16_t>::min();
|
sample = std::numeric_limits<int16_t>::max();
|
||||||
else if (tmp > std::numeric_limits<int16_t>::max())
|
else
|
||||||
sample = std::numeric_limits<int16_t>::max();
|
sample = tmp;
|
||||||
else
|
|
||||||
sample = tmp;
|
|
||||||
});
|
});
|
||||||
|
|
||||||
w.clear();
|
w.clear();
|
||||||
|
|||||||
Reference in New Issue
Block a user