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

Author Topic: Getting notification when music ends  (Read 2709 times)

0 Members and 1 Guest are viewing this topic.

Dipper

  • Newbie
  • *
  • Posts: 3
    • View Profile
    • My projects
Getting notification when music ends
« on: April 24, 2015, 01:00:11 pm »
I plan to use SFML to play audio in my music player and now I'm wondering if there's an option to be notified about the end of the track (using sf::Music). I thinking of a callback or similar.
It would help a lot with the implementation of a playlist.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11032
    • View Profile
    • development blog
    • Email
Re: Getting notification when music ends
« Reply #1 on: April 24, 2015, 01:07:12 pm »
If the documentation doesn't have it, then SFML doesn't have it. ;)

So no, SFML doesn't work with callbacks, you'll have to poll the status.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Dipper

  • Newbie
  • *
  • Posts: 3
    • View Profile
    • My projects
Re: Getting notification when music ends
« Reply #2 on: April 24, 2015, 01:16:50 pm »
Are you suggesting to create a different thread and check the status every n ms?

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Re: Getting notification when music ends
« Reply #3 on: April 24, 2015, 01:26:03 pm »
It needn't be a separate thread, you can do it as part of your main loop update.
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

 

anything