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

Author Topic: [SOLVED] I can't play music  (Read 2072 times)

0 Members and 1 Guest are viewing this topic.

CytraL

  • Jr. Member
  • **
  • Posts: 68
    • View Profile
    • GitHub
[SOLVED] I can't play music
« on: May 10, 2013, 06:25:48 pm »
Hi! I've never had problems playing sounds but with 2.0 yes.. xDD

Code: [Select]
    sf::Music musicIntro;
    if (musicIntro.openFromFile("sonidos/intro.ogg"))
    {
        //musicIntro.setPitch(1.0f);
        //musicIntro.setVolume(100);
        musicIntro.play();
    }

I try with .wav and .ogg... Can found the sound here: http://soundbible.com/1563-Pacman-Introduction-Music.html

P.S: SFML not show errors in console..
P.S 2: Sry for my bad english :d

-------------------

Yes... i know.... omg.... xDD
« Last Edit: May 10, 2013, 07:34:39 pm by CytraL »
dev@redneboa.es | WordPress | GitHub | YouTube

Grimshaw

  • Hero Member
  • *****
  • Posts: 631
  • Nephilim SDK
    • View Profile
Re: I can't play music
« Reply #1 on: May 10, 2013, 07:19:44 pm »
You re doing that code in a local scope, like a function or something. When that function ends, the sf::Music object is destroyed and you don't get to hear anything.

Define sf::Music in a place that it will remain alive for longer time

CytraL

  • Jr. Member
  • **
  • Posts: 68
    • View Profile
    • GitHub
Re: I can't play music
« Reply #2 on: May 10, 2013, 07:27:12 pm »
Fuuuuuuu.... sry sry sry sry sry sry sry sry sry xDDDDD
dev@redneboa.es | WordPress | GitHub | YouTube

 

anything