settings: add volume_change_step configuration option

master
Andrzej Rybczak 13 years ago
parent c79997c08b
commit a4160790cf
  1. 2
      doc/config
  2. 3
      doc/ncmpcpp.1
  3. 6
      src/actions.cpp
  4. 6
      src/settings.cpp
  5. 1
      src/settings.h

@ -301,6 +301,8 @@
# #
#seek_time = "1" #seek_time = "1"
# #
#volume_change_step = "1"
#
#autocenter_mode = "no" #autocenter_mode = "no"
# #
#centered_cursor = "no" #centered_cursor = "no"

@ -108,6 +108,9 @@ If you use encoding other than utf8, set it in order to handle utf8 encoded stri
.B seek_time = SECONDS .B seek_time = SECONDS
Base seek time to begin with. Base seek time to begin with.
.TP .TP
.B volume_change_step = NUMBER
Number of percents volume has to be increased/decreased by in volume_up/volume_down.
.TP
.B playlist_disable_highlight_delay = SECONDS .B playlist_disable_highlight_delay = SECONDS
Delay for highlighting playlist since the last key was pressed. If set to 0, highlighting never fades away. Delay for highlighting playlist since the last key was pressed. If set to 0, highlighting never fades away.
.TP .TP

@ -615,12 +615,14 @@ void SlaveScreen::run()
void VolumeUp::run() void VolumeUp::run()
{ {
Mpd.SetVolume(Mpd.GetVolume()+1); int volume = std::min(Mpd.GetVolume()+Config.volume_change_step, 100);
Mpd.SetVolume(volume);
} }
void VolumeDown::run() void VolumeDown::run()
{ {
Mpd.SetVolume(Mpd.GetVolume()-1); int volume = std::max(Mpd.GetVolume()-Config.volume_change_step, 0);
Mpd.SetVolume(volume);
} }
bool DeletePlaylistItems::canBeRun() const bool DeletePlaylistItems::canBeRun() const

@ -224,6 +224,7 @@ void Configuration::SetDefaults()
mpd_connection_timeout = 15; mpd_connection_timeout = 15;
crossfade_time = 5; crossfade_time = 5;
seek_time = 1; seek_time = 1;
volume_change_step = 1;
playlist_disable_highlight_delay = 5; playlist_disable_highlight_delay = 5;
message_delay_time = 4; message_delay_time = 4;
lyrics_db = 0; lyrics_db = 0;
@ -367,6 +368,11 @@ void Configuration::Read()
if (boost::lexical_cast<int>(v) > 0) if (boost::lexical_cast<int>(v) > 0)
seek_time = boost::lexical_cast<int>(v); seek_time = boost::lexical_cast<int>(v);
} }
else if (name == "volume_change_step")
{
if (boost::lexical_cast<int>(v) > 0)
volume_change_step = boost::lexical_cast<int>(v);
}
else if (name == "playlist_disable_highlight_delay") else if (name == "playlist_disable_highlight_delay")
{ {
if (boost::lexical_cast<int>(v) >= 0) if (boost::lexical_cast<int>(v) >= 0)

@ -189,6 +189,7 @@ struct Configuration
int mpd_connection_timeout; int mpd_connection_timeout;
int crossfade_time; int crossfade_time;
int seek_time; int seek_time;
int volume_change_step;
int playlist_disable_highlight_delay; int playlist_disable_highlight_delay;
int message_delay_time; int message_delay_time;
int lyrics_db; int lyrics_db;

Loading…
Cancel
Save