tones running in the background?

"Greg London" <[email protected]>
Newsgroups gmane.comp.lang.perl.tk
Message-ID <[email protected]>
 
I thought it would be interesting to try coding up a morse code trainer in perl/tk.
I got a simple GUI working which contains a Label with a bunch of empty text.
The label is bound to two different callbacks, one for mouse button press,
and another for release. The callbacks call hirestimer and determine how long
the button was pushed, or how long it was released. these time values get
pushed into an array, and I think a simple bit of processing should be able
to translate an array of time delays into morse code versions of various letters.
 
Interestingly enough, this was all rather easy to do. What has me stumped is
that I need to play a tone while the mouse button is pushed and stop it when 
the button is released. The only way I know of to make noise on perl/tk is
to call $widget->bell(); which wont cut it.
 
I need to be able to make a funciton call to turn the tone on and have the
function return immediately, meanwhile, the tone is still sounding.
A call to another subroutine will then turn the tone off. 
 
This relates to the way the mouse button call backs work.
 
 sub ButtonPressCallback {
    tone_on();
    # call hi res timer, do some calculations
 }

 sub ButtonReleaseCallback {
     tone_off();
    # call hi res timer, do some calculations
 }

Anyone have any idea how to do this in perl tk?
I'm running activestate, so it will need to be compatible with that as well.
 
Thanks in advance,
Greg London
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.