There is a
copyFrom() method which takes a raw
float * and asks you to set the channel count & sample rate metadata:
void copyFrom(const float * floatBuffer, std::size_t numFrames, std::size_t numChannels, unsigned int sampleRate)
…Or you could access the underlying buffer if you’d like to use
std::vector methods like
begin() / end()
If you get the raw buffer like this, you should set the sample rate and channel count later, or things like resampling or playback won’t work correctly.
For reading the buffer, you can use
operator to access the underlying
std::vector<float> directly, or use
getSample() to handle the
(frameIndex * channels) + channel calculation for you.
ofSoundBuffer doesn’t include any file I/O at the moment