Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 11, 2009, 2:05:00 AM (15 years ago)
Author:
scheusso
Message:

various fixes for client: NHC, sound, callback handling of Vector4 & Quaternion

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

Legend:

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

    r6307 r6320  
    5858    {
    5959        registerVariable(volume_, ObjectDirection::ToClient, new NetworkCallback<BaseSound>(static_cast<BaseSound*>(this), &BaseSound::volumeChanged));
    60 //         registerVariable(source_, ObjectDirection::ToClient, new NetworkCallback<BaseSound>(static_cast<BaseSound*>(this), &BaseSound::sourceChanged));
    6160        registerVariable(ambientSource_, ObjectDirection::ToClient, new NetworkCallback<AmbientSound>(this, &AmbientSound::ambientSourceChanged));
    6261        registerVariable(bLooping_, ObjectDirection::ToClient, new NetworkCallback<BaseSound>(static_cast<BaseSound*>(this), &BaseSound::loopingChanged));
    6362        registerVariable(pitch_, ObjectDirection::ToClient, new NetworkCallback<BaseSound>(static_cast<BaseSound*>(this), &BaseSound::pitchChanged));
    64         registerVariable((int&)(BaseSound::state_), ObjectDirection::ToClient);
     63        registerVariable((int&)(BaseSound::state_), ObjectDirection::ToClient, new NetworkCallback<BaseSound>(static_cast<BaseSound*>(this), &BaseSound::stateChanged));
    6564    }
    6665
     
    8483            SoundManager::getInstance().registerAmbientSound(this);
    8584        }
     85        else
     86            BaseSound::play();
    8687    }
    8788
     
    9798            SoundManager::getInstance().unregisterAmbientSound(this);
    9899        }
     100        else
     101            BaseSound::stop();
    99102    }
    100103
     
    110113            SoundManager::getInstance().pauseAmbientSound(this);
    111114        }
     115        else
     116            BaseSound::pause();
    112117    }
    113118   
     
    136141    }
    137142
    138     void AmbientSound::changedActivity() 
     143    void AmbientSound::changedActivity()
    139144    {
    140145        SUPER(AmbientSound, changedActivity);
  • code/branches/presentation2/src/orxonox/sound/BaseSound.cc

    r6307 r6320  
    221221            alSourcePause(this->audioSource_);
    222222    }
     223   
     224    void BaseSound::stateChanged()
     225    {
     226        CCOUT(0) << "changed state to " << this->state_ << endl;
     227        switch( this->state_ )
     228        {
     229            case Playing:
     230                this->play();
     231                break;
     232            case Paused:
     233                this->pause();
     234                break;
     235            case Stopped:
     236            default:
     237                this->stop();
     238                break;
     239        }
     240    }
    223241}
  • code/branches/presentation2/src/orxonox/sound/BaseSound.h

    r6307 r6320  
    5959        virtual void pause();
    6060
    61         bool isPlaying() { return this->state_ == Playing; }
    62         bool isPaused()  { return this->state_ == Paused; }
    63         bool isStopped() { return this->state_ == Stopped; }
     61        bool isPlaying() const { return this->state_ == Playing; }
     62        bool isPaused()  const { return this->state_ == Paused; }
     63        bool isStopped() const { return this->state_ == Stopped; }
    6464
    6565        void setPlaying(bool val)
     
    8484        void setPitch(float pitch);
    8585        inline void pitchChanged(){ this->setPitch(this->pitch_); }
     86       
     87        void stateChanged();
    8688
    8789        //ALuint getALAudioSource(void);
  • code/branches/presentation2/src/orxonox/sound/WorldSound.cc

    r6307 r6320  
    6060        registerVariable(source_, ObjectDirection::ToClient, new NetworkCallback<BaseSound>(static_cast<BaseSound*>(this), &BaseSound::sourceChanged));
    6161        registerVariable(bLooping_, ObjectDirection::ToClient, new NetworkCallback<BaseSound>(static_cast<BaseSound*>(this), &BaseSound::loopingChanged));
    62         registerVariable((int&)(BaseSound::state_), ObjectDirection::ToClient);
     62        registerVariable((int&)(BaseSound::state_), ObjectDirection::ToClient, new NetworkCallback<BaseSound>(static_cast<BaseSound*>(this), &BaseSound::stateChanged));
    6363        registerVariable(pitch_, ObjectDirection::ToClient, new NetworkCallback<BaseSound>(static_cast<BaseSound*>(this), &BaseSound::pitchChanged));
    6464    }
Note: See TracChangeset for help on using the changeset viewer.