AudioSampleBuffer::AudioSampleBuffer (float* const* dataToReferTo, const int numChannels_, const int numSamples) noexcept : numChannels (numChannels_), size (numSamples), allocatedBytes (0) { jassert (numChannels_ > 0); allocateChannels (dataToReferTo, 0); }
AudioSampleBuffer::AudioSampleBuffer (float* const* dataToReferTo, const int numChans, const int numSamples) noexcept : numChannels (numChans), size (numSamples), allocatedBytes (0) { jassert (dataToReferTo != nullptr); jassert (numChans >= 0 && numSamples >= 0); allocateChannels (dataToReferTo, 0); }
AudioSampleBuffer::AudioSampleBuffer (float* const* dataToReferTo, const int numChans, const int startSample, const int numSamples) noexcept : numChannels (numChans), size (numSamples), allocatedBytes (0), isClear (false) { jassert (dataToReferTo != nullptr); jassert (numChans >= 0); allocateChannels (dataToReferTo, startSample); }
void AudioSampleBuffer::setDataToReferTo (float** dataToReferTo, const int newNumChannels, const int newNumSamples) noexcept { jassert (newNumChannels > 0); allocatedBytes = 0; allocatedData.free(); numChannels = newNumChannels; size = newNumSamples; allocateChannels (dataToReferTo, 0); }
void AudioSampleBuffer::setDataToReferTo (float** dataToReferTo, const int newNumChannels, const int newNumSamples) noexcept { jassert (dataToReferTo != nullptr); jassert (newNumChannels >= 0 && newNumSamples >= 0); if (allocatedBytes != 0) { allocatedBytes = 0; allocatedData.free(); } numChannels = newNumChannels; size = newNumSamples; allocateChannels (dataToReferTo, 0); jassert (! isClear); }
AudioSampleBuffer::AudioSampleBuffer (const AudioSampleBuffer& other) noexcept : numChannels (other.numChannels), size (other.size), allocatedBytes (other.allocatedBytes) { if (allocatedBytes == 0) { allocateChannels (other.channels, 0); } else { allocateData(); if (other.isClear) { clear(); } else { for (int i = 0; i < numChannels; ++i) FloatVectorOperations::copy (channels[i], other.channels[i], size); } } }