mirror of
https://codeberg.org/armin/monoslicer.git
synced 2026-09-01 04:10:45 +02:00
- Add octave offset combo (-3 to +3) in title bar for MIDI input transposition - Fix waveform sidebar base note from C3 to C4 - Fix midiNoteToSliceIndex to compare pitch classes instead of raw MIDI notes - Add colored slice indicator dots on waveform sidebar keys - Embed audio data, file path, sample rate, and slices in plugin state for DAW project save/restore (falls back to file path if embedded data missing)
98 lines
4.1 KiB
C++
98 lines
4.1 KiB
C++
#pragma once
|
|
#include <juce_audio_processors/juce_audio_processors.h>
|
|
#include "PluginProcessor.h"
|
|
#include "WaveformDisplay.h"
|
|
|
|
class MonoSlicerEditor : public juce::AudioProcessorEditor,
|
|
private juce::FileDragAndDropTarget,
|
|
private juce::Button::Listener,
|
|
private juce::ComboBox::Listener,
|
|
private juce::Timer
|
|
{
|
|
public:
|
|
MonoSlicerEditor(MonoSlicerProcessor&);
|
|
~MonoSlicerEditor() override;
|
|
|
|
void paint(juce::Graphics&) override;
|
|
void resized() override;
|
|
|
|
bool isInterestedInFileDrag(const juce::StringArray& files) override;
|
|
void filesDropped(const juce::StringArray& files, int x, int y) override;
|
|
void buttonClicked(juce::Button* button) override;
|
|
void comboBoxChanged(juce::ComboBox* comboBoxThatHasChanged) override;
|
|
void timerCallback() override;
|
|
|
|
private:
|
|
MonoSlicerProcessor& processorRef;
|
|
|
|
WaveformDisplay waveformDisplay;
|
|
|
|
// Bottom panel buttons
|
|
juce::TextButton autoSliceButton { "Auto Slice" };
|
|
juce::TextButton clearSlicesButton { "Clear Slices" };
|
|
|
|
// Title bar buttons
|
|
juce::TextButton loadSampleButton { "Load" };
|
|
juce::TextButton prevSampleButton { "<" };
|
|
juce::TextButton nextSampleButton { ">" };
|
|
juce::TextButton undoButton { "Undo" };
|
|
juce::TextButton redoButton { "Redo" };
|
|
juce::TextButton zoomInButton { "+" };
|
|
juce::TextButton zoomOutButton { "-" };
|
|
juce::TextButton zoomResetButton { "1:1" };
|
|
juce::ComboBox scaleComboBox;
|
|
juce::ComboBox octaveComboBox;
|
|
|
|
static constexpr int baseWidth = 1100;
|
|
static constexpr int baseHeight = 550;
|
|
|
|
// Slice knobs
|
|
juce::Slider bassSlider, trebleSlider, sensitivitySlider;
|
|
juce::Label bassLabel, trebleLabel, sensitivityLabel;
|
|
|
|
// Amp ADSR knobs
|
|
juce::Slider ampAttackSlider, ampDecaySlider, ampSustainSlider, ampReleaseSlider;
|
|
juce::Label ampAttackLabel, ampDecayLabel, ampSustainLabel, ampReleaseLabel;
|
|
|
|
// Filter type selector
|
|
juce::ComboBox filterTypeComboBox;
|
|
|
|
// Filter knobs
|
|
juce::Slider filterCutoffSlider, filterResoSlider, filterEnvDepthSlider;
|
|
juce::Label filterCutoffLabel, filterResoLabel, filterEnvDepthLabel;
|
|
|
|
using SliderAttachment = juce::AudioProcessorValueTreeState::SliderAttachment;
|
|
using ComboBoxAttachment = juce::AudioProcessorValueTreeState::ComboBoxAttachment;
|
|
|
|
// Filter ADSR knobs
|
|
juce::Slider filterAttackSlider, filterDecaySlider, filterSustainSlider, filterReleaseSlider;
|
|
juce::Label filterAttackLabel, filterDecayLabel, filterSustainLabel, filterReleaseLabel;
|
|
|
|
// Time-stretch controls
|
|
juce::Slider bpmSlider;
|
|
juce::ComboBox stretchBeatsComboBox;
|
|
juce::TextButton stretchButton { "Stretch" };
|
|
juce::ComboBox keyShiftComboBox;
|
|
juce::Label keyShiftLabel;
|
|
std::unique_ptr<SliderAttachment> stretchBpmAttachment;
|
|
std::unique_ptr<ComboBoxAttachment> stretchBeatsAttachment;
|
|
std::unique_ptr<ComboBoxAttachment> keyShiftAttachment;
|
|
std::unique_ptr<ComboBoxAttachment> scaleAttachment;
|
|
std::unique_ptr<ComboBoxAttachment> octaveAttachment;
|
|
|
|
std::unique_ptr<SliderAttachment> bassAttachment, trebleAttachment, sensitivityAttachment;
|
|
std::unique_ptr<SliderAttachment> ampAttackAttachment, ampDecayAttachment, ampSustainAttachment, ampReleaseAttachment;
|
|
std::unique_ptr<SliderAttachment> filterCutoffAttachment, filterResoAttachment, filterEnvDepthAttachment;
|
|
std::unique_ptr<SliderAttachment> filterAttackAttachment, filterDecayAttachment, filterSustainAttachment, filterReleaseAttachment;
|
|
std::unique_ptr<ComboBoxAttachment> filterTypeAttachment;
|
|
|
|
juce::FileChooser fileChooser { "Load Audio File", juce::File{}, "*.wav;*.aiff;*.flac;*.ogg" };
|
|
|
|
void setupSlider(juce::Slider& slider, juce::Label& label, const juce::String& name);
|
|
void attachSlider(juce::Slider& slider, juce::Label& label, const juce::String& name,
|
|
const juce::String& paramId, std::unique_ptr<SliderAttachment>& attachment);
|
|
|
|
int keyClickNote = -1;
|
|
|
|
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(MonoSlicerEditor)
|
|
};
|