You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

65 lines
1.7KB

  1. /*
  2. ==============================================================================
  3. This file was auto-generated!
  4. It contains the basic framework code for a JUCE plugin editor.
  5. ==============================================================================
  6. */
  7. #include "PluginProcessor.h"
  8. #include "PluginEditor.h"
  9. //==============================================================================
  10. PaulstretchpluginAudioProcessorEditor::PaulstretchpluginAudioProcessorEditor (PaulstretchpluginAudioProcessor& p)
  11. : AudioProcessorEditor (&p), processor (p)
  12. {
  13. const auto& pars = processor.getParameters();
  14. for (int i=0;i<pars.size();++i)
  15. {
  16. m_parcomps.push_back(std::make_shared<ParameterComponent>(pars[i]));
  17. m_parcomps.back()->setBounds(1, i * 25, 598, 24);
  18. addAndMakeVisible(m_parcomps.back().get());
  19. }
  20. addAndMakeVisible(&m_rec_enable);
  21. m_rec_enable.setButtonText("Capture");
  22. m_rec_enable.addListener(this);
  23. setSize (600, pars.size()*25+30);
  24. startTimer(1, 100);
  25. }
  26. PaulstretchpluginAudioProcessorEditor::~PaulstretchpluginAudioProcessorEditor()
  27. {
  28. }
  29. void PaulstretchpluginAudioProcessorEditor::buttonClicked(Button * but)
  30. {
  31. if (but == &m_rec_enable)
  32. {
  33. processor.setRecordingEnabled(but->getToggleState());
  34. }
  35. }
  36. //==============================================================================
  37. void PaulstretchpluginAudioProcessorEditor::paint (Graphics& g)
  38. {
  39. g.fillAll(Colours::darkgrey);
  40. }
  41. void PaulstretchpluginAudioProcessorEditor::resized()
  42. {
  43. m_rec_enable.setBounds(1, getHeight() - 25, 10, 24);
  44. m_rec_enable.changeWidthToFitText();
  45. }
  46. void PaulstretchpluginAudioProcessorEditor::timerCallback(int id)
  47. {
  48. if (id == 1)
  49. {
  50. for (auto& e : m_parcomps)
  51. e->updateComponent();
  52. }
  53. }