Skip to content

Commit d9e4980

Browse files
committed
Better control layout, vitling link and parameter defaults work as expected
1 parent 5beaac1 commit d9e4980

3 files changed

Lines changed: 35 additions & 17 deletions

File tree

CMakeLists.txt

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ project(PARTICLES_PLUGIN VERSION 0.1.0)
2525
add_subdirectory(JUCE)
2626

2727
juce_add_plugin(ParticlesPlugin
28-
VERSION 0.1.0 # Set this if the plugin version is different to the project version
2928
ICON_BIG ${CMAKE_CURRENT_SOURCE_DIR}/icon_1024.png # ICON_* arguments specify a path to an image file to use as an icon for the Standalone
3029
ICON_SMALL ${CMAKE_CURRENT_SOURCE_DIR}/icon_128.png
3130
COMPANY_NAME Vitling # Specify the name of the plugin's author
@@ -43,7 +42,6 @@ juce_add_plugin(ParticlesPlugin
4342
FORMATS VST3 AU Standalone # The formats to build. Other valid formats are: AAX Unity VST AU AUv3
4443
BUNDLE_ID "xyz.vitling.plugins.particles"
4544
HARDENED_RUNTIME_ENABLED TRUE
46-
4745
PRODUCT_NAME "Particles") # The name of the final executable, which can differ from the target name
4846

4947

@@ -58,12 +56,8 @@ target_compile_definitions(ParticlesPlugin
5856
JUCE_USE_CURL=0
5957
JUCE_VST3_CAN_REPLACE_VST2=0)
6058

61-
# juce_add_binary_data(ParticlesPluginData SOURCES ui.png)
6259

6360

6461
target_link_libraries(ParticlesPlugin PRIVATE
65-
# ParticlesPluginData
66-
juce::juce_audio_utils
67-
juce::juce_dsp)
68-
69-
#set_target_properties(ParticlesPlugin PROPERTIES)
62+
juce::juce_audio_utils
63+
juce::juce_dsp)

ParticleSimulation.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,9 @@ class ParticleSimulation {
5656

5757
float gravity = 0.0f;
5858

59-
int particleGenerationMultiplier = 1;
59+
int particleGenerationMultiplier = 5;
6060

61-
ParticleOrigin particleOrigin = ParticleOrigin::TOP_LEFT;
61+
ParticleOrigin particleOrigin = ParticleOrigin::RANDOM_INSIDE;
6262

6363
bool sizeByNote = true;
6464
float particleScale = 1.0f;

ParticlesPlugin.cpp

Lines changed: 31 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,7 @@ class ParticlesAudioProcessor : public BasicStereoSynthPlugin, public AudioProce
242242

243243
// If we want to allow midi "sidechain" output (the only way to support plugin midi effects in some hosts) then
244244
// we need to leave some midi data in the buffer that we were given at the start
245+
// Note: this is currently disabled by the way the plugin is built. This may be desirable in future versions
245246
midiInput.clear();
246247
midiInput.addEvents(midiEventsForCurrentSampleRange, 0, audio.getNumSamples(), 0);
247248
}
@@ -270,6 +271,8 @@ class ParticlesPluginEditor: public AudioProcessorEditor {
270271

271272
ParticleSimulationVisualiser simulationVisualiser;
272273
std::vector<std::unique_ptr<ParameterControl>> parameterControls;
274+
275+
HyperlinkButton vitlingButton;
273276
public:
274277
explicit ParticlesPluginEditor(ParticlesAudioProcessor &proc):
275278
AudioProcessorEditor(proc),
@@ -280,11 +283,17 @@ class ParticlesPluginEditor: public AudioProcessorEditor {
280283
// Allow user to resize within sensible limits so that we can still show all controls and a reasonable
281284
// picture of the simulation
282285
setResizable(true, true);
283-
setResizeLimits(700, 500, 1400, 1200);
286+
setResizeLimits(760, 560, 1400, 1200);
284287

285288
// Create default rotary controllers for all parameters exposed in the parameter state
286289
createSimpleControls(proc.state, Params::all());
287290

291+
vitlingButton.setURL(URL("https://www.vitling.xyz"));
292+
vitlingButton.setButtonText("Plugin by Vitling");
293+
vitlingButton.setColour(HyperlinkButton::ColourIds::textColourId, Colours::white);
294+
295+
addAndMakeVisible(vitlingButton);
296+
288297
addAndMakeVisible(simulationVisualiser);
289298

290299
// Don't wait until resize to set the bounds of subcomponents
@@ -317,17 +326,26 @@ class ParticlesPluginEditor: public AudioProcessorEditor {
317326

318327
// Lay out parameter controls in a grid
319328
const auto controlWidth = 100, controlHeight = 100, controlPanelWidth = 200;
320-
auto x = 0, y = 0;
329+
//auto x = 0, y = 0;
330+
331+
auto pNum = 0;
332+
321333
for (auto &control: parameterControls) {
334+
335+
// Hack to get sim/sound parameters separated visually
336+
if (pNum == 5) pNum++;
337+
338+
int x = (pNum % 2) * controlWidth;
339+
int y = (pNum / 2) * controlHeight + 20 + (pNum >5 ? 20: 0);
340+
322341
control->slider.setBounds(x,y,controlWidth,controlHeight-20);
323342
control->label.setBounds(x,y + controlHeight-20,controlWidth,20);
324-
x+=controlWidth;
325-
if (x >= controlPanelWidth) {
326-
x = 0;
327-
y+=controlHeight;
328-
}
343+
344+
pNum++;
329345
}
330346

347+
vitlingButton.setBounds(0,540,200,20);
348+
331349
// Use the rest of the available space right of the control panel for the simulation visualiser
332350
simulationVisualiser.setBounds(controlPanelWidth,0,bounds.getWidth()-controlPanelWidth, bounds.getHeight());
333351
}
@@ -345,6 +363,12 @@ class ParticlesPluginEditor: public AudioProcessorEditor {
345363
void paint(Graphics &g) override {
346364
g.setGradientFill(colourfulBackground());
347365
g.fillAll();
366+
g.setColour(Colours::white);
367+
g.drawText("Simulation", 0,0,200,20,Justification::centred, false);
368+
g.drawText("Synthesiser", 0,320,200,20,Justification::centred, false);
369+
g.drawLine(0,20,200,20);
370+
g.drawLine(0,320,200,320);
371+
g.drawLine(0,340,200,340);
348372
}
349373
};
350374

0 commit comments

Comments
 (0)