From 6ff9c1fb62f642f79079510b5d85e67d9014c41f Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Wed, 22 Oct 2008 22:48:53 +0200 Subject: don't set the volume of pacat unless it is explicitly set --- src/utils/pacat.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/utils/pacat.c') diff --git a/src/utils/pacat.c b/src/utils/pacat.c index 99df5b9e..ea736e23 100644 --- a/src/utils/pacat.c +++ b/src/utils/pacat.c @@ -57,6 +57,7 @@ static char *stream_name = NULL, *client_name = NULL, *device = NULL; static int verbose = 0; static pa_volume_t volume = PA_VOLUME_NORM; +static int volume_is_set = 0; static pa_sample_spec sample_spec = { .format = PA_SAMPLE_S16LE, @@ -283,7 +284,7 @@ static void context_state_callback(pa_context *c, void *userdata) { if (mode == PLAYBACK) { pa_cvolume cv; - if ((r = pa_stream_connect_playback(stream, device, latency > 0 ? &buffer_attr : NULL, flags, pa_cvolume_set(&cv, sample_spec.channels, volume), NULL)) < 0) { + if ((r = pa_stream_connect_playback(stream, device, latency > 0 ? &buffer_attr : NULL, flags, volume_is_set ? pa_cvolume_set(&cv, sample_spec.channels, volume) : NULL, NULL)) < 0) { fprintf(stderr, _("pa_stream_connect_playback() failed: %s\n"), pa_strerror(pa_context_errno(c))); goto fail; } @@ -627,6 +628,7 @@ int main(int argc, char *argv[]) { case ARG_VOLUME: { int v = atoi(optarg); volume = v < 0 ? 0U : (pa_volume_t) v; + volume_is_set = 1; break; } -- cgit v1.2.3