-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Included second opengl panner visualisation
- Loading branch information
Showing
9 changed files
with
538 additions
and
215 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
// | ||
// Created by Valentin Ackva on 17/06/2024. | ||
// | ||
|
||
#include "PannerComponent.h" | ||
|
||
PannerComponent::PannerComponent(AudioPluginAudioProcessor &processor) : processorRef(processor), viewButton("viewButton", juce::DrawableButton::ButtonStyle::ImageFitted) { | ||
addAndMakeVisible(pannerVisualisation); | ||
addAndMakeVisible(openGLVisualisation); | ||
pannerVisualisation.addListener(this); | ||
startTimerHz(30); | ||
|
||
viewButton.setClickingTogglesState(true); | ||
viewButton.setImages(button2d.get(), | ||
button2d.get(), | ||
button3d.get(), | ||
button2d.get(), | ||
button3d.get(), | ||
button3d.get(), | ||
button3d.get(), | ||
button3d.get()); | ||
|
||
viewButton.onClick = [this]() { | ||
if (show2D) { | ||
show2D = false; | ||
pannerVisualisation.setVisible(false); | ||
openGLVisualisation.setVisible(true); | ||
} else { | ||
show2D = true; | ||
pannerVisualisation.setVisible(true); | ||
openGLVisualisation.setVisible(false); | ||
} | ||
}; | ||
|
||
openGLVisualisation.setVisible(false); | ||
|
||
addAndMakeVisible(viewButton); | ||
} | ||
|
||
PannerComponent::~PannerComponent() { | ||
pannerVisualisation.removeListener(this); | ||
stopTimer(); | ||
} | ||
|
||
void PannerComponent::paint(Graphics &g) { | ||
g.setColour(juce::Colour {0xff151517}); | ||
g.fillRoundedRectangle(getLocalBounds().toFloat(), 10.f); | ||
} | ||
|
||
void PannerComponent::resized() { | ||
pannerVisualisation.setBounds(getLocalBounds().reduced(10)); | ||
openGLVisualisation.setBounds(getLocalBounds().reduced(20)); | ||
|
||
juce::Rectangle<int> button (getWidth() - 68, getHeight() - 18, 68, 18); | ||
viewButton.setBounds(button); | ||
} | ||
|
||
void PannerComponent::pannerChanged(float x, float y) { | ||
auto& processorParams = processorRef.getValueTreeState(); | ||
|
||
auto paramX = processorParams.getParameter(PluginParameters::X_ID.getParamID()); | ||
auto paramY = processorParams.getParameter(PluginParameters::Y_ID.getParamID()); | ||
|
||
paramX->setValueNotifyingHost(paramX->convertTo0to1(x)); | ||
paramY->setValueNotifyingHost(paramY->convertTo0to1(y)); | ||
} | ||
|
||
void PannerComponent::timerCallback() { | ||
float normalizedX = processorRef.getValueTreeState().getParameter("param_x")->getValue(); | ||
float normalizedY = processorRef.getValueTreeState().getParameter("param_y")->getValue(); | ||
float normalizedZ = processorRef.getValueTreeState().getParameter("param_z")->getValue(); | ||
|
||
float x = PluginParameters::xRange.convertFrom0to1(normalizedX); | ||
float y = PluginParameters::yRange.convertFrom0to1(normalizedY); | ||
float z = PluginParameters::zRange.convertFrom0to1(normalizedZ); | ||
|
||
if (show2D) { | ||
pannerVisualisation.setVisualPosition(x, y, z); | ||
} else { | ||
openGLVisualisation.setVisualPosition(x, y, z); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// | ||
// Created by Valentin Ackva on 17/06/2024. | ||
// | ||
|
||
#include "ParameterComponent.h" | ||
|
||
ParameterComponent::ParameterComponent(AudioPluginAudioProcessor &processor) : processorRef(processor) { | ||
genericParameter = std::make_unique<CustomGenericAudioProcessorEditor>(processorRef); | ||
addAndMakeVisible(*genericParameter); | ||
} | ||
|
||
void ParameterComponent::paint(juce::Graphics &g) { | ||
g.setColour(juce::Colours::transparentBlack); | ||
g.fillAll(); | ||
g.setColour(juce::Colour{0xff151517}); | ||
g.fillRoundedRectangle(getLocalBounds().toFloat(), 10.f); | ||
|
||
auto bounds = getLocalBounds(); | ||
auto headerBounds = bounds.removeFromTop(static_cast<int>((float)getHeight() * 0.2f)); | ||
orbeLogo->drawWithin(g, headerBounds.toFloat(), juce::RectanglePlacement::doNotResize, 1.f); | ||
} | ||
|
||
void ParameterComponent::resized() { | ||
auto bounds = getLocalBounds(); | ||
auto headerBounds = bounds.removeFromTop(static_cast<int>((float)getHeight() * 0.2f)); | ||
bounds.removeFromBottom(10); | ||
auto paramBounds = bounds; | ||
|
||
genericParameter->setBounds(paramBounds); | ||
} |
Oops, something went wrong.