PluginProcessor.h (3983B)
1 /* 2 ============================================================================== 3 4 This file was auto-generated! 5 6 It contains the basic framework code for a JUCE plugin processor. 7 8 ============================================================================== 9 */ 10 11 #pragma once 12 13 #include "../JuceLibraryCode/JuceHeader.h" 14 15 16 #define GAIN_ID "drive" 17 #define GAIN_NAME "Drive" 18 #define MASTER_ID "level" 19 #define MASTER_NAME "Level" 20 #define BASS_ID "bass" 21 #define BASS_NAME "Bass" 22 #define MID_ID "mid" 23 #define MID_NAME "Mid" 24 #define TREBLE_ID "treble" 25 #define TREBLE_NAME "Treble" 26 27 #include <nlohmann/json.hpp> 28 #include "RTNeuralLSTM.h" 29 #include "Eq4Band.h" 30 #include "CabSim.h" 31 32 //============================================================================== 33 /** 34 */ 35 class ProteusAudioProcessor : public AudioProcessor 36 { 37 public: 38 //============================================================================== 39 ProteusAudioProcessor(); 40 ~ProteusAudioProcessor(); 41 42 //============================================================================== 43 void prepareToPlay (double sampleRate, int samplesPerBlock) override; 44 void releaseResources() override; 45 46 #ifndef JucePlugin_PreferredChannelConfigurations 47 bool isBusesLayoutSupported (const BusesLayout& layouts) const override; 48 #endif 49 50 void processBlock (AudioBuffer<float>&, MidiBuffer&) override; 51 52 //============================================================================== 53 AudioProcessorEditor* createEditor() override; 54 bool hasEditor() const override; 55 56 //============================================================================== 57 const String getName() const override; 58 59 bool acceptsMidi() const override; 60 bool producesMidi() const override; 61 bool isMidiEffect() const override; 62 double getTailLengthSeconds() const override; 63 64 //============================================================================== 65 int getNumPrograms() override; 66 int getCurrentProgram() override; 67 void setCurrentProgram (int index) override; 68 const String getProgramName (int index) override; 69 void changeProgramName (int index, const String& newName) override; 70 71 //============================================================================== 72 void getStateInformation (MemoryBlock& destData) override; 73 void setStateInformation (const void* data, int sizeInBytes) override; 74 75 void set_ampEQ(float bass_slider, float mid_slider, float treble_slider); 76 77 // Files and configuration 78 void loadConfig(File configFile); 79 80 // Pedal/amp states 81 int fw_state = 1; // 0 = off, 1 = on 82 int cab_state = 1; // 0 = off, 1 = on 83 84 File currentDirectory = File::getCurrentWorkingDirectory().getFullPathName(); 85 int current_model_index = 0; 86 87 Array<File> fileArray; 88 std::vector<File> jsonFiles; 89 int num_models = 0; 90 File folder = File::getSpecialLocation(File::userDesktopDirectory); 91 File saved_model; 92 93 AudioProcessorValueTreeState treeState; 94 95 bool conditioned = false; 96 97 const char* char_filename = ""; 98 99 int pauseVolume = 3; 100 101 bool model_loaded = false; 102 103 private: 104 105 Eq4Band eq4band; // Amp EQ 106 Eq4Band eq4band2; // Amp EQ 107 108 std::atomic<float>* driveParam = nullptr; 109 std::atomic<float>* masterParam = nullptr; 110 std::atomic<float>* bassParam = nullptr; 111 std::atomic<float>* midParam = nullptr; 112 std::atomic<float>* trebleParam = nullptr; 113 114 float previousDriveValue = 0.5; 115 float previousMasterValue = 0.5; 116 //float steppedValue1 = 0.0; 117 118 RT_LSTM LSTM; 119 RT_LSTM LSTM2; 120 121 dsp::ProcessorDuplicator<dsp::IIR::Filter<float>, dsp::IIR::Coefficients<float>> dcBlocker; 122 123 chowdsp::ResampledProcess<chowdsp::ResamplingTypes::SRCResampler<>> resampler; 124 125 // IR processing 126 CabSim cabSimIRa; 127 128 //============================================================================== 129 JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (ProteusAudioProcessor) 130 };