(1)Added MonoComponent file (2)Size Adjustment

This commit is contained in:
Takeshi Yokemura 2021-05-17 07:11:32 +09:00
parent 2b0da1a0b4
commit c77f380fda
6 changed files with 202 additions and 17 deletions

View File

@ -46,6 +46,10 @@
file="Source/EnvelopeParamsComponent.cpp"/>
<FILE id="zBFywa" name="EnvelopeParamsComponent.h" compile="0" resource="0"
file="Source/EnvelopeParamsComponent.h"/>
<FILE id="SHaDYI" name="MonophonicComponent.cpp" compile="1" resource="0"
file="Source/MonophonicComponent.cpp"/>
<FILE id="cyIRRW" name="MonophonicComponent.h" compile="0" resource="0"
file="Source/MonophonicComponent.h"/>
<FILE id="RF89Wr" name="NoiseParamsComponent.cpp" compile="1" resource="0"
file="Source/NoiseParamsComponent.cpp"/>
<FILE id="jPVIvX" name="NoiseParamsComponent.h" compile="0" resource="0"

View File

@ -163,8 +163,9 @@ void BasicParamsComponent::buttonClicked (juce::Button* buttonThatWasClicked)
if (buttonThatWasClicked == monoButton.get())
{
polyNumberInput.get()->setValue(1);
//[UserButtonCode_monoButton] -- add your button handler code here..
polyNumberInput.get()->setValue(1);
return;
//[/UserButtonCode_monoButton]
}
@ -196,8 +197,7 @@ void BasicParamsComponent::comboBoxChanged (ComboBox* comboBoxThatHasChanged)
BEGIN_JUCER_METADATA
<JUCER_COMPONENT documentType="Component" className="BasicParamsComponent" componentName=""
parentClasses="public Component, public ComboBox::Listener, public Button::Listener"
constructorParams="Magical8bitPlug2AudioProcessor&amp; p, Magical8bitPlug2AudioProcessorEditor&amp; e"
parentClasses="public Component, public ComboBox::Listener" constructorParams="Magical8bitPlug2AudioProcessor&amp; p, Magical8bitPlug2AudioProcessorEditor&amp; e"
variableInitialisers="processor(p),editor(e)" snapPixels="8"
snapActive="1" snapShown="1" overlayOpacity="0.330" fixedSize="1"
initialWidth="700" initialHeight="64">

View File

@ -0,0 +1,107 @@
/*
==============================================================================
This is an automatically generated GUI class created by the Projucer!
Be careful when adding custom code to these files, as only the code within
the "//[xyz]" and "//[/xyz]" sections will be retained when the file is loaded
and re-saved.
Created with Projucer version: 6.0.8
------------------------------------------------------------------------------
The Projucer is part of the JUCE library.
Copyright (c) 2020 - Raw Material Software Limited.
==============================================================================
*/
//[Headers] You can add your own extra header files here...
//[/Headers]
#include "MonophonicComponent.h"
//[MiscUserDefs] You can add your own user definitions and misc code here...
//[/MiscUserDefs]
//==============================================================================
MonophonicComponent::MonophonicComponent ()
{
//[Constructor_pre] You can add your own custom stuff here..
//[/Constructor_pre]
//[UserPreSize]
//[/UserPreSize]
setSize (640, 400);
//[Constructor] You can add your own custom stuff here..
//[/Constructor]
}
MonophonicComponent::~MonophonicComponent()
{
//[Destructor_pre]. You can add your own custom destruction code here..
//[/Destructor_pre]
//[Destructor]. You can add your own custom destruction code here..
//[/Destructor]
}
//==============================================================================
void MonophonicComponent::paint (juce::Graphics& g)
{
//[UserPrePaint] Add your own custom painting code here..
//[/UserPrePaint]
g.fillAll (juce::Colour (0xff323e44));
//[UserPaint] Add your own custom painting code here..
//[/UserPaint]
}
void MonophonicComponent::resized()
{
//[UserPreResize] Add your own custom resize code here..
//[/UserPreResize]
//[UserResized] Add your own custom resize handling here..
//[/UserResized]
}
//[MiscUserCode] You can add your own definitions of your custom methods or any other code here...
//[/MiscUserCode]
//==============================================================================
#if 0
/* -- Projucer information section --
This is where the Projucer stores the metadata that describe this GUI layout, so
make changes in here at your peril!
BEGIN_JUCER_METADATA
<JUCER_COMPONENT documentType="Component" className="MonophonicComponent" componentName=""
parentClasses="public juce::Component" constructorParams="" variableInitialisers=""
snapPixels="8" snapActive="1" snapShown="1" overlayOpacity="0.330"
fixedSize="0" initialWidth="640" initialHeight="400">
<BACKGROUND backgroundColour="ff323e44"/>
</JUCER_COMPONENT>
END_JUCER_METADATA
*/
#endif
//[EndFile] You can add extra defines here...
//[/EndFile]

