[SDL] Ringing the bell
haleyjd at hotmail.com
Tue Aug 18 12:17:26 PDT 2009
The Chocolate Doom project (www.chocolate-doom.org) has a PC speaker
emulation library which can attach to the SDL audio core or to
SDL_mixer and provides a fully functional square wave generator.
Chocolate DOOM and my own port, Eternity, use this code to support
the PC speaker format sound effects that were used in DOOM, but
with a little extra work it could be made to play arbitrary sounds.
The best thing about it is that it's portable; no conditionals are
needed. The worst thing about it is that it has no filtering, and
that I believe listening to it for an extended period of time can
cause damage to your hearing. I certainly know it made my ears
hurt for several hours...
> Date: Mon, 17 Aug 2009 15:08:30 -0700
> From: breadbox at muppetlabs.com
> To: sdl at lists.libsdl.org
> Subject: [SDL] Ringing the bell
> Often I have wished for a simple beep function in SDL. For example,
> when someone tries to scroll past the last item in a list, or
> backspace past the beginning of an input field, you want to ring the
> bell (as they used to say) without having to spin up the whole audio
> Presumably this wouldn't be hard to write; I'm just not sure what the
> details are on the less popular platforms. I think that if I were to
> write this for myself, it would look something like this:
> #include "SDL_syswm.h"
> void sdlBeep(void)
> #if defined(WIN32)
> #elif defined(__APPLE__)
> #elif defined(SDL_VIDEO_DRIVER_X11)
> SDL_SysWMInfo info;
> XBell(info.info.x11.display, 100);
> #elif defined(OTHER_CASES)
> /* ??? */
> /* fallback method (won't work if stderr is piped to a file) */
> fputc('\a', stderr);
> (And I expect some platform-dependent logic in the Makefile as well.)
> But of course it would be SO much nicer if SDL supplied this directly.
> It seems like the sort of thing that would be appropriate to SDL -- is
> there any interest in adding it?
> Also, do folks know how to ring the bell on other SDL-supported
> SDL mailing list
> SDL at lists.libsdl.org
Windows Live: Keep your friends up to date with what you do online.
More information about the SDL