Skip to content

Commit

Permalink
JUCE leaked object detector asserting on biquads class...
Browse files Browse the repository at this point in the history
  • Loading branch information
nathanjhood committed Mar 18, 2024
1 parent 5b1800e commit fdba0c6
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 7 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.2.2.170
1.2.2.171
6 changes: 3 additions & 3 deletions include/StoneyDSP/Biquads/Processor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,9 @@ class AudioPluginAudioProcessor final : public juce::AudioProcessor
std::unique_ptr<AudioPluginAudioProcessorWrapper<float>> processorFltPtr;
std::unique_ptr<AudioPluginAudioProcessorWrapper<double>> processorDblPtr;

AudioPluginAudioProcessorParameters& parameters;
AudioPluginAudioProcessorWrapper<float>& processorFlt;
AudioPluginAudioProcessorWrapper<double>& processorDbl;
// AudioPluginAudioProcessorParameters& parameters;
// AudioPluginAudioProcessorWrapper<float>& processorFlt;
// AudioPluginAudioProcessorWrapper<double>& processorDbl;

//==============================================================================
/** Parameter pointers. */
Expand Down
20 changes: 17 additions & 3 deletions src/StoneyDSP/Biquads/Processor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ AudioPluginAudioProcessor::AudioPluginAudioProcessor()
, parametersPtr(std::make_unique<AudioPluginAudioProcessorParameters>(*this, getAPVTS()))
, processorFltPtr(std::make_unique<AudioPluginAudioProcessorWrapper<float>> (*this, getAPVTS(), getSpec()))
, processorDblPtr(std::make_unique<AudioPluginAudioProcessorWrapper<double>>(*this, getAPVTS(), getSpec()))
, parameters (*parametersPtr.get())
, processorFlt (*processorFltPtr.get())
, processorDbl (*processorDblPtr.get())
// , parameters (*parametersPtr.get())
// , processorFlt (*processorFltPtr.get())
// , processorDbl (*processorDblPtr.get())
// , processingPrecision(singlePrecision)
, bypassState (dynamic_cast<juce::AudioParameterBool*> (apvts.getParameter("Master_bypassID")))
{
Expand Down Expand Up @@ -188,6 +188,9 @@ void AudioPluginAudioProcessor::changeProgramName (int index, const juce::String
//==============================================================================
void AudioPluginAudioProcessor::prepareToPlay (double sampleRate, int samplesPerBlock)
{
AudioPluginAudioProcessorWrapper<float>& processorFlt = *processorFltPtr.get();
AudioPluginAudioProcessorWrapper<double>& processorDbl = *processorDblPtr.get();

// Use this method as the place to do any pre-playback
// initialisation that you need..
processingPrecision = getProcessingPrecision();
Expand All @@ -210,6 +213,9 @@ void AudioPluginAudioProcessor::prepareToPlay (double sampleRate, int samplesPer

void AudioPluginAudioProcessor::releaseResources()
{
AudioPluginAudioProcessorWrapper<float>& processorFlt = *processorFltPtr.get();
AudioPluginAudioProcessorWrapper<double>& processorDbl = *processorDblPtr.get();

// When playback stops, you can use this as an opportunity to free up any
// spare memory, etc.
if(!isUsingDoublePrecision())
Expand Down Expand Up @@ -252,6 +258,8 @@ void AudioPluginAudioProcessor::processBlock (juce::AudioBuffer<float>& buffer,
{
jassert (! isUsingDoublePrecision());

AudioPluginAudioProcessorWrapper<float>& processorFlt = *processorFltPtr.get();

juce::ScopedNoDenormals noDenormals;

processorFlt.process(buffer, midiMessages);
Expand All @@ -268,6 +276,8 @@ void AudioPluginAudioProcessor::processBlock (juce::AudioBuffer<double>& buffer,
{
jassert (isUsingDoublePrecision());

AudioPluginAudioProcessorWrapper<double>& processorDbl = *processorDblPtr.get();

juce::ScopedNoDenormals noDenormals;

processorDbl.process(buffer, midiMessages);
Expand All @@ -282,13 +292,17 @@ void AudioPluginAudioProcessor::processBlockBypassed(juce::AudioBuffer<float>& b
{
jassert (! isUsingDoublePrecision());

AudioPluginAudioProcessorWrapper<float>& processorFlt = *processorFltPtr.get();

processorFlt.processBypass(buffer, midiMessages);
}

void AudioPluginAudioProcessor::processBlockBypassed(juce::AudioBuffer<double>& buffer, juce::MidiBuffer& midiMessages)
{
jassert (isUsingDoublePrecision());

AudioPluginAudioProcessorWrapper<double>& processorDbl = *processorDblPtr.get();

processorDbl.processBypass(buffer, midiMessages);
}

Expand Down

0 comments on commit fdba0c6

Please sign in to comment.