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?
streaming oggs
Started by rogerdv, May 07 2004 03:19 PM
2 replies to this topic
#2
Posted 10 July 2004 - 12:58 PM
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
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
#3
Posted 10 July 2004 - 01:26 PM
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.
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.
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users












