fix cr/lfs and remove trailing whitespaces...
[supertux.git] / src / audio / stream_sound_source.cpp
index 0cf75b2..958ef6f 100644 (file)
@@ -33,10 +33,14 @@ StreamSoundSource::StreamSoundSource()
 {
   alGenBuffers(STREAMFRAGMENTS, buffers);
   SoundManager::check_al_error("Couldn't allocate audio buffers: ");
+  //add me to update list
+  sound_manager->register_for_update( this );
 }
 
 StreamSoundSource::~StreamSoundSource()
 {
+  //don't update me any longer
+  sound_manager->remove_from_update( this );
   delete file;
   stop();
   alDeleteBuffers(STREAMFRAGMENTS, buffers);
@@ -74,8 +78,8 @@ StreamSoundSource::update()
   if(!playing()) {
     if(processed == 0 || !looping)
       return;
-    
-    // we might have to restart the source if we had a buffer underrun  
+
+    // we might have to restart the source if we had a buffer underrun
     log_info << "Restarting audio source because of buffer underrun" << std::endl;
     play();
   }
@@ -138,4 +142,3 @@ StreamSoundSource::fillBufferAndQueue(ALuint buffer)
   // return false if there aren't more buffers to fill
   return bytesread >= STREAMFRAGMENTSIZE;
 }
-