Changeset 6562 for code/branches
- Timestamp:
- Mar 18, 2010, 3:48:49 PM (15 years ago)
- Location:
- code/branches/sound5/src/orxonox/sound
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/sound5/src/orxonox/sound/AmbientSound.cc
r6511 r6562 175 175 176 176 this->soundstreamthread_ = boost::thread(SoundStreamer(), this->audioSource_, dataStream); 177 if(this->soundstreamthread_ == boost::thread()) 178 COUT(2) << "Sound: Failed to create thread." << std::endl; 179 177 180 178 181 this->updateVolume(); -
code/branches/sound5/src/orxonox/sound/SoundManager.cc
r6510 r6562 116 116 117 117 // Create sound context and make it the currently used one 118 this->context_ = alcCreateContext(this->device_, NULL); 118 const ALint contattr[] = {ALC_SYNC, 1, 0}; 119 this->context_ = alcCreateContext(this->device_, contattr); 119 120 if (this->context_ == NULL) 120 121 ThrowException(InitialisationFailed, "Sound: Error: Could not create ALC context"); -
code/branches/sound5/src/orxonox/sound/SoundStreamer.cc
r6506 r6562 28 28 29 29 #include <al.h> 30 #include <alc.h> 30 31 #include <vorbis/vorbisfile.h> 31 32 #include "SoundManager.h" … … 67 68 ALuint initbuffers[4]; 68 69 alGenBuffers(4, initbuffers); 70 if (ALint error = alGetError()) { 71 COUT(2) << "Sound: Streamer: Could not generate buffer:" << getALErrorString(error) << std::endl; 72 return; 73 } 69 74 int current_section; 70 75 … … 84 89 85 90 alBufferData(initbuffers[i], format, &inbuffer, ret, vorbisInfo->rate); 91 alGetError(); 86 92 } 87 93 alSourceQueueBuffers(audioSource, 4, initbuffers); 94 if (ALint error = alGetError()) { 95 COUT(2) << "Sound: Warning: Couldn't queue buffers: " << getALErrorString(error) << std::endl; 96 } 88 97 89 98 while(true) // Stream forever, control through thread control 90 99 { 91 100 int processed; 101 102 if(alcGetCurrentContext() == NULL) 103 COUT(2) << "This should not be!" << std::endl; 104 92 105 alGetSourcei(audioSource, AL_BUFFERS_PROCESSED, &processed); 93 106 if (ALint error = alGetError()) 94 COUT(2) << "Sound Warning: Couldn't get number of processed buffers: " << getALErrorString(error) << std::endl;107 COUT(2) << "Sound: Warning: Couldn't get number of processed buffers: " << getALErrorString(error) << std::endl; 95 108 96 109 if(processed > 0) … … 99 112 alSourceUnqueueBuffers(audioSource, processed, buffers); 100 113 if (ALint error = alGetError()) 101 COUT(2) << "Sound Warning: Couldn't unqueue buffers: " << getALErrorString(error) << std::endl;114 COUT(2) << "Sound: Warning: Couldn't unqueue buffers: " << getALErrorString(error) << std::endl; 102 115 103 116 for(int i = 0; i < processed; i++) … … 116 129 117 130 alBufferData(buffers[i], format, &inbuffer, ret, vorbisInfo->rate); 131 alGetError(); 118 132 } 119 133 120 134 alSourceQueueBuffers(audioSource, processed, buffers); 121 135 if (ALint error = alGetError()) 122 COUT(2) << "Sound Warning: Couldn't queue buffers: " << getALErrorString(error) << std::endl;136 COUT(2) << "Sound: Warning: Couldn't queue buffers: " << getALErrorString(error) << std::endl; 123 137 } 124 msleep( 250); // perhaps another value here is better138 msleep(100); // perhaps another value here is better 125 139 } 126 140 }
Note: See TracChangeset
for help on using the changeset viewer.