本文整理汇总了C++中AudioBuffer::makeCopyOf方法的典型用法代码示例。如果您正苦于以下问题:C++ AudioBuffer::makeCopyOf方法的具体用法?C++ AudioBuffer::makeCopyOf怎么用?C++ AudioBuffer::makeCopyOf使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AudioBuffer
的用法示例。
在下文中一共展示了AudioBuffer::makeCopyOf方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: renderNextBlock
void SynthesiserVoice::renderNextBlock (AudioBuffer<double>& outputBuffer,
int startSample, int numSamples)
{
AudioBuffer<double> subBuffer (outputBuffer.getArrayOfWritePointers(),
outputBuffer.getNumChannels(),
startSample, numSamples);
tempBuffer.makeCopyOf (subBuffer, true);
renderNextBlock (tempBuffer, 0, numSamples);
subBuffer.makeCopyOf (tempBuffer, true);
}
示例2: audioDeviceIOCallback
//==============================================================================
void AudioProcessorPlayer::audioDeviceIOCallback (const float** const inputChannelData,
const int numInputChannels,
float** const outputChannelData,
const int numOutputChannels,
const int numSamples)
{
// these should have been prepared by audioDeviceAboutToStart()...
jassert (sampleRate > 0 && blockSize > 0);
incomingMidi.clear();
messageCollector.removeNextBlockOfMessages (incomingMidi, numSamples);
int totalNumChans = 0;
if (numInputChannels > numOutputChannels)
{
// if there aren't enough output channels for the number of
// inputs, we need to create some temporary extra ones (can't
// use the input data in case it gets written to)
tempBuffer.setSize (numInputChannels - numOutputChannels, numSamples,
false, false, true);
for (int i = 0; i < numOutputChannels; ++i)
{
channels[totalNumChans] = outputChannelData[i];
memcpy (channels[totalNumChans], inputChannelData[i], sizeof (float) * (size_t) numSamples);
++totalNumChans;
}
for (int i = numOutputChannels; i < numInputChannels; ++i)
{
channels[totalNumChans] = tempBuffer.getWritePointer (i - numOutputChannels);
memcpy (channels[totalNumChans], inputChannelData[i], sizeof (float) * (size_t) numSamples);
++totalNumChans;
}
}
else
{
for (int i = 0; i < numInputChannels; ++i)
{
channels[totalNumChans] = outputChannelData[i];
memcpy (channels[totalNumChans], inputChannelData[i], sizeof (float) * (size_t) numSamples);
++totalNumChans;
}
for (int i = numInputChannels; i < numOutputChannels; ++i)
{
channels[totalNumChans] = outputChannelData[i];
zeromem (channels[totalNumChans], sizeof (float) * (size_t) numSamples);
++totalNumChans;
}
}
AudioBuffer<float> buffer (channels, totalNumChans, numSamples);
{
const ScopedLock sl (lock);
if (processor != nullptr)
{
const ScopedLock sl2 (processor->getCallbackLock());
if (! processor->isSuspended())
{
if (processor->isUsingDoublePrecision())
{
conversionBuffer.makeCopyOf (buffer, true);
processor->processBlock (conversionBuffer, incomingMidi);
buffer.makeCopyOf (conversionBuffer, true);
}
else
{
processor->processBlock (buffer, incomingMidi);
}
return;
}
}
}
for (int i = 0; i < numOutputChannels; ++i)
FloatVectorOperations::clear (outputChannelData[i], numSamples);
}