add ping-pong loop mode and crossfade length rotary

This commit is contained in:
Armin 2026-07-24 13:09:52 +02:00
commit e9dc3a4d66
10 changed files with 67 additions and 17 deletions

View file

@ -50,9 +50,12 @@ JustaSampleAudioProcessorEditor::JustaSampleAudioProcessorEditor(JustaSampleAudi
loopButton(true),
loopStartButton(true),
loopEndButton(true),
pingPongButton(true),
loopAttachment(p.APVTS(), PluginParameters::IS_LOOPING, loopButton),
loopStartAttachment(p.APVTS(), PluginParameters::LOOPING_HAS_START, loopStartButton),
loopEndAttachment(p.APVTS(), PluginParameters::LOOPING_HAS_END, loopEndButton),
pingPongAttachment(p.APVTS(), PluginParameters::IS_PING_PONG, pingPongButton),
crossfadeAttachment(p.APVTS(), PluginParameters::CROSSFADE_SAMPLES, crossfadeRotary),
// Master module
monoOutputAttachment(p.APVTS(), PluginParameters::MONO_OUTPUT, monoOutputButton),
@ -179,6 +182,15 @@ JustaSampleAudioProcessorEditor::JustaSampleAudioProcessorEditor(JustaSampleAudi
loopEndButton.setHelpText("Loop with release portion");
addAndMakeVisible(&loopEndButton);
pingPongButton.useShape(getOutlineFromSVG(BinaryData::IconPingPong_svg));
pingPongButton.setOwnerButton(&loopButton);
pingPongButton.setHelpText("Ping-pong loop");
addAndMakeVisible(&pingPongButton);
crossfadeRotary.getProperties().set(ComponentProps::ROTARY_UNIT, "samp");
crossfadeRotary.setHelpText("Loop crossfade length");
addAndMakeVisible(&crossfadeRotary);
monoOutputButton.useShape(getOutlineFromSVG(BinaryData::IconMono_svg));
monoOutputButton.setHelpText("Mix output to mono");
addAndMakeVisible(&monoOutputButton);
@ -190,7 +202,7 @@ JustaSampleAudioProcessorEditor::JustaSampleAudioProcessorEditor(JustaSampleAudi
gainSlider.setHelpText("Sample gain");
addAndMakeVisible(&gainSlider);
rotaries = { &semitoneRotary, &waveformSemitoneRotary, &centRotary, &waveformCentRotary, &attackTimeRotary, &releaseTimeRotary, &playbackSpeedRotary };
rotaries = { &semitoneRotary, &waveformSemitoneRotary, &centRotary, &waveformCentRotary, &attackTimeRotary, &releaseTimeRotary, &playbackSpeedRotary, &crossfadeRotary };
for (auto rotary : rotaries)
{
rotary->setSliderStyle(juce::Slider::RotaryVerticalDrag);
@ -651,22 +663,32 @@ void JustaSampleAudioProcessorEditor::resized()
loopingLabel.setBounds(loopingLabelBounds.toNearestInt());
loopModule.removeFromTop(scalei(Layout::moduleLabelGap));
loopModule.reduce(scalei(16.f), scalei(6.f));
loopModule.reduce(scalei(16.f) - rotaryPadding, scalei(6.f) - rotaryPadding);
loopStartButton.setBounds(loopModule.removeFromLeft(scalei(34.f)).toNearestInt());
loopStartButton.setBorder(scalef(2.5f), scalef(6.f), true, false, true, false);
loopStartButton.setPadding(scalef(8.f), scalef(4.f), scalef(7.5f), scalef(7.5f));
loopModule.removeFromLeft(scalei(6.f));
loopButton.setBounds(loopModule.removeFromLeft(scalei(105.f)).toNearestInt());
loopButton.setBounds(loopModule.removeFromLeft(scalei(65.f)).toNearestInt());
loopButton.setBorder(scalef(2.5f));
loopButton.setPadding(scalef(13.f));
loopModule.removeFromLeft(scalei(3.f));
pingPongButton.setBounds(loopModule.removeFromLeft(scalei(34.f)).toNearestInt());
pingPongButton.setBorder(scalef(2.5f), scalef(6.f));
pingPongButton.setPadding(scalef(8.f));
loopModule.removeFromLeft(scalei(6.f));
loopEndButton.setBounds(loopModule.removeFromLeft(scalei(34.f)).toNearestInt());
loopEndButton.setBorder(scalef(2.5f), scalef(6.f), false, true, false, true);
loopEndButton.setPadding(scalef(4.f), scalef(8.f), scalef(7.5f), scalef(7.5f));
loopModule.removeFromLeft(scalei(6.f));
auto crossfadeRotaryBounds = loopModule.removeFromLeft(rotarySize + 2 * rotaryPadding);
crossfadeRotary.setBounds(crossfadeRotaryBounds.toNearestInt());
crossfadeRotary.sendLookAndFeelChange();
controls.removeFromLeft(scalei(Layout::moduleGap));
// Master module
@ -787,6 +809,7 @@ void JustaSampleAudioProcessorEditor::lookAndFeelChanged()
loopButton.setColors(theme.dark, theme.loop, shadow);
loopStartButton.setColors(theme.dark, theme.loop, shadow);
loopEndButton.setColors(theme.dark, theme.loop, shadow);
pingPongButton.setColors(theme.dark, theme.loop, shadow);
monoOutputButton.setColors(theme.dark, theme.light, shadow);
linkSampleToggle.setColors(theme.dark, theme.slate.withAlpha(0.5f), shadow);
waveformModeLabel.setColors(theme.foreground, theme.slate.withAlpha(0.f), shadow);
@ -810,7 +833,7 @@ void JustaSampleAudioProcessorEditor::lookAndFeelChanged()
juce::Array<Component*> foregroundComponents = {
&tuningLabel, &attackLabel, &releaseLabel, &playbackLabel, &loopingLabel, &masterLabel, &semitoneRotary, &waveformSemitoneRotary, &centRotary, &waveformCentRotary, &tuningDetectLabel, &tuningDetectButton,
&attackTimeRotary, &attackCurve, &releaseTimeRotary, &releaseCurve, &lofiModeButton, &playbackModeButton, &playbackSpeedRotary, &loopStartButton, &loopButton, &loopEndButton,
&attackTimeRotary, &attackCurve, &releaseTimeRotary, &releaseCurve, &lofiModeButton, &playbackModeButton, &playbackSpeedRotary, &loopStartButton, &loopButton, &loopEndButton, &pingPongButton, &crossfadeRotary,
&monoOutputButton, &gainSlider, &filenameComponent, &linkSampleToggle, &playStopButton, &recordButton, &deviceSettingsButton, &fitButton, &pinButton, &sampleNavigator, &preFXButton, &showFXButton
};
@ -1047,7 +1070,7 @@ void JustaSampleAudioProcessorEditor::enablementChanged()
&playStopButton, &fitButton, &pinButton, &sampleEditor, &sampleNavigator, &fxChain, &showFXButton
};
juce::Array<Component*> notWaveformModeComponents = { &playbackModeButton, &loopStartButton, &loopButton, &loopEndButton, &tuningDetectLabel, &tuningDetectButton };
juce::Array<Component*> notWaveformModeComponents = { &playbackModeButton, &loopStartButton, &loopButton, &loopEndButton, &pingPongButton, &crossfadeRotary, &tuningDetectLabel, &tuningDetectButton };
juce::Array<Component*> notLoadingDependentComponents = { &tuningDetectButton, &tuningDetectLabel, &recordButton, &deviceSettingsButton };