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

Author Topic: Music hangs on setPlayingOffset  (Read 2796 times)

0 Members and 1 Guest are viewing this topic.

nimn

  • Newbie
  • *
  • Posts: 13
    • View Profile
Music hangs on setPlayingOffset
« on: November 28, 2017, 05:14:29 am »
morning,

I have sound and music playing, my problem is that when setPlayingOffset is called it hangs for about .25 seconds and then plays from that location. The location it plays from is good, but i get about a quarter second of silence. I am using it as music in a small array for actual music, rain and anything else that may arise.

I've done some googling but cant find anything... any ideas?

The Below are c+p'ed from multiple places - hope its coherent
sf::Music music[3];

void Soundtrack::musicreconciliation(ENV &env, int i) {
        if (env.musicbuffername[i] == "4 Overworld") {
                env.music[i].setPlayingOffset(sf::Time(sf::milliseconds(7000)));
                env.musicbufferduration[i] = 4250; //frames to be expired before calling this func again
        }
        else if (env.musicbuffername[i] == "rain") {
                env.music[i].setPlayingOffset(sf::Time(sf::milliseconds(2000)));
                env.musicbufferduration[i] = 120;
        }
}

 

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: Music hangs on setPlayingOffset
« Reply #1 on: November 28, 2017, 08:21:26 am »
What SFML version? What OS?
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

nimn

  • Newbie
  • *
  • Posts: 13
    • View Profile
Re: Music hangs on setPlayingOffset
« Reply #2 on: November 28, 2017, 09:03:34 pm »
howdy

SFML 2.4.2
Windows 7 64 sp1
Visual Studio Community '17

additionally i should make it clear that the game does not hang, it seems to progress at regular speed, but the sound is delayed a bit before playing from defined location. I've tried defining with millisecond & seconds. I take it this is not expected - not just closing and opening the source? The source is 1396kB and wav format 1:29s long. I think I have pretty well emulated known-working code provided on youtube videos and such but am getting this hang on different files and defining with SFML sound and music.

Please let me know if more code would help


nimn

  • Newbie
  • *
  • Posts: 13
    • View Profile
Re: Music hangs on setPlayingOffset
« Reply #3 on: December 01, 2017, 07:08:24 am »
Disregard - I got it working last night after building it out with some more planning
Not sure what the problem was, no changes in paradigm but is working currently

thanks

 

anything