mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
Converted AudioSampleBuffer into a templated class that can use either float or double types. Used this to implement 64-bit audio plugin support in VST and AU
This commit is contained in:
parent
ba672f03fb
commit
c562cfc3cc
27 changed files with 1713 additions and 1104 deletions
|
|
@ -22,11 +22,12 @@
|
|||
==============================================================================
|
||||
*/
|
||||
|
||||
AudioProcessorPlayer::AudioProcessorPlayer()
|
||||
AudioProcessorPlayer::AudioProcessorPlayer(bool doDoublePrecisionProcessing)
|
||||
: processor (nullptr),
|
||||
sampleRate (0),
|
||||
blockSize (0),
|
||||
isPrepared (false),
|
||||
isDoublePrecision (doDoublePrecisionProcessing),
|
||||
numInputChans (0),
|
||||
numOutputChans (0)
|
||||
{
|
||||
|
|
@ -45,6 +46,12 @@ void AudioProcessorPlayer::setProcessor (AudioProcessor* const processorToPlay)
|
|||
if (processorToPlay != nullptr && sampleRate > 0 && blockSize > 0)
|
||||
{
|
||||
processorToPlay->setPlayConfigDetails (numInputChans, numOutputChans, sampleRate, blockSize);
|
||||
|
||||
const bool supportsDouble = processorToPlay->supportsDoublePrecisionProcessing() && isDoublePrecision;
|
||||
AudioProcessor::ProcessingPrecision precision = supportsDouble ? AudioProcessor::doublePrecision
|
||||
: AudioProcessor::singlePrecision;
|
||||
|
||||
processorToPlay->setProcessingPrecision (precision);
|
||||
processorToPlay->prepareToPlay (sampleRate, blockSize);
|
||||
}
|
||||
|
||||
|
|
@ -62,6 +69,28 @@ void AudioProcessorPlayer::setProcessor (AudioProcessor* const processorToPlay)
|
|||
}
|
||||
}
|
||||
|
||||
void AudioProcessorPlayer::setDoublePrecisionProcessing (bool doublePrecision)
|
||||
{
|
||||
if (doublePrecision != isDoublePrecision)
|
||||
{
|
||||
const ScopedLock sl (lock);
|
||||
|
||||
if (processor != nullptr)
|
||||
{
|
||||
processor->releaseResources();
|
||||
|
||||
const bool supportsDouble = processor->supportsDoublePrecisionProcessing() && doublePrecision;
|
||||
AudioProcessor::ProcessingPrecision precision = supportsDouble ? AudioProcessor::doublePrecision
|
||||
: AudioProcessor::singlePrecision;
|
||||
|
||||
processor->setProcessingPrecision (precision);
|
||||
processor->prepareToPlay (sampleRate, blockSize);
|
||||
}
|
||||
|
||||
isDoublePrecision = doublePrecision;
|
||||
}
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
void AudioProcessorPlayer::audioDeviceIOCallback (const float** const inputChannelData,
|
||||
const int numInputChannels,
|
||||
|
|
@ -126,7 +155,17 @@ void AudioProcessorPlayer::audioDeviceIOCallback (const float** const inputChann
|
|||
|
||||
if (! processor->isSuspended())
|
||||
{
|
||||
processor->processBlock (buffer, incomingMidi);
|
||||
if (processor->isUsingDoublePrecision())
|
||||
{
|
||||
conversionBuffer.makeCopyOf (buffer);
|
||||
processor->processBlock (conversionBuffer, incomingMidi);
|
||||
buffer.makeCopyOf (conversionBuffer);
|
||||
}
|
||||
else
|
||||
{
|
||||
processor->processBlock (buffer, incomingMidi);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue