diff options
author | Max Kellermann <max@duempel.org> | 2009-07-06 21:51:24 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2009-07-06 21:51:24 +0200 |
commit | 90472526e00c671f76d78341b5e474fcf069d41e (patch) | |
tree | 1599ac0a94d11867558e0cb38ca2eaf3b3831848 /src/volume.c | |
parent | 206392ad1a9f4aa22d11719fb19f036c9f860272 (diff) | |
download | mpd-90472526e00c671f76d78341b5e474fcf069d41e.tar.gz mpd-90472526e00c671f76d78341b5e474fcf069d41e.tar.xz mpd-90472526e00c671f76d78341b5e474fcf069d41e.zip |
volume, mixer: removed the "relative" parameter
Since the "volume" command has been removed, nobody uses relative
volumes anymore.
Diffstat (limited to 'src/volume.c')
-rw-r--r-- | src/volume.c | 44 |
1 files changed, 19 insertions, 25 deletions
diff --git a/src/volume.c b/src/volume.c index 938a51ac1..146c6b13a 100644 --- a/src/volume.c +++ b/src/volume.c @@ -117,51 +117,45 @@ int volume_level_get(void) return -1; } -static bool software_volume_change(int change, bool rel) +static bool software_volume_change(int volume) { - int new = change; + if (volume > 100) + volume = 100; + else if (volume < 0) + volume = 0; - if (rel) - new += volume_software_set; + volume_software_set = volume; - if (new > 100) - new = 100; - else if (new < 0) - new = 0; - - volume_software_set = new; - - /*new = 100.0*(exp(new/50.0)-1)/(M_E*M_E-1)+0.5; */ - if (new >= 100) - new = PCM_VOLUME_1; - else if (new <= 0) - new = 0; + if (volume >= 100) + volume = PCM_VOLUME_1; + else if (volume <= 0) + volume = 0; else - new = pcm_float_to_volume((exp(new / 25.0) - 1) / - (54.5981500331F - 1)); + volume = pcm_float_to_volume((exp(volume / 25.0) - 1) / + (54.5981500331F - 1)); - setPlayerSoftwareVolume(new); + setPlayerSoftwareVolume(volume); return true; } -static bool hardware_volume_change(int change, bool rel) +static bool hardware_volume_change(int volume) { /* reset the cache */ last_hardware_volume = -1; - return mixer_all_set_volume(change, rel); + return mixer_all_set_volume(volume); } -bool volume_level_change(int change, bool rel) +bool volume_level_change(int volume) { idle_add(IDLE_MIXER); switch (volume_mixer_type) { case MIXER_TYPE_HARDWARE: - return hardware_volume_change(change, rel); + return hardware_volume_change(volume); case MIXER_TYPE_SOFTWARE: - return software_volume_change(change, rel); + return software_volume_change(volume); default: return true; } @@ -182,7 +176,7 @@ void read_sw_volume_state(FILE *fp) g_strchomp(buf); sv = strtol(buf + strlen(SW_VOLUME_STATE), &end, 10); if (G_LIKELY(!*end)) - software_volume_change(sv, 0); + software_volume_change(sv); else g_warning("Can't parse software volume: %s\n", buf); return; |