streaming oggs

9275cef0ad2f15ec1813d63b0c5b0fad
0
rogerdv 101 May 07, 2004 at 15:19

I tried to adapt the example in the ogg streaming article to my game. But in my project, I cant use the loop while(stream.update), I have to call update from my main game loop. But it doesnt works, simply plays a second of music and the buffrs is not updated anymore. Can somebody give me an idea?

2 Replies

Please log in or register to post a reply.

9abb86727d07673e9bb13c8064654ff7
0
mario__ 101 Jul 10, 2004 at 12:58

i can help you, put the update into a principal loop
the code for the funtion is
int processed;
bool active = true;

alGetSourcei(m_OggSource, AL_BUFFERS_PROCESSED, &processed);

while(processed–)
{
ALuint buffer;
cout << “procced: “<< processed << endl;
alSourceUnqueueBuffers(m_OggSource, 1, &buffer);

if(alGetError() != AL_NO_ERROR) {
return false;
}

active = OxOggStream(buffer);

alSourceQueueBuffers(m_OggSource, 1, &buffer);

if(alGetError() != AL_NO_ERROR) {
return false;
}
cout << “active: “<< active << endl;
}

return active;
if you have a problem with the sound try to change the buffer value

9275cef0ad2f15ec1813d63b0c5b0fad
0
rogerdv 101 Jul 10, 2004 at 13:26

Here is the code:
alGetSourcei(source, AL_BUFFERS_PROCESSED, &processed);
cout << “Processed “<<processed<<endl;
while(processed–)
{
ALuint buffer;
cout << “proced: “<<processed << endl;
alSourceUnqueueBuffers(source, 1, &buffer);
if (alGetError!=AL_NO_ERROR) { return false;}
//check();

active = stream(buffer);

alSourceQueueBuffers(source, 1, &buffer);
if (alGetError!=AL_NO_ERROR) { return false;}
//check();
cout <<“Active “<<active <<endl;
}

I just hear half second of music. Here is the output
Processed 2
proced: 1
Processed 1
proced: 0
Processed 0
Processed 0
Processed 0
Processed 0

As you can see, after the first call, all next returns 0 in processed, so, the app never enters the loop.