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

Author Topic: Music doesn't work  (Read 3669 times)

0 Members and 1 Guest are viewing this topic.

glu4it

  • Newbie
  • *
  • Posts: 9
    • View Profile
Music doesn't work
« on: November 20, 2013, 04:35:08 pm »
Hi. I make a game and try to add a music. But it doesn't work and game crashes :(
What i do wrong?
Music mMusic;
if(!mMusic.openFromFile("sounds/mMusic.mid"))
        return EXIT_FAILURE;
 

G.

  • Hero Member
  • *****
  • Posts: 1593
    • View Profile
Re: Music doesn't work
« Reply #1 on: November 20, 2013, 04:44:43 pm »

glu4it

  • Newbie
  • *
  • Posts: 9
    • View Profile
Re: Music doesn't work
« Reply #2 on: November 20, 2013, 04:49:51 pm »
Supported formats.
Thank you!

UPD
Music mMusic;
        if(!mMusic.openFromFile("sounds/mMusic.ogg"))
                return EXIT_FAILURE;
        mMusic.play();
Recoded to ogg and it still does not work.
« Last Edit: November 20, 2013, 05:04:43 pm by glu4it »

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Re: Music doesn't work
« Reply #3 on: November 20, 2013, 05:49:05 pm »
Please read this thread and provide a meaningful problem description.
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

glu4it

  • Newbie
  • *
  • Posts: 9
    • View Profile
Re: Music doesn't work
« Reply #4 on: November 20, 2013, 06:28:58 pm »
I use Microsoft Visual Studio 2008, SFML 2.1, Windows 7.
I also tried to change code to
SoundBuffer buffer;
        if(!buffer.loadFromFile("sounds/171673__fins__failure-1.wav"))
                return EXIT_FAILURE;
        Sound sound;
        sound.setBuffer(buffer);
            sound.play();
 

In this case, the music is not playing, but the game does not break
« Last Edit: November 20, 2013, 06:32:26 pm by glu4it »

glu4it

  • Newbie
  • *
  • Posts: 9
    • View Profile
Re: Music doesn't work
« Reply #5 on: November 20, 2013, 08:09:24 pm »
I noticed that in the console there is the following message:
"Failed to open the audio device"