I have two separate AudioSampleBuffer objects in two separate classes. Here is the private section of the first class which is called TransportBar.h:
private:
Atomic<int> playState;
Atomic<int> soloState;
Atomic<int> muteState;
unsigned int bufferPosition;
AudioSampleBuffer masterBuffer;
static const int bufferSize = 352800; //constant
and here is the private section of the section class which is called Looper.h:
private:
//Shared data
Atomic<int> recordState;
Atomic<int> playState;
//Audio data
static const int bufferSize = 352800; //constant
unsigned int bufferPosition;
AudioSampleBuffer audioSampleBuffer;
The application I am creating has 4 tracks which record to audioSampleBuffer. I then want a "master" play button, which plays all this data. Therefor what I need to do is copy the data from audioSampleBuffer to masterBuffer. Is there a way to do this?
AudioSampleBuffer
is simply a typedef
for AudioBuffer<float>
, the documentation for which can be found here. Inside there you will see the copyFrom
member function. There are several overloads for this function, one of which takes an AudioBuffer<T>
as its source buffer.
To get access to the AudioSampleBuffer
so you can copy it, you must do one of the following:
It's worth asking yourself whether or not this is an architectural problem too; could this problem have been avoided entirely with a better design?