NeuralPi

Raspberry Pi guitar pedal using neural networks to emulate real amps and effects
Log | Files | Refs | Submodules | README

commit 3650e9cc84d3f8bb059be3c8fc5571bdf561f5da
parent d48a89891f8a5247c62c46143815b650a377870f
Author: keith <kbloemer89@gmail.com>
Date:   Sun, 30 May 2021 22:19:37 -0500

WIP added processor osc functions

Diffstat:
MSource/PluginProcessor.cpp | 23+++++++++++++++--------
MSource/PluginProcessor.h | 1-
2 files changed, 15 insertions(+), 9 deletions(-)

diff --git a/Source/PluginProcessor.cpp b/Source/PluginProcessor.cpp @@ -161,8 +161,8 @@ void NeuralPiAudioProcessor::processBlock (AudioBuffer<float>& buffer, MidiBuffe // Amp ============================================================================= if (amp_state == 1) { - buffer.applyGain(ampDrive); + //buffer.applyGain(gainParam->get()); // Apply LSTM model if (model_loaded == 1) { @@ -171,6 +171,7 @@ void NeuralPiAudioProcessor::processBlock (AudioBuffer<float>& buffer, MidiBuffe // Master Volume buffer.applyGain(ampMaster); + //buffer.applyGain(masterParam->get()); } for (int ch = 1; ch < buffer.getNumChannels(); ++ch) @@ -189,17 +190,22 @@ AudioProcessorEditor* NeuralPiAudioProcessor::createEditor() } //============================================================================== -void NeuralPiAudioProcessor::getStateInformation (MemoryBlock& destData) +void NeuralPiAudioProcessor::getStateInformation(MemoryBlock& destData) { - // You should use this method to store your parameters in the memory block. - // You could do that either as raw data, or use the XML or ValueTree classes - // as intermediaries to make it easy to save and load complex data. + MemoryOutputStream stream(destData, true); + + stream.writeFloat(*gainParam); + stream.writeFloat(*masterParam); + stream.writeFloat(*modelParam); } -void NeuralPiAudioProcessor::setStateInformation (const void* data, int sizeInBytes) +void NeuralPiAudioProcessor::setStateInformation(const void* data, int sizeInBytes) { - // You should use this method to restore your parameters from this memory block, - // whose contents will have been created by the getStateInformation() call. + MemoryInputStream stream(data, static_cast<size_t> (sizeInBytes), false); + + gainParam->setValueNotifyingHost(stream.readFloat()); + masterParam->setValueNotifyingHost(stream.readFloat()); + modelParam->setValueNotifyingHost(stream.readFloat()); } void NeuralPiAudioProcessor::loadConfig(File configFile) @@ -333,6 +339,7 @@ float NeuralPiAudioProcessor::decibelToLinear(float dbValue) return powf(10.0, dbValue/20.0); } + //============================================================================== // This creates new instances of the plugin.. AudioProcessor* JUCE_CALLTYPE createPluginFilter() diff --git a/Source/PluginProcessor.h b/Source/PluginProcessor.h @@ -104,7 +104,6 @@ public: //AudioProcessorValueTreeState treeState; - private: // Amp float ampDrive = 1.0;