[pulseaudio-discuss] pa_context_set_source_volume_by_index() failed
Tanu Kaskinen
tanuk at iki.fi
Thu Oct 27 14:35:25 UTC 2016
On Wed, 2016-10-26 at 19:32 +0200, pfl wrote:
> it seems pa_context_set_sink_volume_by_index has no effect
>
> no more error, but the settings are not kept as default
What do you mean by "kept as default"?
> setOutputVolume(0,100);
> setOutputVolume(1,100);
> setOutputVolume(2,100);
> setOutputVolume(3,100);
> setOutputVolume(4,100);
>
> void setOutputVolume(int index,int volume)
> {
> pa_operation* o;
>
> currentVolume.values[0]=volume;
> currentVolume.values[1]=volume;
>
> if (!(o = pa_context_set_sink_volume_by_index(context, index,
> ¤tVolume, NULL/*volumeCallback*/, NULL)))
> {
> printf("pa_context_set_source_volume_by_index() failed\n");
> debugContextState(pa_context_get_state(context));
> return;
> }
>
> printf("new volume [%d]: %d %d\n",index,currentVolume.values[0],currentVolume.values[1]);
When you print this message, do you expect the volume at the server end
to have already changed? All interactions with the server are
asynchronous, so at this point in your code libpulse has only queued
the "set sink volume" command to be sent. The command has not yet
reached the server.
--
Tanu
More information about the pulseaudio-discuss
mailing list