[SDL] Ring a bell...
David Olofson
david at olofson.net
Sun May 6 12:39:15 PDT 2007
On Sunday 06 May 2007 21:26, Manuel García Cabrera wrote:
[...]
> If it's gonna be platform dependent, never mind.
Well, it's like one line of code per platform - but even so, it's
pretty hard to get it right without actually testing on each
platform...
You might want to have a look at my "speaker" hack over here:
http://olofson.net/mixed.html
Haven't looked at that code in a long time, but I believe the SDL part
should be pretty portable. For a simple beep, you can drop pretty
much everything but the SDL audio setup code and the callback, I
think.
You should definitely drop the CONSOLE (Linux only, and requires root
privileges unless you're actually running from a Linux text console)
and XBELL (X11 only) targets.
Or maybe even simpler; make a callback that just beeps at all times,
and use SDL_PauseAudio() to switch it on and off. Or even open/close
audio altogether. (No point in wasting cycles playing silence at all
times - but AFAIK, SDL audio *will* do just that if you just use
SDL_PauseAudio(), as that's only meant to detach the callback.)
//David Olofson - Programmer, Composer, Open Source Advocate
.------- http://olofson.net - Games, SDL examples -------.
| http://zeespace.net - 2.5D rendering engine |
| http://audiality.org - Music/audio engine |
| http://eel.olofson.net - Real time scripting |
'-- http://www.reologica.se - Rheology instrumentation --'
More information about the SDL
mailing list