Skip to content

Commit

Permalink
Add target class for benchmark
Browse files Browse the repository at this point in the history
  • Loading branch information
utokusa committed Nov 30, 2021
1 parent 2af4263 commit 9385c2a
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 6 deletions.
24 changes: 24 additions & 0 deletions src/FancyFx.h
@@ -0,0 +1,24 @@
#pragma once

#include <JuceHeader.h>

class FancyFx
{
public:
FancyFx() = default;
void render (juce::AudioBuffer<float>& out_buffer)
{

for (int channel = 0; channel < out_buffer.getNumChannels(); ++channel)
{
auto* channelData = out_buffer.getWritePointer (channel);
for (int i = 0; i < out_buffer.getNumSamples(); i++)
{
channelData[i] = channelData[i] * gain;
}
}
}
private:
const float gain = 0.3f;

};
8 changes: 2 additions & 6 deletions src/PluginProcessor.cpp
Expand Up @@ -21,6 +21,7 @@ JuceBenchmarkAudioProcessor::JuceBenchmarkAudioProcessor()
#endif
)
#endif
, fancy_fx()
{
}

Expand Down Expand Up @@ -150,12 +151,7 @@ void JuceBenchmarkAudioProcessor::processBlock (juce::AudioBuffer<float>& buffer
// the samples and the outer loop is handling the channels.
// Alternatively, you can process the samples with the channels
// interleaved by keeping the same state.
for (int channel = 0; channel < totalNumInputChannels; ++channel)
{
auto* channelData = buffer.getWritePointer (channel);

// ..do something to the data...
}
fancy_fx.render(buffer);
}

//==============================================================================
Expand Down
4 changes: 4 additions & 0 deletions src/PluginProcessor.h
Expand Up @@ -9,6 +9,7 @@
#pragma once

#include <JuceHeader.h>
#include "FancyFx.h"

//==============================================================================
/**
Expand Down Expand Up @@ -54,6 +55,9 @@ class JuceBenchmarkAudioProcessor : public juce::AudioProcessor
void setStateInformation (const void* data, int sizeInBytes) override;

private:
//==============================================================================
FancyFx fancy_fx;

//==============================================================================
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (JuceBenchmarkAudioProcessor)
};

0 comments on commit 9385c2a

Please sign in to comment.