Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6232 for code


Ignore:
Timestamp:
Dec 3, 2009, 7:48:42 PM (15 years ago)
Author:
rgrieder
Message:

Fixed two problems in the sound system: Buffers did not get removed from the list in the SoundManager and failed creation was not caught.

Location:
code/branches/presentation2/src/orxonox/sound
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • code/branches/presentation2/src/orxonox/sound/BaseSound.cc

    r6222 r6232  
    170170
    171171        this->source_ = source;
    172         if (source_.empty()) 
     172        if (source_.empty())
    173173            return;
    174174
  • code/branches/presentation2/src/orxonox/sound/SoundBuffer.cc

    r6203 r6232  
    8181
    8282        if (this->audioBuffer_ == AL_NONE)
    83             ThrowException(General, "Sound: Standard file loader failed: " << alutGetErrorString(alutGetError()));
     83            ThrowException(General, "Sound Error: Standard file loader failed: " << alutGetErrorString(alutGetError()));
    8484    }
    8585
     
    127127            COUT(2) << "Sound: libvorbisfile: File does not seem to be an Ogg Vorbis bitstream" << std::endl;
    128128            ov_clear(&vf);
    129             ThrowException(General, "Sound: Ogg file loader failed when opening the bitstream");
     129            ThrowException(General, "Sound Error: Ogg file loader failed when opening the bitstream");
    130130        }
    131131
     
    143143                COUT(2) << "Sound: libvorbisfile: error reading the file" << std::endl;
    144144                ov_clear(&vf);
    145                 ThrowException(General, "Sound: Ogg file loader failed when decoding the file");
     145                ThrowException(General, "Sound Error: Ogg file loader failed when decoding the file");
    146146            }
    147147            else
  • code/branches/presentation2/src/orxonox/sound/SoundManager.cc

    r6208 r6232  
    484484        else
    485485        {
    486             shared_ptr<SoundBuffer> buffer(new SoundBuffer(fileInfo));
     486            shared_ptr<SoundBuffer> buffer;
     487            try
     488            {
     489                buffer.reset(new SoundBuffer(fileInfo));
     490            }
     491            catch (...)
     492            {
     493                COUT(1) << Exception::handleMessage() << std::endl;
     494                return shared_ptr<SoundBuffer>();
     495            }
    487496            this->soundBuffers_[fileInfo->group + '/' + fileInfo->filename] = buffer;
    488497            return buffer;
     
    494503        std::map<std::string, weak_ptr<SoundBuffer> >::iterator it
    495504            = this->soundBuffers_.find(fileInfo->group + '/' + fileInfo->filename);
    496         if (it == this->soundBuffers_.end())
     505        if (it != this->soundBuffers_.end())
    497506            this->soundBuffers_.erase(it);
    498507    }
Note: See TracChangeset for help on using the changeset viewer.