aboutsummaryrefslogtreecommitdiffstats
path: root/src/player_control.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-11-11 16:32:32 +0100
committerMax Kellermann <max@duempel.org>2008-11-11 16:32:32 +0100
commitedcd45df94bf69b78342943cd319d8ceb43ed6d1 (patch)
treed70e37392d8f51131563e16bf33668ba56f28d3e /src/player_control.c
parentad77a3e0ace2bb082bc619de1c6d8732715e8977 (diff)
downloadmpd-edcd45df94bf69b78342943cd319d8ceb43ed6d1.tar.gz
mpd-edcd45df94bf69b78342943cd319d8ceb43ed6d1.tar.xz
mpd-edcd45df94bf69b78342943cd319d8ceb43ed6d1.zip
pcm_volume: added constant PCM_VOLUME_1
It may be desirable to change the range of integer volume levels (e.g. to 1024, which may utilize shifts instead of expensive integer divisions). Introduce the constant PCM_VOLUME_1 which describes the integer value for "100% volume". This is currently 1000.
Diffstat (limited to '')
-rw-r--r--src/player_control.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/player_control.c b/src/player_control.c
index f65ba7c08..1d5c76aa0 100644
--- a/src/player_control.c
+++ b/src/player_control.c
@@ -22,6 +22,7 @@
#include "tag.h"
#include "song.h"
#include "idle.h"
+#include "pcm_utils.h"
#include "os_compat.h"
#include "main_notify.h"
@@ -35,7 +36,7 @@ void pc_init(unsigned int buffered_before_play)
pc.error = PLAYER_ERROR_NOERROR;
pc.state = PLAYER_STATE_STOP;
pc.cross_fade_seconds = 0;
- pc.software_volume = 1000;
+ pc.software_volume = PCM_VOLUME_1;
}
void pc_deinit(void)
@@ -220,7 +221,11 @@ void setPlayerCrossFade(float crossFadeInSeconds)
void setPlayerSoftwareVolume(int volume)
{
- volume = (volume > 1000) ? 1000 : (volume < 0 ? 0 : volume);
+ if (volume > PCM_VOLUME_1)
+ volume = PCM_VOLUME_1;
+ else if (volume < 0)
+ volume = 0;
+
pc.software_volume = volume;
}