Add octave offset dropdown, fix waveform sidebar, embed audio in plugin state

- 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)
This commit is contained in:
Armin 2026-07-21 15:20:49 +02:00
commit 73c4095139
6 changed files with 130 additions and 12 deletions

View file

@ -35,6 +35,17 @@ MonoSlicerEditor::MonoSlicerEditor(MonoSlicerProcessor& p)
scaleComboBox.setTooltip("UI Scale");
scaleAttachment = std::make_unique<ComboBoxAttachment>(processorRef.getAPVTS(), "uiScale", scaleComboBox);
addAndMakeVisible(octaveComboBox);
for (int i = -3; i <= 3; ++i)
octaveComboBox.addItem((i >= 0 ? "+" : "") + juce::String(i) + " oct", i + 4);
octaveComboBox.setSelectedId(4, juce::dontSendNotification);
octaveComboBox.setColour(juce::ComboBox::backgroundColourId, juce::Colour(0xff2a2a4a));
octaveComboBox.setColour(juce::ComboBox::textColourId, juce::Colours::white);
octaveComboBox.setColour(juce::ComboBox::outlineColourId, juce::Colour(0xff444466));
octaveComboBox.setColour(juce::ComboBox::arrowColourId, juce::Colours::white);
octaveComboBox.setTooltip("Octave offset for MIDI input");
octaveAttachment = std::make_unique<ComboBoxAttachment>(processorRef.getAPVTS(), "octaveOffset", octaveComboBox);
// Bottom panel buttons
addAndMakeVisible(autoSliceButton);
autoSliceButton.addListener(this);
@ -251,6 +262,7 @@ void MonoSlicerEditor::resized()
placeBtn(zoomInButton, 28);
scaleComboBox.setBounds(titleBar.getRight() - 100, titleBar.getY() + 8, 90, 24);
octaveComboBox.setBounds(titleBar.getRight() - 176, titleBar.getY() + 8, 72, 24);
auto bottomPanel = bounds.removeFromBottom(200);
auto bottomRow = bottomPanel.reduced(8);
@ -329,6 +341,11 @@ void MonoSlicerEditor::resized()
void MonoSlicerEditor::timerCallback()
{
if (processorRef.stateRestored.exchange(false))
{
waveformDisplay.setSampleBuffer(&processorRef.getSampleBuffer(), processorRef.getSampleRateLoaded());
}
waveformDisplay.setPlaybackPosition(processorRef.currentPlaybackSample.load());
waveformDisplay.setActiveSliceIndex(processorRef.currentActiveSlice.load());
waveformDisplay.setSelectedSlice(processorRef.selectedSlice.load());