[SDL] Ringing the bell

Donny Viszneki donny.viszneki at gmail.com
Mon Aug 17 16:01:27 PDT 2009


If it isn't going to use the SDL audio subsystem, what would be the
advantage of making it part of SDL? I'd say a BIG step closer to what
you want in life would be to write a library for making a beep noise
yourself.

On Mon, Aug 17, 2009 at 6:08 PM, Brian Raiter<breadbox at muppetlabs.com> wrote:
> 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
> subsystem.
>
> 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)
>      MessageBeep(0);
>  #elif defined(__APPLE__)
>      SysBeep(1);
>  #elif defined(SDL_VIDEO_DRIVER_X11)
>      SDL_SysWMInfo info;
>      SDL_VERSION(&info.version);
>      SDL_GetWMInfo(&info);
>      XBell(info.info.x11.display, 100);
>  #elif defined(OTHER_CASES)
>      /* ??? */
>  #else
>      /* fallback method (won't work if stderr is piped to a file) */
>      fputc('\a', stderr);
>      fflush(stderr);
>  #endif
>  }
>
> (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
> platforms?
>
> b
> _______________________________________________
> SDL mailing list
> SDL at lists.libsdl.org
> http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
>



-- 
http://codebad.com/



More information about the SDL mailing list