Lade till visuella mätare på Gate och Kompressor
This commit is contained in:
1 parent
5b1d22c745
commit
f0570b1313
4 files changed
+300
-43
No files matched your search
+38
-2
@@ -2,18 +2,54 @@
|
||||
#include <JuceHeader.h>
|
||||
#include "PluginProcessor.h"
|
||||
|
||||
class CrilleBassStripAudioProcessorEditor final : public juce::AudioProcessorEditor
|
||||
class CrilleBassStripAudioProcessorEditor final : public juce::AudioProcessorEditor,
|
||||
private juce::Timer
|
||||
{
|
||||
public:
|
||||
explicit CrilleBassStripAudioProcessorEditor(CrilleBassStripAudioProcessor&);
|
||||
~CrilleBassStripAudioProcessorEditor() override = default;
|
||||
|
||||
void paint(juce::Graphics&) override;
|
||||
void resized() override;
|
||||
|
||||
private:
|
||||
struct Knob { juce::Slider slider; juce::Label label; };
|
||||
class LevelMeter final : public juce::Component
|
||||
{
|
||||
public:
|
||||
enum class Mode { inputLevel, gainReduction };
|
||||
|
||||
explicit LevelMeter(Mode meterMode);
|
||||
void setLevel(float newLevelDb);
|
||||
void setThreshold(float newThresholdDb);
|
||||
void paint(juce::Graphics&) override;
|
||||
|
||||
private:
|
||||
Mode mode;
|
||||
float displayedDb = -80.0f;
|
||||
float thresholdDb = -80.0f;
|
||||
};
|
||||
|
||||
struct Knob
|
||||
{
|
||||
juce::Slider slider;
|
||||
juce::Label label;
|
||||
};
|
||||
|
||||
CrilleBassStripAudioProcessor& processor;
|
||||
std::vector<std::unique_ptr<Knob>> knobs;
|
||||
std::vector<std::unique_ptr<juce::AudioProcessorValueTreeState::SliderAttachment>> attachments;
|
||||
|
||||
LevelMeter gateInputMeter { LevelMeter::Mode::inputLevel };
|
||||
LevelMeter compressorInputMeter { LevelMeter::Mode::inputLevel };
|
||||
LevelMeter compressorReductionMeter { LevelMeter::Mode::gainReduction };
|
||||
|
||||
float smoothedGateDb = -80.0f;
|
||||
float smoothedCompressorDb = -80.0f;
|
||||
float smoothedReductionDb = 0.0f;
|
||||
|
||||
void addKnob(const juce::String& parameter, const juce::String& caption);
|
||||
void timerCallback() override;
|
||||
static float smoothMeter(float current, float target, float attack, float release);
|
||||
|
||||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(CrilleBassStripAudioProcessorEditor)
|
||||
};
|
||||
Reference in new issue
Block a user