As others suggested, check python. It's not to difficult and most of it is
cross platform.
There are several ways to get chars, both blocking and non-blocking.

I was thinking about curses, but there are other ways.

>From python docs:

> While curses is most widely used in the Unix environment, versions are
> available for DOS, OS/2, and possibly other systems as well. This extension
> module is designed to match the API of ncurses, an open-source curses
> library hosted on Linux and the BSD variants of Unix.
>

The first thing that comes to my mind is doing something based on threads,
assuming that beeping is a blocking function (doesn't return until the beep
ends).

start a thread that accepts beep requests (and performs the beeping)
last_beep_end_time = now()

while akey is pressed:

   speaker_is_idle = now() > last_beep_end_time

   if akey is quit_key:
       quit

   if akey is key1 and the speaker is idle:
      ask the thread to beep
      compute last_beep_end_time (at which the beep ends, eg now + 100ms)

   ...
   silently ignore keypresses while the speaker is already beeping.


Cheers,
Joseph

Reply via email to