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,
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;
}
case ARG_VOLUME: {
int v = atoi(optarg);
volume = v < 0 ? 0U : (pa_volume_t) v;
+ volume_is_set = 1;
break;
}