2004-08-18T22:06:16 jerome_pub: > i'ld like to send a beep as long as i'm pressing a key in Tk (with > bind event)
So I presume you've got the problem of capturing the key press/release solved (I don't do GUIs:-). > and i can't... i've tryed with Audio::Play... but it's impossible > to stop the sound before the end of data called... > > i've tryed to with threads and DESTROY methode of Audio::Play... I think you need a different approach. That API is cool for preparing sounds in a batch fashion, then spitting them at the audio device, but that's not what you're looking for. If it were me, I'd write a sample of the sound you want to beep with to a file, convert as necessary to get something you can cat >/dev/... to play, then examine that data. You want to spit small amounts of this data into the device at a time, and refrain from spitting them faster than it can play --- but you also don't want the device to completely drain while the key is held down, since you don't want gaps in the beep while the key is held down. So the timing of this spitting will be awfully tight indeed. If there were a way to query the device to find out how much it's got left in its queue, that'd be a big help. Hmm. Maybe you could go ahead with the approach you're using now, but use something like Audio::DSP::reset to clobber the device when you want it to shut up. Interesting problem, although the tricky bits of it seem to like outside of perl. -Bennett
pgpGZwhKJrjNI.pgp
Description: PGP signature
