Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

scatter-plot-for-main: add scatter-plot to main branch #95

Draft
wants to merge 13 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Examples/SignalGenerator/SignalGenerator.jucer
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
pluginVSTCategory="kPlugCategGenerator" projectLineFeed="
"
companyName="Foleys Finest Audio" companyWebsite="https://foleysfinest.com"
bundleIdentifier="com.foleysfinest.signalgenerator" pluginManufacturerCode="FFAU"
addUsingNamespaceToJuceHeader="0" jucerFormatVersion="1" version="1.3.2">
addUsingNamespaceToJuceHeader="0" jucerFormatVersion="1" version="1.3.2"
displaySplashScreen="1">
<MAINGROUP id="KtcAG2" name="SignalGenerator">
<GROUP id="{C9FD3DD7-E1DA-CA2D-54CB-B4D603FF3A7D}" name="Source">
<FILE id="GPUQn8" name="PluginProcessor.cpp" compile="1" resource="0"
Expand Down
116 changes: 116 additions & 0 deletions modules/foleys_gui_magic/General/foleys_MagicJUCEFactories.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
#include "../Widgets/foleys_XYDragComponent.h"
#include "../Widgets/foleys_MagicLevelMeter.h"
#include "../Widgets/foleys_MagicPlotComponent.h"
#include "../Widgets/foleys_MagicAudioPlotComponent.h"
#include "../Widgets/foleys_MidiLearnComponent.h"
#include "../Widgets/foleys_MidiDrumpadComponent.h"
#include "../Helpers/foleys_PopupMenuHelper.h"
Expand Down Expand Up @@ -593,6 +594,120 @@ const juce::Identifier PlotItem::pGradient {"plot-gradient"};

//==============================================================================

