osci-render/Source/PluginEditor.cpp

57 wiersze
2.0 KiB
C++

/*
==============================================================================
This file contains the basic framework code for a JUCE plugin editor.
==============================================================================
*/
#include "PluginProcessor.h"
#include "PluginEditor.h"
//==============================================================================
OscirenderAudioProcessorEditor::OscirenderAudioProcessorEditor (OscirenderAudioProcessor& p)
: AudioProcessorEditor (&p), audioProcessor (p)
{
// Make sure that before the constructor has finished, you've set the
// editor's size to whatever you need it to be.
setSize (200, 200);
midiVolume.setSliderStyle(juce::Slider::LinearBarVertical);
midiVolume.setRange(0.0, 127.0, 1.0);
midiVolume.setTextBoxStyle(juce::Slider::NoTextBox, false, 90, 0);
midiVolume.setPopupDisplayEnabled(true, false, this);
midiVolume.setTextValueSuffix(" Volume");
midiVolume.setValue(1.0);
addAndMakeVisible(midiVolume);
midiVolume.addListener(this);
}
OscirenderAudioProcessorEditor::~OscirenderAudioProcessorEditor()
{
}
//==============================================================================
void OscirenderAudioProcessorEditor::paint (juce::Graphics& g)
{
// (Our component is opaque, so we must completely fill the background with a solid colour)
g.fillAll (getLookAndFeel().findColour (juce::ResizableWindow::backgroundColourId));
g.setColour (juce::Colours::white);
g.setFont (15.0f);
g.drawFittedText ("Midi Volume", getLocalBounds(), juce::Justification::centred, 1);
}
void OscirenderAudioProcessorEditor::resized()
{
// This is generally where you'll want to lay out the positions of any
// subcomponents in your editor..
midiVolume.setBounds(40, 30, 20, getHeight() - 60);
}
void OscirenderAudioProcessorEditor::sliderValueChanged(juce::Slider* slider) {
audioProcessor.noteOnVel = midiVolume.getValue();
}