-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathPluginProcessor.h
More file actions
100 lines (71 loc) · 3.43 KB
/
PluginProcessor.h
File metadata and controls
100 lines (71 loc) · 3.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
/*
==============================================================================
This class describes the Audio Processing in Fuzzed.
==============================================================================
*/
#ifndef PLUGINPROCESSOR_H_INCLUDED
#define PLUGINPROCESSOR_H_INCLUDED
#include "../JuceLibraryCode/JuceHeader.h"
#include "Simulation.h"
//==============================================================================
/**
*/
class FuzzFaceJuceAudioProcessor : public AudioProcessor, private Timer
{
public:
//==============================================================================
FuzzFaceJuceAudioProcessor();
~FuzzFaceJuceAudioProcessor();
//==============================================================================
//Instance of the simulation class, using scoped pointer to avoid memory leaking
ScopedPointer<Simulation> sim;
//Parameters
AudioParameterFloat* volParam, *fuzzParam, *gainParam;
//The actual values for the parameters
double volVal, fuzzVal, gainVal;
//Parameter smoothing
ScopedPointer<LinearSmoothedValue<double>> linFuzzSmoother;
ScopedPointer<LinearSmoothedValue<double>> linVolSmoother;
ScopedPointer<LinearSmoothedValue<double>> linGainSmoother;
//value for currentSampleRate
double currentSampleRate;
//parameter update coefficient
double paramCoeff;
//==============================================================================
void prepareToPlay (double sampleRate, int samplesPerBlock) override;
void releaseResources() override;
#ifndef JucePlugin_PreferredChannelConfigurations
bool setPreferredBusArrangement (bool isInput, int bus, const AudioChannelSet& preferredSet) override;
#endif
void processBlock (AudioSampleBuffer&, MidiBuffer&) override;
//==============================================================================
AudioProcessorEditor* createEditor() override;
bool hasEditor() const override;
//==============================================================================
const String getName() const override;
bool acceptsMidi() const override;
bool producesMidi() const override;
double getTailLengthSeconds() const override;
//==============================================================================
int getNumPrograms() override;
int getCurrentProgram() override;
void setCurrentProgram (int index) override;
const String getProgramName (int index) override;
void changeProgramName (int index, const String& newName) override;
//==============================================================================
void getStateInformation (MemoryBlock& destData) override;
void setStateInformation (const void* data, int sizeInBytes) override;
//==============================================================================
//Monitor the input to the FUZZFACE simulation, the value to be displayed on inputSignal Label
double currentInput;
private:
//Timer callback used for parameter updates
void timerCallback() override;
//Input scaling, including a clipper used to limit the max input to signal and avoid crashes
void inputScaling(float* _channelData);
//Used to determine if the current sample is within the muted startup period
int sampleIndex;
//==============================================================================
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (FuzzFaceJuceAudioProcessor)
};
#endif // PLUGINPROCESSOR_H_INCLUDED