-
Notifications
You must be signed in to change notification settings - Fork 3
/
plugin_development_steps.pl
1 lines (1 loc) · 3.43 KB
/
plugin_development_steps.pl
1
['#include "PlugexLookAndFeel.h"\n', ' PlugexLookAndFeel plugexLookAndFeel;\n', ' setLookAndFeel(&plugexLookAndFeel);\n plugexLookAndFeel.setTheme("blue");\n', ' Label title;\n', ' title.setText("Plugex - 01 - Amplitude Linear", NotificationType::dontSendNotification);\n title.setFont(title.getFont().withPointHeight(title.getFont().getHeightInPoints() + 4));\n title.setJustificationType(Justification::horizontallyCentred);\n addAndMakeVisible(&title);\n', ' auto area = getLocalBounds().reduced(12, 12);\n\n title.setBounds(area.removeFromTop(36));\n area.removeFromTop(12);\n', ' AudioProcessorValueTreeState parameters;\n \n float *gainParameter = nullptr;\n', 'AudioProcessorValueTreeState::ParameterLayout createParameterLayout() {\n using Parameter = AudioProcessorValueTreeState::Parameter;\n\n std::vector<std::unique_ptr<Parameter>> parameters;\n\n parameters.push_back(std::make_unique<Parameter>(String("gain"), String("Gain"), String(),\n NormalisableRange<float>(0.0f, 2.0f),\n 1.0f, nullptr, nullptr));\n\n return { parameters.begin(), parameters.end() };\n}\n', ' parameters (*this, nullptr, Identifier(JucePlugin_Name), createParameterLayout())\n', ' gainParameter = parameters.getRawParameterValue("gain");\n', ' for (int i = 0; i < buffer.getNumSamples(); i++) {\n channelData[i] *= *gainParameter;\n }\n', ', AudioProcessorValueTreeState& vts', ' AudioProcessorValueTreeState& valueTreeState;\n\n Label gainLabel;\n Slider gainKnob;\n\n std::unique_ptr<AudioProcessorValueTreeState::SliderAttachment> gainAttachment;\n', ', valueTreeState (vts)', ' gainLabel.setText("Gain", NotificationType::dontSendNotification);\n gainLabel.setJustificationType(Justification::horizontallyCentred);\n addAndMakeVisible(&gainLabel);\n\n gainKnob.setLookAndFeel(&plugexLookAndFeel);\n gainKnob.setSliderStyle(Slider::RotaryHorizontalVerticalDrag);\n gainKnob.setTextBoxStyle(Slider::TextBoxBelow, false, 80, 20);\n addAndMakeVisible(&gainKnob);\n\n gainAttachment.reset(new AudioProcessorValueTreeState::SliderAttachment(valueTreeState, "gain", gainKnob));\n', ' gainKnob.setLookAndFeel(nullptr);\n setLookAndFeel(nullptr);\n', ' auto gainArea = area.removeFromTop(100).withSizeKeepingCentre(80, 100);\n gainLabel.setBounds(gainArea.removeFromTop(20));\n gainKnob.setBounds(gainArea);\n area.removeFromTop(12);\n', ', parameters', ' SmoothedValue<float> gainSmoothed;\n', ' gainSmoothed.reset(sampleRate, samplesPerBlock/sampleRate);\n gainSmoothed.setCurrentAndTargetValue(*gainParameter);\n', ' gainSmoothed.setTargetValue(*gainParameter);\n', ' channelData[i] *= gainSmoothed.getNextValue();\n', 'static String gainSliderValueToText(float value) {\n float val = 20.0f * log10f(jmax(0.001f, value));\n return String(val, 2) + String(" dB");\n}\n\nstatic float gainSliderTextToValue(const String& text) {\n float val = jlimit(-60.0f, 18.0f, text.getFloatValue());\n return powf(10.0f, val * 0.05f);\n}\n', ' parameters.push_back(std::make_unique<Parameter>(String("gain"), String("Gain"), String(),\n NormalisableRange<float>(0.001f, 7.94f, 0.001f, 0.3f),\n 1.0f, gainSliderValueToText, gainSliderTextToValue));\n']