After my original post, I figured out how to use on_blank(), but I’m still 
interested to know whether I should have been able to do this with the 
on_connect() & on_start() callback functions in input.pulseaudio and 
output.icecast.

Also, I’d appreciate any corrections to my usage of on_blank():

def on_receiving()
    do stuff
end

source_original = input.pulseaudio(device="4", fallible=true)

source_icecast = on_blank(
on_noise=on_receiving,
{()},
source_original,
start_blank=true,
max_blank=1.,
threshold=-84.
)

output.icecast(%ogg(%flac(compression=5)), fallible=true, host="localhost", 
port=8000, password="sourcepwd", mount="mystream", format="audio/ogg", 
source_icecast)

Thanks again!  —Bob

> On Jan 12, 2019, at 2:37 AM, Bob Stern via Savonet-users 
> <savonet-users@lists.sourceforge.net> wrote:
> 
> Per Romain’s advice, I am successfully using pulseaudio to receive music from 
> a virtual audio device.  The virtual audio device is capturing (like Jack) 
> audio from a music player that can alternate between play and pause modes.
> 
> QUESTION:  Is there a way to call a handler when the audio stream from the 
> virtual audio device starts after having been paused?
> 
> My attempts to use the on_connect & on_start callback functions in 
> input.pulseaudio and output.icecast were unsuccessful.  In both cases each of 
> the functions was called as soon as liquidsoap launched, but were never 
> called again regardless of my switching the music player between pause and 
> play modes.  
> 
> The pause->play transition should have been detectable by liquidsoap because 
> icecast server did detect it.  When the music player paused, icecast dropped 
> the connection to liquidsoap and its mountpoint, and then liquidsoap would 
> log the errors:
>       Error while sending data: could not write data to host: Broken pipe in 
> write()!
>       Closing connection...
>       Will try to reconnect in 3.00 seconds.
> 
> icecast promptly reinstated its connection to liquidsoap and its mountpoint 
> when the music player resumed play mode, but the on_connect & on_start 
> functions were not called.
> 
> Do I need to use on_blank()  instead of on_start()?  If so, can you please 
> provide the code?  It’s unclear to me how the source argument and source 
> result of on_blank() should should be associated with input.pulseaudio() in 
> the following command:
> 
> output.icecast(%ogg(%flac(compression=5)), 
> input.pulseaudio(device="4", fallible=true, on_start=pulse_start(), 
> on_start=pulse_start()), 
> fallible=true, host="localhost", port=8000, password="sourcepwd", 
> mount="mystream", format="audio/ogg”, 
> on_connect=on_connect(), on_start=on_start())
> 
> Each callback function was as follows except for the function name and echo’d 
> text:
> def pulse_start()
>     system ('echo "pulse" >> 
> /usr/local/hqp_liquidsoap/log/on_start_on_connect_LOG.log')
>     {()}
> end
> 
> Thanks very much for your help,
> 
> Bob Stern


_______________________________________________
Savonet-users mailing list
Savonet-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/savonet-users

Reply via email to