View File

@ -0,0 +1,65 @@
/*
==============================================================================
This is an automatically generated GUI class created by the Projucer!
Be careful when adding custom code to these files, as only the code within
the "//[xyz]" and "//[/xyz]" sections will be retained when the file is loaded
and re-saved.
Created with Projucer version: 6.0.8
------------------------------------------------------------------------------
The Projucer is part of the JUCE library.
Copyright (c) 2020 - Raw Material Software Limited.
==============================================================================
*/
#pragma once
//[Headers] -- You can add your own extra header files here --
#include <JuceHeader.h>
//[/Headers]
//==============================================================================
/**
//[Comments]
An auto-generated component, created by the Projucer.
Describe your class and how it works here!
//[/Comments]
*/
class MonophonicComponent : public juce::Component
{
public:
//==============================================================================
MonophonicComponent ();
~MonophonicComponent() override;
//==============================================================================
//[UserMethods] -- You can add your own custom methods in this section.
//[/UserMethods]
void paint (juce::Graphics& g) override;
void resized() override;
private:
//[UserVariables] -- You can add your own custom variables in this section.
//[/UserVariables]
//==============================================================================
//==============================================================================
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (MonophonicComponent)
};
//[EndFile] You can add extra defines here...
//[/EndFile]

View File

@ -169,8 +169,7 @@ struct
}
if (isMono)
{
retHeight += sectionSeparatorHeight
+ monoCompoHeight;
retHeight += monoCompoHeight;
}
return retHeight;
}
@ -206,26 +205,36 @@ void Magical8bitPlug2AudioProcessorEditor::resized()
int w = sizes.halfComponentWidth;
basicCompo->setBounds (x, y, sizes.fullComponentWidth, sizes.basCompoHeight);
y += sizes.basCompoHeight + sizes.sectionSeparatorHeight;
//
// Monophonic
//
if (processor.settingRefs.isMonophonic()) {
y += sizes.monoCompoHeight;
}
int y1 = y;
int y2 = y;
//
// Main part - Left
//
y = sizes.topMargin + sizes.basCompoHeight + sizes.sectionSeparatorHeight;
pulCompo->setBounds (x, y, w, sizes.toneSpecificControlHeight);
noiCompo->setBounds (x, y, w, sizes.toneSpecificControlHeight);
y += sizes.toneSpecificControlHeight;
pulCompo->setBounds (x, y1, w, sizes.toneSpecificControlHeight);
noiCompo->setBounds (x, y1, w, sizes.toneSpecificControlHeight);
y1 += sizes.toneSpecificControlHeight;
envCompo->setBounds (x, y, w, sizes.envCompoHeight);
y += sizes.envCompoHeight;
envCompo->setBounds (x, y1, w, sizes.envCompoHeight);
y1 += sizes.envCompoHeight;
bendCompo->setBounds (x, y, w, sizes.bendCompoHeight);
y += sizes.bendCompoHeight;
bendCompo->setBounds (x, y1, w, sizes.bendCompoHeight);
y1 += sizes.bendCompoHeight;
//
// Main part - Right
//
x = sizes.leftMargin + sizes.halfComponentWidth + sizes.verticalSeparatorWidth;
int y2 = sizes.topMargin + sizes.basCompoHeight + sizes.sectionSeparatorHeight;
sweepCompo->setBounds (x, y2, w, sizes.sweepCompoHeight);
y2 += sizes.sweepCompoHeight;
@ -237,7 +246,7 @@ void Magical8bitPlug2AudioProcessorEditor::resized()
// Advanced part
//
x = sizes.leftMargin;
int y3 = y > y2 ? y : y2;
int y3 = y1 > y2 ? y1 : y2;
y3 += sizes.sectionSeparatorHeight;
advCompo->setBounds (x, y3, sizes.fullComponentWidth, sizes.advCompoHeight);
@ -276,8 +285,7 @@ void Magical8bitPlug2AudioProcessorEditor::resizeWholePanel()
if (!isComponentsReady) {
return;
}
bool isMono = (int)(*processor.settingRefs.maxPoly) == 1;
setSize (sizes.totalWidth, sizes.totalHeight (processor.settingRefs.isAdvancedPanelOpen(), isMono));
setSize (sizes.totalWidth, sizes.totalHeight (processor.settingRefs.isAdvancedPanelOpen(), processor.settingRefs.isMonophonic()));
}
void Magical8bitPlug2AudioProcessorEditor::parameterValueChanged (int parameterIndex, float newValue)

View File

@ -139,6 +139,7 @@ struct SettingRefs
// accessors
//
int oscillatorType() { return (int) (*osc); }
bool isMonophonic() { return (int)(*maxPoly) == 1; }
bool isAdvancedPanelOpen() { return *isAdvancedPanelOpen_raw > 0.5; }
ColorSchemeType colorSchemeType() { return (ColorSchemeType) ((int) (*colorScheme)); }