SFML community forums
Help => Audio => Topic started by: lzr on January 11, 2009, 03:55:21 am
-
Sorry I keep posting these questions, but I'm trying to port a game to mac and I keep running into snags, and since I know virtually nothing about the platform, these snags are quite difficult to overcome. Thanks for promptly responding to all of my questions so far, Ceylo.
So my new problem is with sfml-audio. I can succesfully run the sample programs that are precompiled, but when I compile them myself, they no longer work. I can get them to compile, but they always crash at runtime. The place they crash is when alSourcei is called in the constructor of sf::Sound (Sound.cpp, line 41). I get the same crash in my own programs. What could be the problem?
Thanks
-
Uh... this is... weird.. really, especially if you're using the same source code to make the programs and the same project I used to build them...
And crashing on a alSourcei() call is ... odd :mrgreen: .
I don't have the faintest clue why this happens... :roll:
-
What is your Mac OS X version ? GCC version ?
-
I have Mac OS X version 10.4.11 and gcc version 4.0.1 (Apple Computer, Inc. build 5370) and Xcode version 2.5.
-
Hum... what's odd is that the samples were built for Mac OS X 10.5, so the one provided may not have worked on your computer, but they did. And now when you build them yourself for the good OS X version, it does no more work...
And I'm using GCC 4.0 too...
By the way... another Mac OS X Leopard user reported that the audio samples ere working fine. I don't know if it's a Mac OS X 10.4 issue only, I'd need some more feedbacks from other users.
I currently know nothing and I understand nothing about this crash, sorry.
-
Could you send to me the executable you compiled and which is crashing ? (ceylow@gmail.com)
I thought of one possible thing I'd like to check.
And... check you have no OpenAL framework in /Library/Frameworks.
-
I think I figured it out. For some reason, SFML crashes if create an sf::Music without creating an sf::SoundBuffer first. The reason why the sample didn't work was because for some reason, I had commented out the PlaySound function, so all it did was play music. Does this bug occur for others, or is it just me?
-
Could you show me the code you used and what you changed to make it work ?
-
This is a simplified version of the music code that doesn't work:
#include <iostream>
#include <SFML/Audio.hpp>
using namespace std;
int main (int argc, char * const argv[]) {
sf::Music Music;
Music.OpenFromFile("music.ogg");
Music.Play();
cout<<"Playing song, press enter to exit";
cin.ignore(10000, '\n');
return 0;
}
And here is the code that works:
#include <iostream>
#include <SFML/Audio.hpp>
using namespace std;
int main (int argc, char * const argv[]) {
sf::SoundBuffer buffer;
sf::Music Music;
Music.OpenFromFile("music.ogg");
Music.Play();
cout<<"Playing song, press enter to exit";
cin.ignore(10000, '\n');
return 0;
}