Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 2998


Ignore:
Timestamp:
May 20, 2009, 8:31:23 PM (15 years ago)
Author:
erwin
Message:

fixed some bugs

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

Legend:

Unmodified
Added
Removed
  • code/branches/sound/src/orxonox/objects/items/Engine.cc

    r2982 r2998  
    226226        this->ship_ = ship;
    227227
    228         if(this->sound_ != NULL)
    229             this->sound_->attachToEntity(ship);
    230 
    231228        if (ship)
    232229        {
     
    240237                this->boostBlur_ = 0;
    241238            }
     239
     240            if(this->sound_ != NULL)
     241                this->sound_->attachToEntity(ship);
    242242        }
    243243    }
  • code/branches/sound/src/orxonox/sound/SoundBase.cc

    r2984 r2998  
    134134    bool SoundBase::loadFile(std::string filename) {
    135135        filename = Core::getMediaPathString() + "/audio/" + filename;
     136
     137        if(!SoundBase::soundmanager_s->isSoundAvailable())
     138        {
     139            COUT(3) << "Sound: not available, skipping " << filename << std::endl;
     140            return false;
     141        }
     142
    136143        COUT(3) << "Sound: OpenAL ALUT: loading file " << filename << std::endl;
    137144        this->buffer_ = alutCreateBufferFromFile(filename.c_str());
  • code/branches/sound/src/orxonox/sound/SoundManager.cc

    r2984 r2998  
    4444    SoundManager::SoundManager()
    4545    {
     46        this->soundavailable_ = true;
    4647        if(!alutInitWithoutContext(NULL,NULL))
    4748        {
    4849            COUT(2) << "Sound: OpenAL ALUT: " << alutGetErrorString(alutGetError()) << std::endl;
     50            this->soundavailable_ = false;
    4951        }
    5052        else
     
    6163            {
    6264                COUT(2) << "Sound: OpenAL: Could not open sound device" << std::endl;
     65                this->soundavailable_ = false;
    6366            }
    6467            else
     
    6972                {
    7073                    COUT(2) << "Sound: OpenAL: Could not create sound context" << std::endl;
     74                    this->soundavailable_ = false;
    7175                }
    7276                else
     
    146150            (*i)->update();
    147151    }
     152   
     153    /**
     154    * Check if sound is available
     155    */
     156    bool SoundManager::isSoundAvailable()
     157    {
     158        return this->soundavailable_;
     159    }
    148160}
  • code/branches/sound/src/orxonox/sound/SoundManager.h

    r2966 r2998  
    5050        void addSound(SoundBase* sound);
    5151        void removeSound(SoundBase* sound);
    52 
    5352        virtual void tick(float dt);
     53        bool isSoundAvailable();
    5454
    5555    private:
     
    5757        ALCcontext* context_;
    5858        std::list<SoundBase*> soundlist_;
     59        bool soundavailable_;
    5960
    6061    }; // class SoundManager
Note: See TracChangeset for help on using the changeset viewer.