Changeset 9869 in orxonox.OLD for trunk/src/lib/sound
- Timestamp:
- Oct 3, 2006, 12:19:30 AM (18 years ago)
- Location:
- trunk/src/lib/sound
- Files:
-
- 9 edited
- 4 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/sound/Makefile.am
r5475 r9869 7 7 sound_source.cc \ 8 8 sound_buffer.cc \ 9 sound_buffer_data.cc \ 10 resource_sound_buffer.cc \ 9 11 ogg_player.cc 10 12 … … 12 14 sound_source.h \ 13 15 sound_buffer.h \ 16 sound_buffer_data.h \ 17 resource_sound_buffer.h \ 14 18 ogg_player.h -
trunk/src/lib/sound/ogg_player.cc
r9406 r9869 34 34 35 35 #include "helper_functions.h" 36 37 #ifdef HAVE_SDL_SDL_H 38 39 #include <SDL/SDL.h> 40 #include <SDL/SDL_endian.h> 41 42 #else 43 44 #include <SDL.h> 45 #include <SDL_endian.h> 46 47 #endif 36 #include "sdlincl.h" 48 37 49 38 namespace OrxSound 50 39 { 40 ObjectListDefinition(OggPlayer); 51 41 /** 52 42 * initializes an Ogg-player from a file … … 55 45 OggPlayer::OggPlayer(const std::string& fileName) 56 46 { 57 this-> setClassID(CL_SOUND_OGG_PLAYER, "OggPlayer");47 this->registerObject(this, OggPlayer::_objectList); 58 48 59 49 this->state = OggPlayer::None; … … 276 266 ogg->update(); 277 267 } 278 SDL_Delay(1 0);268 SDL_Delay(1); 279 269 } 280 270 PRINTF(4)("End the AudioThread\n"); -
trunk/src/lib/sound/ogg_player.h
r9019 r9869 13 13 #include <ogg/ogg.h> 14 14 #include <vorbis/vorbisfile.h> 15 #include " threading.h"15 #include "util/threading.h" 16 16 17 17 struct File; … … 25 25 class OggPlayer : public BaseObject 26 26 { 27 ObjectListDeclaration(OggPlayer); 28 27 29 public: 28 30 /** … … 98 100 99 101 100 std::string _title; 101 std::string _artist; 102 std::string _album; 103 std::string _vendor; 102 std::string _title; //!< Song Title. 103 std::string _artist; //!< Artist Name of the current song. 104 std::string _album; //!< Album Name of the current song. 105 std::string _vendor; //!< Vendor Name of the current song. 104 106 }; 105 107 -
trunk/src/lib/sound/sound_buffer.cc
r8971 r9869 18 18 #include "sound_buffer.h" 19 19 20 #include "sound_engine.h"21 20 22 #include "sdlincl.h"23 #include <cassert>24 #include "debug.h"25 #include "sys/stat.h"26 #include "helper_functions.h"27 28 #ifdef HAVE_SDL_SDL_H29 #include <SDL/SDL.h>30 #include <SDL/SDL_endian.h>31 #else32 #include <SDL.h>33 #include <SDL_endian.h>34 #endif35 21 namespace OrxSound 36 22 { 23 ObjectListDefinition(SoundBuffer); 37 24 ////////////////// 38 25 /* SOUND-BUFFER */ 39 26 ////////////////// 27 SoundBuffer::SoundBuffer() 28 : data(new SoundBufferData) 29 { 30 this->registerObject(this, SoundBuffer::_objectList); 31 } 40 32 /** 41 * Creates a Soundbuffer out of an inputfile33 * @brief Creates a Soundbuffer out of an inputfile 42 34 * @param fileName The name of the File 43 35 */ 44 36 SoundBuffer::SoundBuffer(const std::string& fileName) 37 : data(new SoundBufferData) 45 38 { 46 this->setClassID(CL_SOUND_BUFFER, "SoundBuffer"); 47 this->setName(fileName); 39 this->registerObject(this, SoundBuffer::_objectList); 40 this->load(fileName); 41 } 48 42 49 // generate a Buffer 50 alGenBuffers(1, &this->bufferID); 51 SoundEngine::checkError("Generate Buffer", __LINE__); 52 if (!nocaseCmp(fileName.substr(fileName.size() - 3), "WAV")) 53 { 54 this->loadWAV(fileName); 55 } 56 else if (!nocaseCmp(fileName.substr(fileName.size() - 3), "OGG")) 57 this->loadOGG(fileName); 43 SoundBuffer::SoundBuffer(const SoundBuffer& buffer) 44 : data(buffer.data) 45 { 46 this->registerObject(this, SoundBuffer::_objectList); 47 } 58 48 59 } 49 SoundBuffer::SoundBuffer(const SoundBufferData::Pointer& dataPointer) 50 : data(dataPointer) 51 { 52 this->registerObject(this, SoundBuffer::_objectList); 53 }; 60 54 61 55 SoundBuffer::~SoundBuffer() 62 56 { 63 // SoundEngine::getInstance()->removeBuffer(this);64 alDeleteBuffers(1, &this->bufferID);65 SoundEngine::checkError("SoundBuffer: Delete Buffer", __LINE__);66 57 } 67 58 68 /**69 * @brief loads a Waveform from the local fileSystem into this Source.70 * @param fileName the Name of the File to Load.71 * @returns true on success.72 */73 bool SoundBuffer::loadWAV(const std::string& fileName)74 {75 SDL_AudioSpec wavSpec;76 Uint32 wavLength;77 Uint8 *wavBuffer;78 79 /* Load the WAV */80 if( SDL_LoadWAV(fileName.c_str(), &wavSpec, &wavBuffer, &wavLength) == NULL)81 {82 PRINTF(2)("Could not open %s: %s\n", fileName.c_str(), SDL_GetError());83 return false;84 }85 #if SDL_BYTEORDER == SDL_BIG_ENDIAN86 if ( !( wavSpec.format == AUDIO_U8 || wavSpec.format == AUDIO_S8 ) )87 {88 int cnt = wavLength/2;89 Uint16* wavBufferAsShorts = ( Uint16* )wavBuffer;90 for ( int i = 0; i < cnt; ++i, ++wavBufferAsShorts )91 *wavBufferAsShorts = SDL_Swap16( *wavBufferAsShorts );92 }93 #endif94 alBufferData(this->bufferID, SoundBuffer::sdlAudioSpecToAlFormat(&wavSpec),95 wavBuffer, wavLength, wavSpec.freq);96 97 SDL_FreeWAV(wavBuffer);98 if (SoundEngine::checkError("Could not load Wave file", __LINE__))99 return true;100 else101 return false;102 }103 104 105 #ifndef AL_FORMAT_VORBIS_EXT106 #define AL_FORMAT_VORBIS_EXT 0x100030107 #endif108 /**109 * @brief loads an OGG-file into a SOundBuffer110 * @param fileName the Name of the File to load.111 * @returns true on success (file exists and is fully loaded), false otherwise.112 */113 bool SoundBuffer::loadOGG(const std::string& fileName)114 {115 void* ovdata;116 FILE* fh;117 118 fh = fopen( fileName.c_str() , "rb") ;119 if( fh != NULL )120 {121 struct stat sbuf ;122 123 if(stat( fileName.c_str(), &sbuf ) != -1)124 {125 ovdata = malloc(sbuf.st_size);126 if(ovdata != NULL)127 {128 fread( ovdata, 1, sbuf.st_size, fh);129 130 alBufferData( this->bufferID,131 AL_FORMAT_VORBIS_EXT,132 ovdata,133 sbuf.st_size,134 1) ;135 SoundEngine::checkError("Could not load OGG file", __LINE__);136 137 free(ovdata);138 }139 fclose(fh);140 }141 else142 return false;143 }144 else145 return false;146 147 return true ;148 149 }150 151 152 /**153 * @brief converts an SDL_AudioSpec into a valid OpenAL AUDIO_FORMAT enumerator154 * @param audiospec the AudioSpec to convert.155 * @returns the AL_FORMAT156 */157 ALenum SoundBuffer::sdlAudioSpecToAlFormat(const SDL_AudioSpec* audiospec)158 {159 assert (audiospec != NULL);160 bool stereo = true;161 bool is16Bit = true;162 if (audiospec->format == AUDIO_U8 || audiospec->format == AUDIO_S8)163 is16Bit = false;164 if (audiospec->channels == 1)165 stereo = false;166 167 if (!stereo && !is16Bit)168 return AL_FORMAT_MONO8;169 else if (!stereo && is16Bit)170 return AL_FORMAT_MONO16;171 else if (stereo && !is16Bit)172 return AL_FORMAT_STEREO8;173 else /* if (stereo && is16Bit) */174 return AL_FORMAT_STEREO16;175 }176 59 } -
trunk/src/lib/sound/sound_buffer.h
r8969 r9869 8 8 9 9 #include "base_object.h" 10 #include "alincl.h" 11 12 // FORWARD DECLARATION 13 typedef struct SDL_AudioSpec; 10 #include "sound_buffer_data.h" 14 11 15 12 namespace OrxSound 16 13 { 17 14 //! A class that represents a datastructure to play Sounds. 18 class SoundBuffer : public BaseObject15 class SoundBuffer : virtual public BaseObject 19 16 { 17 ObjectListDeclaration(SoundBuffer); 20 18 public: 19 SoundBuffer(); 20 SoundBuffer(const SoundBuffer& buffer); 21 SoundBuffer(const SoundBufferData::Pointer& dataPointer); 21 22 SoundBuffer(const std::string& fileName); 22 23 virtual ~SoundBuffer(); 23 24 24 bool loadWAV(const std::string& fileName); 25 bool loadOGG(const std::string& fileName); 25 /** @brief assignment operator */ 26 SoundBuffer& operator=(const SoundBuffer& buffer) { this->data = buffer.data; return *this; }; 27 bool operator==(const SoundBuffer& buffer) const {return this->data == buffer.data; }; 28 29 /** @see SoundBufferData::load */ 30 inline bool load(const std::string& fileName) { return this->data->load(fileName); }; 31 /** @see SoundBufferData::loadWav */ 32 inline bool loadWAV(const std::string& fileName) { return this->data->loadWAV(fileName); }; 33 /** @see SoundBufferData::loadOgg */ 34 inline bool loadOGG(const std::string& fileName) { return this->data->loadOGG(fileName); }; 26 35 27 36 /** @returns the ID of the buffer used in this SoundBuffer */ 28 inline ALuint getID() const { return this->bufferID; } 37 inline ALuint getID() const { return this->data->getID(); } 38 inline bool loaded() const { return this->data->loaded(); } 39 40 /** @returns the DataPointer */ 41 const SoundBufferData::Pointer& dataPointer() const { return data; } 42 /** @param dataPointer the data to acquire @brief Buffer shall acquire dataPointers data */ 43 void acquireData(const SoundBufferData::Pointer& dataPointer) { data = dataPointer; }; 29 44 30 45 private: 31 ALenum sdlAudioSpecToAlFormat(const SDL_AudioSpec* audiospec); 32 33 private: 34 ALuint bufferID; //!< The address of the Buffer. 35 36 ALsizei size; //!< The size of the Buffer. 37 ALboolean loop; //!< loop information. 46 SoundBufferData::Pointer data; //!< Pointer to the Stored Data 38 47 }; 39 48 } -
trunk/src/lib/sound/sound_engine.cc
r9235 r9869 21 21 #include "sound_engine.h" 22 22 23 #include "class_list.h"24 25 23 #include "p_node.h" 26 #include "util/loading/resource_manager.h"27 24 #include "debug.h" 28 #include " util/preferences.h"25 #include "parser/preferences/preferences.h" 29 26 #include "globals.h" 27 #include "resource_sound_buffer.h" 30 28 31 29 namespace OrxSound 32 30 { 33 31 ObjectListDefinition(SoundEngine); 34 32 ////////////////// 35 33 /* SOUND-ENGINE */ … … 40 38 SoundEngine::SoundEngine () 41 39 { 42 this-> setClassID(CL_SOUND_ENGINE, "SoundEngine");40 this->registerObject(this, SoundEngine::_objectList); 43 41 this->setName("SoundEngine"); 44 42 45 43 this->listener = NULL; 46 this->bufferList = NULL;47 this->sourceList = NULL;48 44 49 45 this->device = NULL; … … 69 65 { 70 66 // deleting all the SoundSources 71 if(this->sourceList != NULL) 72 { 73 while (this->sourceList->size() > 0) 74 delete static_cast<SoundSource*>(this->sourceList->front()); 75 } 67 while (!SoundSource::objectList().empty()) 68 delete (SoundSource::objectList().front()); 76 69 77 70 while(!this->ALSources.empty()) … … 89 82 90 83 // deleting all the SoundBuffers 91 if (this->bufferList != NULL) 92 { 93 while(this->bufferList->size() > 0) 94 ResourceManager::getInstance()->unload(static_cast<SoundBuffer*>(this->bufferList->front())); 95 } 84 // while(!SoundBuffer::objectList().empty()) 85 //ResourceManager::getInstance()->unload(SoundBuffer::objectList().front()); 96 86 97 87 // removing openAL from AudioResource … … 129 119 SoundSource* SoundEngine::createSource(const std::string& fileName, PNode* sourceNode) 130 120 { 131 SoundBuffer * buffer = NULL;121 SoundBuffer buffer; 132 122 if (!fileName.empty()) 133 123 { 134 buffer = (SoundBuffer*)ResourceManager::getInstance()->load(fileName, WAV, RP_LEVEL);135 if ( buffer == NULL)124 buffer = ResourceSoundBuffer(fileName); 125 if (!buffer.loaded()) 136 126 PRINTF(2)("Wav-Sound %s could not be loaded onto new Source\n", fileName.c_str()); 137 127 } … … 212 202 213 203 // updating all the Sources positions 214 if (likely(this->sourceList != NULL || (this->sourceList = ClassList::getList(CL_SOUND_SOURCE)) != NULL)) 215 { 216 std::list<BaseObject*>::const_iterator sourceIT; 217 SoundSource* source; 218 for (sourceIT = this->sourceList->begin(); sourceIT != this->sourceList->end(); sourceIT++) 204 ObjectList<SoundSource>::const_iterator sourceIT; 205 for (sourceIT = SoundSource::objectList().begin(); 206 sourceIT != SoundSource::objectList().end(); 207 sourceIT++) 208 { 209 if ((*sourceIT)->isPlaying()) 219 210 { 220 source = static_cast<SoundSource*>(*sourceIT); 221 if (source->isPlaying()) 211 int play = 0x000; 212 alGetSourcei((*sourceIT)->getID(), AL_SOURCE_STATE, &play); 213 if (DEBUG_LEVEL > 2) 214 SoundEngine::checkError("SoundEngine::update() Play", __LINE__); 215 if(play == AL_PLAYING) 222 216 { 223 int play = 0x000; 224 alGetSourcei(source->getID(), AL_SOURCE_STATE, &play); 225 if (DEBUG_LEVEL > 2) 226 SoundEngine::checkError("SoundEngine::update() Play", __LINE__); 227 if(play == AL_PLAYING) 217 if (likely((*sourceIT)->getNode() != NULL)) 228 218 { 229 if (likely(source->getNode() != NULL)) 230 { 231 alSource3f(source->getID(), AL_POSITION, 232 source->getNode()->getAbsCoor().x, 233 source->getNode()->getAbsCoor().y, 234 source->getNode()->getAbsCoor().z); 235 if (DEBUG_LEVEL > 2) 236 SoundEngine::checkError("SoundEngine::update() Set Source Position", __LINE__); 237 alSource3f(source->getID(), AL_VELOCITY, 238 source->getNode()->getVelocity().x, 239 source->getNode()->getVelocity().y, 240 source->getNode()->getVelocity().z); 241 if (DEBUG_LEVEL > 2) 242 SoundEngine::checkError("SoundEngine::update() Set Source Velocity", __LINE__); 243 } 219 alSource3f((*sourceIT)->getID(), AL_POSITION, 220 (*sourceIT)->getNode()->getAbsCoor().x, 221 (*sourceIT)->getNode()->getAbsCoor().y, 222 (*sourceIT)->getNode()->getAbsCoor().z); 223 if (DEBUG_LEVEL > 2) 224 SoundEngine::checkError("SoundEngine::update() Set Source Position", __LINE__); 225 alSource3f((*sourceIT)->getID(), AL_VELOCITY, 226 (*sourceIT)->getNode()->getVelocity().x, 227 (*sourceIT)->getNode()->getVelocity().y, 228 (*sourceIT)->getNode()->getVelocity().z); 229 if (DEBUG_LEVEL > 2) 230 SoundEngine::checkError("SoundEngine::update() Set Source Velocity", __LINE__); 244 231 } 245 else246 {247 source->stop();248 }232 } 233 else 234 { 235 (*sourceIT)->stop(); 249 236 } 250 237 } … … 393 380 default: 394 381 case AL_NO_ERROR: 395 382 return ("AL_NO_ERROR"); 396 383 case AL_INVALID_NAME: 397 384 return ("AL_INVALID_NAME"); 398 385 case AL_INVALID_ENUM: 399 386 return ("AL_INVALID_ENUM"); 400 387 case AL_INVALID_VALUE: 401 388 return ("AL_INVALID_VALUE"); 402 389 case AL_INVALID_OPERATION: 403 390 return ("AL_INVALID_OPERATION"); 404 391 case AL_OUT_OF_MEMORY: 405 392 return ("AL_OUT_OF_MEMORY"); 406 393 }; 407 394 } … … 414 401 default: 415 402 case ALC_NO_ERROR: 416 403 return ("AL_NO_ERROR"); 417 404 case ALC_INVALID_DEVICE: 418 405 return ("ALC_INVALID_DEVICE"); 419 406 case ALC_INVALID_CONTEXT: 420 407 return("ALC_INVALID_CONTEXT"); 421 408 case ALC_INVALID_ENUM: 422 409 return("ALC_INVALID_ENUM"); 423 410 case ALC_INVALID_VALUE: 424 411 return ("ALC_INVALID_VALUE"); 425 412 case ALC_OUT_OF_MEMORY: 426 413 return("ALC_OUT_OF_MEMORY"); 427 414 }; 428 415 } -
trunk/src/lib/sound/sound_engine.h
r7847 r9869 27 27 class SoundEngine : public BaseObject 28 28 { 29 public: 29 ObjectListDeclaration(SoundEngine); 30 public: 30 31 virtual ~SoundEngine(); 31 32 /** @returns a Pointer to the only object of this Class */ … … 75 76 const PNode* listener; //!< The listener of the Scene 76 77 77 const std::list<BaseObject*>* bufferList; //!< A list of buffers78 const std::list<BaseObject*>* sourceList; //!< A list for all the sources in the scene.79 80 78 unsigned int maxSourceCount; //!< How many Sources is the Maximum 81 79 std::stack<ALuint> ALSources; //!< A list of real openAL-Sources, the engine allocates, and stores for reuse. -
trunk/src/lib/sound/sound_source.cc
r8969 r9869 19 19 #include "sound_engine.h" 20 20 21 #include "alincl.h"22 21 #include "compiler.h" 23 22 #include "debug.h" … … 25 24 namespace OrxSound 26 25 { 26 ObjectListDefinition(SoundSource); 27 27 /** 28 28 * @brief creates a SoundSource at position sourceNode with the SoundBuffer buffer 29 29 */ 30 SoundSource::SoundSource(const PNode* sourceNode, const SoundBuffer* buffer) 31 { 32 this->setClassID(CL_SOUND_SOURCE, "SoundSource"); 33 30 SoundSource::SoundSource(const PNode* sourceNode, const SoundBuffer& buffer) 31 { 32 this->registerObject(this, SoundSource::_objectList); 34 33 // adding the Source to the SourcesList of the SoundEngine 35 34 this->buffer = buffer; … … 51 50 SoundSource::SoundSource(const SoundSource& source) 52 51 { 53 this-> setClassID(CL_SOUND_SOURCE, "SoundSource");52 this->registerObject(this, SoundSource::_objectList); 54 53 55 54 // adding the Source to the SourcesList of the SoundEngine … … 120 119 void SoundSource::play() 121 120 { 122 if (this-> buffer && this->retrieveSource())121 if (this->retrieveSource()) 123 122 { 124 123 if (this->bPlay) 125 124 alSourceStop(this->sourceID); 126 125 127 alSourcei (this->sourceID, AL_BUFFER, this->buffer ->getID());126 alSourcei (this->sourceID, AL_BUFFER, this->buffer.getID()); 128 127 alSourcei (this->sourceID, AL_LOOPING, AL_FALSE); 129 128 alSourcef (this->sourceID, AL_GAIN, 1); … … 141 140 * @param buffer the buffer to play back on this Source 142 141 */ 143 void SoundSource::play(const SoundBuffer *buffer)142 void SoundSource::play(const SoundBuffer& buffer) 144 143 { 145 144 if (!this->retrieveSource()) … … 150 149 151 150 alSourceStop(this->sourceID); 152 alSourcei (this->sourceID, AL_BUFFER, buffer ->getID());151 alSourcei (this->sourceID, AL_BUFFER, buffer.getID()); 153 152 alSourcei (this->sourceID, AL_LOOPING, AL_FALSE); 154 153 alSourcef (this->sourceID, AL_GAIN, 1); … … 156 155 alSourcePlay(this->sourceID); 157 156 158 if (unlikely(this->buffer != NULL))159 alSourcei (this->sourceID, AL_BUFFER, this->buffer ->getID());157 if (unlikely(this->buffer.getID() != 0)) 158 alSourcei (this->sourceID, AL_BUFFER, this->buffer.getID()); 160 159 this->bPlay = true; 161 160 … … 170 169 * @param gain the gain of the sound buffer 171 170 */ 172 void SoundSource::play(const SoundBuffer *buffer, float gain)171 void SoundSource::play(const SoundBuffer& buffer, float gain) 173 172 { 174 173 if (!this->retrieveSource()) … … 179 178 180 179 alSourceStop(this->sourceID); 181 alSourcei (this->sourceID, AL_BUFFER, buffer ->getID());180 alSourcei (this->sourceID, AL_BUFFER, buffer.getID()); 182 181 alSourcei (this->sourceID, AL_LOOPING, AL_FALSE); 183 182 alSourcef (this->sourceID, AL_GAIN, gain); … … 185 184 alSourcePlay(this->sourceID); 186 185 187 if (unlikely(this->buffer != NULL))188 alSourcei (this->sourceID, AL_BUFFER, this->buffer ->getID());186 if (unlikely(this->buffer.getID() != 0)) 187 alSourcei (this->sourceID, AL_BUFFER, this->buffer.getID()); 189 188 this->bPlay = true; 190 189 … … 199 198 * @param loop if true, sound gets looped 200 199 */ 201 void SoundSource::play(const SoundBuffer *buffer, float gain, bool loop)200 void SoundSource::play(const SoundBuffer& buffer, float gain, bool loop) 202 201 { 203 202 if (!this->retrieveSource()) … … 208 207 209 208 alSourceStop(this->sourceID); 210 alSourcei (this->sourceID, AL_BUFFER, buffer ->getID());209 alSourcei (this->sourceID, AL_BUFFER, buffer.getID()); 211 210 212 211 if (loop) … … 219 218 alSourcePlay(this->sourceID); 220 219 221 if (unlikely(this->buffer != NULL))222 alSourcei (this->sourceID, AL_BUFFER, this->buffer ->getID());220 if (unlikely(this->buffer.getID() != 0)) 221 alSourcei (this->sourceID, AL_BUFFER, this->buffer.getID()); 223 222 this->bPlay = true; 224 223 … … 232 231 * @param gain the new gain value 233 232 */ 234 void SoundSource::gain(const SoundBuffer *buffer, float gain)233 void SoundSource::gain(const SoundBuffer& buffer, float gain) 235 234 { 236 235 // alSourcei (this->sourceID, AL_BUFFER, buffer->getID()); … … 347 346 * @param duration time perios to fade in 348 347 */ 349 void SoundSource::fadein(const SoundBuffer *buffer, ALfloat duration)348 void SoundSource::fadein(const SoundBuffer& buffer, ALfloat duration) 350 349 { 351 350 //if (this->buffer && this->retrieveSource()) -
trunk/src/lib/sound/sound_source.h
r8793 r9869 8 8 9 9 #include "base_object.h" 10 #include "sound_buffer.h" 10 11 #include "alincl.h" 11 12 … … 14 15 namespace OrxSound 15 16 { 16 class SoundBuffer;17 17 //! A class that represents a SoundSource 18 18 class SoundSource : public BaseObject 19 19 { 20 ObjectListDeclaration(SoundSource); 20 21 public: 21 SoundSource(const PNode* sourceNode = NULL, const SoundBuffer * buffer = NULL);22 SoundSource(const PNode* sourceNode = NULL, const SoundBuffer& buffer = SoundBuffer()); 22 23 SoundSource(const SoundSource& source); 23 24 SoundSource& operator=(const SoundSource& source); … … 28 29 // user interaction 29 30 void play(); 30 void play(const SoundBuffer *buffer);31 void play(const SoundBuffer *buffer, float gain);32 void play(const SoundBuffer *buffer, float gain, bool loop);31 void play(const SoundBuffer& buffer); 32 void play(const SoundBuffer& buffer, float gain); 33 void play(const SoundBuffer& buffer, float gain, bool loop); 33 34 34 void gain(const SoundBuffer *buffer, float gain);35 void gain(const SoundBuffer& buffer, float gain); 35 36 36 37 void stop(); 37 38 void pause(); 38 39 void rewind(); 39 void fadein(const SoundBuffer *buffer, ALfloat duration);40 void fadein(const SoundBuffer& buffer, ALfloat duration); 40 41 41 42 // development functions … … 46 47 void setSourceNode(const PNode* sourceNode); 47 48 /** @returns the SoundBuffer of this Source */ 48 inline const SoundBuffer *getBuffer() const { return this->buffer; };49 inline const SoundBuffer& getBuffer() const { return this->buffer; }; 49 50 /** @returns the SourceNode of this Source */ 50 51 inline const PNode* getNode() const { return this->sourceNode; }; … … 65 66 bool resident; //!< If the alSource should be resident (if true, the alSource will be returned on deletion). 66 67 ALuint sourceID; //!< The ID of the Source 67 const SoundBuffer*buffer; //!< The buffer to play in this source.68 SoundBuffer buffer; //!< The buffer to play in this source. 68 69 const PNode* sourceNode; //!< The SourceNode representing the position/velocity... of this source. 69 70 };
Note: See TracChangeset
for help on using the changeset viewer.