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

Author Topic: Negative offset for music, especially when looping ?  (Read 2801 times)

0 Members and 1 Guest are viewing this topic.

ticowiko

  • Newbie
  • *
  • Posts: 2
    • View Profile
    • Email
Negative offset for music, especially when looping ?
« on: October 26, 2023, 12:05:10 am »
Is there any way for music offset to be negative ? I'm especially interested in making this happen when looping music, having a small delay between the end of one loop and the start of the next. I've tried just using a negative offset and this is simply ignored, be it for the initial offset or the looping one :

Quote
  float loopDelay = 5.0f;
  music.setPlayingOffset(sf::seconds(-loopDelay));
  music.setLoopPoints(sf::Music::TimeSpan(sf::seconds(-loopDelay), music.getDuration() + sf::seconds(loopDelay)));
  music.play();

I can implement this myself if needed by managing the looping with custom code, but I was curious if this was available out of the box as this doesn't seem too niche of a feature.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11028
    • View Profile
    • development blog
    • Email
Re: Negative offset for music, especially when looping ?
« Reply #1 on: October 26, 2023, 05:39:53 pm »
No, SFML doesn't offer anything like that.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

ticowiko

  • Newbie
  • *
  • Posts: 2
    • View Profile
    • Email
Re: Negative offset for music, especially when looping ?
« Reply #2 on: October 26, 2023, 05:41:45 pm »
Thanks for the confirmation. Time to roll my own solution then !

 

anything