allebb / pirrot

A radio repeater controller (supporting both simplex and duplex operation modes) for the RaspberryPi.
https://pirrot.hallinet.com
54 stars 12 forks source link

Signal sox to stop recording (exit) when the COS signal goes low. #15

Closed allebb closed 7 years ago

allebb commented 7 years ago

The mainVox loop needs to be able to stop the execution of the sox binary when the COS signal goes low, will need to further look into the most efficent way to do this but most likely to involve open a new process, store the PID in memory and then use kill on the process after the COS signal goes high.

allebb commented 7 years ago

This has now been implemented, I used the follow to spawn 'sox' process (and get the PID) and then kill it using another system command:-

$pid = system($this->audioService->audioRecordBin . ' -t ' . $this->config->get('record_device',
                    'alsa') . ' default ' . $this->basePath . '/storage/input/buffer.ogg > /dev/null & echo $!');

// Then kill it like so:

system('kill ' . $pid);