This is how I start my Android JUCE application:
class NP2Application : public juce::JUCEApplication
{
public:
//==============================================================================
NP2Application() {}
const juce::String getApplicationName() override { return ProjectInfo::projectName; }
const juce::String getApplicationVersion() override { return ProjectInfo::versionString; }
bool moreThanOneInstanceAllowed() override { return true; }
//==============================================================================
void initialise (const juce::String& commandLine) override
{
//This stars by itself
whiteNoiseComponent = std::make_unique<WhiteNoiseComponent>();
//This does not starts by itself
testpluginAudioProcessor = std::make_unique<TestpluginAudioProcessor>();
}
WhiteNoiseComponent
is a class WhiteNoiseComponent : public juce::AudioAppComponent
and it starts by itself and generates white noise.
This is my TestAudioPluginProcessor
:
class TestpluginAudioProcessor : public juce::AudioProcessor
{
public:
//==============================================================================
TestpluginAudioProcessor();
~TestpluginAudioProcessor() override;
//==============================================================================
void prepareToPlay (double sampleRate, int samplesPerBlock) override;
void releaseResources() override;
#ifndef JucePlugin_PreferredChannelConfigurations
bool isBusesLayoutSupported (const BusesLayout& layouts) const override;
#endif
void processBlock (juce::AudioBuffer<float>&, juce::MidiBuffer&) override;
//==============================================================================
juce::AudioProcessorEditor* createEditor() override;
bool hasEditor() const override;
//==============================================================================
const juce::String getName() const override;
bool acceptsMidi() const override;
bool producesMidi() const override;
bool isMidiEffect() const override;
double getTailLengthSeconds() const override;
//==============================================================================
int getNumPrograms() override;
int getCurrentProgram() override;
void setCurrentProgram (int index) override;
const juce::String getProgramName (int index) override;
void changeProgramName (int index, const juce::String& newName) override;
//==============================================================================
void getStateInformation (juce::MemoryBlock& destData) override;
void setStateInformation (const void* data, int sizeInBytes) override;
private:
//==============================================================================
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (TestpluginAudioProcessor)
};
it simply won’t start. Even though it does nothing:
void TestpluginAudioProcessor::processBlock (juce::AudioBuffer<float>& buffer, juce::MidiBuffer& midiMessages)
{
juce::ScopedNoDenormals noDenormals;
auto totalNumInputChannels = getTotalNumInputChannels();
auto totalNumOutputChannels = getTotalNumOutputChannels();
for (auto i = totalNumInputChannels; i < totalNumOutputChannels; ++i)
buffer.clear (i, 0, buffer.getNumSamples());
for (int channel = 0; channel < totalNumInputChannels; ++channel)
{
auto* channelData = buffer.getWritePointer (channel);
// ..do something to the data...
}
ALOGV(TAG, "block process");
}
I do not see block process
on the output, which means it’s not processing anything.
How do I start a juce::AudioProcessor
from my application?