Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Commit before rebase, attempt to fix everything ;-)

Location:
code/branches/sound4/src/orxonox/sound
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • code/branches/sound4/src/orxonox/sound/AmbientSound.cc

    r6476 r6504  
    172172
    173173        this->soundstreamthread_ = boost::thread(SoundStreamer(), this->audioSource_, dataStream);
     174        this->initialiseSource();
     175    }
     176
     177    void AmbientSound::doStop()
     178    {
     179        SUPER(AmbientSound, doStop);
     180        this->soundstreamthread_.interrupt();
    174181    }
    175182}
  • code/branches/sound4/src/orxonox/sound/AmbientSound.h

    r6476 r6504  
    7373        ~AmbientSound() { }
    7474
     75        void doPlay();
     76        void doStop();
     77
    7578    private:
    7679        void preDestroy();
  • code/branches/sound4/src/orxonox/sound/BaseSound.cc

    r6435 r6504  
    141141        alSource3f(this->audioSource_, AL_DIRECTION, 0, 0, 0);
    142142        if (ALint error = alGetError())
    143             COUT(2) << "Sound Warning: Setting source parameters to 0 failed: " << getALErrorString(error) << std::endl;
     143            COUT(2) << "Sound: Warning: Setting source parameters to 0 failed: " << getALErrorString(error) << std::endl;
    144144        assert(this->soundBuffer_ != NULL);
    145145        alSourcei(this->audioSource_, AL_BUFFER, this->soundBuffer_->getBuffer());
    146146        if (ALuint error = alGetError())
    147             COUT(1) << "Sound Error: Could not set buffer \"" << this->source_ << "\": " << getALErrorString(error) << std::endl;
     147            COUT(1) << "Sound: Error: Could not set buffer \"" << this->source_ << "\": " << getALErrorString(error) << std::endl;
    148148    }
    149149
     
    152152        this->volume_ = clamp(vol, 0.0f, 1.0f);
    153153        if (this->volume_ != vol)
    154             COUT(2) << "Sound warning: volume out of range, clamping value." << std::endl;
     154            COUT(2) << "Sound: Warning: volume out of range, clamping value." << std::endl;
    155155        this->updateVolume();
    156156    }
     
    178178        if (pitch > 2 || pitch < 0.5)
    179179        {
    180             COUT(2) << "Sound warning: pitch out of range, cropping value." << std::endl;
     180            COUT(2) << "Sound: Warning: pitch out of range, cropping value." << std::endl;
    181181            pitch = pitch > 2 ? 2 : pitch;
    182182            pitch = pitch < 0.5 ? 0.5 : pitch;
     
    232232            if (ALuint error = alGetError())
    233233            {
    234                 COUT(1) << "Sound Error: Could not set buffer \"" << source << "\": " << getALErrorString(error) << std::endl;
     234                COUT(1) << "Sound: Error: Could not set buffer \"" << source << "\": " << getALErrorString(error) << std::endl;
    235235                return;
    236236            }
  • code/branches/sound4/src/orxonox/sound/SoundManager.cc

    r6435 r6504  
    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"
     
    7979
    8080        if (!alutInitWithoutContext(NULL, NULL))
    81             ThrowException(InitialisationFailed, "Sound Error: ALUT initialisation failed: " << alutGetErrorString(alutGetError()));
     81            ThrowException(InitialisationFailed, "Sound: Error: ALUT initialisation failed: " << alutGetErrorString(alutGetError()));
    8282        Loki::ScopeGuard alutExitGuard = Loki::MakeGuard(&alutExit);
    8383
     
    111111            COUT(1) << "Sound: Just getting the DLL with the dependencies is not enough for Windows (esp. Windows 7)!" << std::endl;
    112112#endif
    113             ThrowException(InitialisationFailed, "Sound Error: Could not open sound device.");
     113            ThrowException(InitialisationFailed, "Sound: Error: Could not open sound device.");
    114114        }
    115115        Loki::ScopeGuard closeDeviceGuard = Loki::MakeGuard(&alcCloseDevice, this->device_);
     
    118118        this->context_ = alcCreateContext(this->device_, NULL);
    119119        if (this->context_ == NULL)
    120             ThrowException(InitialisationFailed, "Sound Error: Could not create ALC context");
     120            ThrowException(InitialisationFailed, "Sound: Error: Could not create ALC context");
    121121        Loki::ScopeGuard desroyContextGuard = Loki::MakeGuard(&alcDestroyContext, this->context_);
    122122        if (!alcMakeContextCurrent(this->context_))
    123             ThrowException(InitialisationFailed, "Sound Error: Could not use ALC context");
     123            ThrowException(InitialisationFailed, "Sound: Error: Could not use ALC context");
    124124
    125125        GameMode::setPlaysSound(true);
     
    134134            COUT(4) << "Sound: --- Supported MIME Types: " << types << std::endl;
    135135        else
    136             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;
    137137
    138138        this->mute_[SoundType::All]     = 1.0f;
     
    148148            this->availableSoundSources_.push_back(source);
    149149        else
    150             ThrowException(InitialisationFailed, "Sound Error: Could not create even a single source");
     150            ThrowException(InitialisationFailed, "Sound: Error: Could not create even a single source");
    151151        // Create a few initial sources
    152152        this->createSoundSources(this->minSources_ - 1);
     
    169169        // If there are still used buffers around, well, that's just very bad...
    170170        if (this->soundBuffers_.size() != this->effectsPool_.size())
    171             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;
    172172        // Empty buffer pool and buffer list
    173173        this->effectsPool_.clear();
     
    176176        // There should not be any sources in use anymore
    177177        if (!this->usedSoundSources_.empty())
    178             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;
    179179        while (!this->availableSoundSources_.empty())
    180180        {
     
    187187        // Relieve context to destroy it
    188188        if (!alcMakeContextCurrent(NULL))
    189             COUT(1) << "Sound Error: Could not unset ALC context" << std::endl;
     189            COUT(1) << "Sound: Error: Could not unset ALC context" << std::endl;
    190190        alcDestroyContext(this->context_);
    191191        if (ALCenum error = alcGetError(this->device_))
    192192        {
    193193            if (error == AL_INVALID_OPERATION)
    194                 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;
    195195            else
    196                 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;
    197197        }
    198198#ifdef AL_VERSION_1_1
    199199        if (!alcCloseDevice(this->device_))
    200             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;
    201201#else
    202202        alcCloseDevice(this->device_);
    203203#endif
    204204        if (!alutExit())
    205             COUT(1) << "Sound Error: Closing ALUT failed: " << alutGetErrorString(alutGetError()) << std::endl;
     205            COUT(1) << "Sound: Error: Closing ALUT failed: " << alutGetErrorString(alutGetError()) << std::endl;
    206206    }
    207207
     
    249249        if (crossFadeStep_ <= 0.0 || crossFadeStep_ >= 1.0 )
    250250        {
    251             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;
    252252            ResetConfigValue(crossFadeStep_);
    253253        }
     
    258258        float clampedVolume = clamp(this->volume_[type], 0.0f, 1.0f);
    259259        if (clampedVolume != this->volume_[type])
    260             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;
    261261        this->updateVolume(type);
    262262    }
     
    350350                if (it->first == newAmbient)
    351351                {
    352                     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;
    353353                    return;
    354354                }
     
    618618            alDeleteSources(1, &this->availableSoundSources_.back());
    619619            if (alGetError())
    620                 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;
    621621            this->availableSoundSources_.pop_back();
    622622        }
Note: See TracChangeset for help on using the changeset viewer.