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

Tanu Kaskinen tanu.kaskinen at linux.intel.com
Thu May 8 23:50:12 PDT 2014


On Thu, 2014-05-08 at 15:34 +0500, Ibrar Ahmed wrote:
> Is this the right forum to ask these type of question?

Yes.

> On Thu, May 8, 2014 at 1:50 AM, Ibrar Ahmed <ibrar.ahmad at gmail.com>
> wrote:
>         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)
>         
>         with pacific volume but need to know how to change the volume
>         after connecting to stream. I don't want to call
>         pa_stream_connect_playback function again and again to change
>         the volume.

You can use pa_context_set_sink_input_volume(). The index that the
function requires can be acquired with pa_stream_get_index().

-- 
Tanu




More information about the pulseaudio-discuss mailing list