4

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. Dont want to call pa_stream_connect_playback function again and again to change the volume.

Ibrar Ahmed
  • 1,039
  • 1
  • 13
  • 25

1 Answers1

0

Finally I am able to change the volume of each channel by calling pa_context_set_sink_input_volume. The pa_cvolume parameter can be used to specify the volume and channel in pa_context_set_sink_input_volume.

Ibrar Ahmed
  • 1,039
  • 1
  • 13
  • 25
  • I have two different audio streams that I'm trying to do independently, so your answer ( which modifies the shared sync ) doesn't work --- but does for you! – Brian Bulkowski Jul 29 '19 at 04:10