[Gambas-user] Obtaining Sound Output Monitor's Name

John Rose john.aaron.rose at ...626...
Tue Dec 10 14:33:28 CET 2013


I'm trying to obtain the sound output monitor's name (as a string using 
the Shell command) for later use in an Exec command (calling ffmpeg).

Running  the appropriate command in a Terminal gives:
   john at ...2811...:~$ pactl list | grep -A2 '^Source #' | grep 'Name: 
.*\.monitor$' | awk '{print $NF}' | tail -n1
   alsa_output.pci-0000_00_1b.0.analog-stereo.monitor

I have Gambas code for opening FMain form as:
   Dim sSoundMonitorExtractor As String
   Me.Center()
   sSoundMonitorExtractor = Shell$("pactl list | grep -A2 '^Source #' | 
grep 'Name: .*\\.monitor$' | awk '{print $NF}' | tail -n1")
   Shell sSoundMonitorExtractor To sSoundMonitor
   Print "Sound Monitor = " & sSoundMonitor

I have 2 backslashes in the Shell$'s string as otherwise the compiler 
objects. When I run the Gambas executable, the Console displays:
   Sound Monitor =
I.e. sSoundMonitor is not set. What am I doing wrong?

Regards,
John




More information about the User mailing list