[Orxonox-commit 2009] r6726 - code/branches/sound5/src/orxonox/sound
erwin at orxonox.net
erwin at orxonox.net
Wed Apr 14 14:19:32 CEST 2010
Author: erwin
Date: 2010-04-14 14:19:32 +0200 (Wed, 14 Apr 2010)
New Revision: 6726
Modified:
code/branches/sound5/src/orxonox/sound/BaseSound.cc
code/branches/sound5/src/orxonox/sound/BaseSound.h
code/branches/sound5/src/orxonox/sound/SoundStreamer.cc
Log:
Some more atempts to fix maybe it's platform specific...
Modified: code/branches/sound5/src/orxonox/sound/BaseSound.cc
===================================================================
--- code/branches/sound5/src/orxonox/sound/BaseSound.cc 2010-04-13 20:39:54 UTC (rev 6725)
+++ code/branches/sound5/src/orxonox/sound/BaseSound.cc 2010-04-14 12:19:32 UTC (rev 6726)
@@ -141,8 +141,9 @@
alSource3f(this->audioSource_, AL_DIRECTION, 0, 0, 0);
if (ALint error = alGetError())
COUT(2) << "Sound: Warning: Setting source parameters to 0 failed: " << getALErrorString(error) << std::endl;
- assert(this->soundBuffer_ != NULL);
- alSourcei(this->audioSource_, AL_BUFFER, this->soundBuffer_->getBuffer());
+ if(this->soundBuffer_ != NULL) {
+ alSourcei(this->audioSource_, AL_BUFFER, this->soundBuffer_->getBuffer());
+ }
if (ALuint error = alGetError())
COUT(1) << "Sound: Error: Could not set buffer \"" << this->source_ << "\": " << getALErrorString(error) << std::endl;
}
Modified: code/branches/sound5/src/orxonox/sound/BaseSound.h
===================================================================
--- code/branches/sound5/src/orxonox/sound/BaseSound.h 2010-04-13 20:39:54 UTC (rev 6725)
+++ code/branches/sound5/src/orxonox/sound/BaseSound.h 2010-04-14 12:19:32 UTC (rev 6726)
@@ -85,9 +85,9 @@
virtual ~BaseSound();
- void doPlay();
- void doStop();
- void doPause();
+ virtual void doPlay();
+ virtual void doStop();
+ virtual void doPause();
// network callbacks
inline void pitchChanged()
Modified: code/branches/sound5/src/orxonox/sound/SoundStreamer.cc
===================================================================
--- code/branches/sound5/src/orxonox/sound/SoundStreamer.cc 2010-04-13 20:39:54 UTC (rev 6725)
+++ code/branches/sound5/src/orxonox/sound/SoundStreamer.cc 2010-04-14 12:19:32 UTC (rev 6726)
@@ -67,15 +67,15 @@
format = AL_FORMAT_STEREO16;
char inbuffer[4096];
- ALuint initbuffers[20];
- alGenBuffers(20, initbuffers);
+ ALuint initbuffers[5];
+ alGenBuffers(5, initbuffers);
if (ALint error = alGetError()) {
COUT(2) << "Sound: Streamer: Could not generate buffer:" << getALErrorString(error) << std::endl;
return;
}
int current_section;
- for(int i = 0; i < 20; i++)
+ for(int i = 0; i < 5; i++)
{
long ret = ov_read(&vf, inbuffer, sizeof(inbuffer), 0, 2, 1, ¤t_section);
if (ret == 0)
@@ -98,7 +98,6 @@
if (ALint error = alGetError()) {
COUT(2) << "Sound: Warning: Couldn't queue buffers: " << getALErrorString(error) << std::endl;
}
- COUT(4) << "Sound: " << ret << std::endl;
}
while(true) // Stream forever, control through thread control
@@ -115,7 +114,6 @@
if (ALint error = alGetError())
COUT(2) << "Sound: Warning: Couldn't get number of processed buffers: " << getALErrorString(error) << std::endl;
- COUT(2) << "Sound: Blub: " << processed << std::endl;
if(processed > 0)
{
COUT(4) << "Sound: " << processed << std::endl;
@@ -129,7 +127,7 @@
long ret = ov_read(&vf, inbuffer, sizeof(inbuffer), 0, 2, 1, ¤t_section);
if (ret == 0)
{
- break;
+ return;
}
else if (ret < 0)
{
More information about the Orxonox-commit
mailing list