Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Implementation of sf::SoundBuffer  (Read 24716 times)

0 Members and 2 Guests are viewing this topic.

MadMartin

  • Jr. Member
  • **
  • Posts: 74
    • View Profile
Implementation of sf::SoundBuffer
« 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

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Implementation of sf::SoundBuffer
« Reply #1 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.
Laurent Gomila - SFML developer

 

anything