From 8c0c230eb015cef1a5affb872c080bba886e6271 Mon Sep 17 00:00:00 2001 From: bruce Date: Mon, 4 Nov 2013 22:46:00 +0800 Subject: [PATCH] Add very basic velocity sensitivity for carrier and modulator. --- Source/PluginGui.cpp | 256 +++++++++++++++++++++++++------------ Source/PluginGui.h | 4 + Source/PluginProcessor.cpp | 49 ++++++- 3 files changed, 222 insertions(+), 87 deletions(-) diff --git a/Source/PluginGui.cpp b/Source/PluginGui.cpp index 30455f7..52b6fef 100644 --- a/Source/PluginGui.cpp +++ b/Source/PluginGui.cpp @@ -80,6 +80,9 @@ void PluginGui::updateFromParameters() tremoloSlider->setValue(processor->getEnumParameter("Tremolo Depth") * 3.8 + 1.0, NotificationType::dontSendNotification); feedbackSlider->setValue(processor->getIntParameter("Modulator Feedback"), NotificationType::dontSendNotification); + velocityComboBox->setSelectedItemIndex(processor->getEnumParameter("Modulator Velocity Sensitivity"), true); + velocityComboBox2->setSelectedItemIndex(processor->getEnumParameter("Carrier Velocity Sensitivity"), true); + } //[/MiscUserDefs] @@ -635,6 +638,44 @@ PluginGui::PluginGui (JuceOplvstiAudioProcessor* ownerFilter) frequencyLabel7->setColour (TextEditor::textColourId, Colours::black); frequencyLabel7->setColour (TextEditor::backgroundColourId, Colour (0x00000000)); + addAndMakeVisible (velocityComboBox = new ComboBox ("velocity combo box")); + velocityComboBox->setEditableText (false); + velocityComboBox->setJustificationType (Justification::centredLeft); + velocityComboBox->setTextWhenNothingSelected (String::empty); + velocityComboBox->setTextWhenNoChoicesAvailable ("(no choices)"); + velocityComboBox->addItem ("Off", 1); + velocityComboBox->addItem ("Light", 2); + velocityComboBox->addItem ("Heavy", 3); + velocityComboBox->addListener (this); + + addAndMakeVisible (attenuationLabel3 = new Label ("attenuation label", + "Velocity")); + attenuationLabel3->setFont (Font (15.00f, Font::plain)); + attenuationLabel3->setJustificationType (Justification::centredLeft); + attenuationLabel3->setEditable (false, false, false); + attenuationLabel3->setColour (Label::textColourId, Colour (0xff007f00)); + attenuationLabel3->setColour (TextEditor::textColourId, Colours::black); + attenuationLabel3->setColour (TextEditor::backgroundColourId, Colour (0x00000000)); + + addAndMakeVisible (velocityComboBox2 = new ComboBox ("velocity combo box")); + velocityComboBox2->setEditableText (false); + velocityComboBox2->setJustificationType (Justification::centredLeft); + velocityComboBox2->setTextWhenNothingSelected (String::empty); + velocityComboBox2->setTextWhenNoChoicesAvailable ("(no choices)"); + velocityComboBox2->addItem ("Off", 1); + velocityComboBox2->addItem ("Light", 2); + velocityComboBox2->addItem ("Heavy", 3); + velocityComboBox2->addListener (this); + + addAndMakeVisible (attenuationLabel4 = new Label ("attenuation label", + "Velocity")); + attenuationLabel4->setFont (Font (15.00f, Font::plain)); + attenuationLabel4->setJustificationType (Justification::centredLeft); + attenuationLabel4->setEditable (false, false, false); + attenuationLabel4->setColour (Label::textColourId, Colour (0xff007f00)); + attenuationLabel4->setColour (TextEditor::textColourId, Colours::black); + attenuationLabel4->setColour (TextEditor::backgroundColourId, Colour (0x00000000)); + //[UserPreSize] frequencyComboBox->setColour (ComboBox::textColourId, Colour (COLOUR_MID)); @@ -676,6 +717,17 @@ PluginGui::PluginGui (JuceOplvstiAudioProcessor* ownerFilter) frequencyComboBox2->addItem ("x12", 12); frequencyComboBox2->addItem ("x15", 15); + velocityComboBox->setColour (ComboBox::textColourId, Colour (COLOUR_MID)); + velocityComboBox->setColour (ComboBox::outlineColourId, Colour (COLOUR_MID)); + velocityComboBox->setColour (ComboBox::arrowColourId, Colour (COLOUR_MID)); + velocityComboBox->setColour (ComboBox::buttonColourId, Colours::black); + velocityComboBox->setColour (ComboBox::backgroundColourId, Colours::black); + velocityComboBox2->setColour (ComboBox::textColourId, Colour (COLOUR_MID)); + velocityComboBox2->setColour (ComboBox::outlineColourId, Colour (COLOUR_MID)); + velocityComboBox2->setColour (ComboBox::arrowColourId, Colour (COLOUR_MID)); + velocityComboBox2->setColour (ComboBox::buttonColourId, Colours::black); + velocityComboBox2->setColour (ComboBox::backgroundColourId, Colours::black); + sineImageButton->setClickingTogglesState(true); sineImageButton->setRepaintsOnMouseActivity(false); abssineImageButton->setClickingTogglesState(true); @@ -777,6 +829,10 @@ PluginGui::~PluginGui() dbLabel6 = nullptr; feedbackSlider = nullptr; frequencyLabel7 = nullptr; + velocityComboBox = nullptr; + attenuationLabel3 = nullptr; + velocityComboBox2 = nullptr; + attenuationLabel4 = nullptr; //[Destructor]. You can add your own custom destruction code here.. @@ -797,7 +853,7 @@ void PluginGui::paint (Graphics& g) void PluginGui::resized() { - groupComponent->setBounds (16, 8, 400, 336); + groupComponent->setBounds (16, 8, 408, 336); frequencyComboBox->setBounds (128, 80, 72, 24); frequencyLabel->setBounds (32, 80, 80, 24); aSlider->setBounds (40, 208, 48, 72); @@ -808,56 +864,60 @@ void PluginGui::resized() dLabel2->setBounds (168, 280, 48, 24); rSlider->setBounds (232, 208, 48, 72); rLabel->setBounds (232, 280, 48, 24); - attenuationSlider->setBounds (304, 168, 72, 112); - attenuationLabel->setBounds (304, 280, 96, 24); - dbLabel->setBounds (368, 256, 40, 24); - sineImageButton->setBounds (120, 40, 34, 30); - halfsineImageButton->setBounds (176, 40, 34, 30); - abssineImageButton->setBounds (232, 40, 34, 30); - quartersineImageButton->setBounds (288, 40, 34, 30); + attenuationSlider->setBounds (312, 200, 72, 96); + attenuationLabel->setBounds (312, 304, 96, 24); + dbLabel->setBounds (376, 272, 40, 24); + sineImageButton->setBounds (128, 40, 34, 30); + halfsineImageButton->setBounds (184, 40, 34, 30); + abssineImageButton->setBounds (240, 40, 34, 30); + quartersineImageButton->setBounds (296, 40, 34, 30); waveLabel->setBounds (32, 40, 80, 24); tremoloButton->setBounds (144, 120, 96, 24); vibratoButton->setBounds (40, 120, 96, 24); sustainButton->setBounds (40, 304, 96, 24); - keyscaleEnvButton->setBounds (136, 304, 184, 24); - keyscaleSlider->setBounds (256, 104, 112, 24); - frequencyLabel2->setBounds (248, 80, 152, 24); - dbLabel2->setBounds (368, 96, 40, 40); - groupComponent2->setBounds (16, 352, 400, 320); + keyscaleEnvButton->setBounds (128, 304, 184, 24); + keyscaleSlider->setBounds (256, 88, 112, 24); + frequencyLabel2->setBounds (248, 120, 152, 24); + dbLabel2->setBounds (368, 80, 40, 40); + groupComponent2->setBounds (16, 352, 408, 336); frequencyComboBox2->setBounds (128, 424, 72, 24); frequencyLabel3->setBounds (32, 424, 80, 24); - aSlider2->setBounds (40, 536, 48, 72); - aLabel2->setBounds (40, 608, 48, 24); - dSlider2->setBounds (104, 536, 48, 72); - dLabel3->setBounds (104, 608, 48, 24); - sSlider2->setBounds (168, 536, 48, 72); - dLabel4->setBounds (168, 608, 48, 24); - rSlider2->setBounds (232, 536, 48, 72); - rLabel2->setBounds (232, 608, 48, 24); - attenuationSlider2->setBounds (304, 496, 72, 112); - attenuationLabel2->setBounds (304, 608, 96, 24); - dbLabel3->setBounds (368, 584, 40, 24); - sineImageButton2->setBounds (120, 384, 34, 30); - halfsineImageButton2->setBounds (176, 384, 34, 30); - abssineImageButton2->setBounds (232, 384, 34, 30); - quartersineImageButton2->setBounds (288, 384, 34, 30); + aSlider2->setBounds (40, 552, 48, 72); + aLabel2->setBounds (40, 624, 48, 24); + dSlider2->setBounds (104, 552, 48, 72); + dLabel3->setBounds (104, 624, 48, 24); + sSlider2->setBounds (168, 552, 48, 72); + dLabel4->setBounds (168, 624, 48, 24); + rSlider2->setBounds (232, 552, 48, 72); + rLabel2->setBounds (232, 624, 48, 24); + attenuationSlider2->setBounds (312, 544, 72, 96); + attenuationLabel2->setBounds (312, 648, 96, 24); + dbLabel3->setBounds (376, 616, 40, 24); + sineImageButton2->setBounds (128, 384, 34, 30); + halfsineImageButton2->setBounds (184, 384, 34, 30); + abssineImageButton2->setBounds (240, 384, 34, 30); + quartersineImageButton2->setBounds (296, 384, 34, 30); waveLabel2->setBounds (32, 384, 80, 24); tremoloButton2->setBounds (152, 464, 96, 24); vibratoButton2->setBounds (40, 464, 96, 24); - sustainButton2->setBounds (40, 632, 96, 24); - keyscaleEnvButton2->setBounds (136, 632, 184, 24); - keyscaleSlider2->setBounds (256, 448, 112, 24); - frequencyLabel4->setBounds (248, 424, 152, 24); - dbLabel4->setBounds (368, 440, 40, 40); - groupComponent3->setBounds (16, 680, 400, 96); - tremoloSlider->setBounds (48, 712, 112, 24); - frequencyLabel5->setBounds (40, 736, 152, 24); - dbLabel5->setBounds (160, 704, 40, 40); - vibratoSlider->setBounds (233, 713, 112, 24); - frequencyLabel6->setBounds (225, 737, 152, 24); - dbLabel6->setBounds (345, 705, 47, 40); - feedbackSlider->setBounds (120, 168, 136, 24); + sustainButton2->setBounds (40, 648, 96, 24); + keyscaleEnvButton2->setBounds (128, 648, 184, 24); + keyscaleSlider2->setBounds (256, 432, 112, 24); + frequencyLabel4->setBounds (248, 464, 152, 24); + dbLabel4->setBounds (368, 424, 40, 40); + groupComponent3->setBounds (16, 696, 408, 96); + tremoloSlider->setBounds (48, 728, 112, 24); + frequencyLabel5->setBounds (48, 752, 152, 24); + dbLabel5->setBounds (160, 720, 40, 40); + vibratoSlider->setBounds (240, 728, 112, 24); + frequencyLabel6->setBounds (240, 752, 152, 24); + dbLabel6->setBounds (352, 720, 47, 40); + feedbackSlider->setBounds (112, 168, 136, 24); frequencyLabel7->setBounds (32, 168, 80, 24); + velocityComboBox->setBounds (336, 168, 72, 24); + attenuationLabel3->setBounds (272, 168, 64, 24); + velocityComboBox2->setBounds (336, 512, 72, 24); + attenuationLabel4->setBounds (272, 512, 64, 24); //[UserResized] Add your own custom resize handling here.. //[/UserResized] } @@ -883,6 +943,20 @@ void PluginGui::comboBoxChanged (ComboBox* comboBoxThatHasChanged) processor->setEnumParameter("Carrier Frequency Multiplier", id); //[/UserComboBoxCode_frequencyComboBox2] } + else if (comboBoxThatHasChanged == velocityComboBox) + { + //[UserComboBoxCode_velocityComboBox] -- add your combo box handling code here.. + int id = comboBoxThatHasChanged->getSelectedId() - 1; + processor->setEnumParameter("Modulator Velocity Sensitivity", id); + //[/UserComboBoxCode_velocityComboBox] + } + else if (comboBoxThatHasChanged == velocityComboBox2) + { + //[UserComboBoxCode_velocityComboBox2] -- add your combo box handling code here.. + int id = comboBoxThatHasChanged->getSelectedId() - 1; + processor->setEnumParameter("Carrier Velocity Sensitivity", id); + //[/UserComboBoxCode_velocityComboBox2] + } //[UsercomboBoxChanged_Post] //[/UsercomboBoxChanged_Post] @@ -1116,7 +1190,7 @@ BEGIN_JUCER_METADATA initialWidth="430" initialHeight="800">