Streaming sound stops playing after a second

Ident

31-08-2010 02:32:08

Hello, I try to play my sound file streamed like this:

//Background sound
OgreAL::Sound *bgSound = soundManager->createSound("gameBackgroundSound_1", "../../media/sounds/bgs_1.ogg", true, true);
bgSound->setGain(0.3);
bgSound->setGainScale(0.5);
bgSound->setRelativeToListener(false);
bgSound->play();


However, after the first second of playing it stops and doesn't play anymore. Is this bug known? What am I doing wrong?

The sound works if not being streamed. (But takes longer time to load of course)

Ident

12-09-2010 15:57:47

Okay I managed to "fix" this

It's quite simple - whenever you load something for a long time and the streaming is interrupted it will discontinue. I had a long loading break (2+ sec) which interrupted the sound and it stopped playing then. However this is only the case for STREAMING sounds, other sounds work normally!

I hope this helps somebody who reads this ;)

Phobius

17-09-2010 11:01:35

Yeah, I think this is because the "play" action is registered when the play() call is performed, but then the buffers load, which, if you're preloading the whole thing, takes a while. Then when it finally loads, the time it took to load is skipped to in order to maintain sync.

Ident

09-10-2010 23:42:01

You mean the load time is the time it skips to?

Well i never noticed that it skips anything, hmm. Also I don't undersdtand why this would be a problem. In my project i had to load other things for like 15 sec and then it would make a short noise from the streamed sound and then stop it and never continue. THe play got triggered before i loaded those things.
Sound is on loop.

However, now i got it triggered on a key, and it works every time. I changed nothing but the moment of starting to play the track.


Hmm, I don't really get it. But at leats I know how to get around it now.

Btw. I read somewhere on some forum about OpenAL that streaming stops if there is a longer break. That's how i got to trying this out. Normal sounds play fine.

Streaming is great btw., the song loads in a very short time.

Phobius

15-10-2010 22:59:06

Can you provide a testcase?