Created
June 9, 2015 19:22
-
-
Save bradbatt/041ecbcf78f2b4a89d38 to your computer and use it in GitHub Desktop.
Universal Play / Pause script for afplay
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/zsh | |
afplay_status=$(ps -clx | grep 'afplay' | awk '{print $11}') | |
if [[ $afplay_status == T ]] then | |
killall -CONT -c "afplay" | |
else | |
killall -STOP -c "afplay" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This doesn't actually pause afplay :/ it effectively just mutes it. I think afplay takes note of the time it is started and picks position to fill the audio buffer based on the time since start (probably in case a frame is missed)