SFML community forums

Help => Audio => Topic started by: nimn on November 28, 2017, 05:14:29 am

Title: Music hangs on setPlayingOffset
Post by: nimn 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;
        }
}

 
Title: Re: Music hangs on setPlayingOffset
Post by: eXpl0it3r on November 28, 2017, 08:21:26 am
What SFML version? What OS?
Title: Re: Music hangs on setPlayingOffset
Post by: nimn 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

Title: Re: Music hangs on setPlayingOffset
Post by: nimn 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