[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Start pacat on boot (or after xbmc)



Hi again,

The bad news is that no one answered my e-mail, the good news is that
I managed to solve this myself.
More below.

2014-02-17 23:53 GMT+01:00 Steven Post <redalert.commander@gmail.com>:
> I have a script that starts and kills pacat (pulseaudio cat) in order to
> get my USB turntable to work.
> It is a rather simple script, reproduced below for reference.
> I want to run this script at boot, but whatever I try, it doesn't seem
> to work. When started at boot (using an init script, or rc.local) the
> log it produces is always "pa_stream_drain(): Bad state".
> When running the script manually it works perfectly.
> The script is invoked with this command:
> su username -l -c /path/to/vinyl.sh
>
This is now fixed by adding the following cron job (crontab -e)
@reboot sleep 10; /path/to/vinyl.sh

I think the issue was that pacat was started too soon (before
pulseaudio), and thus the sleep makes sure that the system is fully
operational.
If you do this yourself, you may find that 10 seconds is not enough,
since this was a pretty minimal system with a SSD.

A better approach would be to check 'ps' for the pulseaudio existence
in a loop with a sleep 1,
thus minimizing the time between full boot and starting pacat, while
still being sure it doesn't launch to soon (even on slow systems).
I'll have a go at that tomorrow.

Best regards,
Steven


Reply to: