PluginEditor.cpp 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  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 (Equalizer)
  16. this->equalizerLowGainSlider.setRange(0.0, 1.0);
  17. this->equalizerLowGainSlider.setTextBoxStyle(juce::Slider::TextBoxRight, false, 100, 20);
  18. this->equalizerLowGainSlider.addListener(this);
  19. this->equalizerLowGainLabel.setText("Equalizer Low Gain", juce::dontSendNotification);
  20. addAndMakeVisible(this->equalizerLowGainSlider);
  21. addAndMakeVisible(this->equalizerLowGainLabel);
  22. this->equalizerHighGainSlider.setRange(0.0, 1.0);
  23. this->equalizerHighGainSlider.setTextBoxStyle(juce::Slider::TextBoxRight, false, 100, 20);
  24. this->equalizerHighGainSlider.addListener(this);
  25. this->equalizerHighGainLabel.setText("Equalizer High Gain", juce::dontSendNotification);
  26. addAndMakeVisible(this->equalizerHighGainSlider);
  27. addAndMakeVisible(this->equalizerHighGainLabel);
  28. // Add aliders to the editor (Distortion)
  29. this->distortionDriveSlider.setRange(0.0, 1.0);
  30. this->distortionDriveSlider.setTextBoxStyle(juce::Slider::TextBoxRight, false, 100, 20);
  31. this->distortionDriveSlider.addListener(this);
  32. this->distortionDriveLabel.setText("Distortion Drive", juce::dontSendNotification);
  33. addAndMakeVisible(this->distortionDriveSlider);
  34. addAndMakeVisible(this->distortionDriveLabel);
  35. this->distortionMixSlider.setRange(0.0, 1.0);
  36. this->distortionMixSlider.setTextBoxStyle(juce::Slider::TextBoxRight, false, 100, 20);
  37. this->distortionMixSlider.addListener(this);
  38. this->distortionMixLabel.setText("Distortion Mix", juce::dontSendNotification);
  39. addAndMakeVisible(this->distortionMixSlider);
  40. addAndMakeVisible(this->distortionMixLabel);
  41. // Add aliders to the editor (Chorus)
  42. this->chorusDryWetSlider.setRange(0.0, 1.0);
  43. this->chorusDryWetSlider.setTextBoxStyle(juce::Slider::TextBoxRight, false, 100, 20);
  44. this->chorusDryWetSlider.addListener(this);
  45. this->chorusDryWetLabel.setText("Chorus Dry/Wet", juce::dontSendNotification);
  46. addAndMakeVisible(this->chorusDryWetSlider);
  47. addAndMakeVisible(this->chorusDryWetLabel);
  48. this->chorusAmountSlider.setRange(0.0, 1.0);
  49. this->chorusAmountSlider.setTextBoxStyle(juce::Slider::TextBoxRight, false, 100, 20);
  50. this->chorusAmountSlider.addListener(this);
  51. this->chorusAmountLabel.setText("Chorus Amount", juce::dontSendNotification);
  52. addAndMakeVisible(this->chorusAmountSlider);
  53. addAndMakeVisible(this->chorusAmountLabel);
  54. // Add sliders to the editor (Reverb)
  55. this->reverbDryWetSlider.setRange(0.0, 1.0);
  56. this->reverbDryWetSlider.setTextBoxStyle(juce::Slider::TextBoxRight, false, 100, 20);
  57. this->reverbDryWetSlider.addListener(this);
  58. this->reverbDryWetLabel.setText("Reverb Dry/Wet", juce::dontSendNotification);
  59. addAndMakeVisible(this->reverbDryWetSlider);
  60. addAndMakeVisible(this->reverbDryWetLabel);
  61. this->reverbRoomSizeSlider.setRange(0.0, 1.0);
  62. this->reverbRoomSizeSlider.setTextBoxStyle(juce::Slider::TextBoxRight, false, 100, 20);
  63. this->reverbRoomSizeSlider.addListener(this);
  64. this->reverbRoomSizeLabel.setText("Reverb Room Size", juce::dontSendNotification);
  65. addAndMakeVisible(this->reverbRoomSizeSlider);
  66. addAndMakeVisible(this->reverbRoomSizeLabel);
  67. // Add sliders to the editor (Delay)
  68. this->delayDryWetSlider.setRange(0.0, 1.0);
  69. this->delayDryWetSlider.setTextBoxStyle(juce::Slider::TextBoxRight, false, 100, 20);
  70. this->delayDryWetSlider.addListener(this);
  71. this->delayDryWetLabel.setText("Delay Dry/Wet", juce::dontSendNotification);
  72. addAndMakeVisible(this->delayDryWetSlider);
  73. addAndMakeVisible(this->delayDryWetLabel);
  74. this->delayAmountSlider.setRange(0.0, 1.0);
  75. this->delayAmountSlider.setTextBoxStyle(juce::Slider::TextBoxRight, false, 100, 20);
  76. this->delayAmountSlider.addListener(this);
  77. this->delayAmountLabel.setText("Delay Amount", juce::dontSendNotification);
  78. addAndMakeVisible(this->delayAmountSlider);
  79. addAndMakeVisible(this->delayAmountLabel);
  80. }
  81. CMLSProjectAudioProcessorEditor::~CMLSProjectAudioProcessorEditor()
  82. {
  83. }
  84. //==============================================================================
  85. void CMLSProjectAudioProcessorEditor::paint (juce::Graphics& g)
  86. {
  87. // (Our component is opaque, so we must completely fill the background with a solid colour)
  88. g.fillAll (getLookAndFeel().findColour (juce::ResizableWindow::backgroundColourId));
  89. }
  90. void CMLSProjectAudioProcessorEditor::resized()
  91. {
  92. //titleLabel.setBounds(10, 10, getWidth() - 20, 20);
  93. equalizerLowGainSlider.setBounds(130, 10, getWidth() - 130, 20);
  94. equalizerLowGainLabel.setBounds(10, 10, 100, 20);
  95. equalizerHighGainSlider.setBounds(130, 30, getWidth() - 130, 20);
  96. equalizerHighGainLabel.setBounds(10, 30, 100, 20);
  97. distortionDriveSlider.setBounds(130, 70, getWidth() - 130, 20);
  98. distortionDriveLabel.setBounds(10, 70, 100, 20);
  99. distortionMixSlider.setBounds(130, 90, getWidth() - 130, 20);
  100. distortionMixLabel.setBounds(10, 90, 100, 20);
  101. chorusDryWetSlider.setBounds(130, 130, getWidth() - 130, 20);
  102. chorusDryWetLabel.setBounds(10, 130, 100, 20);
  103. chorusAmountSlider.setBounds(130, 150, getWidth() - 130, 20);
  104. chorusAmountLabel.setBounds(10, 150, 100, 20);
  105. reverbDryWetSlider.setBounds(130, 190, getWidth() - 130, 20);
  106. reverbDryWetLabel.setBounds(10, 190, 100, 20);
  107. reverbRoomSizeSlider.setBounds(130, 210, getWidth() - 130, 20);
  108. reverbRoomSizeLabel.setBounds(10, 210, 100, 20);
  109. delayDryWetSlider.setBounds(130, 250, getWidth() - 130, 20);
  110. delayDryWetLabel.setBounds(10, 250, 100, 20);
  111. delayAmountSlider.setBounds(130, 270, getWidth() - 130, 20);
  112. delayAmountLabel.setBounds(10, 270, 100, 20);
  113. }
  114. void CMLSProjectAudioProcessorEditor::sliderValueChanged(juce::Slider* slider){
  115. if (slider == &this->chorusDryWetSlider)
  116. {
  117. this->audioProcessor.setChorusDryWet(slider->getValue());
  118. }
  119. else if (slider == &this->chorusAmountSlider)
  120. {
  121. this->audioProcessor.setChorusAmount(slider->getValue());
  122. }
  123. else if (slider == &this->reverbDryWetSlider)
  124. {
  125. this->audioProcessor.setReverbDryWet(slider->getValue());
  126. }
  127. else if (slider == &this->reverbRoomSizeSlider)
  128. {
  129. this->audioProcessor.setReverbRoomSize(slider->getValue());
  130. }
  131. else if (slider == &this->delayDryWetSlider)
  132. {
  133. this->audioProcessor.setDelayDryWet(slider->getValue());
  134. }
  135. else if (slider == &this->delayAmountSlider)
  136. {
  137. this->audioProcessor.setDelayAmount(slider->getValue());
  138. }
  139. else if (slider == &this->equalizerLowGainSlider)
  140. {
  141. this->audioProcessor.setEqLowGain(slider->getValue());
  142. }
  143. else if (slider == &this->equalizerHighGainSlider)
  144. {
  145. this->audioProcessor.setEqHighGain(slider->getValue());
  146. }
  147. else if (slider == &this->distortionDriveSlider)
  148. {
  149. this->audioProcessor.setDistortionDrive(slider->getValue());
  150. }
  151. else if (slider == &this->distortionMixSlider)
  152. {
  153. this->audioProcessor.setDistortionMix(slider->getValue());
  154. }
  155. }