Hi...I am using OGG streaming and OpenAL. However, I have a problem. I want to play OGG streams in loop, but when I try to set loop to a source, I find errors. I'm doing like this: when the file finishes, I load and play the file again, but sometimes a lag occurs. My question is: Is there a way to play OGG stream files in loop without this lag?? thanks
OGG Streaming & Loop
Started by darwintn, Mar 16 2004 02:38 PM
5 replies to this topic
#1
Posted 16 March 2004 - 02:38 PM
#2
Posted 16 March 2004 - 03:56 PM
i guess the same way it works for other types of streams, too, but i'm unsure.
then again, waiting for the OGG_EXT would be the most simple solution, hehe.
sorry, i'm not much help, as i don't have much Real Expirience with OpenAL.
then again, waiting for the OGG_EXT would be the most simple solution, hehe.
sorry, i'm not much help, as i don't have much Real Expirience with OpenAL.
davepermen.net
-Loving a Person is having the wish to see this Person happy, no matter what that means to yourself.
-No matter what it means to myself....
-Loving a Person is having the wish to see this Person happy, no matter what that means to yourself.
-No matter what it means to myself....
#3
Posted 16 March 2004 - 07:36 PM
How are you loading your ogg files? Are they from disk or from memory? Im guessing your developing for Win32?
What u need to do (if you are using the ogg vorbis SDK) is to seek back to the begginning of the sample using (if loading the sample form disk) ov_time_seek(oggFileStream, 0) (or which ever seek function you are comfortable using). If loading from memory, then you will need to use your own seek function.
Though what davepermen said is more than true. This will probably be much easier to wait for native ogg vorbis support in the libs, but who knows when thats going to happen for the windows version!
Hope that helps
Spree
What u need to do (if you are using the ogg vorbis SDK) is to seek back to the begginning of the sample using (if loading the sample form disk) ov_time_seek(oggFileStream, 0) (or which ever seek function you are comfortable using). If loading from memory, then you will need to use your own seek function.
Though what davepermen said is more than true. This will probably be much easier to wait for native ogg vorbis support in the libs, but who knows when thats going to happen for the windows version!
Hope that helps
Spree
#4
Posted 28 March 2004 - 02:27 AM
you are aware that when dealing with graphics, you usually use 2 buffers
for my ogg streamer, i too use 2 buffers, and the way it works:
[opening]
1)open ogg
2)load ogg info
3)calculate buffersize
a)get ogg length
b)calculate how many flips are required for a buffersize of 1 meg (u can change it)
c)round up the flipscount and recalculate buffersize
d){gave me headaches} if you are using 2 channel audio, the buffersize should always be even
4) allocate 2 sound buffers and 1 temprary memory buffer
5) decompress
[part 2, playing]
1) play first buffer
2) when playing buffer is finished, play secondary buffer, then load next portion into the previously playing buffer
for looping
a) when having reached end of file your next portion is the beginning of file
for my ogg streamer, i too use 2 buffers, and the way it works:
[opening]
1)open ogg
2)load ogg info
3)calculate buffersize
a)get ogg length
b)calculate how many flips are required for a buffersize of 1 meg (u can change it)
c)round up the flipscount and recalculate buffersize
d){gave me headaches} if you are using 2 channel audio, the buffersize should always be even
4) allocate 2 sound buffers and 1 temprary memory buffer
5) decompress
[part 2, playing]
1) play first buffer
2) when playing buffer is finished, play secondary buffer, then load next portion into the previously playing buffer
for looping
a) when having reached end of file your next portion is the beginning of file
#5
Posted 28 March 2004 - 11:27 AM
When using ogg files, it isn't required to calculate how many buffer re-fills are required. You can easily detect when you have reached the end of the file and (if you have a smallish buffer file about 4096 - 8192 bytes) it takes no time at all to decompress the file and load it so you only need the two buffers, so the memory buffer isnt really needed
Spree
Spree
#6
Posted 28 March 2004 - 10:53 PM
i know that calculating the flipcount isnt necessary but it helps alot
as for the third, memory, buffer
i took it out and am using the buffer provided by dsound->Lock
now my streaming code runs even faster than fmod
as for the third, memory, buffer
i took it out and am using the buffer provided by dsound->Lock
now my streaming code runs even faster than fmod
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users











