kopia lustrzana https://github.com/jameshball/osci-render
Remove tabs from interface, move MIDI settings to seperate toggleable window, resign MIDI settings and envelope component, wire up MIDI keyboard
rodzic
07a35e709e
commit
3eb8bbae5a
|
@ -1,6 +1,7 @@
|
|||
#include "LookAndFeel.h"
|
||||
|
||||
OscirenderLookAndFeel::OscirenderLookAndFeel() {
|
||||
// slider
|
||||
setColour(juce::Slider::thumbColourId, Colours::veryDark);
|
||||
setColour(juce::Slider::textBoxOutlineColourId, juce::Colours::white);
|
||||
setColour(juce::Slider::textBoxBackgroundColourId, Colours::veryDark);
|
||||
|
@ -8,40 +9,71 @@ OscirenderLookAndFeel::OscirenderLookAndFeel() {
|
|||
setColour(juce::Slider::trackColourId, juce::Colours::grey);
|
||||
setColour(juce::Slider::backgroundColourId, Colours::dark);
|
||||
setColour(sliderThumbOutlineColourId, juce::Colours::white);
|
||||
|
||||
// buttons
|
||||
setColour(juce::ToggleButton::tickDisabledColourId, juce::Colours::white);
|
||||
setColour(juce::ResizableWindow::backgroundColourId, Colours::dark);
|
||||
setColour(juce::TextButton::buttonColourId, Colours::veryDark);
|
||||
|
||||
// windows & menus
|
||||
setColour(juce::ResizableWindow::backgroundColourId, Colours::grey);
|
||||
setColour(groupComponentBackgroundColourId, Colours::darker);
|
||||
setColour(groupComponentHeaderColourId, Colours::veryDark);
|
||||
setColour(juce::PopupMenu::backgroundColourId, Colours::veryDark);
|
||||
setColour(juce::PopupMenu::highlightedBackgroundColourId, Colours::darker);
|
||||
setColour(juce::TooltipWindow::backgroundColourId, Colours::veryDark);
|
||||
setColour(juce::TooltipWindow::outlineColourId, juce::Colours::white);
|
||||
|
||||
// combo box
|
||||
setColour(juce::ComboBox::backgroundColourId, Colours::veryDark);
|
||||
setColour(juce::ComboBox::outlineColourId, juce::Colours::white);
|
||||
setColour(juce::ComboBox::arrowColourId, juce::Colours::white);
|
||||
setColour(juce::TextButton::buttonColourId, Colours::veryDark);
|
||||
|
||||
// text box
|
||||
setColour(juce::TextEditor::backgroundColourId, Colours::veryDark);
|
||||
setColour(juce::TextEditor::outlineColourId, juce::Colours::white);
|
||||
setColour(juce::CaretComponent::caretColourId, Dracula::foreground);
|
||||
setColour(juce::TextEditor::highlightColourId, Colours::grey);
|
||||
|
||||
// list box
|
||||
setColour(juce::ListBox::backgroundColourId, Colours::darker);
|
||||
|
||||
// scroll bar
|
||||
setColour(juce::ScrollBar::thumbColourId, juce::Colours::white);
|
||||
setColour(juce::ScrollBar::trackColourId, Colours::veryDark);
|
||||
setColour(juce::ScrollBar::backgroundColourId, Colours::veryDark);
|
||||
|
||||
// custom components
|
||||
setColour(effectComponentBackgroundColourId, juce::Colours::transparentBlack);
|
||||
setColour(effectComponentHandleColourId, Colours::veryDark);
|
||||
|
||||
// code editor
|
||||
setColour(juce::CodeEditorComponent::backgroundColourId, Colours::darker);
|
||||
setColour(juce::CodeEditorComponent::defaultTextColourId, Dracula::foreground);
|
||||
setColour(juce::CodeEditorComponent::lineNumberBackgroundId, Colours::veryDark);
|
||||
setColour(juce::CodeEditorComponent::lineNumberTextId, Dracula::foreground);
|
||||
setColour(juce::CodeEditorComponent::highlightColourId, Colours::grey);
|
||||
setColour(juce::CaretComponent::caretColourId, Dracula::foreground);
|
||||
setColour(juce::TextEditor::highlightColourId, Colours::grey);
|
||||
setColour(juce::TabbedButtonBar::tabOutlineColourId, Colours::veryDark);
|
||||
setColour(juce::TabbedButtonBar::frontOutlineColourId, Colours::veryDark);
|
||||
setColour(juce::TabbedButtonBar::tabTextColourId, juce::Colours::white);
|
||||
setColour(juce::TabbedButtonBar::frontTextColourId, juce::Colours::white);
|
||||
setColour(juce::TabbedComponent::outlineColourId, Colours::veryDark);
|
||||
setColour(tabbedComponentBackgroundColourId, Colours::veryDark);
|
||||
setColour(juce::TooltipWindow::backgroundColourId, Colours::veryDark);
|
||||
setColour(juce::TooltipWindow::outlineColourId, juce::Colours::white);
|
||||
|
||||
// envelope
|
||||
setColour(EnvelopeComponent::Node, Colours::accentColor);
|
||||
setColour(EnvelopeComponent::ReleaseNode, Colours::accentColor);
|
||||
setColour(EnvelopeComponent::LoopNode, Colours::accentColor);
|
||||
setColour(EnvelopeComponent::Line, juce::Colours::white);
|
||||
setColour(EnvelopeComponent::LoopLine, juce::Colours::white);
|
||||
setColour(EnvelopeComponent::Background, Colours::veryDark);
|
||||
setColour(EnvelopeComponent::GridLine, Colours::dark);
|
||||
setColour(EnvelopeComponent::LegendText, juce::Colours::white);
|
||||
setColour(EnvelopeComponent::LegendBackground, Colours::veryDark);
|
||||
|
||||
// midi keyboard
|
||||
setColour(juce::MidiKeyboardComponent::blackNoteColourId, Colours::veryDark);
|
||||
setColour(juce::MidiKeyboardComponent::whiteNoteColourId, juce::Colours::white);
|
||||
setColour(juce::MidiKeyboardComponent::mouseOverKeyOverlayColourId, Colours::accentColor.withAlpha(0.3f));
|
||||
setColour(juce::MidiKeyboardComponent::keyDownOverlayColourId, Colours::accentColor.withAlpha(0.7f));
|
||||
setColour(juce::MidiKeyboardComponent::shadowColourId, juce::Colours::transparentBlack);
|
||||
setColour(juce::MidiKeyboardComponent::upDownButtonBackgroundColourId, Colours::veryDark);
|
||||
setColour(juce::MidiKeyboardComponent::upDownButtonArrowColourId, juce::Colours::white);
|
||||
|
||||
// UI colours
|
||||
getCurrentColourScheme().setUIColour(ColourScheme::widgetBackground, Colours::veryDark);
|
||||
getCurrentColourScheme().setUIColour(ColourScheme::UIColour::defaultFill, Colours::accentColor);
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <JuceHeader.h>
|
||||
#include "UGen/ugen_JuceEnvelopeComponent.h"
|
||||
|
||||
enum ColourIds {
|
||||
groupComponentBackgroundColourId,
|
||||
|
@ -8,11 +9,10 @@ enum ColourIds {
|
|||
effectComponentBackgroundColourId,
|
||||
effectComponentHandleColourId,
|
||||
sliderThumbOutlineColourId,
|
||||
tabbedComponentBackgroundColourId,
|
||||
};
|
||||
|
||||
namespace Colours {
|
||||
const juce::Colour dark{0xff424242};
|
||||
const juce::Colour dark{0xff353535};
|
||||
const juce::Colour darker{0xff212121};
|
||||
const juce::Colour veryDark{0xff111111};
|
||||
const juce::Colour grey{0xff555555};
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
#include "PluginEditor.h"
|
||||
|
||||
MidiComponent::MidiComponent(OscirenderAudioProcessor& p, OscirenderAudioProcessorEditor& editor) : audioProcessor(p), pluginEditor(editor) {
|
||||
setText("MIDI Settings");
|
||||
|
||||
addAndMakeVisible(midiToggle);
|
||||
addAndMakeVisible(keyboard);
|
||||
|
||||
|
@ -15,6 +17,7 @@ MidiComponent::MidiComponent(OscirenderAudioProcessor& p, OscirenderAudioProcess
|
|||
envelope.setAdsrMode(true);
|
||||
envelope.setEnv(audioProcessor.adsrEnv);
|
||||
envelope.addListener(&audioProcessor);
|
||||
envelope.setGrid(EnvelopeComponent::GridBoth, EnvelopeComponent::GridNone, 0.1, 0.25);
|
||||
|
||||
audioProcessor.attackTime->addListener(this);
|
||||
audioProcessor.attackLevel->addListener(this);
|
||||
|
@ -45,7 +48,6 @@ void MidiComponent::parameterValueChanged(int parameterIndex, float newValue) {
|
|||
void MidiComponent::parameterGestureChanged(int parameterIndex, bool gestureIsStarting) {}
|
||||
|
||||
void MidiComponent::handleAsyncUpdate() {
|
||||
DBG("MidiComponent::handleAsyncUpdate");
|
||||
Env newEnv = Env(
|
||||
{
|
||||
0.0,
|
||||
|
@ -71,14 +73,13 @@ void MidiComponent::handleAsyncUpdate() {
|
|||
}
|
||||
|
||||
void MidiComponent::resized() {
|
||||
auto area = getLocalBounds().reduced(5);
|
||||
midiToggle.setBounds(area.removeFromTop(50));
|
||||
envelope.setBounds(area.removeFromTop(200));
|
||||
keyboard.setBounds(area.removeFromBottom(100));
|
||||
auto area = getLocalBounds().withTrimmedTop(20).reduced(20);
|
||||
midiToggle.setBounds(area.removeFromTop(30));
|
||||
area.removeFromTop(5);
|
||||
keyboard.setBounds(area.removeFromBottom(50));
|
||||
envelope.setBounds(area);
|
||||
}
|
||||
|
||||
void MidiComponent::paint(juce::Graphics& g) {
|
||||
auto rect = getLocalBounds().reduced(5);
|
||||
g.setColour(getLookAndFeel().findColour(groupComponentBackgroundColourId));
|
||||
g.fillRect(rect);
|
||||
juce::GroupComponent::paint(g);
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
#include "PluginProcessor.h"
|
||||
|
||||
class OscirenderAudioProcessorEditor;
|
||||
class MidiComponent : public juce::Component, public juce::AudioProcessorParameter::Listener, public juce::AsyncUpdater {
|
||||
class MidiComponent : public juce::GroupComponent, public juce::AudioProcessorParameter::Listener, public juce::AsyncUpdater {
|
||||
public:
|
||||
MidiComponent(OscirenderAudioProcessor&, OscirenderAudioProcessorEditor&);
|
||||
~MidiComponent() override;
|
||||
|
@ -20,8 +20,7 @@ private:
|
|||
OscirenderAudioProcessorEditor& pluginEditor;
|
||||
|
||||
juce::ToggleButton midiToggle{"Enable MIDI"};
|
||||
juce::MidiKeyboardState keyboardState;
|
||||
juce::MidiKeyboardComponent keyboard{keyboardState, juce::MidiKeyboardComponent::horizontalKeyboard};
|
||||
juce::MidiKeyboardComponent keyboard{audioProcessor.keyboardState, juce::MidiKeyboardComponent::horizontalKeyboard};
|
||||
|
||||
EnvelopeContainerComponent envelope;
|
||||
|
||||
|
|
|
@ -6,10 +6,6 @@ OscirenderAudioProcessorEditor::OscirenderAudioProcessorEditor(OscirenderAudioPr
|
|||
{
|
||||
juce::Desktop::getInstance().setDefaultLookAndFeel(&lookAndFeel);
|
||||
setLookAndFeel(&lookAndFeel);
|
||||
|
||||
addAndMakeVisible(tabs);
|
||||
tabs.addTab("Main", getLookAndFeel().findColour(tabbedComponentBackgroundColourId), &settings, false);
|
||||
tabs.addTab("MIDI", getLookAndFeel().findColour(tabbedComponentBackgroundColourId), &midi, false);
|
||||
addAndMakeVisible(volume);
|
||||
|
||||
menuBar.setModel(&menuBarModel);
|
||||
|
@ -33,6 +29,7 @@ OscirenderAudioProcessorEditor::OscirenderAudioProcessorEditor(OscirenderAudioPr
|
|||
juce::Path path;
|
||||
path.addTriangle(0.0f, 0.5f, 1.0f, 1.0f, 1.0f, 0.0f);
|
||||
collapseButton.setShape(path, false, true, true);
|
||||
collapseButton.setMouseCursor(juce::MouseCursor::PointingHandCursor);
|
||||
|
||||
colourScheme = lookAndFeel.getDefaultColourScheme();
|
||||
|
||||
|
@ -62,6 +59,7 @@ OscirenderAudioProcessorEditor::OscirenderAudioProcessorEditor(OscirenderAudioPr
|
|||
layout.setItemLayout(1, 7, 7, 7);
|
||||
layout.setItemLayout(2, -0.1, -1.0, -0.3);
|
||||
|
||||
addAndMakeVisible(settings);
|
||||
addAndMakeVisible(resizerBar);
|
||||
}
|
||||
|
||||
|
@ -115,6 +113,8 @@ void OscirenderAudioProcessorEditor::resized() {
|
|||
|
||||
juce::Component* columns[] = { &dummy, &resizerBar, codeEditors[index].get() };
|
||||
|
||||
DBG("area: " << area.toString());
|
||||
|
||||
layout.layOutComponents(columns, 3, area.getX(), area.getY(), area.getWidth(), area.getHeight(), false, true);
|
||||
auto dummyBounds = dummy.getBounds();
|
||||
collapseButton.setBounds(dummyBounds.removeFromRight(20));
|
||||
|
@ -123,6 +123,7 @@ void OscirenderAudioProcessorEditor::resized() {
|
|||
|
||||
} else {
|
||||
codeEditors[index]->setBounds(0, 0, 0, 0);
|
||||
resizerBar.setBounds(0, 0, 0, 0);
|
||||
collapseButton.setBounds(area.removeFromRight(20));
|
||||
}
|
||||
} else {
|
||||
|
@ -139,9 +140,8 @@ void OscirenderAudioProcessorEditor::resized() {
|
|||
path.addTriangle(0.0f, 0.5f, 1.0f, 1.0f, 1.0f, 0.0f);
|
||||
collapseButton.setShape(path, false, true, true);
|
||||
}
|
||||
|
||||
tabs.setBounds(area);
|
||||
|
||||
settings.setBounds(area);
|
||||
repaint();
|
||||
}
|
||||
|
||||
|
|
|
@ -38,8 +38,6 @@ public:
|
|||
private:
|
||||
OscirenderAudioProcessor& audioProcessor;
|
||||
|
||||
juce::TabbedComponent tabs{juce::TabbedButtonBar::TabsAtTop};
|
||||
MidiComponent midi{audioProcessor, *this};
|
||||
SettingsComponent settings{audioProcessor, *this};
|
||||
VolumeComponent volume{audioProcessor};
|
||||
std::vector<std::shared_ptr<juce::CodeDocument>> codeDocuments;
|
||||
|
|
|
@ -479,6 +479,9 @@ void OscirenderAudioProcessor::processBlock(juce::AudioBuffer<float>& buffer, ju
|
|||
buffer.clear(i, 0, buffer.getNumSamples());
|
||||
}
|
||||
|
||||
// merge keyboard state and midi messages
|
||||
keyboardState.processNextMidiBuffer(midiMessages, 0, buffer.getNumSamples(), true);
|
||||
|
||||
bool usingInput = inputEnabled->getBoolValue();
|
||||
|
||||
bool usingMidi = midiEnabled->getBoolValue();
|
||||
|
|
|
@ -232,7 +232,7 @@ public:
|
|||
std::shared_ptr<DelayEffect> delayEffect = std::make_shared<DelayEffect>();
|
||||
std::shared_ptr<PerspectiveEffect> perspectiveEffect = std::make_shared<PerspectiveEffect>(VERSION_HINT);
|
||||
|
||||
BooleanParameter* midiEnabled = new BooleanParameter("MIDI Enabled", "midiEnabled", VERSION_HINT, !juce::JUCEApplicationBase::isStandaloneApp());
|
||||
BooleanParameter* midiEnabled = new BooleanParameter("MIDI Enabled", "midiEnabled", VERSION_HINT, false);
|
||||
BooleanParameter* inputEnabled = new BooleanParameter("Audio Input Enabled", "inputEnabled", VERSION_HINT, false);
|
||||
std::atomic<float> frequency = 440.0f;
|
||||
|
||||
|
@ -247,14 +247,14 @@ public:
|
|||
std::atomic<bool> objectServerRendering = false;
|
||||
juce::ChangeBroadcaster fileChangeBroadcaster;
|
||||
|
||||
FloatParameter* attackTime = new FloatParameter("Attack Time", "attackTime", VERSION_HINT, 0.05, 0.0, 1.0);
|
||||
FloatParameter* attackTime = new FloatParameter("Attack Time", "attackTime", VERSION_HINT, 0.005, 0.0, 1.0);
|
||||
FloatParameter* attackLevel = new FloatParameter("Attack Level", "attackLevel", VERSION_HINT, 1.0, 0.0, 1.0);
|
||||
FloatParameter* decayTime = new FloatParameter("Decay Time", "decayTime", VERSION_HINT, 0.05, 0.0, 1.0);
|
||||
FloatParameter* sustainLevel = new FloatParameter("Sustain Level", "sustainLevel", VERSION_HINT, 0.8, 0.0, 1.0);
|
||||
FloatParameter* releaseTime = new FloatParameter("Release Time", "releaseTime", VERSION_HINT, 0.2, 0.0, 1.0);
|
||||
FloatParameter* decayTime = new FloatParameter("Decay Time", "decayTime", VERSION_HINT, 0.095, 0.0, 1.0);
|
||||
FloatParameter* sustainLevel = new FloatParameter("Sustain Level", "sustainLevel", VERSION_HINT, 0.6, 0.0, 1.0);
|
||||
FloatParameter* releaseTime = new FloatParameter("Release Time", "releaseTime", VERSION_HINT, 0.4, 0.0, 1.0);
|
||||
FloatParameter* attackShape = new FloatParameter("Attack Shape", "attackShape", VERSION_HINT, 5, -50, 50);
|
||||
FloatParameter* decayShape = new FloatParameter("Decay Shape", "decayShape", VERSION_HINT, -20, -50, 50);
|
||||
FloatParameter* releaseShape = new FloatParameter("Release Shape", "releaseShape", VERSION_HINT, 5,-50, 50);
|
||||
FloatParameter* releaseShape = new FloatParameter("Release Shape", "releaseShape", VERSION_HINT, -5,-50, 50);
|
||||
|
||||
Env adsrEnv = Env::adsr(
|
||||
attackTime->getValueUnnormalised(),
|
||||
|
@ -265,6 +265,8 @@ public:
|
|||
std::vector<EnvCurve>{ attackShape->getValueUnnormalised(), decayShape->getValueUnnormalised(), releaseShape->getValueUnnormalised() }
|
||||
);
|
||||
|
||||
juce::MidiKeyboardState keyboardState;
|
||||
|
||||
private:
|
||||
juce::SpinLock consumerLock;
|
||||
std::vector<std::shared_ptr<BufferConsumer>> consumers;
|
||||
|
|
|
@ -4,19 +4,25 @@
|
|||
SettingsComponent::SettingsComponent(OscirenderAudioProcessor& p, OscirenderAudioProcessorEditor& editor) : audioProcessor(p), pluginEditor(editor) {
|
||||
addAndMakeVisible(effects);
|
||||
addAndMakeVisible(main);
|
||||
addAndMakeVisible(columnResizerBar);
|
||||
addAndMakeVisible(rowResizerBar);
|
||||
addAndMakeVisible(midiResizerBar);
|
||||
addAndMakeVisible(mainResizerBar);
|
||||
addAndMakeVisible(effectResizerBar);
|
||||
addAndMakeVisible(midi);
|
||||
addChildComponent(lua);
|
||||
addChildComponent(obj);
|
||||
addChildComponent(txt);
|
||||
|
||||
columnLayout.setItemLayout(0, -0.1, -0.9, -0.4);
|
||||
columnLayout.setItemLayout(1, 7, 7, 7);
|
||||
columnLayout.setItemLayout(2, -0.1, -0.9, -0.6);
|
||||
midiLayout.setItemLayout(0, -0.1, -1.0, -1.0);
|
||||
midiLayout.setItemLayout(1, 7, 7, 7);
|
||||
midiLayout.setItemLayout(2, CLOSED_PREF_SIZE, -0.9, CLOSED_PREF_SIZE);
|
||||
|
||||
rowLayout.setItemLayout(0, -0.1, -1.0, -0.63);
|
||||
rowLayout.setItemLayout(1, 7, 7, 7);
|
||||
rowLayout.setItemLayout(2, -0.1, -0.9, -0.37);
|
||||
mainLayout.setItemLayout(0, -0.1, -0.9, -0.4);
|
||||
mainLayout.setItemLayout(1, 7, 7, 7);
|
||||
mainLayout.setItemLayout(2, -0.1, -0.9, -0.6);
|
||||
|
||||
effectLayout.setItemLayout(0, -0.1, -1.0, -0.63);
|
||||
effectLayout.setItemLayout(1, 7, 7, 7);
|
||||
effectLayout.setItemLayout(2, -0.1, -0.9, -0.37);
|
||||
}
|
||||
|
||||
|
||||
|
@ -29,8 +35,11 @@ void SettingsComponent::resized() {
|
|||
|
||||
juce::Component dummy;
|
||||
|
||||
juce::Component* columns[] = { &main, &columnResizerBar, &dummy };
|
||||
columnLayout.layOutComponents(columns, 3, area.getX(), area.getY(), area.getWidth(), area.getHeight(), false, true);
|
||||
juce::Component* midiComponents[] = { &dummy, &midiResizerBar, &midi };
|
||||
midiLayout.layOutComponents(midiComponents, 3, area.getX(), area.getY(), area.getWidth(), area.getHeight(), true, true);
|
||||
|
||||
juce::Component* columns[] = { &main, &mainResizerBar, &dummy };
|
||||
mainLayout.layOutComponents(columns, 3, dummy.getX(), dummy.getY(), dummy.getWidth(), dummy.getHeight(), false, true);
|
||||
|
||||
juce::Component* effectSettings = nullptr;
|
||||
|
||||
|
@ -42,14 +51,16 @@ void SettingsComponent::resized() {
|
|||
effectSettings = &txt;
|
||||
}
|
||||
|
||||
juce::Component* rows[] = { &effects, &rowResizerBar, effectSettings };
|
||||
juce::Component* rows[] = { &effects, &effectResizerBar, effectSettings };
|
||||
|
||||
// use the dummy component to work out the bounds of the rows
|
||||
if (effectSettings != nullptr) {
|
||||
rowLayout.layOutComponents(rows, 3, dummy.getX(), dummy.getY(), dummy.getWidth(), dummy.getHeight(), true, true);
|
||||
effectLayout.layOutComponents(rows, 3, dummy.getX(), dummy.getY(), dummy.getWidth(), dummy.getHeight(), true, true);
|
||||
} else {
|
||||
effects.setBounds(dummy.getBounds());
|
||||
}
|
||||
|
||||
repaint();
|
||||
}
|
||||
|
||||
void SettingsComponent::fileUpdated(juce::String fileName) {
|
||||
|
@ -77,3 +88,49 @@ void SettingsComponent::update() {
|
|||
void SettingsComponent::disableMouseRotation() {
|
||||
obj.disableMouseRotation();
|
||||
}
|
||||
|
||||
void SettingsComponent::toggleMidiComponent() {
|
||||
double minSize, maxSize, preferredSize;
|
||||
midiLayout.getItemLayout(2, minSize, maxSize, preferredSize);
|
||||
if (preferredSize == CLOSED_PREF_SIZE) {
|
||||
midiLayout.setItemLayout(0, -0.1, -1.0, -0.7);
|
||||
midiLayout.setItemLayout(2, CLOSED_PREF_SIZE, -0.9, -0.3);
|
||||
} else {
|
||||
midiLayout.setItemLayout(0, -0.1, -1.0, -1.0);
|
||||
midiLayout.setItemLayout(2, CLOSED_PREF_SIZE, -0.9, CLOSED_PREF_SIZE);
|
||||
}
|
||||
|
||||
resized();
|
||||
}
|
||||
|
||||
void SettingsComponent::mouseMove(const juce::MouseEvent& event) {
|
||||
// if mouse over midi component, change cursor to link cursor
|
||||
if (midi.getBounds().removeFromTop(CLOSED_PREF_SIZE).contains(event.getPosition())) {
|
||||
setMouseCursor(juce::MouseCursor::PointingHandCursor);
|
||||
} else {
|
||||
setMouseCursor(juce::MouseCursor::NormalCursor);
|
||||
}
|
||||
}
|
||||
|
||||
void SettingsComponent::mouseDown(const juce::MouseEvent& event) {
|
||||
// if mouse over midi component, toggle midi component
|
||||
if (midi.getBounds().removeFromTop(CLOSED_PREF_SIZE).contains(event.getPosition())) {
|
||||
toggleMidiComponent();
|
||||
}
|
||||
}
|
||||
|
||||
void SettingsComponent::paint(juce::Graphics& g) {
|
||||
// add drop shadow to each component
|
||||
auto dc = juce::DropShadow(juce::Colours::black, 5, juce::Point<int>(0, 0));
|
||||
dc.drawForRectangle(g, main.getBounds());
|
||||
dc.drawForRectangle(g, effects.getBounds());
|
||||
dc.drawForRectangle(g, midi.getBounds());
|
||||
|
||||
if (lua.isVisible()) {
|
||||
dc.drawForRectangle(g, lua.getBounds());
|
||||
} else if (obj.isVisible()) {
|
||||
dc.drawForRectangle(g, obj.getBounds());
|
||||
} else if (txt.isVisible()) {
|
||||
dc.drawForRectangle(g, txt.getBounds());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#include "ObjComponent.h"
|
||||
#include "TxtComponent.h"
|
||||
#include "EffectsComponent.h"
|
||||
#include "MidiComponent.h"
|
||||
|
||||
class OscirenderAudioProcessorEditor;
|
||||
class SettingsComponent : public juce::Component {
|
||||
|
@ -17,6 +18,10 @@ public:
|
|||
void fileUpdated(juce::String fileName);
|
||||
void update();
|
||||
void disableMouseRotation();
|
||||
void toggleMidiComponent();
|
||||
void mouseMove(const juce::MouseEvent& event) override;
|
||||
void mouseDown(const juce::MouseEvent& event) override;
|
||||
void paint(juce::Graphics& g) override;
|
||||
|
||||
private:
|
||||
OscirenderAudioProcessor& audioProcessor;
|
||||
|
@ -27,11 +32,16 @@ private:
|
|||
ObjComponent obj{audioProcessor, pluginEditor};
|
||||
TxtComponent txt{audioProcessor, pluginEditor};
|
||||
EffectsComponent effects{audioProcessor, pluginEditor};
|
||||
MidiComponent midi{audioProcessor, pluginEditor};
|
||||
|
||||
juce::StretchableLayoutManager columnLayout;
|
||||
juce::StretchableLayoutResizerBar columnResizerBar{&columnLayout, 1, true};
|
||||
juce::StretchableLayoutManager rowLayout;
|
||||
juce::StretchableLayoutResizerBar rowResizerBar{&rowLayout, 1, false};
|
||||
const double CLOSED_PREF_SIZE = 30.0;
|
||||
|
||||
juce::StretchableLayoutManager midiLayout;
|
||||
juce::StretchableLayoutResizerBar midiResizerBar{&midiLayout, 1, false};
|
||||
juce::StretchableLayoutManager mainLayout;
|
||||
juce::StretchableLayoutResizerBar mainResizerBar{&mainLayout, 1, true};
|
||||
juce::StretchableLayoutManager effectLayout;
|
||||
juce::StretchableLayoutResizerBar effectResizerBar{&effectLayout, 1, false};
|
||||
|
||||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(SettingsComponent)
|
||||
};
|
|
@ -200,15 +200,15 @@ void EnvelopeHandleComponent::paint(juce::Graphics& g)
|
|||
}
|
||||
else if(env->isReleaseNode(this))
|
||||
{
|
||||
handleColour = env->getEnvColour(EnvelopeComponent::ReleaseNode);
|
||||
handleColour = findColour(EnvelopeComponent::ReleaseNode);
|
||||
}
|
||||
else if(env->isLoopNode(this))
|
||||
{
|
||||
handleColour = env->getEnvColour(EnvelopeComponent::LoopNode);
|
||||
handleColour = findColour(EnvelopeComponent::LoopNode);
|
||||
}
|
||||
else
|
||||
{
|
||||
handleColour = env->getEnvColour(EnvelopeComponent::Node);
|
||||
handleColour = findColour(EnvelopeComponent::Node);
|
||||
}
|
||||
|
||||
g.setColour(handleColour);
|
||||
|
@ -554,16 +554,6 @@ EnvelopeComponent::EnvelopeComponent()
|
|||
{
|
||||
setMouseCursor(juce::MouseCursor::NormalCursor);
|
||||
setBounds(0, 0, 200, 200); // non-zero size to start with
|
||||
|
||||
colours[Node] = juce::Colour(0xFF69B4FF);
|
||||
colours[ReleaseNode] = juce::Colour(0xFFB469FF);
|
||||
colours[LoopNode] = juce::Colour(0xFF69FFB4);
|
||||
colours[Line] = juce::Colour(0xFFFFFFFF);
|
||||
colours[LoopLine] = juce::Colour(0xFFB469FF);
|
||||
colours[Background] = juce::Colour(0xFF555555);
|
||||
colours[GridLine] = juce::Colour(0xFF888888);
|
||||
colours[LegendText] = juce::Colour(0xFF000000);
|
||||
colours[LegendBackground] = juce::Colour(0xFF696969);
|
||||
}
|
||||
|
||||
EnvelopeComponent::~EnvelopeComponent()
|
||||
|
@ -719,7 +709,7 @@ void EnvelopeComponent::paint(juce::Graphics& g)
|
|||
time = nextTime;
|
||||
}
|
||||
|
||||
g.setColour(colours[Line]);
|
||||
g.setColour(findColour(Line));
|
||||
g.strokePath (path, juce::PathStrokeType(1.0f));
|
||||
|
||||
if((loopNode >= 0) && (releaseNode >= 0) && (releaseNode > loopNode))
|
||||
|
@ -730,7 +720,7 @@ void EnvelopeComponent::paint(juce::Graphics& g)
|
|||
if((releaseHandle != 0) && (loopHandle != 0))
|
||||
{
|
||||
// draw a horizontal line from release
|
||||
g.setColour(colours[LoopLine]);
|
||||
g.setColour(findColour(LoopLine));
|
||||
|
||||
const float loopY = (loopHandle->getY() + loopHandle->getBottom()) * 0.5f;
|
||||
const float releaseY = (releaseHandle->getY() + releaseHandle->getBottom()) * 0.5f;
|
||||
|
@ -748,7 +738,7 @@ void EnvelopeComponent::paint(juce::Graphics& g)
|
|||
0.5f);
|
||||
|
||||
if(loopY == releaseY)
|
||||
g.setColour(colours[LoopNode]);
|
||||
g.setColour(findColour(LoopNode));
|
||||
|
||||
// g.drawArrow(loopX + arrowLength, releaseY,
|
||||
// loopX, releaseY,
|
||||
|
@ -770,10 +760,10 @@ inline double round(double a, double b) throw()
|
|||
|
||||
void EnvelopeComponent::paintBackground(juce::Graphics& g)
|
||||
{
|
||||
g.setColour(colours[Background]);
|
||||
g.setColour(findColour(Background));
|
||||
g.fillRect(0, 0, getWidth(), getHeight());
|
||||
|
||||
g.setColour(colours[GridLine]);
|
||||
g.setColour(findColour(GridLine));
|
||||
|
||||
if((gridDisplayMode & GridValue) && (valueGrid > 0.0))
|
||||
{
|
||||
|
@ -1389,28 +1379,6 @@ double EnvelopeComponent::constrainValue(double valueToConstrain) const
|
|||
// return value;
|
||||
//}
|
||||
|
||||
void EnvelopeComponent::setEnvColour(const EnvColours which, juce::Colour colour) throw()
|
||||
{
|
||||
if((which >= 0) && (which < NumEnvColours))
|
||||
{
|
||||
//lock();
|
||||
colours[which] = colour;
|
||||
//unlock();
|
||||
|
||||
//updateGUI();
|
||||
getParentComponent()->repaint();
|
||||
repaint();
|
||||
}
|
||||
}
|
||||
|
||||
const juce::Colour EnvelopeComponent::getEnvColour(const EnvColours which) const throw()
|
||||
{
|
||||
if ((which < 0) || (which >= NumEnvColours))
|
||||
return juce::Colour();
|
||||
else
|
||||
return colours[which];
|
||||
}
|
||||
|
||||
EnvelopeLegendComponent::EnvelopeLegendComponent(juce::String _defaultText)
|
||||
: defaultText(_defaultText)
|
||||
{
|
||||
|
@ -1440,12 +1408,12 @@ void EnvelopeLegendComponent::resized()
|
|||
void EnvelopeLegendComponent::paint(juce::Graphics& g)
|
||||
{
|
||||
EnvelopeComponent *env = getEnvelopeComponent();
|
||||
juce::Colour backColour = env ? env->getEnvColour(EnvelopeComponent::LegendBackground) : juce::Colour(0xFF696969);
|
||||
juce::Colour backColour = findColour(EnvelopeComponent::LegendBackground);
|
||||
|
||||
g.setColour(backColour);
|
||||
g.fillRect(0, 0, getWidth(), getHeight());
|
||||
|
||||
juce::Colour textColour = env ? env->getEnvColour(EnvelopeComponent::LegendText) : juce::Colour(0xFF0000);
|
||||
juce::Colour textColour = findColour(EnvelopeComponent::LegendText);
|
||||
text->setColour(juce::Label::textColourId, textColour);
|
||||
}
|
||||
|
||||
|
|
|
@ -235,9 +235,20 @@ public:
|
|||
// double quantiseDomain(double value);
|
||||
// double quantiseValue(double value);
|
||||
|
||||
enum EnvColours { Node, ReleaseNode, LoopNode, Line, LoopLine, Background, GridLine, LegendText, LegendBackground, NumEnvColours };
|
||||
void setEnvColour(const EnvColours which, juce::Colour colour) throw();
|
||||
const juce::Colour getEnvColour(const EnvColours which) const throw();
|
||||
const static int COLOUR_OFFSET = 0x6082100;
|
||||
|
||||
enum EnvColours {
|
||||
Node = COLOUR_OFFSET,
|
||||
ReleaseNode = COLOUR_OFFSET + 1,
|
||||
LoopNode = COLOUR_OFFSET + 2,
|
||||
Line = COLOUR_OFFSET + 3,
|
||||
LoopLine = COLOUR_OFFSET + 4,
|
||||
Background = COLOUR_OFFSET + 5,
|
||||
GridLine = COLOUR_OFFSET + 6,
|
||||
LegendText = COLOUR_OFFSET + 7,
|
||||
LegendBackground = COLOUR_OFFSET + 8,
|
||||
NumEnvColours = 9,
|
||||
};
|
||||
|
||||
enum MoveMode { MoveClip, MoveSlide, NumMoveModes };
|
||||
|
||||
|
@ -262,8 +273,6 @@ private:
|
|||
bool allowCurveEditing = false;
|
||||
bool allowNodeEditing = false;
|
||||
bool adsrMode = false;
|
||||
|
||||
juce::Colour colours[NumEnvColours];
|
||||
};
|
||||
|
||||
class EnvelopeLegendComponent : public juce::Component
|
||||
|
@ -311,16 +320,7 @@ public:
|
|||
Env getEnv() const { return getEnvelopeComponent()->getEnv(); }
|
||||
void setEnv(Env const& env) { return getEnvelopeComponent()->setEnv(env); }
|
||||
float lookup(const float time) const { return getEnvelopeComponent()->lookup(time); }
|
||||
|
||||
void setEnvColour(const EnvelopeComponent::EnvColours which, juce::Colour const& colour) throw()
|
||||
{
|
||||
envelope->setEnvColour(which, colour);
|
||||
}
|
||||
|
||||
const juce::Colour getEnvColour(const EnvelopeComponent::EnvColours which) const throw()
|
||||
{
|
||||
return envelope->getEnvColour(which);
|
||||
}
|
||||
|
||||
|
||||
void setDomainRange(const double min, const double max) { envelope->setDomainRange(min, max); }
|
||||
void setDomainRange(const double max) { setDomainRange(0.0, max); }
|
||||
|
|
Ładowanie…
Reference in New Issue