Changeset 2932 for code/branches
- Timestamp:
- Apr 27, 2009, 3:30:34 PM (16 years ago)
- Location:
- code/branches/sound/src/sound
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/sound/src/sound/SoundBase.cc
r2931 r2932 113 113 } 114 114 115 bool SoundBase::loadFile(std::string filename) { 116 this->buffer_ = alutCreateBufferFromFile(filename.c_str()); 117 if(this->buffer_ == AL_NONE) { 118 COUT(2) << "OpenAL ALUT: " << alutGetErrorString(alutGetError()); 119 return false; 120 } 121 122 alGenSources(1, &this->source_); 123 alSourcei(this->source_, AL_BUFFER, this->buffer_); 124 if(alGetError() != AL_NO_ERROR) { 125 COUT(2) << "OpenAL: Error loading sample file"; 126 return false; 127 } 128 return true; 129 } 130 115 131 ALint SoundBase::getSourceState() { 116 132 ALint state; -
code/branches/sound/src/sound/SoundBase.h
r2931 r2932 29 29 #define _SOUNDBASE_H__ 30 30 31 #include <al.h> 31 #include <AL/al.h> 32 #include <AL/alut.h> 32 33 #include <string> 33 34 … … 57 58 bool isStopped(); 58 59 59 virtual void loadFile(std::string filename) = 0;60 bool loadFile(std::string filename); 60 61 61 62 private: -
code/branches/sound/src/sound/SoundManager.cc
r2931 r2932 27 27 */ 28 28 29 #include < OgreSceneNode.h>29 #include <AL/alut.h> 30 30 31 31 #include "orxonox/CameraManager.h" … … 57 57 SoundManager::SoundManager() 58 58 { 59 // OpenAL device and context creation 60 this->device_ = alcOpenDevice(NULL); // we operate on the default sound device 61 if(this->device_) 62 COUT(2) << "OpenAL: Could not create sound device, there will be no sound!" << std::endl; 63 64 this->context_ = alcCreateContext(this->device_, NULL); 65 alcMakeContextCurrent(this->context_); 66 ALenum error = alcGetError(this->device_); 67 if(error != ALC_NO_ERROR) 68 COUT(2) << "OpenAL: Could not create sound context." << std::endl; 69 59 if(!alutInit(NULL,NULL)) { 60 COUT(2) << "OpenAL ALUT: " << alutGetErrorString(alutGetError()); 61 } 70 62 } 71 63 -
code/branches/sound/src/sound/SoundManager.h
r2930 r2932 28 28 #define _SOUNDMANGER_H__ 29 29 30 #include < al.h>31 #include < alc.h>30 #include <AL/al.h> 31 #include <AL/alc.h> 32 32 33 33 #include <orxonox/objects/Tickable.h> … … 57 57 static SoundManager* singleton_; 58 58 59 ALCcontext* context_;60 ALCdevice* device_;61 62 59 std::list<SoundBase*> soundlist_; 63 60
Note: See TracChangeset
for help on using the changeset viewer.