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

Author Topic: I need Music restarting on an specific offset from 2nd loop  (Read 3456 times)

0 Members and 1 Guest are viewing this topic.

Tigre Pablito

  • Full Member
  • ***
  • Posts: 226
    • View Profile
    • Email
I need Music restarting on an specific offset from 2nd loop
« on: November 12, 2017, 06:10:40 pm »
Hello

Is there an easy way to restart a Music from a specific offset from the 2nd loop?


eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: I need Music restarting on an specific offset from 2nd loop
« Reply #1 on: November 12, 2017, 06:28:47 pm »
Loop points, which will come with SFML 2.5. You could build SFML from source, but then you'd have to manually port it to CSFML and SFML.NET.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Tigre Pablito

  • Full Member
  • ***
  • Posts: 226
    • View Profile
    • Email
Re: I need Music restarting on an specific offset from 2nd loop
« Reply #2 on: November 12, 2017, 06:47:31 pm »
I don't know how to do that ... So I'll have to solve my issue other way and just wait for SFML.Net 2.5

Thanks

Hapax

  • Hero Member
  • *****
  • Posts: 3379
  • My number of posts is shown in hexadecimal.
    • View Profile
    • Links
Re: I need Music restarting on an specific offset from 2nd loop
« Reply #3 on: November 13, 2017, 01:55:37 pm »
One slightly hacky way around this is to manually set the current playing position if it has passed the end of where you want to loop. The most glitch-free way to do this is to calculate how far past the end it is currently and then add the distance from the beginning of where you want it to loop.

Note that this requires that it loops before the end and it works a lot better if the music following the end loop point is identical to what is at the beginning loop point (a sort of buffer of time).
Selba Ward -SFML drawables
Cheese Map -Drawable Layered Tile Map
Kairos -Timing Library
Grambol
 *Hapaxia Links*

Tigre Pablito

  • Full Member
  • ***
  • Posts: 226
    • View Profile
    • Email
Re: I need Music restarting on an specific offset from 2nd loop
« Reply #4 on: November 14, 2017, 02:18:24 am »
Hi Hapax

I don't understand you perfect at all, maybe cos I´m not English native speaker ... ;)

I understood that I have to add the offset from the 2nd loop ... but I would need to check every frame if the music has reached the end  ... or you mean calculating the number of frames from the 2nd starting and the total length, and just use a counter variable? that would be easier once I have got that numbers ...  :P

And also understood that the ending and the new starting have to concur ... I was cutting back the music files so they become smaller size and tried to make the ending points concur with the beggining ones

In addition, by the way, I have been reading, a few days ago, that some members were requiering new strange and not useful at all features for SFML while questionning the SFML developer and I remember that one of them mentioned SDL like saying that it had some thing(s) that SFML didn't, and I remember also that in another board there was one that rebuked the developer saying something like "are you hiding some bad code and want to keep it hidden, Laurent?" ... I WONDER ... if instead of doing such a lot of that silly stuff, we, the SFML community members, concentrate in requiering features like the one on this post that (I suppose) is really useful, and set aside the silly stuff, I think that SFML would grow much faster and would be even greater than what it currently is

And those who don't like SFML or its developer, or SFML doesn't fill their needs, are not forced at all to stay on it ... but, we ask them, please, to let space for matters and requests that have sense ... cos if they are consented and allowed to keep moving, not further than a few weeks they will request a feature that makes their computers automatically wake up when they do, and say "Good morning" in their own respective languages

achpile

  • Full Member
  • ***
  • Posts: 231
    • View Profile
    • Achpile's homepage
    • Email
Re: I need Music restarting on an specific offset from 2nd loop
« Reply #5 on: November 14, 2017, 05:55:01 am »
if (getPos() > endLoop) setPos(startLoop + (getPos() - endLoop))

 

anything