Browse Source

Set avoidReallocating argument of AudioBuffer::makeCopyOf() to true in some audio class methods to avoid unnecessary reallocations in double-float buffer conversion

tags/2021-05-28
ed 9 years ago
parent
commit
9a130f2810
3 changed files with 6 additions and 6 deletions
  1. +2
    -2
      modules/juce_audio_basics/synthesisers/juce_Synthesiser.cpp
  2. +2
    -2
      modules/juce_audio_processors/processors/juce_AudioProcessorGraph.cpp
  3. +2
    -2
      modules/juce_audio_utils/players/juce_AudioProcessorPlayer.cpp

+ 2
- 2
modules/juce_audio_basics/synthesisers/juce_Synthesiser.cpp View File

@@ -78,9 +78,9 @@ void SynthesiserVoice::renderNextBlock (AudioBuffer<double>& outputBuffer,
outputBuffer.getNumChannels(),
startSample, numSamples);
tempBuffer.makeCopyOf (subBuffer);
tempBuffer.makeCopyOf (subBuffer, true);
renderNextBlock (tempBuffer, 0, numSamples);
subBuffer.makeCopyOf (tempBuffer);
subBuffer.makeCopyOf (tempBuffer, true);
}
//==============================================================================


+ 2
- 2
modules/juce_audio_processors/processors/juce_AudioProcessorGraph.cpp View File

@@ -293,9 +293,9 @@ struct ProcessBufferOp : public AudioGraphRenderingOp<ProcessBufferOp>
// precision then we need to convert between buffer formats. Note, that
// this will only happen if the processor does not support double
// precision processing.
tempBuffer.makeCopyOf (buffer);
tempBuffer.makeCopyOf (buffer, true);
processor->processBlock (tempBuffer, midiMessages);
buffer.makeCopyOf (tempBuffer);
buffer.makeCopyOf (tempBuffer, true);
}
}


+ 2
- 2
modules/juce_audio_utils/players/juce_AudioProcessorPlayer.cpp View File

@@ -156,9 +156,9 @@ void AudioProcessorPlayer::audioDeviceIOCallback (const float** const inputChann
{
if (processor->isUsingDoublePrecision())
{
conversionBuffer.makeCopyOf (buffer);
conversionBuffer.makeCopyOf (buffer, true);
processor->processBlock (conversionBuffer, incomingMidi);
buffer.makeCopyOf (conversionBuffer);
buffer.makeCopyOf (conversionBuffer, true);
}
else
{


Loading…
Cancel
Save