-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPluginProcessor.h
More file actions
75 lines (58 loc) · 2.3 KB
/
Copy pathPluginProcessor.h
File metadata and controls
75 lines (58 loc) · 2.3 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
#pragma once
#include <JuceHeader.h>
#include <atomic>
class HighChainAudioProcessor : public juce::AudioProcessor
{
public:
HighChainAudioProcessor();
~HighChainAudioProcessor() override = default;
void prepareToPlay (double sampleRate, int samplesPerBlock) override;
void releaseResources() override {}
bool isBusesLayoutSupported (const BusesLayout& layouts) const override;
void processBlock (juce::AudioBuffer<float>&, juce::MidiBuffer&) override;
juce::AudioProcessorEditor* createEditor() override;
bool hasEditor() const override { return true; }
const juce::String getName() const override { return JucePlugin_Name; }
bool acceptsMidi() const override { return false; }
bool producesMidi() const override { return false; }
bool isMidiEffect() const override { return false; }
double getTailLengthSeconds() const override { return 0.0; }
int getNumPrograms() override { return 1; }
int getCurrentProgram() override { return 0; }
void setCurrentProgram (int) override {}
const juce::String getProgramName (int) override { return {}; }
void changeProgramName (int, const juce::String&) override {}
void getStateInformation (juce::MemoryBlock& destData) override;
void setStateInformation (const void* data, int sizeInBytes) override;
static juce::AudioProcessorValueTreeState::ParameterLayout createParameterLayout();
juce::AudioProcessorValueTreeState apvts;
float getSparkMeter() const { return sparkMeter.load(); }
private:
struct ChannelCore
{
double prev = 0.0;
double flip = 1.0;
double lastIn = 0.0;
double dcX1 = 0.0, dcY1 = 0.0;
void reset()
{
prev = 0.0;
flip = 1.0;
lastIn = 0.0;
dcX1 = dcY1 = 0.0;
}
double processSubSample (double x)
{
flip = -flip;
const double xf = x * flip;
const double motion = xf - prev;
prev = xf;
return motion;
}
};
ChannelCore coreL, coreR;
double processChannelSample (double input, ChannelCore& ch, double amount, double dcCoef);
double currentSampleRate = 44100.0;
std::atomic<float> sparkMeter { 0.0f };
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (HighChainAudioProcessor)
};