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

Author Topic: Keeping a single song playing throughout different states  (Read 2643 times)

0 Members and 1 Guest are viewing this topic.

The Terminator

  • Full Member
  • ***
  • Posts: 224
  • Windows and Mac C++ Developer
    • View Profile
Keeping a single song playing throughout different states
« on: December 03, 2012, 01:25:37 am »
I'm having a bit of trouble regarding music. I want a single song to keep playing throughout my whole states. I have attempted to use getPlayingOffset to get the current time, and then pausing it temporarily until it switches states, in which another method will resume the music. However, when I attempt to do this, the music refuses to play and spits out "Failed to play audio stream: sound parameters have not been initialized (call initialized first). Any help explaining the error is much appreciated.
Current Projects:
Technoport

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11039
    • View Profile
    • development blog
    • Email
Re: Keeping a single song playing throughout different states
« Reply #1 on: December 03, 2012, 01:53:43 am »
An easy solution would be to play the song in the application/GameEngine class. ;)

As for the error, who does have the ownership over the sf::Music resource?
Maybe providing code could help to understand the problem. ;)
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: Keeping a single song playing throughout different states
« Reply #2 on: December 03, 2012, 04:43:30 am »
Your first solution worked, Do'h!! :P thanks a lot
Current Projects:
Technoport

 

anything