Advertisement

A Problem with OpenAL and Ogg Vorbis

Started by January 13, 2004 09:09 PM
-1 comments, last by strider44 20 years, 10 months ago
I have a pretty annoying problem. I used the tutorials at http://www.devmaster.net/articles.php?catID=6 to create an ogg vorbis class for a demo. The problem is that in this function:

void COGG::EmptyQueue()
{
   int queued;

   alGetSourcei(source, AL_BUFFERS_QUEUED, &queued);

   while(queued-- > 0)
   {
      ALuint buffer;

      alSourceUnqueueBuffers(source, 1, &buffer);
      if(alGetError() != AL_NO_ERROR)
         MessageBox(hWnd, "Unqueue error", "Error", MB_OK);
   }
}
queued seems to be always below 0 on all computers (three computers) I''ve tried, and gives an infinte loop without the queued-- > 0 there. This happens even with a sound blaster live in my computer. Without a SBLive in the others, the following function seems to stuff up as processed is always below 0:

bool COGG::Update()
{
   int processed;
   bool active = true;

   alGetSourcei(source, AL_BUFFERS_PROCESSED, &processed);

   while(processed-- > 0)
   {
      ALuint buffer;

      alSourceUnqueueBuffers(source, 1, &buffer);
      if(alGetError() != AL_NO_ERROR)
         MessageBox(hWnd, "Buffer Unqueue Error", "Error", MB_OK);

      active = Stream(buffer);

      alSourceQueueBuffers(source, 1, &buffer);
      if(alGetError() != AL_NO_ERROR)
         MessageBox(hWnd, "Buffer Queue Error", "Error", MB_OK);
   }

   return active;
}
I changed while(processes--) to while(processes-- > 0) to avoid an infinite loop. I don''t know what alGetSourcei() means really and I''m totally stuck! I''m basically horrifically nervous as the thing is due in two days, can anyone help me? Thanks
The Love Of Trees

This topic is closed to new replies.

Advertisement