Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7292 in orxonox.OLD for trunk/src/lib/sound


Ignore:
Timestamp:
Apr 14, 2006, 11:18:42 AM (19 years ago)
Author:
bensch
Message:

better debug, (non-threaded again)

Location:
trunk/src/lib/sound
Files:
3 edited

Legend:

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

    r7290 r7292  
    9999  alSourcei (source, AL_SOURCE_RELATIVE, AL_TRUE      );
    100100  alSourcef (source, AL_GAIN,            SoundEngine::getInstance()->getMusicVolume());
     101  SoundEngine::checkError("OggPlayer::SetSourceProperties", __LINE__);
    101102
    102103  this->trackLoaded = true;
     
    112113    return;
    113114  alSourceStop(source);
     115  SoundEngine::checkError("OggPlayer::release()::alSourceStop", __LINE__);
    114116  empty();
    115117  SoundEngine::getInstance()->pushALSource(source);
    116118  this->source = 0;
    117   check();
    118119  alDeleteBuffers(2, buffers);
     120  SoundEngine::checkError("OggPlayer::release()::alDeleteBuffers", __LINE__);
    119121  this->buffers[0] = 0;
    120122  this->buffers[1] = 0;
    121   check();
    122123
    123124  ov_clear(&oggStream);
     
    138139    return true;
    139140
    140   if(!stream(buffers[0]))
    141     return false;
    142 
    143   if(!stream(buffers[1]))
    144     return false;
    145 
    146   alSourceQueueBuffers(source, 2, buffers);
    147   alSourcePlay(source);
    148 
     141  if(!stream(buffers[0]) || !stream(buffers[1]))
     142    return false;
     143
     144  alSourceQueueBuffers(this->source, 2, this->buffers);
     145  if (DEBUG >= 3)
     146    SoundEngine::checkError("OggPlayer::playback()::alSourceQueueBuffers", __LINE__);
     147  alSourcePlay(this->source);
     148  if (DEBUG >= 3)
     149    SoundEngine::checkError("OggPlayer::playback()::alSourcePlay", __LINE__);
     150  printf("%d\n", this->source);
    149151  return true;
    150152}
     
    178180
    179181  alGetSourcei(source, AL_BUFFERS_PROCESSED, &processed);
     182  if (DEBUG >= 3)
     183    SoundEngine::checkError("OggPlayer::update()::alGetSourceI", __LINE__);
    180184
    181185  while(processed--)
     
    184188
    185189    alSourceUnqueueBuffers(source, 1, &buffer);
    186     check();
     190    if (DEBUG >= 3)
     191      SoundEngine::checkError("OggPlayer::update()::unqueue", __LINE__);
    187192
    188193    active = stream(buffer);
    189194
    190195    alSourceQueueBuffers(source, 1, &buffer);
    191     check();
     196    if (DEBUG >= 3)
     197      SoundEngine::checkError("OggPlayer::update()::queue", __LINE__);
    192198  }
    193199
     
    226232
    227233  alBufferData(buffer, format, pcm, size, vorbisInfo->rate);
    228   check();
     234  if (DEBUG >= 3)
     235    SoundEngine::checkError("OggPlayer::playback()::BUFFER", __LINE__);
    229236
    230237  return true;
     
    246253
    247254    alSourceUnqueueBuffers(source, 1, &buffer);
    248     check();
     255    SoundEngine::checkError("OggPlayer::empty()::unqueue Buffers", __LINE__);
    249256  }
    250257}
     
    273280}
    274281
    275 /**
    276  * checks for errors
    277  */
    278 void OggPlayer::check()
    279 {
    280   int error = alGetError();
    281   if(error != AL_NO_ERROR)
    282     PRINTF(2)("OpenAL error was raised.");
    283 }
    284282
    285283/**
  • trunk/src/lib/sound/ogg_player.h

    r7287 r7292  
    3838
    3939protected:
    40 
    4140  bool stream(ALuint buffer);
    4241  void empty();
    43   void check();
    4442  const char* errorString(int code);
    4543
  • trunk/src/lib/sound/sound_engine.cc

    r7291 r7292  
    152152    source = this->ALSources.top();
    153153    this->ALSources.pop();
     154    printf("Retrieve Source %d\n", source);
    154155  }
    155156}
Note: See TracChangeset for help on using the changeset viewer.