[SDL] [RFC+PATCH] Introducing posix timers to linux SDL_GetTicks()

Tommi Kyntola tommi.kyntola at ray.fi
Fri Sep 30 00:18:16 PDT 2005


> Hi!
> 
> My game (which has, in various versions, been in development for years) is 
> finally nearing completeness, and I've gone through a couple of different 
> audio systems in the process. I've stumbled on a couple of issues though, 
> which I'd very much like to clear up before finalising the system.
> 
> 1) SDL_mixer/OpenAL/anything else?
> 
> For the first version, I used SDL_mixer. Later, I switched to OpenAL, partly 
> because I had performance problems with SDL_mixer and stereo panning (I 
> suppose I did something wrong) but mainly because for a different project I 
> needed surround sound and wanted to reuse my resource manager. I'm not overly 
> happy with OpenAL though. The Linux version isn't up to date, and having 
> sound effects in surround sound isn't that exciting when the music comes out 
> only in mono...

If you don't plan to sell your game (or don't have the money to buy a 
license for commercial project), you may use FMOD and FMOD Ex for free. 
I've been using FMOD for almost 2 years and IMHO it's very good, stable, 
cross platform, feature-rich etc. API. Now, with the release of FMOD Ex, 
it became fantastic, filled with cool features, amazing API, that I 
wholeheartly recommend. Read more: http://www.fmod.org/

> 
> 2) Streaming music
> 
> For music playback, I use ogg files which I stream from the harddisk. The 
> problem is that the HD access results in a noticeable performance impact on 
> at least some systems; every few frames, a frame gets delayed a little longer 
> because the next bit of the stream is read. I tried to compensate for this by 
> putting the streaming code in a separate thread, hoping that the I/O blocking 
> mechanism wouldn't slow down my gfx routines that way, but the effect is 
> still noticeable, and of course I now have to fight race conditions as well.
> 
> Is there any real gain in putting this in its own thread to begin with? Is 
> there a recommended buffer size for streaming audio which works reasonably 
> well for most platforms? Or should I simply cache the entire ogg files and 
> just decode them on the fly?

I never had any problems of this kind with FMOD, everything was playing 
   smoothly and the overall performance loss was about stable ~1 or ~2 %.

> 
> 3) Continuous updates
> 
> This has perhaps caused me the most trouble. Refreshing the screen is one 
> thing, because it (hopefully) runs at the display's refresh rate and the 
> human eye doesn't notice the difference. But how should I go about updating 
> sound volumes and panning for moving sources? Is it enough to update them 
> once per frame (all I know is that the ears are "quicker" than the eyes), or 
> would these steps be audible? This also applies to fading music (currently 
> done in the music thread, see #2).

With FMOD all of this is done for you :-)


> When these questions are answered, I'm afraid I'll probably come up with a few 
> more. ;)
> 
> Thanks in advance,
> Marian.

In summary, if you don't have the time to create your own solutions, I 
suggest to use FMOD Ex. Even Blizzard is using FMOD :-)



Koshmaar




More information about the SDL mailing list