Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Mar 11, 2010, 3:16:12 PM (15 years ago)
Author:
scheusso
Message:

merged sound4 into sound5

Location:
code/branches/sound5
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/branches/sound5

  • code/branches/sound5/src/orxonox/sound/SoundManager.cc

    r6417 r6506  
    4343#include "core/ScopedSingletonManager.h"
    4444#include "core/Resource.h"
    45 #include "SoundBuffer.h"
     45#include "SoundBuffer.h":
    4646#include "BaseSound.h"
    4747#include "AmbientSound.h"
     
    5252    ManageScopedSingleton(SoundManager, ScopeID::Graphics, true);
    5353
    54     std::string SoundManager::getALErrorString(ALenum code)
     54    // From SoundPrereqs.h
     55    std::string getALErrorString(ALenum code)
    5556    {
    5657        switch (code)
     
    7879
    7980        if (!alutInitWithoutContext(NULL, NULL))
    80             ThrowException(InitialisationFailed, "Sound Error: ALUT initialisation failed: " << alutGetErrorString(alutGetError()));
     81            ThrowException(InitialisationFailed, "Sound: Error: ALUT initialisation failed: " << alutGetErrorString(alutGetError()));
    8182        Loki::ScopeGuard alutExitGuard = Loki::MakeGuard(&alutExit);
    8283
     
    110111            COUT(1) << "Sound: Just getting the DLL with the dependencies is not enough for Windows (esp. Windows 7)!" << std::endl;
    111112#endif
    112             ThrowException(InitialisationFailed, "Sound Error: Could not open sound device.");
     113            ThrowException(InitialisationFailed, "Sound: Error: Could not open sound device.");
    113114        }
    114115        Loki::ScopeGuard closeDeviceGuard = Loki::MakeGuard(&alcCloseDevice, this->device_);
     
    117118        this->context_ = alcCreateContext(this->device_, NULL);
    118119        if (this->context_ == NULL)
    119             ThrowException(InitialisationFailed, "Sound Error: Could not create ALC context");
     120            ThrowException(InitialisationFailed, "Sound: Error: Could not create ALC context");
    120121        Loki::ScopeGuard desroyContextGuard = Loki::MakeGuard(&alcDestroyContext, this->context_);
    121122        if (!alcMakeContextCurrent(this->context_))
    122             ThrowException(InitialisationFailed, "Sound Error: Could not use ALC context");
     123            ThrowException(InitialisationFailed, "Sound: Error: Could not use ALC context");
    123124
    124125        GameMode::setPlaysSound(true);
     
    133134            COUT(4) << "Sound: --- Supported MIME Types: " << types << std::endl;
    134135        else
    135             COUT(2) << "Sound Warning: MIME Type retrieval failed: " << alutGetErrorString(alutGetError()) << std::endl;
     136            COUT(2) << "Sound: Warning: MIME Type retrieval failed: " << alutGetErrorString(alutGetError()) << std::endl;
    136137
    137138        this->mute_[SoundType::All]     = 1.0f;
     
    147148            this->availableSoundSources_.push_back(source);
    148149        else
    149             ThrowException(InitialisationFailed, "Sound Error: Could not create even a single source");
     150            ThrowException(InitialisationFailed, "Sound: Error: Could not create even a single source");
    150151        // Create a few initial sources
    151152        this->createSoundSources(this->minSources_ - 1);
     
    168169        // If there are still used buffers around, well, that's just very bad...
    169170        if (this->soundBuffers_.size() != this->effectsPool_.size())
    170             COUT(1) << "Sound Error: Some sound buffers are still in use but OpenAL is about to shut down. Fix this!" << std::endl;
     171            COUT(1) << "Sound: Error: Some sound buffers are still in use but OpenAL is about to shut down. Fix this!" << std::endl;
    171172        // Empty buffer pool and buffer list
    172173        this->effectsPool_.clear();
     
    175176        // There should not be any sources in use anymore
    176177        if (!this->usedSoundSources_.empty())
    177             COUT(1) << "Sound Error: Some sound sources are still in use but OpenAL is about to shut down. Fix this!" << std::endl;
     178            COUT(1) << "Sound: Error: Some sound sources are still in use but OpenAL is about to shut down. Fix this!" << std::endl;
    178179        while (!this->availableSoundSources_.empty())
    179180        {
     
    186187        // Relieve context to destroy it
    187188        if (!alcMakeContextCurrent(NULL))
    188             COUT(1) << "Sound Error: Could not unset ALC context" << std::endl;
     189            COUT(1) << "Sound: Error: Could not unset ALC context" << std::endl;
    189190        alcDestroyContext(this->context_);
    190191        if (ALCenum error = alcGetError(this->device_))
    191192        {
    192193            if (error == AL_INVALID_OPERATION)
    193                 COUT(1) << "Sound Error: Could not destroy ALC context because it is the current one" << std::endl;
     194                COUT(1) << "Sound: Error: Could not destroy ALC context because it is the current one" << std::endl;
    194195            else
    195                 COUT(1) << "Sound Error: Could not destroy ALC context because it is invalid" << std::endl;
     196                COUT(1) << "Sound: Error: Could not destroy ALC context because it is invalid" << std::endl;
    196197        }
    197198#ifdef AL_VERSION_1_1
    198199        if (!alcCloseDevice(this->device_))
    199             COUT(1) << "Sound Error: Could not destroy ALC device. This might be because there are still buffers in use!" << std::endl;
     200            COUT(1) << "Sound: Error: Could not destroy ALC device. This might be because there are still buffers in use!" << std::endl;
    200201#else
    201202        alcCloseDevice(this->device_);
    202203#endif
    203204        if (!alutExit())
    204             COUT(1) << "Sound Error: Closing ALUT failed: " << alutGetErrorString(alutGetError()) << std::endl;
     205            COUT(1) << "Sound: Error: Closing ALUT failed: " << alutGetErrorString(alutGetError()) << std::endl;
    205206    }
    206207
     
    248249        if (crossFadeStep_ <= 0.0 || crossFadeStep_ >= 1.0 )
    249250        {
    250             COUT(2) << "Sound warning: fade step out of range, ignoring change." << std::endl;
     251            COUT(2) << "Sound: Warning: fade step out of range, ignoring change." << std::endl;
    251252            ResetConfigValue(crossFadeStep_);
    252253        }
     
    257258        float clampedVolume = clamp(this->volume_[type], 0.0f, 1.0f);
    258259        if (clampedVolume != this->volume_[type])
    259             COUT(2) << "Sound warning: Volume setting (" << type << ") out of range, clamping." << std::endl;
     260            COUT(2) << "Sound: Warning: Volume setting (" << type << ") out of range, clamping." << std::endl;
    260261        this->updateVolume(type);
    261262    }
     
    349350                if (it->first == newAmbient)
    350351                {
    351                     COUT(2) << "Sound warning: Will not play an AmbientSound twice." << std::endl;
     352                    COUT(2) << "Sound: Warning: Will not play an AmbientSound twice." << std::endl;
    352353                    return;
    353354                }
     
    617618            alDeleteSources(1, &this->availableSoundSources_.back());
    618619            if (alGetError())
    619                 COUT(1) << "Sound Error: Failed to delete a source --> lost forever" << std::endl;
     620                COUT(1) << "Sound: Error: Failed to delete a source --> lost forever" << std::endl;
    620621            this->availableSoundSources_.pop_back();
    621622        }
Note: See TracChangeset for help on using the changeset viewer.