Advertisement
Guest User

Untitled

a guest
Nov 18th, 2019
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.92 KB | None | 0 0
  1. /* editopcpp
  2.   ==============================================================================
  3.  
  4.     This file was auto-generated!
  5.  
  6.     It contains the basic framework code for a JUCE plugin editor.
  7.  
  8.   ==============================================================================
  9. */
  10.  
  11. #include "PluginProcessor.h"
  12. #include "PluginEditor.h"
  13.  
  14. //==============================================================================
  15. DistortionVstAudioProcessorEditor::DistortionVstAudioProcessorEditor (DistortionVstAudioProcessor& p)
  16.     : AudioProcessorEditor (&p), processor (p)
  17. {
  18.     addAndMakeVisible(driveKnob = new Slider("Drive"));
  19.     driveKnob->setSliderStyle(Slider::Rotary);
  20.     driveKnob->setTextBoxStyle(Slider::NoTextBox, false, 100, 100);
  21.  
  22.     addAndMakeVisible(rangeKnob = new Slider("Range"));
  23.     rangeKnob->setSliderStyle(Slider::Rotary);
  24.     rangeKnob->setTextBoxStyle(Slider::NoTextBox, false, 100, 100);
  25.  
  26.     addAndMakeVisible(blendKnob = new Slider("Blend"));
  27.     blendKnob->setSliderStyle(Slider::Rotary);
  28.     blendKnob->setTextBoxStyle(Slider::NoTextBox, false, 100, 100);
  29.  
  30.     addAndMakeVisible(volumeKnob = new Slider("Volume"));
  31.     volumeKnob->setSliderStyle(Slider::Rotary);
  32.     volumeKnob->setTextBoxStyle(Slider::NoTextBox, false, 100, 100);
  33.  
  34.  
  35.     driveAttachment = new AudioProcessorValueTreeState::SliderAttachment(p.getState(), "drive", *driveKnob);
  36.     rangeAttachment = new AudioProcessorValueTreeState::SliderAttachment(p.getState(), "range", *rangeKnob);
  37.     blendAttachment = new AudioProcessorValueTreeState::SliderAttachment(p.getState(), "blend", *blendKnob);
  38.     volumeAttachment = new AudioProcessorValueTreeState::SliderAttachment(p.getState(), "volume", *volumeKnob);
  39.  
  40.     // Make sure that before the constructor has finished, you've set the
  41.     // editor's size to whatever you need it to be.
  42.     setSize (500, 200);
  43. }
  44.  
  45. DistortionVstAudioProcessorEditor::~DistortionVstAudioProcessorEditor()
  46. {
  47. }
  48.  
  49. //==============================================================================
  50. void DistortionVstAudioProcessorEditor::paint (Graphics& g)
  51. {
  52.     // (Our component is opaque, so we must completely fill the background with a solid colour)
  53.     g.fillAll (getLookAndFeel().findColour (ResizableWindow::backgroundColourId));
  54.  
  55.     g.setColour (Colours::white);
  56.     g.setFont (15.0f);
  57.     g.drawFittedText ("Hello World!", getLocalBounds(), Justification::centred, 1);
  58. }
  59.  
  60. void DistortionVstAudioProcessorEditor::resized()
  61. {
  62.    
  63.     // This is generally where you'll want to lay out the positions of any
  64.     // subcomponents in your editor..
  65.  
  66.  
  67.     driveKnob->setBounds(((getWidth() / 5) * 1) - (100, 2), (getHeight() / 2) - (100 / 2), 100, 100);
  68.     rangeKnob->setBounds(((getWidth() / 5) * 2) - (100, 2), (getHeight() / 2) - (100 / 2), 100, 100);
  69.     blendKnob->setBounds(((getWidth() / 5) * 3) - (100, 2), (getHeight() / 2) - (100 / 2), 100, 100);
  70.     volumeKnob->setBounds(((getWidth() / 5) * 4) - (100, 2), (getHeight() / 2) - (100 / 2), 100, 100);
  71. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement