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

Author Topic: Seamless music looping  (Read 13979 times)

0 Members and 1 Guest are viewing this topic.

Jesse

  • Newbie
  • *
  • Posts: 16
    • View Profile
Seamless music looping
« Reply #15 on: February 22, 2009, 11:53:40 pm »
Quote from: "Ceylo"
Could you give a minimal example that produces this error ?

Actually, the issue seems to have been resolved by switching from the debug to the release versions of the SFML frameworks.

In case you're interested, here's the test program I was using:

Code: [Select]
#include <iostream>
#include <SFML/Audio.hpp>

int main()
{
    sf::Music music;
    music.OpenFromFile("music.ogg");
    music.Play();

    char c;
    std::cin >> c;
}


When using the debug version of the SFML audio framework, this generated a couple of different errors, depending on which version of the OpenAL framework was used. With the version of OpenAL currently available on the OpenAL website, I got:

Code: [Select]
An internal OpenAL call failed in Sound.cpp (41) :
AL_INVALID_OPERATION, the specified operation is not allowed in the current state


When first playing the music track. With the version of OpenAL that installs along with OS X, I was getting:

Code: [Select]
An internal OpenAL call failed in SoundStream.cpp (276) :
AL_INVALID_OPERATION, the specified operation is not allowed in the current state

On shutdown (or when calling Stop() on the music object).

I'm guessing this is just a case of user error related to using the wrong frameworks. I figured I'd go ahead and post the above information though, just in case.

Thanks,
Jesse

Ceylo

  • Hero Member
  • *****
  • Posts: 2325
    • View Profile
    • http://sfemovie.yalir.org/
    • Email
Seamless music looping
« Reply #16 on: February 23, 2009, 06:01:24 pm »
The OpenAL framework provided with Mac OS X *should* have worked fine. I also get this error message with the debug framework.

The worst point is that this error produces a leak (128 bytes/error).
I'mma try to find out what's wrong.
Want to play movies in your SFML application? Check out sfeMovie!

Ceylo

  • Hero Member
  • *****
  • Posts: 2325
    • View Profile
    • http://sfemovie.yalir.org/
    • Email
Seamless music looping
« Reply #17 on: March 01, 2009, 12:17:50 am »
I failed in finding out what's wrong.

I read this in the OpenAL documentation :
A buffer which is attached to a source can not be deleted.

So I suppose the OpenAL buffer objects that should have been deleted are still attached to a source. I also noticed that no error is produced when the music has enough time to finish playing.

I've tried to go further with this sample code:
Code: [Select]
sf::Music *music = new sf::Music;

if (!music->OpenFromFile("ball.wav"))
return 3;

music->Play();
delete music;

And I got a crash due to a multi-threading issue (that is what I at least suppose) whereas I was expecting the sf::Music class to clean everything properly before the memory was freed.

I've sent these informations to Laurent.


Edit: I also wanted to try an newer version of OpenAL but I could not access to the OpenAL Subversion repository, and the Mac OS X OpenAL framework installer is really outdated.
Want to play movies in your SFML application? Check out sfeMovie!

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Seamless music looping
« Reply #18 on: March 02, 2009, 06:28:55 pm »
I'm glad to tell you that this bug has been fixed :)
Laurent Gomila - SFML developer

 

anything