[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Inhibit more keyboard event during execution of function
From: |
Ilya Zakharevich |
Subject: |
Re: Inhibit more keyboard event during execution of function |
Date: |
Tue, 29 Dec 2009 22:11:58 +0000 (UTC) |
User-agent: |
slrn/0.9.8.1pl1 (Linux) |
On 2009-12-28, Mathias Dahl <mathias.dahl@gmail.com> wrote:
> I have made a small game for my kid that lets him press a key and that
> will play a sound and display an image. It is implemented as a major
> mode with a keymap where each key is defined using `define-key' and
> bound to a special play command with a string of what to play (say,
> "cow"). Now, it works for me, but when I tested this on my son today he
> kept the key pressed way longer than I do, with the effect that the key
> repeats, playing the sound many times. Quite annoying. Is there a way to
> get around this? I have been thinking of having some timing built in so
> that I will not play again unless a certain time has passed.
>
> Also, even though I tell Emacs to draw the image first (using
> `insert-image-file'), it is not displayed until the sound has stopped
> playing (I use `play-sound-file'). Any way around this?
If you sound is played syncroneously, just introduce a global
variable, set it on during sound play, and do sound play conditionally
- only if the variable is not set.
If the play is async - may be much harder...
Hope this helps,
Ilya
Re: Inhibit more keyboard event during execution of function,
Ilya Zakharevich <=
Re: Inhibit more keyboard event during execution of function, Mathias Dahl, 2009/12/29