aboutsummaryrefslogtreecommitdiffstats
path: root/src/pcm_volume.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2009-03-02 09:42:16 +0100
committerMax Kellermann <max@duempel.org>2009-03-02 09:42:16 +0100
commitb7bfa24f22a3a5a7709ce425ffc84bd4bb64be08 (patch)
tree661eef7a3aa2d5d4b153d23b5703c35502bc2262 /src/pcm_volume.c
parent0579b6ed27a995d6c700f3684b023fb2fda7e616 (diff)
downloadmpd-b7bfa24f22a3a5a7709ce425ffc84bd4bb64be08.tar.gz
mpd-b7bfa24f22a3a5a7709ce425ffc84bd4bb64be08.tar.xz
mpd-b7bfa24f22a3a5a7709ce425ffc84bd4bb64be08.zip
pcm_volume: return bool
Don't abort MPD when a sample format is not supported by pcm_volume().
Diffstat (limited to 'src/pcm_volume.c')
-rw-r--r--src/pcm_volume.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/pcm_volume.c b/src/pcm_volume.c
index 383caecca..49b0f9fb7 100644
--- a/src/pcm_volume.c
+++ b/src/pcm_volume.c
@@ -112,36 +112,35 @@ pcm_volume_change_24(int32_t *buffer, unsigned num_samples, int volume)
}
}
-void
+bool
pcm_volume(void *buffer, int length,
const struct audio_format *format,
int volume)
{
if (volume == PCM_VOLUME_1)
- return;
+ return true;
if (volume <= 0) {
memset(buffer, 0, length);
- return;
+ return true;
}
switch (format->bits) {
case 8:
pcm_volume_change_8((int8_t *)buffer, length, volume);
- break;
+ return true;
case 16:
pcm_volume_change_16((int16_t *)buffer, length / 2,
volume);
- break;
+ return true;
case 24:
pcm_volume_change_24((int32_t*)buffer, length / 4,
volume);
- break;
+ return true;
default:
- g_error("%u bits not supported by pcm_volume!\n",
- format->bits);
+ return false;
}
}