Changeset 6412 for code/branches/pickup2/src/orxonox/sound/BaseSound.h
- Timestamp:
- Dec 25, 2009, 1:18:03 PM (15 years ago)
- Location:
- code/branches/pickup2
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/pickup2
- Property svn:mergeinfo changed
-
code/branches/pickup2/src/orxonox/sound/BaseSound.h
r5929 r6412 26 26 * 27 27 */ 28 28 29 #ifndef _BaseSound_H__ 29 30 #define _BaseSound_H__ … … 32 33 33 34 #include <string> 34 #include < OgreSharedPtr.h>35 #include <boost/shared_ptr.hpp> 35 36 #include <OgreDataStream.h> 36 37 #include "core/OrxonoxClass.h" … … 47 48 public: 48 49 BaseSound(); 50 51 void XMLPortExtern(Element& xmlelement, XMLPort::Mode mode); 52 53 virtual void play() { this->doPlay(); } 54 virtual void stop() { this->doStop(); } 55 virtual void pause() { this->doPause(); } 56 57 bool isPlaying() const { return this->state_ == Playing; } 58 bool isPaused() const { return this->state_ == Paused; } 59 bool isStopped() const { return this->state_ == Stopped; } 60 61 virtual void setSource(const std::string& source); 62 virtual const std::string& getSource() const 63 { return this->source_; } 64 65 void setVolume(float vol); 66 float getVolume() const 67 { return this->volume_; } 68 void updateVolume(); 69 70 bool getLooping() const 71 { return this->bLooping_; } 72 void setLooping(bool val); 73 74 float getPitch() const 75 { return this->pitch_; } 76 void setPitch(float pitch); 77 78 protected: 79 enum State 80 { 81 Stopped, 82 Playing, 83 Paused 84 }; 85 49 86 virtual ~BaseSound(); 50 87 51 void play();52 void stop();53 void pause();88 void doPlay(); 89 void doStop(); 90 void doPause(); 54 91 55 bool isPlaying(); 56 bool isPaused(); 57 bool isStopped(); 92 // network callbacks 93 inline void pitchChanged() 94 { this->setPitch(this->pitch_); } 95 inline void loopingChanged() 96 { this->setLooping(this->bLooping_); } 97 inline void volumeChanged() 98 { this->setVolume(this->volume_); } 99 inline void sourceChanged() 100 { this->setSource(this->source_); } 101 void stateChanged(); 58 102 59 v oid setSource(const std::string& source);60 const std::string& getSource() { return this->source_; }103 virtual void initialiseSource(); 104 ALint getSourceState() const; 61 105 62 bool getPlayOnLoad() { return this->bPlayOnLoad_; } 63 void setPlayOnLoad(bool val); 106 virtual float getRealVolume() = 0; 64 107 65 bool getLoop() { return this->bLoop_; } 66 void setLoop(bool val) { this->bLoop_ = val; } 67 68 protected: 69 ALuint loadOggFile(); 70 ALint getSourceState(); 71 72 ALuint audioSource_; 73 ALuint audioBuffer_; 108 ALuint audioSource_; 109 bool bPooling_; 110 shared_ptr<SoundBuffer> soundBuffer_; 111 std::string source_; 112 float volume_; 113 bool bLooping_; 114 State state_; 115 float pitch_; 74 116 75 117 private: 76 std::string source_; 77 bool bPlayOnLoad_; 78 bool bLoop_; 79 DataStreamPtr dataStream_; 118 DataStreamPtr dataStream_; 80 119 }; 81 120 }
Note: See TracChangeset
for help on using the changeset viewer.