[pulseaudio-discuss] pa_context_set_source_volume_by_index() failed

pfl pfl at messofts.be
Tue Oct 25 17:13:06 UTC 2016


hi,

I try to set the volume on source #0 (the audio jack of my raspbery pi) 
but it does not work

     void setVolume(int index,int volume)  // where index is 0
     {
         pa_operation* o;
         currentVolume.values[0]=volume;
         if (!(o = pa_context_set_source_volume_by_index(context, index, 
&currentVolume, NULL/*volumeCallback*/, NULL)))
         {
             printf("pa_context_set_source_volume_by_index() failed\n");
             return;
         }
         printf("new volume: %d\n",currentVolume.values[0]);
         pa_operation_unref(o);
     }

     SINK : [0] 'alsa_output.0.analog-stereo' 'bcm2835 ALSA Analog Stereo'
     SOURCE : [0] 'alsa_output.0.analog-stereo.monitor' 'Monitor of 
bcm2835 ALSA Analog Stereo' mute:0 volume:65536
     monitor:'alsa_output.0.analog-stereo' driver:'module-alsa-card.c'
     flags: PA_SINK_LATENCY PA_SINK_DECIBEL_VOLUME PA_SINK_FLAT_VOLUME 
PA_SINK_DYNAMIC_LATENCY
     state: PA_SINK_SUSPENDED
     pa_context_set_source_volume_by_index() failed

strangeley, if I plug my audio usb card wich is on index 1,and still 
change the volume on source index 0,  it works

     SINK : [0] 'alsa_output.0.analog-stereo' 'bcm2835 ALSA Analog Stereo'
     SINK : [1] 
'alsa_output.usb-0d8c_C-Media_USB_Headphone_Set-00-Set.analog-stereo' 
'Audio Adapter Analog Stereo'
     SOURCE : [0] 'alsa_output.0.analog-stereo.monitor' 'Monitor of 
bcm2835 ALSA Analog Stereo' mute:0 volume:65536
     monitor:'alsa_output.0.analog-stereo' driver:'module-alsa-card.c'
     flags: PA_SINK_LATENCY PA_SINK_DECIBEL_VOLUME PA_SINK_FLAT_VOLUME 
PA_SINK_DYNAMIC_LATENCY
     state: PA_SINK_SUSPENDED
     SOURCE : [1] 
'alsa_output.usb-0d8c_C-Media_USB_Headphone_Set-00-Set.analog-stereo.monitor' 
'Monitor of Audio Adapter 
monitor:'alsa_output.usb-0d8c_C-Media_USB_Headphone_Set-00-Set.analog-stereo' 
driver:'module-alsa-card.c'
     PA_SINK_LATENCY PA_SINK_DECIBEL_VOLUME PA_SINK_DYNAMIC_LATENCY 
state: PA_SINK_SUSPENDED
     SOURCE : [2] 
'alsa_input.usb-0d8c_C-Media_USB_Headphone_Set-00-Set.analog-mono' 
'Audio Adapter Analog Mono' mute:0     monitor:'(null)' 
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_DYNAMIC_LATENCY 
state: PA_SINK_SUSPENDED
     port 'analog-input-mic' 'Microphone' priority:8700
      available: PA_PORT_AVAILABLE_UNKNOWN

new volume: 12345 OK

thanks

---
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