class AudioPlotItem : public GuiItem //? : public PlotItem
{
public:

FOLEYS_DECLARE_GUI_FACTORY (AudioPlotItem)

static const juce::Identifier pDecay;
static const juce::Identifier pGradient;

static const juce::Identifier pTriggeredPos;
static const juce::Identifier pTriggeredNeg;
static const juce::Identifier pOverlay;
static const juce::Identifier pNormalize;
static const juce::Identifier pLatch;
static const juce::Identifier pChannel;
static const juce::Identifier pNumChannels;
static const juce::Identifier pPlotLength;
static const juce::Identifier pPlotOffset;

AudioPlotItem (MagicGUIBuilder& builder, const juce::ValueTree& node) : GuiItem (builder, node) //? PlotItem (builder, node) { }
{
setColourTranslation (
{
{ "plot-color", MagicAudioPlotComponent::plotColourId },
{ "plot-fill-color", MagicAudioPlotComponent::plotFillColourId },
{ "plot-inactive-color", MagicAudioPlotComponent::plotInactiveColourId },
{ "plot-inactive-fill-color", MagicAudioPlotComponent::plotInactiveFillColourId }
});

addAndMakeVisible (plot);
}

void update() override // and REPLACE, since plotSource must be our specific derived class MagicAudioPlotSource
{
auto sourceID = configNode.getProperty (IDs::source, juce::String()).toString();
if (sourceID.isNotEmpty())
plot.setPlotSource (getMagicState().getObjectWithType<MagicAudioPlotSource>(sourceID));

auto decay = float (getProperty (pDecay));
plot.setDecayFactor (decay);

auto gradient = configNode.getProperty (pGradient, juce::String()).toString();
plot.setGradientFromString (gradient, magicBuilder.getStylesheet());

auto triggeredPos = bool (getProperty (pTriggeredPos));
plot.setTriggeredPos (triggeredPos);

auto triggeredNeg = bool (getProperty (pTriggeredNeg));
plot.setTriggeredNeg (triggeredNeg);

auto overlay = bool (getProperty (pOverlay));
plot.setOverlay (overlay);

auto normalize = bool (getProperty (pNormalize));
plot.setNormalize (normalize);

auto latch = bool (getProperty (pLatch));
plot.setLatch (latch);

auto channel = int (getProperty (pChannel));
plot.setChannel (channel);

auto numChannels = int (getProperty (pNumChannels));
plot.setNumChannels (numChannels);

auto plotLength = int (getProperty (pPlotLength));
plot.setPlotLength (plotLength);

auto plotOffset = float (getProperty (pPlotOffset));
plot.setPlotOffset (plotOffset);
}

std::vector<SettableProperty> getSettableProperties() const override
{
std::vector<SettableProperty> props; //? { AudioPlotItem::getSettableProperties() };
props.push_back ({ configNode, IDs::source, SettableProperty::Choice, {}, magicBuilder.createObjectsMenuLambda<MagicAudioPlotSource>() });
props.push_back ({ configNode, pDecay, SettableProperty::Number, {}, {} });
props.push_back ({ configNode, pGradient, SettableProperty::Gradient, {}, {} });
props.push_back ({ configNode, pTriggeredPos, SettableProperty::Toggle, {}, {} });
props.push_back ({ configNode, pTriggeredNeg, SettableProperty::Toggle, {}, {} });
props.push_back ({ configNode, pOverlay, SettableProperty::Toggle, {}, {} });
props.push_back ({ configNode, pNormalize, SettableProperty::Toggle, {}, {} });
props.push_back ({ configNode, pLatch, SettableProperty::Toggle, {}, {} });
props.push_back ({ configNode, pChannel, SettableProperty::Number, {}, {} });
props.push_back ({ configNode, pNumChannels, SettableProperty::Number, {}, {} });
props.push_back ({ configNode, pPlotLength, SettableProperty::Number, {}, {} });
props.push_back ({ configNode, pPlotOffset, SettableProperty::Number, {}, {} });
return props;
}

juce::Component* getWrappedComponent() override
{
return &plot;
}

private:
MagicAudioPlotComponent plot;

JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (AudioPlotItem)
};
const juce::Identifier AudioPlotItem::pDecay {"plot-decay"};
const juce::Identifier AudioPlotItem::pGradient {"plot-gradient"};
const juce::Identifier AudioPlotItem::pTriggeredPos {"plot-triggered-pos"};
const juce::Identifier AudioPlotItem::pTriggeredNeg {"plot-triggered-neg"};
const juce::Identifier AudioPlotItem::pOverlay {"plot-overlay"};
const juce::Identifier AudioPlotItem::pNormalize {"plot-normalize"};
const juce::Identifier AudioPlotItem::pLatch {"plot-latch"};
const juce::Identifier AudioPlotItem::pChannel {"plot-channel"};
const juce::Identifier AudioPlotItem::pNumChannels {"plot-num-channels"};
const juce::Identifier AudioPlotItem::pPlotLength {"plot-length"};
const juce::Identifier AudioPlotItem::pPlotOffset {"plot-offset"};

//==============================================================================

class XYDraggerItem : public GuiItem
{
public:
Expand Down Expand Up @@ -990,6 +1105,7 @@ void MagicGUIBuilder::registerJUCEFactories()
registerFactory (IDs::toggleButton, &ToggleButtonItem::factory);
registerFactory (IDs::label, &LabelItem::factory);
registerFactory (IDs::plot, &PlotItem::factory);
registerFactory (IDs::audioPlot, &AudioPlotItem::factory);
registerFactory (IDs::xyDragComponent, &XYDraggerItem::factory);
registerFactory (IDs::keyboardComponent, &KeyboardItem::factory);
registerFactory (IDs::drumpadComponent, &DrumpadItem::factory);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ namespace IDs
static juce::Identifier comboBox { "ComboBox" };
static juce::Identifier meter { "Meter" };
static juce::Identifier plot { "Plot" };
static juce::Identifier audioPlot { "AudioPlot" };
static juce::Identifier xyDragComponent { "XYDragComponent" };
static juce::Identifier keyboardComponent { "KeyboardComponent" };
static juce::Identifier drumpadComponent { "DrumpadComponent" };
Expand Down
Loading
Loading