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

Author Topic: Audio Path  (Read 2924 times)

0 Members and 1 Guest are viewing this topic.

Ciphermind

  • Newbie
  • *
  • Posts: 2
    • View Profile
Audio Path
« on: March 26, 2011, 01:03:25 am »
Hi, I'm trying to play BGM using the Music class, and it works great.  However whenever I want to play a sound it has to be in the root folder of the executable!  I've tried specifying a "/sound" path in every syntax I could think of, and I was wondering what the proper syntax would be?

Here is the relevant line:
Code: [Select]
if (!Music.OpenFromFile("\sound\blues.ogg"))

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Audio Path
« Reply #1 on: March 26, 2011, 01:56:12 am »
Try "sound/blues.ogg" or "./sound/blues.ogg". By the way, backslashes are unportable and must be escaped. Prefer slashes.
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

devlin

  • Full Member
  • ***
  • Posts: 128
    • View Profile
Audio Path
« Reply #2 on: March 26, 2011, 07:33:48 am »
Not only that, but if you use normal backslashes for some reason, you'll have to escape them ( '\\', instead of '\' ), unless you use C# in which case you can use @"\". But like Nexus said, use forward-slashes instead, it works on all platforms.

 

anything