diff options
author | Andrzej Rybczak <electricityispower@gmail.com> | 2017-03-12 12:34:45 +0100 |
---|---|---|
committer | Andrzej Rybczak <electricityispower@gmail.com> | 2017-03-12 12:34:45 +0100 |
commit | 625a0dff3aa48eda08e120e04cc6d4ef71499fcd (patch) | |
tree | 7e16ab2decb7a89cb4698b3cc0e1d56d7720c14f | |
parent | 00cbbe55932fc2231fd3bfafd8cebea135819946 (diff) |
Use volume command for relative volume changes instead of setvol
-rw-r--r-- | src/actions.cpp | 6 | ||||
-rw-r--r-- | src/mpdpp.cpp | 8 | ||||
-rw-r--r-- | src/mpdpp.h | 3 |
3 files changed, 12 insertions, 5 deletions
diff --git a/src/actions.cpp b/src/actions.cpp index 86b49a7b..dcea819f 100644 --- a/src/actions.cpp +++ b/src/actions.cpp @@ -623,14 +623,12 @@ void SlaveScreen::run() void VolumeUp::run() { - int volume = std::min(Status::State::volume()+Config.volume_change_step, 100u); - Mpd.SetVolume(volume); + Mpd.ChangeVolume(static_cast<int>(Config.volume_change_step)); } void VolumeDown::run() { - int volume = std::max(int(Status::State::volume()-Config.volume_change_step), 0); - Mpd.SetVolume(volume); + Mpd.ChangeVolume(-static_cast<int>(Config.volume_change_step)); } bool AddItemToPlaylist::canBeRun() diff --git a/src/mpdpp.cpp b/src/mpdpp.cpp index 177340ba..906ed909 100644 --- a/src/mpdpp.cpp +++ b/src/mpdpp.cpp @@ -472,6 +472,14 @@ void Connection::SetVolume(unsigned vol) checkErrors(); } +void Connection::ChangeVolume(int change) +{ + prechecksNoCommandsList(); + mpd_run_change_volume(m_connection.get(), change); + checkErrors(); +} + + std::string Connection::GetReplayGainMode() { prechecksNoCommandsList(); diff --git a/src/mpdpp.h b/src/mpdpp.h index bf1fcb9c..db336760 100644 --- a/src/mpdpp.h +++ b/src/mpdpp.h @@ -536,7 +536,8 @@ struct Connection void SetConsume(bool); void SetCrossfade(unsigned); void SetVolume(unsigned int vol); - + void ChangeVolume(int change); + std::string GetReplayGainMode(); void SetReplayGainMode(ReplayGainMode); |