Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Sound Delay  (Read 4085 times)

0 Members and 1 Guest are viewing this topic.

Sui

  • Jr. Member
  • **
  • Posts: 67
    • View Profile
    • http://www.suisoft.co.uk/
Sound Delay
« on: August 11, 2011, 12:30:10 pm »
I am working with SFML 1.6 under Visual Studio 2010 Pro (C++)
(I have Windows 7 Ultimate 64-bit).

I have a very odd problem with sound playback, in that there is a noticable delay between pressing a fire button in the game and the sound beining played.

The buffer and sound objects are being initialised outside the loop, therefore it isn't loading the file that is causing the issue.

If I go into debug and step over the sound Play call the sound doesn't play. It only plays when I press Continue in the debugger.

Looking at another thread on the forum, I suspect this is a threading issue.

Anyone had any problems with Visual Studio 2010 builds?
I've Googled and looked through the project properties and can't spot any way to tweak default thread priorities.

I am compiling the same codebase on a Mac (XCode) and it works fine (no delay on sound playback).

Thanks.
Gary Marples, Developer of games and other stuff.
www.suisoft.co.uk/games/BlogTwitter

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Sound Delay
« Reply #1 on: August 11, 2011, 12:57:06 pm »
Have you tried SFML 2?
Laurent Gomila - SFML developer

Sui

  • Jr. Member
  • **
  • Posts: 67
    • View Profile
    • http://www.suisoft.co.uk/
Sound Delay
« Reply #2 on: August 11, 2011, 08:53:17 pm »
Quote from: "Laurent"
Have you tried SFML 2?


Not yet. I'm aiming to use the latest official libraries for this build, to reduce the risk of bugs when I release live.

I'll create a couple of demos (as below) and see if I can shed any light on the problem.

VC++ 2008 with SFML v1.6
VC++ 2010 with SFML v2.0

Have there been any significant changes to the Audio part of the library, perhaps a new version of OpenAL?

Thanks.
Gary Marples, Developer of games and other stuff.
www.suisoft.co.uk/games/BlogTwitter

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Sound Delay
« Reply #3 on: August 11, 2011, 09:50:39 pm »
Quote
I'm aiming to use the latest official libraries for this build, to reduce the risk of bugs when I release live.

SFML 1.6 has a lot more bugs than SFML 2.

Quote
Have there been any significant changes to the Audio part of the library, perhaps a new version of OpenAL?

New version of OpenAL, and a significant amount of bug fixes.
Laurent Gomila - SFML developer

Sui

  • Jr. Member
  • **
  • Posts: 67
    • View Profile
    • http://www.suisoft.co.uk/
Sound Delay
« Reply #4 on: August 13, 2011, 09:48:52 am »
Thanks Laurent.

I'll try out SFML 2 and see what happens.
Gary Marples, Developer of games and other stuff.
www.suisoft.co.uk/games/BlogTwitter

Sui

  • Jr. Member
  • **
  • Posts: 67
    • View Profile
    • http://www.suisoft.co.uk/
Sound Delay
« Reply #5 on: August 23, 2011, 10:27:10 am »
I downloaded the SFML 2 snapshot.

Before starting to change my code over, I thought I would try the latest OpenAL DLL (from the SFML 2 snapshot).

Replacing the DLL seems to have worked. The sound delay has gone away. The interface on the DLL must be backwards compatible (at least with the functionality I'm using at the moment, which is very simple).

I noticed a few comments about sound delays and issues with OpenAL under 64-bit versions of Windows - perhaps that was the reason.

I will move over to SFML 2 at some point, I'm just concentrating on getting some gameplay working at the moment. Everything is behind interfaces on my engine, therefore it should be easy to switch.

Thanks again for your help.
Gary Marples, Developer of games and other stuff.
www.suisoft.co.uk/games/BlogTwitter