Files
osc-vst-gui/plugin/PluginEditor.h
T
s13bby b0a75e98db адаптация s13bby/osc под vst и gui. (вайбкод)
вайбкод потому что мне в моменте стало понятно. что проще было сразу писать на фреймворке JUCE, чем адаптировать консольное приложение на MiniAudio.
обновляться данный репозиторий не будет. СmakeLists адаптирован онли под linux.
2026-11-20 14:52:33 +06:00

92 lines
3.2 KiB
C++

#pragma once
#include <juce_audio_processors/juce_audio_processors.h>
#include "PluginProcessor.h"
class DarkLookAndFeel : public juce::LookAndFeel_V4
{
public:
DarkLookAndFeel();
void drawRotarySlider (juce::Graphics&, int x, int y, int width, int height,
float sliderPosProportional, float rotaryStartAngle,
float rotaryEndAngle, juce::Slider&) override;
};
class WaveformView : public juce::Component, private juce::Timer
{
public:
WaveformView(OscAudioProcessor& p, int oscIndex);
void paint(juce::Graphics& g) override;
private:
void timerCallback() override;
OscAudioProcessor& processor;
int osc;
};
class EnvelopeView : public juce::Component, private juce::Timer
{
public:
EnvelopeView(OscAudioProcessor& p);
void paint(juce::Graphics& g) override;
private:
void timerCallback() override;
OscAudioProcessor& processor;
};
class FilterView : public juce::Component, private juce::Timer
{
public:
FilterView(OscAudioProcessor& p);
void paint(juce::Graphics& g) override;
private:
void timerCallback() override;
OscAudioProcessor& processor;
};
class OscAudioProcessorEditor : public juce::AudioProcessorEditor
{
public:
explicit OscAudioProcessorEditor (OscAudioProcessor&);
~OscAudioProcessorEditor() override;
void paint (juce::Graphics&) override;
void resized() override;
private:
void addSlider(juce::Slider& s, juce::Label& l, const juce::String& name, bool rotary = true);
void addCombo(juce::ComboBox& c, juce::Label& l, const juce::String& name);
OscAudioProcessor& processorRef;
DarkLookAndFeel lookAndFeel;
juce::ComboBox waveformBox, waveformBox2, filterTypeBox;
juce::ToggleButton osc1Enable { "OSC 1" }, osc2Enable { "OSC 2" };
juce::Slider osc1Level, osc2Level;
juce::Slider unisonVoices, unisonGain, stereoSpread, detuneAmount;
juce::Slider cutoff, resonance, attack, decay, sustain, release, lfoFreq, pitchBendRange;
juce::Label waveformLabel, waveformLabel2, filterTypeLabel;
juce::Label osc1LevelLabel, osc2LevelLabel;
juce::Label unisonVoicesLabel, unisonGainLabel, stereoSpreadLabel, detuneAmountLabel;
juce::Label cutoffLabel, resonanceLabel, attackLabel, decayLabel, sustainLabel, releaseLabel, lfoFreqLabel, pitchBendRangeLabel;
juce::Label osc1Title, osc2Title, unisonTitle, filterTitle, envTitle, lfoTitle, masterTitle;
WaveformView waveView1, waveView2;
EnvelopeView envView;
FilterView filterView;
using SliderAtt = juce::AudioProcessorValueTreeState::SliderAttachment;
using ComboAtt = juce::AudioProcessorValueTreeState::ComboBoxAttachment;
using ButtonAtt = juce::AudioProcessorValueTreeState::ButtonAttachment;
std::unique_ptr<ComboAtt> waveformAtt, waveformAtt2, filterTypeAtt;
std::unique_ptr<ButtonAtt> osc1EnableAtt, osc2EnableAtt;
std::unique_ptr<SliderAtt> osc1LevelAtt, osc2LevelAtt;
std::unique_ptr<SliderAtt> unisonVoicesAtt, unisonGainAtt, stereoSpreadAtt, detuneAmountAtt;
std::unique_ptr<SliderAtt> cutoffAtt, resonanceAtt, attackAtt, decayAtt, sustainAtt, releaseAtt, lfoFreqAtt, pitchBendRangeAtt;
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (OscAudioProcessorEditor)
};