Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7301 in orxonox.OLD for trunk/src/lib/sound/ogg_player.cc


Ignore:
Timestamp:
Apr 16, 2006, 7:51:18 PM (18 years ago)
Author:
bensch
Message:

less debug, and music should rewind now

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/sound/ogg_player.cc

    r7299 r7301  
    6969  if (this->buffers[0] != 0 && this->buffers[1] != 0)
    7070    state |= BuffersAllocated;
    71   else  {
     71  else
     72  {
    7273    PRINTF(2)("Unable to allocate al-Buffers\n");
    7374    this->release();
     
    252253  if (unlikely(!(this->state & Playing)))
    253254    return false;
    254   char pcm[BUFFER_SIZE];
     255  char pcm[OGG_PLAYER_BUFFER_SIZE];
    255256  int  size = 0;
    256257  int  section;
    257258  int  result;
    258259
    259   while(size < BUFFER_SIZE)
    260   {
    261     result = ov_read(&oggStream, pcm + size, BUFFER_SIZE - size, 0, 2, 1, &section);
     260  while(size < OGG_PLAYER_BUFFER_SIZE)
     261  {
     262    result = ov_read(&this->oggStream, pcm + size, OGG_PLAYER_BUFFER_SIZE - size, 0, 2, 1, &section);
    262263
    263264    if(result > 0)
    264265      size += result;
    265     else
    266       if(result < 0)
    267         throw errorString(result);
    268       else
    269         break;
     266    else if(result < 0)
     267      throw errorString(result);
     268    else /* eof */
     269      ov_time_seek(&this->oggStream, 0.0);
    270270  }
    271271
     
    327327  PRINTF(0)("OggPlayer is in the following States: ");
    328328  if (this->state & FileOpened)
    329       PRINT(0)("FileOpened ");
     329    PRINT(0)("FileOpened ");
    330330  if (this->state & SourceAllocated)
    331331    PRINT(0)("SourceAllocated ");
Note: See TracChangeset for help on using the changeset viewer.