1
Audio / Sound randomly stops playing
« on: October 18, 2016, 01:20:30 am »
Hi, I think I found the problem of sfml sounds or something with what...
Lets say, I have explosion1..5.wav sounds which's length is 4seconds.
In example:
I have the sound buffer array with 5 elements
Then, I have another array of the objects(classes), with sf::Sound variable...
Every sf::Sound has its own buffer
Now, the intresting part:
For the first object i writing sounds[0].play()... Then - "Sleep(3000)"
And then next object starting to play... But only 1sec... Not 4 as it should... Why ?
The sound randomly stops and that's it...
The sequence:
sound[0].play(); (4s of the explosion sound...)
Sleep(3000) (1s left of playing sound for sound[0])
sound[1].play(); (4s of the explosion sound...)
<sound[1] stops after 1 second>
Sleep(3000) (randomly 2 seconds of "nothing")
sound[2].play();
Sleep(3000) (again everything is good, 1s left for sound[2])
sound[3].play() (again, sound[3] stops after 1 second...)
Why this is happening? How to fix that?
Lets say, I have explosion1..5.wav sounds which's length is 4seconds.
In example:
I have the sound buffer array with 5 elements
Then, I have another array of the objects(classes), with sf::Sound variable...
Every sf::Sound has its own buffer
Now, the intresting part:
For the first object i writing sounds[0].play()... Then - "Sleep(3000)"
And then next object starting to play... But only 1sec... Not 4 as it should... Why ?
The sound randomly stops and that's it...
The sequence:
sound[0].play(); (4s of the explosion sound...)
Sleep(3000) (1s left of playing sound for sound[0])
sound[1].play(); (4s of the explosion sound...)
<sound[1] stops after 1 second>
Sleep(3000) (randomly 2 seconds of "nothing")
sound[2].play();
Sleep(3000) (again everything is good, 1s left for sound[2])
sound[3].play() (again, sound[3] stops after 1 second...)
Why this is happening? How to fix that?