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

Ibrar Ahmed ibrar.ahmad at gmail.com
Fri May 9 05:11:13 PDT 2014


I want to change the volume after connecting( calling pa_stream_connect_playback) to the stream, should i call pa_stream_connect_playback again and again whenever i want to change volume? 

> On 09-May-2014, at 12:38 pm, Rémi Denis-Courmont <remi at remlab.net> wrote:
> 
> 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
> _______________________________________________
> pulseaudio-discuss mailing list
> pulseaudio-discuss at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


More information about the pulseaudio-discuss mailing list