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

Author Topic: cant't play music in Mac os (el capitan)  (Read 3227 times)

0 Members and 1 Guest are viewing this topic.

Belz

  • Newbie
  • *
  • Posts: 3
    • View Profile
    • Email
cant't play music in Mac os (el capitan)
« on: November 03, 2015, 04:13:10 am »
Hi,everyone, got some problems with adding music
here is my code
void  Ship::setLocation(float xValue,float yValue)
{
  move(xValue,yValue);

  sf::Music Bgm;
  if(Bgm.openFromFile("Star_Wars.ogg"))
    cout << "error";
  Bgm.play();
 
}

this is part of my assignment, i want to play music while my ship(part of game) is moving, i got no errors when i compiled it, but when i try to run it, i got  a problem that i cant understand(i attach the screenshot)
hope can get some help.

Belz

  • Newbie
  • *
  • Posts: 3
    • View Profile
    • Email
Re: cant't play music in Mac os (el capitan)
« Reply #1 on: November 03, 2015, 04:16:07 am »
sorry, my screen shot is too large
here is the error
dyld: Library not loaded: @rpath/../Frameworks/vorbis.framework/Versions/A/vorbis
  Referenced from: /usr/local/lib/libsfml-audio.2.3.dylib
  Reason: image not found
Trace/BPT trap: 5

GraphicsWhale

  • Full Member
  • ***
  • Posts: 131
    • View Profile
Re: cant't play music in Mac os (el capitan)
« Reply #2 on: November 03, 2015, 08:07:01 am »
You're not getting any sound because you're just immediately destroying the object.

EDIT: Oh, I didn't see your second post. Sounds like you may have skipped a step when linking the audio library. I don't own a mac, so I'm of limited help, but I do advise you to go over the tutorials again just to be sure.
« Last Edit: November 03, 2015, 08:16:30 am by GraphicsWhale »

Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
Re: cant't play music in Mac os (el capitan)
« Reply #3 on: November 03, 2015, 08:59:20 am »
This runtime error says that you didn't install SFML's dependencies correctly. Please read the tutorial again.
SFML / OS X developer

Belz

  • Newbie
  • *
  • Posts: 3
    • View Profile
    • Email
Re: cant't play music in Mac os (el capitan)
« Reply #4 on: November 04, 2015, 01:12:11 am »
thank u, but i follow the tutorials step by step, and i also ask my Professor to check my sfml install, and it still goes wrong, i didn't download the Xcode by the way(we use emacs to edit code),could that be the reason?

Hapax

  • Hero Member
  • *****
  • Posts: 3351
  • My number of posts is shown in hexadecimal.
    • View Profile
    • Links
Re: cant't play music in Mac os (el capitan)
« Reply #5 on: November 04, 2015, 01:31:13 am »
It may be some sort of copy-paste error or an error during an attempt to minimalise the code but in the code you posted:
  • You are only outputting "error" if the file loading is successful.
  • You are playing the music whether the loading is successful or not.
Selba Ward -SFML drawables
Cheese Map -Drawable Layered Tile Map
Kairos -Timing Library
Grambol
 *Hapaxia Links*

Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
Re: cant't play music in Mac os (el capitan)
« Reply #6 on: November 04, 2015, 07:40:48 am »
This error is not about wrong code (although Hapax's advices are good). Not using Xcode doesn't mean you don't have to install SFML dependencies. The tutorial explains where each file of the SDK should go. If something in the tutorial ain't clear, please ask a specific question about it.
SFML / OS X developer

 

anything