[pulseaudio-discuss] pa_context_set_source_volume_by_index() failed

pfl pfl at messofts.be
Wed Oct 26 17:32:00 UTC 2016


it seems pa_context_set_sink_volume_by_index has no effect

no more error, but the settings are not 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, 
&currentVolume, 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]);

     pa_operation_unref(o);
}



here is the logs for details

PA_CONTEXT_CONNECTING
PA_CONTEXT_AUTHORIZING
PA_CONTEXT_SETTING_NAME
PA_CONTEXT_READY

CARD : [0] 'alsa_card.usb-0d8c_C-Media_USB_Headphone_Set-00-Set' 
'module-alsa-card.c'
profile[0]  'input:analog-mono' 'Analog Mono Input' sinks:0 sources:1 
priority:1
profile[1]  'output:analog-stereo' 'Analog Stereo Output' sinks:1 
sources:0 priority:6000
profile[2] [active] 'output:analog-stereo+input:analog-mono' 'Analog 
Stereo Output + Analog Mono Input' sinks:1 sources:1 priority:6001
profile[3]  'output:iec958-stereo' 'Digital Stereo (IEC958) Output' 
sinks:1 sources:0 priority:5500
profile[4]  'output:iec958-stereo+input:analog-mono' 'Digital Stereo 
(IEC958) Output + Analog Mono Input' sinks:1 sources:1 priority:5501
profile[5]  'off' 'Off' sinks:0 sources:0 priority:0
port 'analog-input-mic' 'Microphone' priority:8700
port 'analog-output-headphones' 'Headphones' priority:9000
port 'iec958-stereo-output' 'Digital Output (S/PDIF)' priority:0

CARD : [1] 'alsa_card.0' 'module-alsa-card.c'
profile[0]  'output:analog-mono' 'Analog Mono Output' sinks:1 sources:0 
priority:100
profile[1] [active] 'output:analog-stereo' 'Analog Stereo Output' 
sinks:1 sources:0 priority:6000
profile[2]  'off' 'Off' sinks:0 sources:0 priority:0
port 'analog-output' 'Analog Output' priority:9900

SINK : [0] card 0 
'alsa_output.usb-0d8c_C-Media_USB_Headphone_Set-00-Set.analog-stereo' 
'Audio Adapter Analog Stereo' mute:0 volume:65687
format:'s16le' rate:44100 channels:2
map[0] 'Front Left'
map[1] 'Front Right'
volume(0): 22113
volume(1): 22113
monitor:'alsa_output.usb-0d8c_C-Media_USB_Headphone_Set-00-Set.analog-stereo.monitor' 
driver:'module-alsa-card.c'
PA_SINK_HW_VOLUME_CTRL
PA_SINK_LATENCY
PA_SINK_HARDWARE
PA_SINK_HW_MUTE_CTRL
PA_SINK_DECIBEL_VOLUME
PA_SINK_FLAT_VOLUME
state: PA_SINK_SUSPENDED
port 'analog-output-headphones' 'Headphones' priority:9000
  available: PA_PORT_AVAILABLE_UNKNOWN
port: 'analog-output-headphones'

SINK : [1] card 1 'alsa_output.0.analog-stereo' 'bcm2835 ALSA Analog 
Stereo' mute:0 volume:56210
format:'s16le' rate:44100 channels:2
map[0] 'Front Left'
map[1] 'Front Right'
volume(0): 65511
volume(1): 65511
monitor:'alsa_output.0.analog-stereo.monitor' driver:'module-alsa-card.c'
PA_SINK_HW_VOLUME_CTRL
PA_SINK_LATENCY
PA_SINK_HARDWARE
PA_SINK_HW_MUTE_CTRL
PA_SINK_DECIBEL_VOLUME
PA_SINK_FLAT_VOLUME
PA_SINK_DYNAMIC_LATENCY
state: PA_SINK_SUSPENDED
port 'analog-output' 'Analog Output' priority:9900
  available: PA_PORT_AVAILABLE_UNKNOWN
port: 'analog-output'

SOURCE : [0] card 0 
'alsa_output.usb-0d8c_C-Media_USB_Headphone_Set-00-Set.analog-stereo.monitor' 
'Monitor of Audio Adapter Analog Stereo' mute:0 volume:65536
format:'s16le' rate:44100 channels:2
map[0] 'Front Left'
map[1] 'Front Right'
volume(0): 65536
volume(1): 65536
monitor:'alsa_output.usb-0d8c_C-Media_USB_Headphone_Set-00-Set.analog-stereo' 
driver:'module-alsa-card.c'
PA_SOURCE_LATENCY
PA_SOURCE_DECIBEL_VOLUME
PA_SOURCE_FLAT_VOLUME
state: PA_SOURCE_SUSPENDED
port: 'none'

SOURCE : [1] card 0 
'alsa_input.usb-0d8c_C-Media_USB_Headphone_Set-00-Set.analog-mono' 
'Audio Adapter Analog Mono' mute:0 volume:26281
format:'s16le' rate:44100 channels:1
map[0] 'Mono'
volume(0): 26281
monitor:'(null)' driver:'module-alsa-card.c'
PA_SOURCE_HW_VOLUME_CTRL
PA_SOURCE_LATENCY
PA_SOURCE_HARDWARE
PA_SOURCE_HW_MUTE_CTRL
PA_SOURCE_DECIBEL_VOLUME
PA_SOURCE_FLAT_VOLUME
state: PA_SOURCE_SUSPENDED
port 'analog-input-mic' 'Microphone' priority:8700
  available: PA_PORT_AVAILABLE_UNKNOWN
port: 'analog-input-mic'

SOURCE : [2] card 1 'alsa_output.0.analog-stereo.monitor' 'Monitor of 
bcm2835 ALSA Analog Stereo' mute:0 volume:65536
format:'s16le' rate:44100 channels:2
map[0] 'Front Left'
map[1] 'Front Right'
volume(0): 65536
volume(1): 65536
monitor:'alsa_output.0.analog-stereo' driver:'module-alsa-card.c'
PA_SOURCE_LATENCY
PA_SOURCE_DECIBEL_VOLUME
PA_SOURCE_FLAT_VOLUME
PA_SOURCE_DYNAMIC_LATENCY
state: PA_SOURCE_SUSPENDED
port: 'none'

new volume [0]: 100 100
new volume [1]: 100 100
new volume [2]: 100 100
new volume [3]: 100 100
new volume [4]: 100 100



Le 26/10/2016 à 19:09, Tanu Kaskinen a écrit :
> On Wed, 2016-10-26 at 18:58 +0200, pfl wrote:
>> besides, how come I get a source and a sink if it is only an output ?
> A monitor source is automatically generated for every sink. If you
> record from a monitor source, you get the same audio that is played to
> the corresponding sink (so you can "monitor" what is being played).
>


---
L'absence de virus dans ce courrier électronique a été vérifiée par le logiciel antivirus Avast.
https://www.avast.com/antivirus



More information about the pulseaudio-discuss mailing list