Advertisement

SFML 2.1 Sound delay

Started by October 30, 2013 03:26 PM
1 comment, last by wintertime 11 years ago

Hi,

[If you want to skip the background, jump to (*)] A friend of mine wants some help making a simple 2D scroller, and I offered myself to help with the programming. I haven't done any game programming in a long time, so I looked around a bit and it looks like C++ with SFML 2.1 is a good place to start: I am very familiar with C++ and the library's design is clean and uses C++ in an idiomatic way.

I have been very happy with what I have tried so far (setting up a render window in full-screen mode, measuring time, handling events, drawing a bunch of sprites either with sf::Sprite or by setting up a sf::VertexArray that draws a bunch of quads in a single call...) but then (*) I tried to play some sounds using sf::Sound and I find that there is a significant lag of perhaps 100 ms (estimated by ear). It's possible I can get away with that, but it sounds like too much of a delay. I am using sf::Sound in a very straight-forward manner, so I don't see the point of posting code.

Is this consistent with what other people experience? Are there any workarounds? Or perhaps I have to use a different library to play sound?

One possibly relevant piece of data: My programming environment is Ubuntu Linux running within VirtualBox, with a recent MacBook Air as the host.

Thanks.

Update: I installed XCode 5, the corresponding command-line tools for OSX 10.9 and SFML 2.1 on the MacBook Air, and the program works perfectly well, with no appreciable delay. So it's probably something about my OpenAL driver in Linux within VirtualBox. It looks like I'll have to program on the OSX side, then.

Advertisement

I think that is difficult for people to answer here. I for example didn't really notice large delays (though I'm not trained on noticing this), but I was loading the sounds to a sf::SoundBuffer and created sf::Sound from them early and only did the single play method call when it was time to start playing it.

You should really ask on http://sfml-dev.org/ forums, Laurent (who is programming SFML) is really helpful and would know much better.

This topic is closed to new replies.

Advertisement