View Full Version : streaming oggs
rogerdv
05-07-2004, 08:19 AM
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?
mario++
07-10-2004, 05:58 AM
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
rogerdv
07-10-2004, 06:26 AM
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.
vBulletin, Copyright ©2000-2010, Jelsoft Enterprises Ltd.