SFML community forums

Help => Audio => Topic started by: MadMartin on December 11, 2008, 12:05:11 pm

Title: Implementation of sf::SoundBuffer
Post by: MadMartin on December 11, 2008, 12:05:11 pm
Hi Laurent,

as I studied the source of the audio package of SFML I wondered why you were storing the samples in the vector myBuffer in sf::SoundBuffer. AFAIK OpenAL copies the sample data with alBufferData(..), so you just could use temporary memory and free it after the call to alBufferData(..).

Correct me if I'm wrong! If I'm right, I'd like to know why you did it this way  :wink:


Martin
Title: Implementation of sf::SoundBuffer
Post by: Laurent on December 11, 2008, 01:56:05 pm
If I remember correctly, this is just to avoid allocating and freeing memory each time. As the array will always have the same size, it can be allocated once at startup and reused.