diff --git a/JuceOPLVSTi.jucer b/JuceOPLVSTi.jucer index fc8f925..40bfc56 100644 --- a/JuceOPLVSTi.jucer +++ b/JuceOPLVSTi.jucer @@ -1,6 +1,6 @@ - toggleRect; public: + static const Colour DOS_GREEN; + OPLLookAndFeel(); void drawTickBox(Graphics &g, diff --git a/Source/PluginGui.cpp b/Source/PluginGui.cpp index 1dd7d39..cf3a15b 100644 --- a/Source/PluginGui.cpp +++ b/Source/PluginGui.cpp @@ -166,6 +166,18 @@ PluginGui::PluginGui (AdlibBlasterAudioProcessor* ownerFilter) //[Constructor_pre] You can add your own custom stuff here.. //[/Constructor_pre] + addAndMakeVisible (groupComponent2 = new GroupComponent ("new group", + TRANS("Carrier"))); + groupComponent2->setTextLabelPosition (Justification::centredLeft); + groupComponent2->setColour (GroupComponent::outlineColourId, Colour (0xff007f00)); + groupComponent2->setColour (GroupComponent::textColourId, Colour (0xff007f00)); + + addAndMakeVisible (groupComponent4 = new GroupComponent ("new group", + TRANS("Channels"))); + groupComponent4->setTextLabelPosition (Justification::centredLeft); + groupComponent4->setColour (GroupComponent::outlineColourId, Colour (0xff007f00)); + groupComponent4->setColour (GroupComponent::textColourId, Colour (0xff007f00)); + addAndMakeVisible (groupComponent11 = new GroupComponent ("new group", TRANS("Percussion"))); groupComponent11->setTextLabelPosition (Justification::centredLeft); @@ -198,7 +210,7 @@ PluginGui::PluginGui (AdlibBlasterAudioProcessor* ownerFilter) frequencyComboBox->addListener (this); addAndMakeVisible (frequencyLabel = new Label ("frequency label", - TRANS("Base Frequency"))); + TRANS("Frequency Multiplier"))); frequencyLabel->setTooltip (TRANS("Multiplier applied to base note frequency")); frequencyLabel->setFont (Font (15.00f, Font::plain)); frequencyLabel->setJustificationType (Justification::centredLeft); @@ -297,8 +309,8 @@ PluginGui::PluginGui (AdlibBlasterAudioProcessor* ownerFilter) addAndMakeVisible (attenuationSlider = new Slider ("attenuation slider")); attenuationSlider->setRange (-47.25, 0, 0.75); - attenuationSlider->setSliderStyle (Slider::LinearHorizontal); - attenuationSlider->setTextBoxStyle (Slider::TextBoxRight, true, 64, 20); + attenuationSlider->setSliderStyle (Slider::LinearVertical); + attenuationSlider->setTextBoxStyle (Slider::TextBoxBelow, true, 64, 20); attenuationSlider->setColour (Slider::thumbColourId, Colour (0xff007f00)); attenuationSlider->setColour (Slider::trackColourId, Colour (0x7f007f00)); attenuationSlider->setColour (Slider::textBoxTextColourId, Colour (0xff007f00)); @@ -405,12 +417,6 @@ PluginGui::PluginGui (AdlibBlasterAudioProcessor* ownerFilter) dbLabel2->setColour (TextEditor::textColourId, Colours::black); dbLabel2->setColour (TextEditor::backgroundColourId, Colour (0x00000000)); - addAndMakeVisible (groupComponent2 = new GroupComponent ("new group", - TRANS("Carrier"))); - groupComponent2->setTextLabelPosition (Justification::centredLeft); - groupComponent2->setColour (GroupComponent::outlineColourId, Colour (0xff007f00)); - groupComponent2->setColour (GroupComponent::textColourId, Colour (0xff007f00)); - addAndMakeVisible (frequencyComboBox2 = new ComboBox ("frequency combo box")); frequencyComboBox2->setEditableText (false); frequencyComboBox2->setJustificationType (Justification::centredLeft); @@ -419,7 +425,7 @@ PluginGui::PluginGui (AdlibBlasterAudioProcessor* ownerFilter) frequencyComboBox2->addListener (this); addAndMakeVisible (frequencyLabel3 = new Label ("frequency label", - TRANS("Base Frequency"))); + TRANS("Frequency Multiplier"))); frequencyLabel3->setTooltip (TRANS("Multiplier applied to base note frequency")); frequencyLabel3->setFont (Font (15.00f, Font::plain)); frequencyLabel3->setJustificationType (Justification::centredLeft); @@ -514,8 +520,8 @@ PluginGui::PluginGui (AdlibBlasterAudioProcessor* ownerFilter) addAndMakeVisible (attenuationSlider2 = new Slider ("attenuation slider")); attenuationSlider2->setRange (-47.25, 0, 0.75); - attenuationSlider2->setSliderStyle (Slider::LinearHorizontal); - attenuationSlider2->setTextBoxStyle (Slider::TextBoxRight, true, 64, 20); + attenuationSlider2->setSliderStyle (Slider::LinearVertical); + attenuationSlider2->setTextBoxStyle (Slider::TextBoxBelow, true, 64, 20); attenuationSlider2->setColour (Slider::thumbColourId, Colour (0xff007f00)); attenuationSlider2->setColour (Slider::trackColourId, Colour (0x7f007f00)); attenuationSlider2->setColour (Slider::textBoxTextColourId, Colour (0xff007f00)); @@ -613,8 +619,8 @@ PluginGui::PluginGui (AdlibBlasterAudioProcessor* ownerFilter) keyscaleEnvButton2->setColour (ToggleButton::textColourId, Colour (0xff007f00)); addAndMakeVisible (frequencyLabel4 = new Label ("frequency label", - TRANS("Keyscale Attenuation (db/8ve)"))); - frequencyLabel4->setTooltip (TRANS("Attenuate amplitude with note frequency in db/8ve")); + TRANS("Keyscale Attenuation"))); + frequencyLabel4->setTooltip (TRANS("Attenuate amplitude with note frequency in dB per octave")); frequencyLabel4->setFont (Font (15.00f, Font::plain)); frequencyLabel4->setJustificationType (Justification::centred); frequencyLabel4->setEditable (false, false, false); @@ -705,7 +711,7 @@ PluginGui::PluginGui (AdlibBlasterAudioProcessor* ownerFilter) feedbackSlider->addListener (this); addAndMakeVisible (frequencyLabel7 = new Label ("frequency label", - TRANS("F"))); + TRANS("Feedback"))); frequencyLabel7->setTooltip (TRANS("Extent to which modulator output is fed back into itself")); frequencyLabel7->setFont (Font (15.00f, Font::plain)); frequencyLabel7->setJustificationType (Justification::centred); @@ -842,18 +848,12 @@ PluginGui::PluginGui (AdlibBlasterAudioProcessor* ownerFilter) keyscaleAttenuationComboBox->setJustificationType (Justification::centredLeft); keyscaleAttenuationComboBox->setTextWhenNothingSelected (String()); keyscaleAttenuationComboBox->setTextWhenNoChoicesAvailable (TRANS("(no choices)")); - keyscaleAttenuationComboBox->addItem (TRANS("-0.0"), 1); - keyscaleAttenuationComboBox->addItem (TRANS("-3.0"), 2); - keyscaleAttenuationComboBox->addItem (TRANS("-1.5"), 3); - keyscaleAttenuationComboBox->addItem (TRANS("-6.0"), 4); + keyscaleAttenuationComboBox->addItem (TRANS("-0.0 db/8ve"), 1); + keyscaleAttenuationComboBox->addItem (TRANS("-3.0 db/8ve"), 2); + keyscaleAttenuationComboBox->addItem (TRANS("-1.5 db/8ve"), 3); + keyscaleAttenuationComboBox->addItem (TRANS("-6.0 db/8ve"), 4); keyscaleAttenuationComboBox->addListener (this); - addAndMakeVisible (groupComponent4 = new GroupComponent ("new group", - TRANS("Channels"))); - groupComponent4->setTextLabelPosition (Justification::centredLeft); - groupComponent4->setColour (GroupComponent::outlineColourId, Colour (0xff007f00)); - groupComponent4->setColour (GroupComponent::textColourId, Colour (0xff007f00)); - addAndMakeVisible (groupComponent5 = new GroupComponent ("new group", TRANS("Emulator (currently locked)"))); groupComponent5->setTextLabelPosition (Justification::centredLeft); @@ -1421,8 +1421,8 @@ PluginGui::PluginGui (AdlibBlasterAudioProcessor* ownerFilter) label30->setColour (TextEditor::backgroundColourId, Colour (0x00000000)); addAndMakeVisible (frequencyLabel10 = new Label ("frequency label", - TRANS("Keyscale Attenuation (db/8ve)"))); - frequencyLabel10->setTooltip (TRANS("Attenuate amplitude with note frequency in db/8ve")); + TRANS("Keyscale Attenuation"))); + frequencyLabel10->setTooltip (TRANS("Attenuate amplitude with note frequency in dB per octave")); frequencyLabel10->setFont (Font (15.00f, Font::plain)); frequencyLabel10->setJustificationType (Justification::centred); frequencyLabel10->setEditable (false, false, false); @@ -1520,6 +1520,32 @@ PluginGui::PluginGui (AdlibBlasterAudioProcessor* ownerFilter) ImageCache::getFromMemory (hihat_png, hihat_pngSize), 0.500f, Colour (0x00000000), Image(), 0.500f, Colour (0x00000000), Image(), 1.000f, Colour (0x00000000)); + addAndMakeVisible (dbLabel7 = new Label ("db label", + TRANS("FM"))); + dbLabel7->setFont (Font (15.00f, Font::plain)); + dbLabel7->setJustificationType (Justification::centredLeft); + dbLabel7->setEditable (false, false, false); + dbLabel7->setColour (Label::textColourId, Colour (0xff007f00)); + dbLabel7->setColour (Label::outlineColourId, Colour (0x00000000)); + dbLabel7->setColour (TextEditor::textColourId, Colours::black); + dbLabel7->setColour (TextEditor::backgroundColourId, Colour (0x00000000)); + + addAndMakeVisible (dbLabel8 = new Label ("db label", + TRANS("Additive"))); + dbLabel8->setFont (Font (15.00f, Font::plain)); + dbLabel8->setJustificationType (Justification::centred); + dbLabel8->setEditable (false, false, false); + dbLabel8->setColour (Label::textColourId, Colour (0xff007f00)); + dbLabel8->setColour (Label::outlineColourId, Colour (0x00000000)); + dbLabel8->setColour (TextEditor::textColourId, Colours::black); + dbLabel8->setColour (TextEditor::backgroundColourId, Colour (0x00000000)); + + addAndMakeVisible (imageButton = new ImageButton ("new button")); + + imageButton->setImages (false, true, true, + ImageCache::getFromMemory (adlib_png, adlib_pngSize), 1.000f, Colour (0x00000000), + Image(), 1.000f, Colour (0x00000000), + Image(), 1.000f, Colour (0x00000000)); //[UserPreSize] LookAndFeel::setDefaultLookAndFeel(new OPLLookAndFeel()); @@ -1651,9 +1677,9 @@ PluginGui::PluginGui (AdlibBlasterAudioProcessor* ownerFilter) Font fw(Font::getDefaultMonospacedFontName(), 14, Font::bold); for (unsigned int i = 0; i < channels.size(); ++i) { - Label *channel = new Label("chan label", TRANS("-")); + TextButton *channel = new TextButton(TRANS("-"), String("Disable channel %d", i + 1)); channel->setColour(Label::textColourId, Colour(COLOUR_MID)); - channel->setJustificationType(Justification::centred); + channel->addListener(this); addAndMakeVisible(channel); channels[i] = channel; } @@ -1674,6 +1700,8 @@ PluginGui::~PluginGui() //[Destructor_pre]. You can add your own custom destruction code here.. //[/Destructor_pre] + groupComponent2 = nullptr; + groupComponent4 = nullptr; groupComponent11 = nullptr; groupComponent10 = nullptr; groupComponent9 = nullptr; @@ -1701,7 +1729,6 @@ PluginGui::~PluginGui() sustainButton = nullptr; keyscaleEnvButton = nullptr; dbLabel2 = nullptr; - groupComponent2 = nullptr; frequencyComboBox2 = nullptr; frequencyLabel3 = nullptr; aSlider2 = nullptr; @@ -1748,7 +1775,6 @@ PluginGui::~PluginGui() dbLabel4 = nullptr; keyscaleAttenuationComboBox2 = nullptr; keyscaleAttenuationComboBox = nullptr; - groupComponent4 = nullptr; groupComponent5 = nullptr; emulatorSlider = nullptr; emulatorLabel = nullptr; @@ -1829,6 +1855,9 @@ PluginGui::~PluginGui() tomTomButton = nullptr; cymbalButton = nullptr; hiHatButton = nullptr; + dbLabel7 = nullptr; + dbLabel8 = nullptr; + imageButton = nullptr; //[Destructor]. You can add your own custom destruction code here.. @@ -1852,69 +1881,70 @@ void PluginGui::resized() //[UserPreResize] Add your own custom resize code here.. //[/UserPreResize] - groupComponent11->setBounds (496, 416, 192, 144); - groupComponent10->setBounds (280, 416, 200, 144); - groupComponent9->setBounds (704, 416, 144, 144); - groupComponent->setBounds (16, 88, 408, 312); - frequencyComboBox->setBounds (149, 173, 66, 24); - frequencyLabel->setBounds (32, 173, 112, 24); - aSlider->setBounds (30, 211, 30, 88); - aLabel->setBounds (30, 301, 30, 24); - dSlider->setBounds (70, 211, 30, 88); - dLabel->setBounds (70, 301, 30, 24); - sSlider->setBounds (110, 211, 30, 88); - dLabel2->setBounds (110, 301, 30, 24); - rSlider->setBounds (150, 211, 30, 88); - rLabel->setBounds (150, 301, 30, 24); - attenuationSlider->setBounds (130, 358, 232, 24); - attenuationLabel->setBounds (32, 358, 106, 24); - dbLabel->setBounds (362, 358, 32, 24); + groupComponent2->setBounds (440, 88, 408, 344); + groupComponent4->setBounds (16, 8, 832, 64); + groupComponent11->setBounds (496, 440, 192, 120); + groupComponent10->setBounds (280, 440, 200, 120); + groupComponent9->setBounds (704, 440, 144, 120); + groupComponent->setBounds (16, 88, 408, 344); + frequencyComboBox->setBounds (200, 168, 64, 24); + frequencyLabel->setBounds (40, 168, 152, 24); + aSlider->setBounds (40, 208, 30, 88); + aLabel->setBounds (40, 304, 30, 24); + dSlider->setBounds (88, 208, 30, 88); + dLabel->setBounds (88, 304, 30, 24); + sSlider->setBounds (136, 208, 30, 88); + dLabel2->setBounds (136, 304, 30, 24); + rSlider->setBounds (184, 208, 30, 88); + rLabel->setBounds (184, 304, 30, 24); + attenuationSlider->setBounds (328, 200, 56, 126); + attenuationLabel->setBounds (304, 168, 112, 24); + dbLabel->setBounds (384, 304, 32, 24); sineImageButton->setBounds (88, 113, 34, 30); halfsineImageButton->setBounds (128, 113, 34, 30); abssineImageButton->setBounds (168, 113, 34, 30); quartersineImageButton->setBounds (208, 113, 34, 30); waveLabel->setBounds (32, 115, 48, 24); - tremoloButton->setBounds (323, 170, 80, 24); - vibratoButton->setBounds (243, 170, 72, 24); - sustainButton->setBounds (243, 206, 70, 24); - keyscaleEnvButton->setBounds (323, 194, 101, 48); + tremoloButton->setBounds (120, 352, 80, 24); + vibratoButton->setBounds (32, 352, 72, 24); + sustainButton->setBounds (32, 384, 70, 32); + keyscaleEnvButton->setBounds (120, 376, 101, 48); dbLabel2->setBounds (792, 712, 72, 16); - groupComponent2->setBounds (440, 88, 408, 312); - frequencyComboBox2->setBounds (573, 173, 66, 24); - frequencyLabel3->setBounds (456, 173, 112, 24); - aSlider2->setBounds (462, 211, 30, 88); - aLabel2->setBounds (462, 301, 30, 24); - dSlider2->setBounds (510, 211, 30, 88); - dLabel3->setBounds (510, 301, 30, 24); - sSlider2->setBounds (558, 211, 30, 88); - dLabel4->setBounds (558, 301, 30, 24); - rSlider2->setBounds (606, 211, 30, 88); - rLabel2->setBounds (606, 301, 30, 24); - attenuationSlider2->setBounds (554, 358, 232, 24); - attenuationLabel2->setBounds (456, 358, 106, 24); - dbLabel3->setBounds (782, 358, 40, 24); + frequencyComboBox2->setBounds (624, 168, 66, 24); + frequencyLabel3->setBounds (464, 168, 152, 24); + aSlider2->setBounds (464, 208, 30, 88); + aLabel2->setBounds (464, 304, 30, 24); + dSlider2->setBounds (512, 208, 30, 88); + dLabel3->setBounds (512, 304, 30, 24); + sSlider2->setBounds (560, 208, 30, 88); + dLabel4->setBounds (560, 304, 30, 24); + rSlider2->setBounds (608, 208, 30, 88); + rLabel2->setBounds (608, 304, 30, 24); + attenuationSlider2->setBounds (752, 200, 56, 126); + attenuationLabel2->setBounds (728, 168, 112, 24); + dbLabel3->setBounds (800, 304, 40, 24); sineImageButton2->setBounds (512, 113, 34, 30); halfsineImageButton2->setBounds (552, 113, 34, 30); abssineImageButton2->setBounds (592, 113, 34, 30); quartersineImageButton2->setBounds (632, 113, 34, 30); waveLabel2->setBounds (456, 115, 48, 24); - tremoloButton2->setBounds (746, 170, 80, 24); - vibratoButton2->setBounds (666, 170, 72, 24); - sustainButton2->setBounds (666, 206, 70, 24); - keyscaleEnvButton2->setBounds (746, 194, 102, 48); - frequencyLabel4->setBounds (752, 288, 88, 48); - groupComponent3->setBounds (16, 416, 248, 144); - tremoloSlider->setBounds (112, 456, 80, 24); - frequencyLabel5->setBounds (32, 456, 104, 24); - dbLabel5->setBounds (200, 448, 32, 40); - vibratoSlider->setBounds (112, 504, 80, 24); - frequencyLabel6->setBounds (32, 504, 96, 24); - dbLabel6->setBounds (200, 496, 48, 40); - feedbackSlider->setBounds (190, 240, 30, 59); - frequencyLabel7->setBounds (190, 301, 30, 24); - velocityComboBox->setBounds (244, 257, 72, 24); - velocityComboBox2->setBounds (672, 257, 72, 24); - attenuationLabel4->setBounds (664, 288, 80, 48); + tremoloButton2->setBounds (544, 352, 80, 24); + vibratoButton2->setBounds (456, 352, 72, 24); + sustainButton2->setBounds (456, 384, 70, 24); + keyscaleEnvButton2->setBounds (544, 376, 102, 48); + frequencyLabel4->setBounds (656, 376, 88, 48); + groupComponent3->setBounds (16, 440, 248, 120); + tremoloSlider->setBounds (112, 472, 80, 24); + frequencyLabel5->setBounds (32, 472, 80, 24); + dbLabel5->setBounds (200, 464, 32, 40); + vibratoSlider->setBounds (112, 512, 80, 24); + frequencyLabel6->setBounds (32, 512, 80, 24); + dbLabel6->setBounds (200, 504, 48, 40); + feedbackSlider->setBounds (248, 237, 30, 59); + frequencyLabel7->setBounds (224, 304, 80, 24); + velocityComboBox->setBounds (328, 352, 76, 24); + velocityComboBox2->setBounds (760, 352, 72, 24); + attenuationLabel4->setBounds (760, 376, 80, 48); alternatingsineImageButton->setBounds (288, 113, 34, 30); camelsineImageButton->setBounds (248, 113, 34, 30); squareImageButton->setBounds (328, 113, 34, 30); @@ -1924,28 +1954,27 @@ void PluginGui::resized() squareImageButton2->setBounds (754, 114, 34, 30); logsawImageButton2->setBounds (794, 114, 34, 30); dbLabel4->setBounds (792, 688, 72, 16); - keyscaleAttenuationComboBox2->setBounds (763, 257, 60, 24); - keyscaleAttenuationComboBox->setBounds (338, 257, 60, 24); - groupComponent4->setBounds (16, 8, 832, 64); + keyscaleAttenuationComboBox2->setBounds (664, 352, 76, 24); + keyscaleAttenuationComboBox->setBounds (232, 352, 76, 24); groupComponent5->setBounds (24, 712, 408, 64); emulatorSlider->setBounds (208, 736, 40, 24); emulatorLabel->setBounds (120, 736, 72, 24); emulatorLabel2->setBounds (256, 736, 72, 24); recordButton->setBounds (32, 680, 224, 24); - exportButton->setBounds (728, 504, 96, 24); - loadButton->setBounds (728, 456, 96, 24); + exportButton->setBounds (728, 512, 96, 24); + loadButton->setBounds (728, 472, 96, 24); versionLabel->setBounds (648, 560, 198, 16); ToggleButtonOffExample->setBounds (1032, 584, 12, 12); ToggleButtonOnExample->setBounds (1064, 584, 12, 12); label->setBounds (1000, 608, 104, 24); label2->setBounds (872, 608, 104, 24); - LineBorderButton1C->setBounds (20, 340, 400, 6); + LineBorderButton1C->setBounds (20, 336, 400, 6); LineBorderButton1A->setBounds (20, 152, 400, 6); - LineBorderButton1B->setBounds (230, 156, 6, 186); + LineBorderButton1B->setBounds (296, 156, 6, 182); label3->setBounds (776, 736, 104, 56); - LineBorderButton1C2->setBounds (444, 340, 400, 6); + LineBorderButton1C2->setBounds (444, 336, 400, 6); LineBorderButton1A2->setBounds (444, 152, 400, 6); - LineBorderButton1B2->setBounds (654, 156, 6, 186); + LineBorderButton1B2->setBounds (720, 156, 6, 182); LineBorderButton1C3->setBounds (892, 584, 20, 6); LineBorderButton1B3->setBounds (936, 576, 6, 20); algoSwitchButtonOffEx1->setBounds (952, 701, 64, 24); @@ -1993,23 +2022,26 @@ void PluginGui::resized() label27->setBounds (1055, 250, 32, 24); algoSwitchButtonOn3Ex4->setBounds (1103, 250, 64, 24); label28->setBounds (1121, 250, 32, 24); - groupComponent8->setBounds (1018, 200, 168, 95); + groupComponent8->setBounds (1008, 208, 168, 95); frequencyLabel9->setBounds (1067, 216, 72, 24); label29->setBounds (944, 304, 328, 40); label30->setBounds (961, 768, 319, 24); - frequencyLabel10->setBounds (328, 288, 88, 48); - attenuationLabel5->setBounds (240, 288, 80, 48); - fmButton->setBounds (304, 464, 56, 56); - additiveButton->setBounds (384, 456, 72, 72); - bassDrumButton->setBounds (576, 448, 30, 30); - snareDrumButton->setBounds (632, 448, 30, 30); - disablePercussionButton->setBounds (520, 448, 30, 30); - tomTomButton->setBounds (520, 504, 30, 30); - cymbalButton->setBounds (576, 504, 30, 30); - hiHatButton->setBounds (632, 504, 30, 30); + frequencyLabel10->setBounds (224, 376, 88, 48); + attenuationLabel5->setBounds (328, 376, 80, 48); + fmButton->setBounds (304, 472, 56, 56); + additiveButton->setBounds (392, 464, 72, 72); + bassDrumButton->setBounds (576, 464, 30, 30); + snareDrumButton->setBounds (632, 464, 30, 30); + disablePercussionButton->setBounds (520, 464, 30, 30); + tomTomButton->setBounds (520, 512, 30, 30); + cymbalButton->setBounds (576, 512, 30, 30); + hiHatButton->setBounds (632, 512, 30, 30); + dbLabel7->setBounds (320, 520, 32, 40); + dbLabel8->setBounds (392, 520, 72, 40); + imageButton->setBounds (656, 232, 64, 64); //[UserResized] Add your own custom resize handling here.. for (unsigned int i = 0; i < channels.size(); ++i) - channels[i]->setBounds(68+88*i, 36, 20, 20); + channels[i]->setBounds(64+88*i, 30, 28, 28); //[/UserResized] } @@ -2164,6 +2196,28 @@ void PluginGui::sliderValueChanged (Slider* sliderThatWasMoved) void PluginGui::buttonClicked (Button* buttonThatWasClicked) { //[UserbuttonClicked_Pre] + // TODO: + // - prevent all channels from being disabled + // - fix button tooltip text + // - button styling + // - automatically select channel(s) by default + // - record output to file + for (int i = 1; i <= Hiopl::CHANNELS; ++i) { + Button* channelButton = channels[i - 1]; + if (buttonThatWasClicked == channelButton) { + processor->toggleChannel(i); + const bool channelEnabled = processor->isChannelEnabled(i); + const Colour fg = channelEnabled ? Colours::black : OPLLookAndFeel::DOS_GREEN; + const Colour bg = channelEnabled ? OPLLookAndFeel::DOS_GREEN : Colours::black; + + channelButton->setColour(TextButton::ColourIds::buttonColourId, bg); + channelButton->setColour(TextButton::ColourIds::buttonOnColourId, bg); + channelButton->setColour(TextButton::ColourIds::textColourOnId, fg); + channelButton->setColour(TextButton::ColourIds::textColourOffId, fg); + + return; + } + } //[/UserbuttonClicked_Pre] if (buttonThatWasClicked == sineImageButton) @@ -2548,9 +2602,8 @@ void PluginGui::buttonClicked (Button* buttonThatWasClicked) void PluginGui::timerCallback() { for (int i = 0; i < Hiopl::CHANNELS; ++i) { - channels[i]->setText(processor->getChannelEnvelopeStage(i + 1), NotificationType::dontSendNotification); + channels[i]->setButtonText(processor->getChannelEnvelopeStage(i + 1)); } - //channels[i]->setState(processor->isChannelActive(i+1) ? Button::buttonDown : Button::buttonNormal); } //[/MiscUserCode] @@ -2570,83 +2623,89 @@ BEGIN_JUCER_METADATA snapPixels="8" snapActive="1" snapShown="1" overlayOpacity="0.330" fixedSize="1" initialWidth="860" initialHeight="580"> + +