[pulseaudio-discuss] How to change the volume in PulseAudio (libpulse)

Rémi Denis-Courmont remi at remlab.net
Fri May 9 00:38:37 PDT 2014


Le 2014-05-07 23:50, Ibrar Ahmed a écrit :
> I am writing a program to play audio using libpulse on linux. I have
> successfully played the audio, but need to know how to change the
> volume. I am able to start the stream using
>
> v = PA_VOLUME_NORM;
> pa_cvolume_set(&m_lcvolume, 1, v);
> pa_stream_connect_playback(s, NULL, &attr, PA_STREAM_NOFLAGS,
> &m_lcvolume, NULL)

You should not force the volume to a hard coded value at start. That 
will mess up the system mixer, especially unless flat volumes are 
disabled.

Only pass a volume to pa_stream_connect_playback() based on direct user 
input.

-- 
Rémi Denis-Courmont


More information about the pulseaudio-discuss mailing list