[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Catching CTRL-C inside .oct file?
From: |
John W. Eaton |
Subject: |
Catching CTRL-C inside .oct file? |
Date: |
Wed, 15 Apr 1998 00:06:32 -0500 (CDT) |
On 15-Apr-1998, Erik de Castro Lopo <address@hidden> wrote:
| I'm writing a .oct file to allow the playing of a vector
| thru the sound card (/dev/dsp) as an audio file.
|
| It works something like:
|
| octave > soundplay (fs, mono)
|
| or
|
| octave > soundplay (fs, leftchannel, rightchannel)
|
| where fs is the sampling frequency. This of course would
| be really useful for anybody doing research in the areas
| of sound or speech.
Why do you need to do this inside a .oct file? What features are
missing that prevent an effective .m file implementation?
| Anyway, I need to be able to trap the Ctrl-C signal so I can
| clean up before exiting. Is this possible inside an .oct file?
You should be able to use the function octave_set_sighandler (see
sighandlers.{h,cc}) to catch signals in .oct files.
| Is it possible inside a .m file?
There is currently no way to trap signals directly within Octave
code, but I do have some plans to add a new built-in variable similar
to perl's SIG variable that will allow you to specify a list of
functions to call when various signals are caught. Suggestions for
how to make a feature like this more useful are welcome. Code to
actually do it would also be nice :-).
Thanks,
jwe