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

Author Topic: Can't Get Audio To Work in Mac OS  (Read 26790 times)

0 Members and 1 Guest are viewing this topic.

lzr

  • Newbie
  • *
  • Posts: 48
    • View Profile
    • http://lzr.cc
Can't Get Audio To Work in Mac OS
« 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

Ceylo

  • Hero Member
  • *****
  • Posts: 2325
    • View Profile
    • http://sfemovie.yalir.org/
    • Email
Can't Get Audio To Work in Mac OS
« Reply #1 on: January 11, 2009, 05:38:17 am »
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:
Want to play movies in your SFML application? Check out sfeMovie!

Ceylo

  • Hero Member
  • *****
  • Posts: 2325
    • View Profile
    • http://sfemovie.yalir.org/
    • Email
Can't Get Audio To Work in Mac OS
« Reply #2 on: January 12, 2009, 02:10:42 pm »
What is your Mac OS X version ? GCC version ?
Want to play movies in your SFML application? Check out sfeMovie!

lzr

  • Newbie
  • *
  • Posts: 48
    • View Profile
    • http://lzr.cc
Can't Get Audio To Work in Mac OS
« Reply #3 on: January 13, 2009, 07:10:35 am »
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.

Ceylo

  • Hero Member
  • *****
  • Posts: 2325
    • View Profile
    • http://sfemovie.yalir.org/
    • Email
Can't Get Audio To Work in Mac OS
« Reply #4 on: January 13, 2009, 05:50:20 pm »
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.
Want to play movies in your SFML application? Check out sfeMovie!

Ceylo

  • Hero Member
  • *****
  • Posts: 2325
    • View Profile
    • http://sfemovie.yalir.org/
    • Email
Can't Get Audio To Work in Mac OS
« Reply #5 on: January 16, 2009, 09:11:46 pm »
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.
Want to play movies in your SFML application? Check out sfeMovie!

lzr

  • Newbie
  • *
  • Posts: 48
    • View Profile
    • http://lzr.cc
Can't Get Audio To Work in Mac OS
« Reply #6 on: January 21, 2009, 07:50:50 am »
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?

Ceylo

  • Hero Member
  • *****
  • Posts: 2325
    • View Profile
    • http://sfemovie.yalir.org/
    • Email
Can't Get Audio To Work in Mac OS
« Reply #7 on: January 21, 2009, 12:08:19 pm »
Could you show me the code you used and what you changed to make it work ?
Want to play movies in your SFML application? Check out sfeMovie!

lzr

  • Newbie
  • *
  • Posts: 48
    • View Profile
    • http://lzr.cc
Can't Get Audio To Work in Mac OS
« Reply #8 on: January 22, 2009, 01:09:30 am »
This is a simplified version of the music code that doesn't work:

Code: [Select]

#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:
Code: [Select]

#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;
}

 

anything