Changeset 1784
- Timestamp:
- Sep 15, 2008, 10:54:25 AM (16 years ago)
- Location:
- code/trunk/src
- Files:
-
- 30 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/src/audio/AudioBuffer.cc
r1505 r1784 31 31 namespace audio 32 32 { 33 34 35 36 33 AudioBuffer::AudioBuffer(std::string fileName) 34 { 35 // Load wav data into buffers. 36 alGenBuffers(1, &buffer); 37 37 38 if(alGetError() != AL_NO_ERROR)39 38 if (alGetError() != AL_NO_ERROR) 39 loaded=AL_FALSE; 40 40 41 //FIXME deprecated; seems unneeded42 // 43 44 //FIXME deprecated; seems unneeded45 // 41 //FIXME deprecated; seems unneeded 42 // alutLoadWAVFile((ALbyte*)fileName.c_str(), &format, &data, &size, &freq, &loop); 43 alBufferData(buffer, format, data, size, freq); 44 //FIXME deprecated; seems unneeded 45 // alutUnloadWAV(format, data, size, freq); 46 46 47 48 if(alGetError() != AL_NO_ERROR)49 50 else51 52 47 // Do another error check and return. 48 if (alGetError() != AL_NO_ERROR) 49 loaded=AL_FALSE; 50 else 51 loaded=AL_TRUE; 52 } 53 53 54 55 54 AudioBuffer::~AudioBuffer() 55 { 56 56 57 57 } 58 58 } -
code/trunk/src/audio/AudioBuffer.h
r1505 r1784 33 33 34 34 #include <string> 35 36 35 #include <AL/al.h> 37 36 38 37 namespace audio 39 38 { 40 class _AudioExport AudioBuffer 41 { 42 public: 43 AudioBuffer(std::string fileName); 44 ~AudioBuffer(); 45 private: 46 // Buffers hold sound data. 47 ALuint buffer; 48 // Identifier 49 std::string name; 50 // True if AL was able to load data 51 ALboolean loaded; 39 class _AudioExport AudioBuffer 40 { 41 public: 42 AudioBuffer(std::string fileName); 43 ~AudioBuffer(); 52 44 53 ALenum format; 54 ALsizei size; 55 ALvoid* data; 56 ALsizei freq; 57 ALboolean loop; 58 }; 45 private: 46 // Buffers hold sound data. 47 ALuint buffer; 48 // Identifier 49 std::string name; 50 // True if AL was able to load data 51 ALboolean loaded; 52 53 ALenum format; 54 ALsizei size; 55 ALvoid* data; 56 ALsizei freq; 57 ALboolean loop; 58 }; 59 59 } 60 60 -
code/trunk/src/audio/AudioIncludes.h
r1747 r1784 46 46 #include <vorbis/vorbisenc.h> 47 47 #include <vorbis/vorbisfile.h> 48 49 #include "util/Error.h" -
code/trunk/src/audio/AudioManager.cc
r1747 r1784 30 30 31 31 #include <cstdlib> 32 33 32 #include <AL/alut.h> 34 33 34 #include "util/Debug.h" 35 35 #include "AudioBuffer.h" 36 36 #include "AudioSource.h" 37 37 #include "AudioStream.h" 38 #include "util/Error.h"39 #include "util/Debug.h"40 38 41 39 namespace audio 42 40 { 43 44 45 ambientPath = "audio/ambient";41 AudioManager::AudioManager() 42 { 43 ambientPath = "audio/ambient"; 46 44 47 alutInit(NULL, 0); 45 alutInit(NULL, 0); 46 } 48 47 48 AudioManager::~AudioManager() 49 { 50 for (unsigned int i=0;i<bgSounds.size();i++) 51 { 52 bgSounds[i]->release(); 53 } 54 alutExit(); 55 } 49 56 50 } 57 void AudioManager::ambientStart() 58 { 59 // currentBgSound = 0; 60 if (bgSounds.size() > 0) 61 { 62 currentBgSound = rand() % bgSounds.size(); 63 if(!bgSounds[currentBgSound]->playback()) 64 { 65 COUT(2) << "AudioManager: Ogg refused to play." << std::endl; 66 } 67 else 68 { 69 COUT(3) << "Info: Started playing background sound" << std::endl; 70 } 71 } 72 } 51 73 52 AudioManager::~AudioManager() 53 { 54 for (unsigned int i=0;i<bgSounds.size();i++) 55 { 56 bgSounds[i]->release(); 57 } 58 alutExit(); 59 } 74 void AudioManager::ambientStop() 75 { 76 COUT(3) << "Info: Stopped playing background sound" << std::endl; 77 } 60 78 61 void AudioManager::ambientStart() 62 { 63 // currentBgSound = 0; 64 if (bgSounds.size() > 0) 65 { 66 currentBgSound = rand() % bgSounds.size(); 67 if(!bgSounds[currentBgSound]->playback()) 68 { 69 orxonox::Error("Ogg refused to play."); 70 } 71 else 72 { 73 COUT(3) << "Info: Started playing background sound" << std::endl; 74 } 75 } 76 } 79 void AudioManager::ambientAdd(std::string file) 80 { 81 std::string path = ambientPath + "/" + file + ".ogg"; 82 AudioStream* tmp = new AudioStream(path); 83 tmp->open(); 84 if (tmp->isLoaded()) 85 { 86 bgSounds.push_back(tmp); 87 COUT(3) << "Info: Added background sound " << file << std::endl; 88 } 89 } 77 90 78 void AudioManager::ambientStop() 79 { 80 COUT(3) << "Info: Stopped playing background sound" << std::endl; 81 } 91 void AudioManager::tick(float dt) 92 { 93 if (bgSounds.size() > 0) 94 { 95 if (bgSounds[currentBgSound]->isLoaded()) 96 { 97 bool playing = bgSounds[currentBgSound]->update(); 98 if (!bgSounds[currentBgSound]->playing() && playing) 99 { 100 if (!bgSounds[currentBgSound]->playback()) 101 COUT(2) << "AudioManager: Ogg abruptly stopped." << std::endl; 102 else 103 COUT(2) << "AudioManager: Ogg stream was interrupted." << std::endl; 82 104 83 void AudioManager::ambientAdd(std::string file) 84 { 85 std::string path = ambientPath + "/" + file + ".ogg"; 86 AudioStream* tmp = new AudioStream(path); 87 tmp->open(); 88 if (tmp->isLoaded()) 89 { 90 bgSounds.push_back(tmp); 91 COUT(3) << "Info: Added background sound " << file << std::endl; 92 } 93 } 105 } 106 if (!playing) 107 { 108 // if (currentBgSound < bgSounds.size()-1) 109 // { 110 // currentBgSound++; 111 // } 112 // else 113 // { 114 // currentBgSound=0; 115 // } 116 // switch to next sound in list/array 117 currentBgSound = ++currentBgSound % bgSounds.size(); 94 118 95 void AudioManager::tick(float dt) 96 { 97 if (bgSounds.size() > 0) 98 { 99 if (bgSounds[currentBgSound]->isLoaded()) 100 { 101 bool playing = bgSounds[currentBgSound]->update(); 102 if(!bgSounds[currentBgSound]->playing() && playing) 103 { 104 if(!bgSounds[currentBgSound]->playback()) 105 orxonox::Error("Ogg abruptly stopped."); 106 else 107 orxonox::Error("Ogg stream was interrupted."); 119 if (!bgSounds[currentBgSound]->isLoaded()) 120 { 121 bgSounds[currentBgSound]->release(); 122 bgSounds[currentBgSound]->open(); 123 } 124 bgSounds[currentBgSound]->playback(); 125 COUT(3) << "Info: Playing next background sound" << std::endl; 126 } 127 } 128 } 129 } 108 130 109 } 110 if (!playing) 111 { 112 // if (currentBgSound < bgSounds.size()-1) 113 // { 114 // currentBgSound++; 115 // } 116 // else 117 // { 118 // currentBgSound=0; 119 // } 120 // switch to next sound in list/array 121 currentBgSound = ++currentBgSound % bgSounds.size(); 131 void AudioManager::setPos(std::vector<float> newPosition) 132 { 122 133 123 if (!bgSounds[currentBgSound]->isLoaded()) 124 { 125 bgSounds[currentBgSound]->release(); 126 bgSounds[currentBgSound]->open(); 127 } 128 bgSounds[currentBgSound]->playback(); 129 COUT(3) << "Info: Playing next background sound" << std::endl; 130 } 131 } 132 } 133 } 134 } 134 135 135 void AudioManager::setPos(std::vector<float> newPosition)136 136 void AudioManager::setSpeed(std::vector<float> newSpeed) 137 { 137 138 138 139 } 139 140 140 void AudioManager::setSpeed(std::vector<float> newSpeed)141 141 void AudioManager::setOri(std::vector<float> at, std::vector<float> up) 142 { 142 143 143 } 144 145 void AudioManager::setOri(std::vector<float> at, std::vector<float> up) 146 { 147 148 } 144 } 149 145 } -
code/trunk/src/audio/AudioManager.h
r1747 r1784 37 37 namespace audio 38 38 { 39 class _AudioExport AudioManager 40 { 41 public: 39 class _AudioExport AudioManager 40 { 41 public: 42 // Init audio 43 AudioManager(); 42 44 43 // Init audio 44 45 // Kill audio and set buffers, sources and memory free 46 ~AudioManager(); 45 47 46 // Kill audio and set buffers, sources and memory free 47 ~AudioManager();48 // Set listener position 49 void setPos(std::vector<float> newPosition); 48 50 49 // Set listener position 50 void setPos(std::vector<float> newPosition);51 // Set listener speed 52 void setSpeed(std::vector<float> newSpeed); 51 53 52 // Set listener speed 53 void setSpeed(std::vector<float> newSpeed); 54 // Set listener orientation (first is direction 55 // the listener looks at, the second is the direction 56 // upwards the listener) 57 void setOri(std::vector<float> at, std::vector<float> up); 54 58 55 // Set listener orientation (first is direction 56 // the listener looks at, the second is the direction 57 // upwards the listener) 58 void setOri(std::vector<float> at, std::vector<float> up); 59 // Update 60 void tick(float dt); 59 61 60 // Update 61 void tick(float dt); 62 void ambientAdd(std::string file); 63 void ambientStart(); 64 void ambientStop(); 62 65 63 void ambientAdd(std::string file); 64 void ambientStart(); 65 void ambientStop(); 66 67 private: 68 69 // Background sound 70 std::vector<AudioStream*> bgSounds; 71 int currentBgSound; 66 private: 67 // Background sound 68 std::vector<AudioStream*> bgSounds; 69 int currentBgSound; 72 70 73 71 72 std::string ambientPath; 74 73 75 std::string ambientPath; 74 // Vector containing all audio files 75 std::vector<AudioBuffer*> buffers; 76 // Vector containing all audio sources which referer to one buffer 77 std::vector<AudioSource*> sources; 78 // The ambient background sound 79 AudioSource* ambient; 76 80 77 // Vector containing all audio files 78 std::vector<AudioBuffer*> buffers; 79 // Vector containing all audio sources which referer to one buffer 80 std::vector<AudioSource*> sources; 81 // The ambient background sound 82 AudioSource* ambient; 83 84 std::vector<float> listenerPosition; 85 std::vector<float> listenerSpeed; 86 std::vector<float> listenerAt; 87 std::vector<float> listenerup; 88 }; 81 std::vector<float> listenerPosition; 82 std::vector<float> listenerSpeed; 83 std::vector<float> listenerAt; 84 std::vector<float> listenerup; 85 }; 89 86 } 90 87 -
code/trunk/src/audio/AudioSource.cc
r1505 r1784 31 31 namespace audio 32 32 { 33 34 33 AudioSource::AudioSource() 34 { 35 35 36 36 } 37 37 38 39 38 AudioSource::~AudioSource() 39 { 40 40 41 41 } 42 42 } -
code/trunk/src/audio/AudioSource.h
r1505 r1784 34 34 namespace audio 35 35 { 36 class _AudioExport AudioSource 37 { 38 public: 39 AudioSource(); 40 ~AudioSource(); 41 private: 36 class _AudioExport AudioSource 37 { 38 public: 39 AudioSource(); 40 ~AudioSource(); 42 41 43 }; 42 private: 43 }; 44 44 } 45 45 -
code/trunk/src/audio/AudioStream.cc
r1747 r1784 26 26 * 27 27 */ 28 28 29 #include "AudioStream.h" 29 30 30 #include "util/Debug.h" 31 #include "util/Error.h"32 31 33 32 namespace audio 34 33 { 35 AudioStream::AudioStream(std::string path) 36 { 37 this->path = path; 38 loaded = false; 39 } 40 41 void AudioStream::open() 42 { 43 int result; 44 45 oggFile = fopen(path.c_str(), "rb"); 46 if(!oggFile) 47 { 48 orxonox::Error("Could not open Ogg file "+path); 49 return; 50 } 51 52 if((result = ov_open(oggFile, &oggStream, NULL, 0)) < 0) 53 { 54 fclose(oggFile); 55 orxonox::Error("Could not open Ogg stream. " + errorString(result)); 56 return; 57 } 58 59 loaded = true; 60 61 vorbisInfo = ov_info(&oggStream, -1); 62 vorbisComment = ov_comment(&oggStream, -1); 63 64 if(vorbisInfo->channels == 1) 65 format = AL_FORMAT_MONO16; 66 else 67 format = AL_FORMAT_STEREO16; 68 69 70 alGenBuffers(2, buffers); 71 check(); 72 alGenSources(1, &source); 73 check(); 74 75 alSource3f(source, AL_POSITION, 0.0, 0.0, 0.0); 76 alSource3f(source, AL_VELOCITY, 0.0, 0.0, 0.0); 77 alSource3f(source, AL_DIRECTION, 0.0, 0.0, 0.0); 78 alSourcef (source, AL_ROLLOFF_FACTOR, 0.0 ); 79 alSourcei (source, AL_SOURCE_RELATIVE, AL_FALSE ); 80 } 81 82 83 84 85 void AudioStream::release() 86 { 87 88 alSourceStop(source); 89 empty(); 90 alDeleteSources(1, &source); 91 check(); 92 alDeleteBuffers(1, buffers); 93 check(); 94 95 ov_clear(&oggStream); 96 loaded = false; 97 98 } 99 100 101 102 103 void AudioStream::display() 104 { 105 if (loaded) 106 { 107 COUT(3) 108 << "version " << vorbisInfo->version << std::endl 109 << "channels " << vorbisInfo->channels << std::endl 110 << "rate (hz) " << vorbisInfo->rate << std::endl 111 << "bitrate upper " << vorbisInfo->bitrate_upper << std::endl 112 << "bitrate nominal " << vorbisInfo->bitrate_nominal << std::endl 113 << "bitrate lower " << vorbisInfo->bitrate_lower << std::endl 114 << "bitrate window " << vorbisInfo->bitrate_window << std::endl 115 << std::endl 116 << "vendor " << vorbisComment->vendor << std::endl; 117 118 for(int i = 0; i < vorbisComment->comments; i++) 119 { 120 COUT(3) << " " << vorbisComment->user_comments[i] << std::endl; 121 } 122 123 COUT(3) << std::endl; 124 } 125 } 126 127 128 129 130 bool AudioStream::playback() 131 { 132 if (!loaded) 133 { 134 return false; 135 } 136 137 if(playing()) 138 return true; 139 140 if(!stream(buffers[0])) 141 return false; 142 143 if(!stream(buffers[1])) 144 return false; 145 146 alSourceQueueBuffers(source, 2, buffers); 147 alSourcePlay(source); 148 149 return true; 150 } 151 152 153 154 155 bool AudioStream::playing() 156 { 157 if (!loaded) 158 { 159 return false; 160 } 161 162 ALenum state; 163 alGetSourcei(source, AL_SOURCE_STATE, &state); 164 return (state == AL_PLAYING); 165 } 166 167 168 169 170 bool AudioStream::update() 171 { 172 int processed; 173 bool active = true; 174 175 alGetSourcei(source, AL_BUFFERS_PROCESSED, &processed); 176 177 while(processed--) 178 { 179 ALuint buffer; 180 181 alSourceUnqueueBuffers(source, 1, &buffer); 182 check(); 183 184 active = stream(buffer); 185 186 alSourceQueueBuffers(source, 1, &buffer); 187 check(); 188 } 189 190 if (active==false) 191 { 192 loaded = false; 193 } 194 return active; 195 } 196 197 198 199 200 bool AudioStream::stream(ALuint buffer) 201 { 202 char pcm[BUFFER_SIZE]; 203 int size = 0; 204 int section; 205 int result; 206 207 while(size < BUFFER_SIZE) 208 { 209 result = ov_read(&oggStream, pcm + size, BUFFER_SIZE - size, 0, 2, 1, §ion); 210 211 if(result > 0) 212 size += result; 213 else 214 if(result < 0) 215 orxonox::Error(errorString(result)); 216 else 217 break; 218 } 219 220 if(size == 0) 221 return false; 222 223 alBufferData(buffer, format, pcm, size, vorbisInfo->rate); 224 check(); 225 226 return true; 227 } 228 229 230 231 void AudioStream::empty() 232 { 233 int queued; 234 235 alGetSourcei(source, AL_BUFFERS_QUEUED, &queued); 236 237 while(queued--) 238 { 239 ALuint buffer; 240 241 alSourceUnqueueBuffers(source, 1, &buffer); 242 check(); 243 } 244 } 245 246 247 248 249 void AudioStream::check() 250 { 251 int error = alGetError(); 252 253 if(error != AL_NO_ERROR) 254 orxonox::Error("OpenAL error was raised."); 255 } 256 257 258 259 std::string AudioStream::errorString(int code) 260 { 261 switch(code) 262 { 263 case OV_EREAD: 264 return std::string("Read from media."); 265 case OV_ENOTVORBIS: 266 return std::string("Not Vorbis data."); 267 case OV_EVERSION: 268 return std::string("Vorbis version mismatch."); 269 case OV_EBADHEADER: 270 return std::string("Invalid Vorbis header."); 271 case OV_EFAULT: 272 return std::string("Internal logic fault (bug or heap/stack corruption."); 273 default: 274 return std::string("Unknown Ogg error."); 275 } 276 } 34 AudioStream::AudioStream(std::string path) 35 { 36 this->path = path; 37 loaded = false; 38 } 39 40 void AudioStream::open() 41 { 42 int result; 43 44 oggFile = fopen(path.c_str(), "rb"); 45 if (!oggFile) 46 { 47 COUT(2) << "AudioStream: Could not open Ogg file " << path << std::endl; 48 return; 49 } 50 51 if ((result = ov_open(oggFile, &oggStream, NULL, 0)) < 0) 52 { 53 fclose(oggFile); 54 COUT(2) << "AudioStream: Could not open Ogg stream. " << errorString(result) << std::endl; 55 return; 56 } 57 58 loaded = true; 59 60 vorbisInfo = ov_info(&oggStream, -1); 61 vorbisComment = ov_comment(&oggStream, -1); 62 63 if (vorbisInfo->channels == 1) 64 format = AL_FORMAT_MONO16; 65 else 66 format = AL_FORMAT_STEREO16; 67 68 69 alGenBuffers(2, buffers); 70 check(); 71 alGenSources(1, &source); 72 check(); 73 74 alSource3f(source, AL_POSITION, 0.0, 0.0, 0.0); 75 alSource3f(source, AL_VELOCITY, 0.0, 0.0, 0.0); 76 alSource3f(source, AL_DIRECTION, 0.0, 0.0, 0.0); 77 alSourcef (source, AL_ROLLOFF_FACTOR, 0.0 ); 78 alSourcei (source, AL_SOURCE_RELATIVE, AL_FALSE ); 79 } 80 81 82 83 void AudioStream::release() 84 { 85 alSourceStop(source); 86 empty(); 87 alDeleteSources(1, &source); 88 check(); 89 alDeleteBuffers(1, buffers); 90 check(); 91 92 ov_clear(&oggStream); 93 loaded = false; 94 } 95 96 97 98 void AudioStream::display() 99 { 100 if (loaded) 101 { 102 COUT(3) 103 << "version " << vorbisInfo->version << std::endl 104 << "channels " << vorbisInfo->channels << std::endl 105 << "rate (hz) " << vorbisInfo->rate << std::endl 106 << "bitrate upper " << vorbisInfo->bitrate_upper << std::endl 107 << "bitrate nominal " << vorbisInfo->bitrate_nominal << std::endl 108 << "bitrate lower " << vorbisInfo->bitrate_lower << std::endl 109 << "bitrate window " << vorbisInfo->bitrate_window << std::endl 110 << std::endl 111 << "vendor " << vorbisComment->vendor << std::endl; 112 113 for (int i = 0; i < vorbisComment->comments; i++) 114 { 115 COUT(3) << " " << vorbisComment->user_comments[i] << std::endl; 116 } 117 118 COUT(3) << std::endl; 119 } 120 } 121 122 123 124 bool AudioStream::playback() 125 { 126 if (!loaded) 127 { 128 return false; 129 } 130 131 if (playing()) 132 return true; 133 134 if (!stream(buffers[0])) 135 return false; 136 137 if (!stream(buffers[1])) 138 return false; 139 140 alSourceQueueBuffers(source, 2, buffers); 141 alSourcePlay(source); 142 143 return true; 144 } 145 146 147 148 149 bool AudioStream::playing() 150 { 151 if (!loaded) 152 { 153 return false; 154 } 155 156 ALenum state; 157 alGetSourcei(source, AL_SOURCE_STATE, &state); 158 return (state == AL_PLAYING); 159 } 160 161 162 163 164 bool AudioStream::update() 165 { 166 int processed; 167 bool active = true; 168 169 alGetSourcei(source, AL_BUFFERS_PROCESSED, &processed); 170 171 while (processed--) 172 { 173 ALuint buffer; 174 175 alSourceUnqueueBuffers(source, 1, &buffer); 176 check(); 177 178 active = stream(buffer); 179 180 alSourceQueueBuffers(source, 1, &buffer); 181 check(); 182 } 183 184 if (active==false) 185 { 186 loaded = false; 187 } 188 return active; 189 } 190 191 192 193 194 bool AudioStream::stream(ALuint buffer) 195 { 196 char pcm[BUFFER_SIZE]; 197 int size = 0; 198 int section; 199 int result; 200 201 while (size < BUFFER_SIZE) 202 { 203 result = ov_read(&oggStream, pcm + size, BUFFER_SIZE - size, 0, 2, 1, §ion); 204 205 if (result > 0) 206 size += result; 207 else 208 if (result < 0) 209 COUT(2) << "AudioStream: " << errorString(result) << std::endl; 210 else 211 break; 212 } 213 214 if (size == 0) 215 return false; 216 217 alBufferData(buffer, format, pcm, size, vorbisInfo->rate); 218 check(); 219 220 return true; 221 } 222 223 224 225 void AudioStream::empty() 226 { 227 int queued; 228 229 alGetSourcei(source, AL_BUFFERS_QUEUED, &queued); 230 231 while (queued--) 232 { 233 ALuint buffer; 234 235 alSourceUnqueueBuffers(source, 1, &buffer); 236 check(); 237 } 238 } 239 240 241 242 243 void AudioStream::check() 244 { 245 int error = alGetError(); 246 247 if (error != AL_NO_ERROR) 248 COUT(2) << "AudioStream: OpenAL error was raised." << std::endl; 249 } 250 251 252 253 std::string AudioStream::errorString(int code) 254 { 255 switch (code) 256 { 257 case OV_EREAD: 258 return std::string("Read from media."); 259 case OV_ENOTVORBIS: 260 return std::string("Not Vorbis data."); 261 case OV_EVERSION: 262 return std::string("Vorbis version mismatch."); 263 case OV_EBADHEADER: 264 return std::string("Invalid Vorbis header."); 265 case OV_EFAULT: 266 return std::string("Internal logic fault (bug or heap/stack corruption."); 267 default: 268 return std::string("Unknown Ogg error."); 269 } 270 } 277 271 } 278 272 -
code/trunk/src/audio/AudioStream.h
r1505 r1784 34 34 #include <string> 35 35 #include <iostream> 36 37 36 #include <AL/al.h> 38 37 #include <vorbis/vorbisfile.h> 39 38 #include <vorbis/codec.h> 40 39 40 41 41 namespace audio 42 42 { 43 #define BUFFER_SIZE (4096 * 4)43 const int BUFFER_SIZE = 4096 * 4; 44 44 45 class _AudioExport AudioStream46 {45 class _AudioExport AudioStream 46 { 47 47 public: 48 AudioStream(std::string path);49 void open();50 void release();51 void display();52 bool playback();53 bool playing();54 bool update();55 inline bool isLoaded() { return loaded; }48 AudioStream(std::string path); 49 void open(); 50 void release(); 51 void display(); 52 bool playback(); 53 bool playing(); 54 bool update(); 55 inline bool isLoaded() { return loaded; } 56 56 57 57 protected: 58 bool stream(ALuint buffer);59 void empty();60 void check();61 std::string errorString(int code);58 bool stream(ALuint buffer); 59 void empty(); 60 void check(); 61 std::string errorString(int code); 62 62 63 63 private: 64 std::string path;64 std::string path; 65 65 66 FILE* oggFile;67 OggVorbis_File oggStream;68 vorbis_info* vorbisInfo;69 vorbis_comment* vorbisComment;70 bool loaded;66 FILE* oggFile; 67 OggVorbis_File oggStream; 68 vorbis_info* vorbisInfo; 69 vorbis_comment* vorbisComment; 70 bool loaded; 71 71 72 ALuint buffers[2];73 ALuint source;74 ALenum format;75 };72 ALuint buffers[2]; 73 ALuint source; 74 ALenum format; 75 }; 76 76 } 77 77 -
code/trunk/src/core/ArgumentCompletionListElement.h
r1505 r1784 35 35 #include <list> 36 36 37 #define ACL_MODE_NORMAL 138 #define ACL_MODE_LOWERCASE 239 #define ACL_MODE_DISPLAY 440 37 41 38 namespace orxonox 42 39 { 40 const int ACL_MODE_NORMAL = 1; 41 const int ACL_MODE_LOWERCASE = 2; 42 const int ACL_MODE_DISPLAY = 4; 43 43 44 typedef std::list<ArgumentCompletionListElement> ArgumentCompletionList; 44 45 -
code/trunk/src/core/CommandExecutor.cc
r1747 r1784 30 30 #include "ConsoleCommand.h" 31 31 #include "util/String.h" 32 #include "util/Convert.h"33 32 #include "util/Debug.h" 34 33 #include "Identifier.h" -
code/trunk/src/core/ConfigFileManager.cc
r1747 r1784 34 34 #include "util/String.h" 35 35 36 #define CONFIG_FILE_MAX_LINELENGHT 102437 36 38 37 namespace orxonox 39 38 { 39 const int CONFIG_FILE_MAX_LINELENGHT = 1024; 40 const char* const DEFAULT_CONFIG_FILE = "default.ini"; 41 40 42 SetConsoleCommandShortcutExtern(config).argumentCompleter(0, autocompletion::configvalueclasses()).argumentCompleter(1, autocompletion::configvalues()).argumentCompleter(2, autocompletion::configvalue()); 41 43 SetConsoleCommandShortcutExtern(tconfig).argumentCompleter(0, autocompletion::configvalueclasses()).argumentCompleter(1, autocompletion::configvalues()).argumentCompleter(2, autocompletion::configvalue()); -
code/trunk/src/core/ConfigFileManager.h
r1747 r1784 38 38 39 39 #include "util/Math.h" 40 41 #define DEFAULT_CONFIG_FILE "default.ini"42 40 43 41 namespace orxonox -
code/trunk/src/core/ConfigValueContainer.cc
r1747 r1784 41 41 #include "Identifier.h" 42 42 43 #define MAX_VECTOR_INDEX 255 // to avoid up to 4*10^9 vector entries in the config file after accidentally using a wrong argument44 43 45 44 46 45 namespace orxonox 47 46 { 47 const int MAX_VECTOR_INDEX = 255; // to avoid up to 4*10^9 vector entries in the config file after accidentally using a wrong argument 48 48 49 /** 49 50 @brief Initializes the ConfigValueContainer with defaultvalues. -
code/trunk/src/core/Functor.h
r1747 r1784 36 36 #include "util/Debug.h" 37 37 38 #define MAX_FUNCTOR_ARGUMENTS 539 38 40 39 namespace orxonox 41 40 { 41 const int MAX_FUNCTOR_ARGUMENTS = 5; 42 42 43 enum FunctionType 43 44 { -
code/trunk/src/core/IRC.cc
r1747 r1784 35 35 #include "util/Convert.h" 36 36 37 #define IRC_TCL_THREADID 142142142138 37 39 38 namespace orxonox 40 39 { 40 static const unsigned int IRC_TCL_THREADID = 1421421421; 41 41 42 SetConsoleCommand(IRC, say, true).accessLevel(AccessLevel::User); 42 43 SetConsoleCommand(IRC, msg, false).accessLevel(AccessLevel::User); -
code/trunk/src/core/TclThreadManager.cc
r1747 r1784 43 43 #include "util/Convert.h" 44 44 45 #define TCLTHREADMANAGER_MAX_QUEUE_LENGTH 10046 #define TCLTHREADMANAGER_MAX_CPU_USAGE 0.5047 45 48 46 namespace orxonox 49 47 { 48 const int TCLTHREADMANAGER_MAX_QUEUE_LENGTH = 100; 49 const int TCLTHREADMANAGER_MAX_CPU_USAGE = 0.50; 50 50 51 SetConsoleCommandShortcutAlias(TclThreadManager, execute, "tclexecute").argumentCompleter(0, autocompletion::tclthreads()); 51 52 SetConsoleCommandShortcutAlias(TclThreadManager, query, "tclquery" ).argumentCompleter(0, autocompletion::tclthreads()); -
code/trunk/src/orxonox/Settings.h
r1755 r1784 43 43 #include "util/Debug.h" 44 44 #include "util/MultiType.h" 45 #include "util/Convert.h"46 45 47 46 namespace orxonox -
code/trunk/src/orxonox/gui/OgreCEGUIRenderer.h
r1755 r1784 27 27 This file contains code that is specific to Ogre (http://www.ogre3d.org) 28 28 *************************************************************************/ 29 #ifndef _OgreCEGUIRenderer_ h_30 #define _OgreCEGUIRenderer_ h_29 #ifndef _OgreCEGUIRenderer_H__ 30 #define _OgreCEGUIRenderer_H__ 31 31 32 32 #include <CEGUIBase.h> … … 462 462 463 463 464 #endif // end of guard _OgreCEGUIRenderer_ h_464 #endif // end of guard _OgreCEGUIRenderer_H__ -
code/trunk/src/orxonox/gui/OgreCEGUIResourceProvider.h
r1755 r1784 24 24 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 25 25 *************************************************************************/ 26 #ifndef _OgreCEGUIResourceProvider_ h_27 #define _OgreCEGUIResourceProvider_ h_26 #ifndef _OgreCEGUIResourceProvider_H__ 27 #define _OgreCEGUIResourceProvider_H__ 28 28 29 29 #include <CEGUIResourceProvider.h> … … 50 50 } // End of CEGUI namespace section 51 51 52 #endif // end of guard _OgreCEGUIResourceProvider_ h_52 #endif // end of guard _OgreCEGUIResourceProvider_H__ -
code/trunk/src/orxonox/gui/OgreCEGUITexture.h
r1755 r1784 24 24 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 25 25 *************************************************************************/ 26 #ifndef _OgreCEGUITexture_ h_27 #define _OgreCEGUITexture_ h_26 #ifndef _OgreCEGUITexture_H__ 27 #define _OgreCEGUITexture_H__ 28 28 29 29 #include <CEGUIBase.h> … … 177 177 178 178 179 #endif // end of guard _OgreCEGUITexture_ h_179 #endif // end of guard _OgreCEGUITexture_H__ -
code/trunk/src/orxonox/objects/Ambient.cc
r1755 r1784 37 37 #include "tinyxml/tinyxml.h" 38 38 #include "util/SubString.h" 39 #include "util/Convert.h"40 39 #include "util/Math.h" 41 40 #include "util/Debug.h" -
code/trunk/src/orxonox/objects/Camera.cc
r1755 r1784 40 40 #include "tinyxml/tinyxml.h" 41 41 #include "util/SubString.h" 42 #include "util/Convert.h"43 42 #include "util/Math.h" 44 43 #include "util/Debug.h" -
code/trunk/src/orxonox/objects/SpaceShipAI.cc
r1772 r1784 41 41 #include "Settings.h" 42 42 43 #define ACTION_INTERVAL 1.0f44 43 45 44 namespace orxonox 46 45 { 46 const float ACTION_INTERVAL = 1.0f; 47 47 48 SetConsoleCommand(SpaceShipAI, createEnemy, true).defaultValue(0, 1); 48 49 SetConsoleCommand(SpaceShipAI, killEnemies, true).defaultValue(0, 0); -
code/trunk/src/orxonox/objects/SpaceShipAI.h
r1772 r1784 36 36 #include "util/Math.h" 37 37 38 #define NUM_AI_TEAMS 339 38 40 39 namespace orxonox 41 40 { 41 const int NUM_AI_TEAMS = 3; 42 42 43 class SpaceShipAI : public SpaceShip 43 44 { -
code/trunk/src/orxonox/overlays/OverlayText.cc
r1747 r1784 34 34 #include <OgrePanelOverlayElement.h> 35 35 36 #include "util/Convert.h"37 36 #include "util/String.h" 38 37 #include "core/CoreIncludes.h" -
code/trunk/src/orxonox/overlays/console/InGameConsole.cc
r1755 r1784 50 50 #include "GraphicsEngine.h" 51 51 52 #define LINES 3053 #define CHAR_WIDTH 7.45 // fix this please - determine the char-width dynamically54 55 52 namespace orxonox 56 53 { 54 const int LINES = 30; 55 const float CHAR_WIDTH = 7.45f; // fix this please - determine the char-width dynamically 56 57 57 SetConsoleCommand(InGameConsole, openConsole, true); 58 58 SetConsoleCommand(InGameConsole, closeConsole, true); -
code/trunk/src/util/CRC32.h
r1763 r1784 34 34 #include "Integers.h" 35 35 36 #define UTIL_CRC32POLY 0x04C11DB7/* CRC-32 Polynom */36 const unsigned int UTIL_CRC32POLY = 0x04C11DB7; /* CRC-32 Polynom */ 37 37 38 38 _UtilExport void calcCRCBit(uint32_t &crc32, int bit); -
code/trunk/src/util/OutputBuffer.cc
r1747 r1784 29 29 #include "OutputBuffer.h" 30 30 31 #define OUTPUTBUFFER_MAX_LINE_LENGTH 1638432 31 33 32 namespace orxonox 34 33 { 34 const int OUTPUTBUFFER_MAX_LINE_LENGTH = 16384; 35 35 36 void OutputBuffer::registerListener(OutputBufferListener* listener) 36 37 { -
code/trunk/src/util/SubString.h
r1755 r1784 56 56 */ 57 57 58 #ifndef __S UBSTRING_H__59 #define __S UBSTRING_H__58 #ifndef __SubString_H__ 59 #define __SubString_H__ 60 60 61 61 #include "UtilPrereqs.h" … … 171 171 }; 172 172 173 #endif /* __S UBSTRING_H__ */173 #endif /* __SubString_H__ */
Note: See TracChangeset
for help on using the changeset viewer.