Jump to content

  • Log In with Google      Sign In   
  • Create Account


SFML 2.1 Sound delay


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 Álvaro   Crossbones+   -  Reputation: 11710

Like
0Likes
Like

Posted 30 October 2013 - 09:26 AM

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.

 

 



Sponsor:

#2 Álvaro   Crossbones+   -  Reputation: 11710

Like
0Likes
Like

Posted 31 October 2013 - 06:27 AM

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.



#3 wintertime   Members   -  Reputation: 1575

Like
1Likes
Like

Posted 31 October 2013 - 10:48 AM

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.






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS