Changeset 3055 for code/branches/sound2
- Timestamp:
- May 25, 2009, 1:53:13 PM (16 years ago)
- Location:
- code/branches/sound2/src/orxonox
- Files:
-
- 2 added
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/sound2/src/orxonox/CameraManager.h
r3013 r3055 56 56 57 57 static CameraManager& getInstance() { assert(singletonRef_s); return *singletonRef_s; } 58 static CameraManager* getInstancePtr() { return singletonRef_s; } 58 59 59 60 void useCamera(Ogre::Camera* camera); -
code/branches/sound2/src/orxonox/OrxonoxPrereqs.h
r3013 r3055 253 253 //sound 254 254 class SoundBase; 255 class SoundManger; 255 class SoundManager; 256 class SoundMainMenu; 256 257 } 257 258 -
code/branches/sound2/src/orxonox/gamestates/GSMainMenu.cc
r2957 r3055 40 40 #include "objects/Scene.h" 41 41 #include "GraphicsManager.h" 42 #include "sound/SoundMainMenu.h" 42 43 43 44 namespace orxonox … … 79 80 80 81 InputManager::getInstance().requestEnterState("mainMenu"); 82 83 this->ambient_ = new SoundMainMenu(); 84 this->ambient_->play(true); 81 85 } 82 86 83 87 void GSMainMenu::deactivate() 84 88 { 89 delete this->ambient_; 90 85 91 InputManager::getInstance().requestLeaveState("mainMenu"); 86 92 InputManager::getInstance().requestDestroyState("mainMenu"); -
code/branches/sound2/src/orxonox/gamestates/GSMainMenu.h
r2896 r3055 55 55 // console commands 56 56 ConsoleCommand* ccStartGame_; 57 58 // ambient sound for the main menu 59 SoundMainMenu* ambient_; 57 60 }; 58 61 } -
code/branches/sound2/src/orxonox/sound/CMakeLists.txt
r3013 r3055 2 2 SoundManager.h 3 3 SoundBase.h 4 SoundMainMenu.h 4 5 5 6 SoundManager.cc 6 7 SoundBase.cc 8 SoundMainMenu.cc 7 9 ) 8 10 -
code/branches/sound2/src/orxonox/sound/SoundBase.cc
r3013 r3055 148 148 if(filename.find("ogg", 0) != std::string::npos) 149 149 { 150 COUT(2) << "Sound: Trying fallback ogg loader" << std::endl; 150 151 this->buffer_ = loadOggFile(filename); 151 152 } 152 153 153 if(this->buffer_ == AL_NONE) 154 if(this->buffer_ == AL_NONE) 155 { 156 COUT(2) << "Sound: fallback ogg loader failed: " << alutGetErrorString(alutGetError()) << std::endl; 154 157 return false; 158 } 155 159 } 156 160 … … 158 162 alSourcei(this->source_, AL_BUFFER, this->buffer_); 159 163 if(alGetError() != AL_NO_ERROR) { 160 COUT(2) << "Sound: OpenAL: Error loading sample file "<< std::endl;164 COUT(2) << "Sound: OpenAL: Error loading sample file: " << filename << std::endl; 161 165 return false; 162 166 } … … 172 176 ALuint SoundBase::loadOggFile(std::string filename) 173 177 { 174 COUT(2) << "Sound: Trying fallback ogg loader";175 176 178 char inbuffer[4096]; 177 179 std::vector<char> outbuffer; … … 207 209 } 208 210 } 209 211 210 212 ov_clear(&vf); 211 213 -
code/branches/sound2/src/orxonox/sound/SoundBase.h
r3013 r3055 32 32 #include <string> 33 33 34 #include "OrxonoxPrereqs.h" 35 34 36 namespace orxonox 35 37 { 36 class SoundManager;37 class WorldEntity;38 39 38 /** 40 39 * The SoudBase class is the base class for all sound file loader classes. -
code/branches/sound2/src/orxonox/sound/SoundManager.cc
r3013 r3055 52 52 else 53 53 { 54 COUT(4) << "Sound: OpenAL ALUT version: " << alutGetMajorVersion() << "." << alutGetMinorVersion() << std::endl;55 COUT(4) << "Sound: OpenAL ALUT supported MIME types: " << alutGetMIMETypes(ALUT_LOADER_BUFFER) << std::endl;54 COUT(4) << "Sound: OpenAL ALUT version: " << alutGetMajorVersion() << "." << alutGetMinorVersion() << std::endl; 55 COUT(4) << "Sound: OpenAL ALUT supported MIME types: " << alutGetMIMETypes(ALUT_LOADER_BUFFER) << std::endl; 56 56 if(SoundManager::device_s == NULL) 57 57 { … … 77 77 { 78 78 if(alcMakeContextCurrent(this->context_) == AL_TRUE) 79 COUT(3) << "Sound: OpenAL: Context " << this->context_ << " loaded" << std::endl;79 COUT(3) << "Sound: OpenAL: Context " << this->context_ << " loaded" << std::endl; 80 80 } 81 81 } … … 124 124 void SoundManager::tick(float dt) 125 125 { 126 if (!CameraManager::getInstancePtr()) 127 return; 128 126 129 // update listener position 127 130 Camera* camera = CameraManager::getInstance().getActiveCamera(); -
code/branches/sound2/src/orxonox/sound/SoundManager.h
r3013 r3055 31 31 #include <AL/alc.h> 32 32 33 #include <orxonox/objects/Tickable.h> 33 #include "OrxonoxPrereqs.h" 34 #include "orxonox/objects/Tickable.h" 34 35 35 36 namespace orxonox 36 37 { 37 class SoundBase;38 39 38 /** 40 39 * The SoundManager class manages the OpenAL device, context and listener
Note: See TracChangeset
for help on using the changeset viewer.