y@0: /* y@0: ============================================================================== y@0: y@0: This file was auto-generated by the Introjucer! y@0: y@0: It contains the basic startup code for a Juce application. y@0: y@0: ============================================================================== y@0: */ y@0: y@0: #include "PluginProcessor.h" y@0: #include "PluginEditor.h" y@0: y@0: y@0: //============================================================================== y@0: ADRessAudioProcessorEditor::ADRessAudioProcessorEditor (ADRessAudioProcessor* ownerFilter) y@0: : AudioProcessorEditor (ownerFilter), y@0: fftSizeLabel_("", "FFT Size:"), y@0: hopSizeLabel_("", "Hop Size:"), y@0: windowTypeLabel_("", "Window Type:"), y@0: widthLabel_("", "Width:"), y@0: widthSlider_("width"), y@0: azimuthLabel_("", "Azimuth:"), y@0: azimuthSlider_("azimuth") y@0: { y@0: // This is where our plugin's editor size is set. y@0: // setSize(170, 80); y@0: y@0: betaE_ = 5; y@0: // Set up the selection boxes y@0: y@0: addAndMakeVisible(&fftSizeComboBox_); y@0: fftSizeComboBox_.setEditableText(false); y@0: fftSizeComboBox_.setJustificationType(Justification::left); y@0: fftSizeComboBox_.addItem("1024", 1024); y@0: fftSizeComboBox_.addItem("2048", 2048); y@0: fftSizeComboBox_.addItem("4096", 4096); y@0: fftSizeComboBox_.addListener(this); y@0: y@0: addAndMakeVisible(&hopSizeComboBox_); y@0: hopSizeComboBox_.setEditableText(false); y@0: hopSizeComboBox_.setJustificationType(Justification::left); y@0: hopSizeComboBox_.addItem("1/4 Window", ADRessAudioProcessor::kHopSize1_4Window); y@0: hopSizeComboBox_.addItem("1/8 Window", ADRessAudioProcessor::kHopSize1_8Window); y@0: hopSizeComboBox_.addListener(this); y@0: y@0: addAndMakeVisible(&windowTypeComboBox_); y@0: windowTypeComboBox_.setEditableText(false); y@0: windowTypeComboBox_.setJustificationType(Justification::left); y@0: windowTypeComboBox_.addItem("Rectangular", ADRessAudioProcessor::kWindowRectangular); y@0: windowTypeComboBox_.addItem("Bartlett", ADRessAudioProcessor::kWindowBartlett); y@0: windowTypeComboBox_.addItem("Hann", ADRessAudioProcessor::kWindowHann); y@0: windowTypeComboBox_.addItem("Hamming", ADRessAudioProcessor::kWindowHamming); y@0: windowTypeComboBox_.addListener(this); y@0: y@0: y@0: // Set up the sliders y@0: addAndMakeVisible(&widthSlider_); y@0: widthSlider_.setSliderStyle(Slider::Rotary); y@0: widthSlider_.addListener(this); y@0: widthSlider_.setRange(0, betaE_, 1); y@0: y@0: widthLabel_.attachToComponent(&widthSlider_, false); y@0: widthLabel_.setFont(Font (11.0f)); y@0: y@0: y@0: // Set up the sliders y@0: addAndMakeVisible(&azimuthSlider_); y@0: azimuthSlider_.setSliderStyle(Slider::Rotary); y@0: azimuthSlider_.addListener(this); y@0: azimuthSlider_.setRange(0, 2*betaE_, 1); y@0: y@0: y@0: y@0: azimuthLabel_.attachToComponent(&azimuthSlider_, false); y@0: azimuthLabel_.setFont(Font (11.0f)); y@0: y@0: fftSizeLabel_.attachToComponent(&fftSizeComboBox_, false); y@0: fftSizeLabel_.setFont(Font (11.0f)); y@0: y@0: hopSizeLabel_.attachToComponent(&hopSizeComboBox_, false); y@0: hopSizeLabel_.setFont(Font (11.0f)); y@0: y@0: windowTypeLabel_.attachToComponent(&windowTypeComboBox_, false); y@0: windowTypeLabel_.setFont(Font (11.0f)); y@0: y@0: // add the triangular resizer component for the bottom-right of the UI y@0: addAndMakeVisible(resizer_ = new ResizableCornerComponent (this, &resizeLimits_)); y@0: resizeLimits_.setSizeLimits(360, 400, 360, 400); y@0: y@0: // set our component's initial size to be the last one that was stored in the filter's settings y@0: setSize(ownerFilter->lastUIWidth_, y@0: ownerFilter->lastUIHeight_); y@0: y@0: startTimer(50); y@0: } y@0: y@0: ADRessAudioProcessorEditor::~ADRessAudioProcessorEditor() y@0: { y@0: } y@0: y@0: //============================================================================== y@0: void ADRessAudioProcessorEditor::paint (Graphics& g) y@0: { y@0: g.fillAll (Colours::grey); y@0: } y@0: y@0: void ADRessAudioProcessorEditor::resized() y@0: { y@0: fftSizeComboBox_.setBounds(20, 20, 150, 30); y@0: hopSizeComboBox_.setBounds(200, 20, 150, 30); y@0: windowTypeComboBox_.setBounds(20, 75, 150, 30); y@0: widthSlider_.setBounds(200, 70, 150, 40); y@0: y@0: azimuthSlider_.setBounds(20, 150, 150, 40); y@0: resizer_->setBounds(getWidth() - 16, getHeight() - 16, 16, 16); y@0: y@0: getProcessor()->lastUIWidth_ = getWidth(); y@0: getProcessor()->lastUIHeight_ = getHeight(); y@0: } y@0: y@0: //============================================================================== y@0: // This timer periodically checks whether any of the filter's parameters have changed... y@0: void ADRessAudioProcessorEditor::timerCallback() y@0: { y@0: ADRessAudioProcessor* ourProcessor = getProcessor(); y@0: y@0: fftSizeComboBox_.setSelectedId(ourProcessor->fftSelectedSize_, false); y@0: hopSizeComboBox_.setSelectedId(ourProcessor->hopSelectedSize_, false); y@0: windowTypeComboBox_.setSelectedId(ourProcessor->windowType_, false); y@0: y@0: widthSlider_.setValue(ourProcessor->width_, dontSendNotification); y@0: azimuthSlider_.setValue(ourProcessor->azimuth_, dontSendNotification); y@0: } y@0: y@0: // This is our Slider::Listener callback, when the user drags a slider. y@0: void ADRessAudioProcessorEditor::sliderValueChanged (Slider* slider) y@0: { y@0: if (slider == &widthSlider_) y@0: { y@0: // It's vital to use setParameterNotifyingHost to change any parameters that are automatable y@0: // by the host, rather than just modifying them directly, otherwise the host won't know y@0: // that they've changed. y@0: getProcessor()->setParameterNotifyingHost (ADRessAudioProcessor::kWidthParam, y@0: (float)widthSlider_.getValue()); y@0: } y@0: y@0: if (slider == &azimuthSlider_) y@0: { y@0: getProcessor()->setParameterNotifyingHost (ADRessAudioProcessor::kAzimuthParam, y@0: (float)azimuthSlider_.getValue()); y@0: } y@0: } y@0: y@0: // Similar callback to sliderValueChanged for ComboBox updates y@0: void ADRessAudioProcessorEditor::comboBoxChanged (ComboBox *comboBox) y@0: { y@0: if(comboBox == &fftSizeComboBox_) y@0: { y@0: getProcessor()->setParameterNotifyingHost (ADRessAudioProcessor::kFFTSizeParam, y@0: (float)fftSizeComboBox_.getSelectedId()); y@0: } y@0: else if(comboBox == &hopSizeComboBox_) y@0: { y@0: getProcessor()->setParameterNotifyingHost (ADRessAudioProcessor::kHopSizeParam, y@0: (float)hopSizeComboBox_.getSelectedId()); y@0: } y@0: else if(comboBox == &windowTypeComboBox_) y@0: { y@0: getProcessor()->setParameterNotifyingHost (ADRessAudioProcessor::kWindowTypeParam, y@0: (float)windowTypeComboBox_.getSelectedId()); y@0: } y@0: } y@0: y@0: int ADRessAudioProcessorEditor::getBeta() y@0: { y@0: return betaE_; y@0: }