RenE J.V. Bertin wrote:
Hello,
I’ve been looking for a very simple SDL_bell or SDL_beep functionality,
Um… The only thing I could really think of is to just write your own
function that plays a brief sound clip of a bell or a beep, and then
call it like you otherwise would.
–Scott
That might have been my PC-speaker hack. It has three output
“drivers”; Linux Console (Linux-only AFAIK, and works only for root
unless you’re actually running in a real Linux text console), X
(XBell() obviously) and SDL audio (any platform with digital audio
output; uses a simple PC speaker synth).
You could just throw the sound effect sequencer stuff away and use the
speaker driver/emulator layer. It has a Borland/DOS style
sound()/nosound() API for real time control. Doesn’t get much simpler
than that, I think…
//David Olofson - Programmer, Composer, Open Source Advocate
.- Audiality -----------------------------------------------.
| Free/Open Source audio engine for games and multimedia. |
| MIDI, modular synthesis, real time effects, scripting,… |
`-----------------------------------> http://audiality.org -’
— http://olofson.net — http://www.reologica.se —On Thursday 19 August 2004 22.11, RenE J.V. Bertin wrote:
Hello,
I’ve been looking for a very simple SDL_bell or SDL_beep
functionality, something like the XBell() function, just to play an
alert to the user (or rather, subject: I’m preparing to use SDL in
psychophysics experiments). Google showed my attempts to implement
some sort of PC speaker driver, but nothing easily useful for what
I have in mind. Any suggestions?
Hello,
I’ve been looking for a very simple SDL_bell or SDL_beep
functionality, something like the XBell() function, just to play an
alert to the user (or rather, subject: I’m preparing to use SDL in
psychophysics experiments). Google showed my attempts to implement
some sort of PC speaker driver, but nothing easily useful for what I
have in mind.
Any suggestions?
What, may I ask, are psycho physics?On Aug 19, 2004, at 4:11 PM, RenE J.V. Bertin wrote:
Thanks!
RenE Bertin
SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl
I’ve been looking for a very simple SDL_bell or SDL_beep
functionality, something like the XBell() function, just to play an
alert to the user
I second that! In my own SDL code I’ve done it this way:
#ifdef WIN32
#include “windows.h”
void ding(void)
{
MessageBeep(0);
}
#else
void ding(void)
{
fputc(‘\a’, stderr);
fflush(stderr);
}
#endif
My code has only been ported to Windows and Linux, and I have
absolutely no idea if any of the other platforms (Mac, Be, etc) need
special handling, too.
It would definitely be useful if SDL had a portable function that
supplied this.
b
I wrote a beep(freq, duration) just sending a sine wave to SDL_Audio and
playing with both the AudioSpec.freq and loop time in the callback.
Looks like a sledge-hammer for a simple bell, but, if you have the need for
playing a wave, this doesn’t add much to your existing code.
I can post the code here if anyone is interested.
Petrus