Mercurial > hg > octave-terminal
changeset 12901:f754b65f4bc5
Add a PulseAudio backend to playaudio
author | Fabian Deutsch <fabian.deutsch@gmx.de> |
---|---|
date | Fri, 29 Jul 2011 11:32:38 -0500 |
parents | 00f5292aefeb |
children | b9c66f891281 |
files | scripts/audio/playaudio.m |
diffstat | 1 files changed, 12 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/audio/playaudio.m +++ b/scripts/audio/playaudio.m @@ -47,7 +47,10 @@ num = fopen (file, "wb"); c = fwrite (num, X, "uchar"); fclose (num); - system (sprintf ("cat \"%s\" > /dev/dsp", file)); + [status, out] = system (sprintf ("cat \"%s\" > /dev/dsp", file)); + if (status != 0) + system (sprintf ("paplay --raw \"%s\"", file)) + endif unwind_protect_cleanup unlink (file); end_unwind_protect @@ -61,10 +64,16 @@ print_usage (); endif if (strcmp (ext, "lin") || strcmp (ext, "raw")) - system (sprintf ("cat \"%s\" > /dev/dsp", name)); + [status, out] = system (sprintf ("cat \"%s\" > /dev/dsp", name)); + if (status != 0) + system (sprintf ("paplay --raw \"%s\"", name)) + endif elseif (strcmp (ext, "mu") || strcmp (ext, "au") || strcmp (ext, "snd") || strcmp (ext, "ul")) - system (sprintf ("cat \"%s\" > /dev/audio", name)); + [status, out] = system (sprintf ("cat \"%s\" > /dev/audio", name)); + if (status != 0) + system (sprintf ("paplay \"%s\"", name)) + endif else error ("playaudio: unsupported extension"); endif