mirror of
https://codeberg.org/armin/wavetable.git
synced 2026-09-01 22:10:47 +02:00
69 lines
2.1 KiB
C++
69 lines
2.1 KiB
C++
#include <JuceHeader.h>
|
|
#include "PluginProcessor.h"
|
|
|
|
static void profile (juce::PropertiesFile& settings)
|
|
{
|
|
WavetableAudioProcessor proc;
|
|
proc.setRateAndBufferSizeDetails (44100, 512);
|
|
proc.prepareToPlay (44100, 512);
|
|
|
|
juce::MemoryBlock data;
|
|
|
|
if (data.fromBase64Encoding (settings.getValue ("filterState")) && data.getSize() > 0)
|
|
proc.setStateInformation (data.getData(), (int) data.getSize());
|
|
|
|
proc.reset();
|
|
|
|
juce::AudioSampleBuffer buffer (2, 512);
|
|
|
|
juce::MidiBuffer midiOn;
|
|
juce::MidiBuffer midiOff;
|
|
juce::MidiBuffer midiEmpty;
|
|
|
|
auto start = juce::Time::getMillisecondCounterHiRes();
|
|
|
|
for (int i = 0; i < 20000; i++)
|
|
{
|
|
buffer.clear();
|
|
|
|
if (i % 100 == 0)
|
|
{
|
|
midiOn.clear();
|
|
midiOn.addEvent (juce::MidiMessage::noteOn (1, 60, 0.5f), 0);
|
|
midiOn.addEvent (juce::MidiMessage::noteOn (1, 70, 0.5f), 0);
|
|
midiOn.addEvent (juce::MidiMessage::noteOn (1, 80, 0.5f), 0);
|
|
|
|
proc.processBlock (buffer, midiOn);
|
|
}
|
|
else if (i % 100 == 90)
|
|
{
|
|
midiOff.clear();
|
|
midiOff.addEvent (juce::MidiMessage::noteOff (1, 60, 0.5f), 0);
|
|
midiOff.addEvent (juce::MidiMessage::noteOff (1, 70, 0.5f), 0);
|
|
midiOff.addEvent (juce::MidiMessage::noteOff (1, 80, 0.5f), 0);
|
|
|
|
proc.processBlock (buffer, midiOff);
|
|
}
|
|
else
|
|
{
|
|
midiEmpty.clear();
|
|
proc.processBlock (buffer, midiEmpty);
|
|
}
|
|
}
|
|
|
|
auto end = juce::Time::getMillisecondCounterHiRes();
|
|
printf ("Elapsed time: %.2fs\n", (end - start) / 1000);
|
|
}
|
|
|
|
juce::JUCEApplicationBase* juce_CreateApplication()
|
|
{
|
|
return new gin::StandaloneApp([] (juce::PropertiesFile& settings)
|
|
{
|
|
if (juce::JUCEApplication::getCommandLineParameters ().contains ("-profile"))
|
|
{
|
|
profile (settings);
|
|
return false;
|
|
}
|
|
return true;
|
|
});
|
|
}
|