PluginEditor.cpp 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. /*
  2. ==============================================================================
  3. This file contains the basic framework code for a JUCE plugin editor.
  4. ==============================================================================
  5. */
  6. #include "PluginProcessor.h"
  7. #include "PluginEditor.h"
  8. //==============================================================================
  9. CMLSProjectAudioProcessorEditor::CMLSProjectAudioProcessorEditor (CMLSProjectAudioProcessor& p)
  10. : AudioProcessorEditor (&p), audioProcessor (p)
  11. {
  12. // Make sure that before the constructor has finished, you've set the
  13. // editor's size to whatever you need it to be.
  14. setSize (400, 300);
  15. // Add aliders to the editor (Chorus)
  16. this->chorusDryWetSlider.setRange(0.0, 1.0);
  17. this->chorusDryWetSlider.setTextBoxStyle(juce::Slider::TextBoxRight, false, 100, 20);
  18. this->chorusDryWetSlider.addListener(this);
  19. this->chorusDryWetLabel.setText("Chorus Dry/Wet", juce::dontSendNotification);
  20. addAndMakeVisible(this->chorusDryWetSlider);
  21. addAndMakeVisible(this->chorusDryWetLabel);
  22. this->chorusAmountSlider.setRange(0.0, 1.0);
  23. this->chorusAmountSlider.setTextBoxStyle(juce::Slider::TextBoxRight, false, 100, 20);
  24. this->chorusAmountSlider.addListener(this);
  25. this->chorusAmountLabel.setText("Chorus Amount", juce::dontSendNotification);
  26. addAndMakeVisible(this->chorusAmountSlider);
  27. addAndMakeVisible(this->chorusAmountLabel);
  28. // Add sliders to the editor (Reverb)
  29. this->reverbDryWetSlider.setRange(0.0, 1.0);
  30. this->reverbDryWetSlider.setTextBoxStyle(juce::Slider::TextBoxRight, false, 100, 20);
  31. this->reverbDryWetSlider.addListener(this);
  32. this->reverbDryWetLabel.setText("Reverb Dry/Wet", juce::dontSendNotification);
  33. addAndMakeVisible(this->reverbDryWetSlider);
  34. addAndMakeVisible(this->reverbDryWetLabel);
  35. this->reverbRoomSizeSlider.setRange(0.0, 1.0);
  36. this->reverbRoomSizeSlider.setTextBoxStyle(juce::Slider::TextBoxRight, false, 100, 20);
  37. this->reverbRoomSizeSlider.addListener(this);
  38. this->reverbRoomSizeLabel.setText("Reverb Room Size", juce::dontSendNotification);
  39. addAndMakeVisible(this->reverbRoomSizeSlider);
  40. addAndMakeVisible(this->reverbRoomSizeLabel);
  41. // Add sliders to the editor (Delay)
  42. this->delayDryWetSlider.setRange(0.0, 1.0);
  43. this->delayDryWetSlider.setTextBoxStyle(juce::Slider::TextBoxRight, false, 100, 20);
  44. this->delayDryWetSlider.addListener(this);
  45. this->delayDryWetLabel.setText("Delay Dry/Wet", juce::dontSendNotification);
  46. addAndMakeVisible(this->delayDryWetSlider);
  47. addAndMakeVisible(this->delayDryWetLabel);
  48. this->delayAmountSlider.setRange(0.0, 1.0);
  49. this->delayAmountSlider.setTextBoxStyle(juce::Slider::TextBoxRight, false, 100, 20);
  50. this->delayAmountSlider.addListener(this);
  51. this->delayAmountLabel.setText("Delay Amount", juce::dontSendNotification);
  52. addAndMakeVisible(this->delayAmountSlider);
  53. addAndMakeVisible(this->delayAmountLabel);
  54. }
  55. CMLSProjectAudioProcessorEditor::~CMLSProjectAudioProcessorEditor()
  56. {
  57. }
  58. //==============================================================================
  59. void CMLSProjectAudioProcessorEditor::paint (juce::Graphics& g)
  60. {
  61. // (Our component is opaque, so we must completely fill the background with a solid colour)
  62. g.fillAll (getLookAndFeel().findColour (juce::ResizableWindow::backgroundColourId));
  63. }
  64. void CMLSProjectAudioProcessorEditor::resized()
  65. {
  66. //titleLabel.setBounds(10, 10, getWidth() - 20, 20);
  67. chorusDryWetSlider.setBounds(130, 10, getWidth() - 130, 20);
  68. chorusDryWetLabel.setBounds(10, 10, 100, 20);
  69. chorusAmountSlider.setBounds(130, 30, getWidth() - 130, 20);
  70. chorusAmountLabel.setBounds(10, 30, 100, 20);
  71. reverbDryWetSlider.setBounds(130, 70, getWidth() - 130, 20);
  72. reverbDryWetLabel.setBounds(10, 70, 100, 20);
  73. reverbRoomSizeSlider.setBounds(130, 90, getWidth() - 130, 20);
  74. reverbRoomSizeLabel.setBounds(10, 90, 100, 20);
  75. delayDryWetSlider.setBounds(130, 130, getWidth() - 130, 20);
  76. delayDryWetLabel.setBounds(10, 130, 100, 20);
  77. delayAmountSlider.setBounds(130, 150, getWidth() - 130, 20);
  78. delayAmountLabel.setBounds(10, 150, 100, 20);
  79. }
  80. void CMLSProjectAudioProcessorEditor::sliderValueChanged(juce::Slider* slider){
  81. if (slider == &this->chorusDryWetSlider)
  82. {
  83. this->audioProcessor.setChorusDryWet(slider->getValue());
  84. }
  85. else if (slider == &this->chorusAmountSlider)
  86. {
  87. this->audioProcessor.setChorusAmount(slider->getValue());
  88. }
  89. else if (slider == &this->reverbDryWetSlider)
  90. {
  91. this->audioProcessor.setReverbDryWet(slider->getValue());
  92. }
  93. else if (slider == &this->reverbRoomSizeSlider)
  94. {
  95. this->audioProcessor.setReverbRoomSize(slider->getValue());
  96. }
  97. else if (slider == &this->delayDryWetSlider)
  98. {
  99. this->audioProcessor.setDelayDryWet(slider->getValue());
  100. }
  101. else if (slider == &this->delayAmountSlider)
  102. {
  103. this->audioProcessor.setDelayAmount(slider->getValue());
  104. }
  105. }