[SDL] Beeps and bells.

David Olofson david.olofson at reologica.se
Mon Mar 12 06:03:54 PST 2001


On Sunday 11 March 2001 21:30, Lee Haywood wrote:
> > On 11 Mar 2001 16:17:53 +0000, Lee Haywood wrote:
> > > We've had a thread about using the PC speaker recently, and David
> > > posted a "speaker emulator".
> > >
> > > But what my users want is a simple beep when using a machine without a
> > > soundcard.   I might be able to get X to give me beeps, but is there
> > > some simple way to get Windows to generate them (cross-compiled in
> > > Linux)?
>
> Julian Peterson <julianp at earthling.net> wrote:
> > printf("\a"); ?
>
> Funny, but I asked for something that would work in Windows - if you do
> that you'd get an entry in 'stdout.txt', not to a terminal.

MessageBeep() or something... No control, but it does produce a beep if 
there's no sound card. (There are two API calls, IIRC; one of them *always* 
produces a speaker beep, it seems.)


> Even in Linux it would only work if a terminal (e.g. xterm) was available
> and remained available.

But how does the XTerm do it, then...? I'm assuming the X server has some 
kind of API for it - and as some desktop environments allow tuning the beep, 
it might even be a sound(freq, duration) or even a sound(freq)/nosound() 
style API.

I've not managed to find it, though. Don't know what to look for it seems... 
(Guess I'll just have to look for the console ioctls in the KFree86 source.)
 
For the console, there are the KIOCSOUND(freq/0=stop) and 
KDMKTONE(freq/0=stop, duration/o=forever) ioctls. They represent both of the 
API styles I'm talking about, so they should work great.


//David

.- M A I A -------------------------------------------------.
|      Multimedia Application Integration Architecture      |
| A Free/Open Source Plugin API for Professional Multimedia |
`----------------------> http://www.linuxaudiodev.com/maia -'
.- David Olofson -------------------------------------------.
| Audio Hacker - Open Source Advocate - Singer - Songwriter |
`--------------------------------------> david at linuxdj.com -'



More information about the SDL mailing list