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

Author Topic: Music won't work at all  (Read 3943 times)

0 Members and 1 Guest are viewing this topic.

The Terminator

  • Full Member
  • ***
  • Posts: 224
  • Windows and Mac C++ Developer
    • View Profile
Music won't work at all
« on: September 23, 2012, 10:40:26 pm »
Hi, on my game the sf::Music class doesn't seem to be working at all. I get no errors, and my path to the file is correct, but no music is being played. Here's some of my code:

//Main music
sf::Music m_mainMusic;

//Load mainMusic into memory and set some propertie    
m_mainMusic.openFromFile("Resources/japanesemusic.ogg");    
m_mainMusic.setVolume(50);  
m_mainMusic.setLoop(true);    
m_mainMusic.play();

It won't work at all, and I tried using sf::Sound and soundbuffer as well and they didn't work either. Any suggestions?
Current Projects:
Technoport

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11032
    • View Profile
    • development blog
    • Email
Re: Music won't work at all
« Reply #1 on: September 23, 2012, 10:45:24 pm »
'Stupid' questions: Does your audio driver work? I mean can you listen to music with any other application? Or is the default device set wrongly? ;)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

The Terminator

  • Full Member
  • ***
  • Posts: 224
  • Windows and Mac C++ Developer
    • View Profile
Re: Music won't work at all
« Reply #2 on: September 23, 2012, 10:47:23 pm »
Yes, I tested it out the file with Windows Media Player and the sound file worked fine.
Current Projects:
Technoport

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11032
    • View Profile
    • development blog
    • Email
Re: Music won't work at all
« Reply #3 on: September 23, 2012, 10:56:25 pm »
Hmmm, have you tried it with another file than OGG?
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

The Terminator

  • Full Member
  • ***
  • Posts: 224
  • Windows and Mac C++ Developer
    • View Profile
Re: Music won't work at all
« Reply #4 on: September 23, 2012, 10:58:06 pm »
Yes, I tried with .mp3, it worked in Media player, but not with SFML :(
Current Projects:
Technoport

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Re: Music won't work at all
« Reply #5 on: September 23, 2012, 11:16:31 pm »
The mp3 format is not supported by SFML.

Is there a message on the standard output (i.e. console)? Do you even check whether loading succeeds?
« Last Edit: September 23, 2012, 11:18:02 pm by Nexus »
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

The Terminator

  • Full Member
  • ***
  • Posts: 224
  • Windows and Mac C++ Developer
    • View Profile
Re: Music won't work at all
« Reply #6 on: September 24, 2012, 01:08:28 am »
Just tested, it loads correctly, but still won't play the sound. Very frustrating.
Current Projects:
Technoport

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Music won't work at all
« Reply #7 on: September 24, 2012, 08:01:54 am »
Can you show a complete and minimal code that reproduces the problem?
Laurent Gomila - SFML developer

Qix

  • Full Member
  • ***
  • Posts: 139
  • I am Qix!
    • View Profile
    • Natoga Technologies
Re: Music won't work at all
« Reply #8 on: September 28, 2012, 04:53:04 am »
Is `openFromFile` returning true?
~ Qix
Creator of Rippl Studio
Code: [Select]
<danharibo> iostream: I don't do enough drugs to think that's a good idea.

 

anything