add arpeggiator, rename presets, move spectrum analyzer into waveform

This commit is contained in:
Armin 2026-08-13 00:38:10 +02:00
commit 3331b4cc16
9 changed files with 1126 additions and 395 deletions

View file

@ -1,8 +1,8 @@
#pragma once
#include <juce_audio_processors/juce_audio_processors.h>
#include <juce_audio_basics/juce_audio_basics.h>
#include <juce_dsp/juce_dsp.h>
#include "DSP/Voice.h"
#include "DSP/Arpeggiator.h"
#include "DSP/Distortion.h"
#include "DSP/Compressor.h"
#include "DSP/Limiter.h"
@ -53,17 +53,30 @@ public:
std::array<float, fftSize> fftInput{};
std::atomic<int> fftWritePos{0};
Arpeggiator arp;
float getRmsLevel() const { return rmsLevel.load(); }
bool isArpEnabled() const {
auto* p = apvts.getRawParameterValue("arpEnabled");
return p != nullptr && p->load() > 0.5f;
}
void noteOn(int midiNote, float velocity) {
if (midiNote >= 0 && midiNote < 128)
activeNotes[midiNote].store(true, std::memory_order_relaxed);
synth.noteOn(1, juce::jlimit(0, 127, midiNote + getTransposeSemitones()), velocity);
if (isArpEnabled())
arp.noteOn(midiNote, velocity);
else
synth.noteOn(1, juce::jlimit(0, 127, midiNote + getTransposeSemitones()), velocity);
}
void noteOff(int midiNote) {
if (midiNote >= 0 && midiNote < 128)
activeNotes[midiNote].store(false, std::memory_order_relaxed);
synth.noteOff(1, juce::jlimit(0, 127, midiNote + getTransposeSemitones()), 0.0f, true);
if (isArpEnabled())
arp.noteOff(midiNote);
else
synth.noteOff(1, juce::jlimit(0, 127, midiNote + getTransposeSemitones()), 0.0f, true);
}
bool isNoteActive(int midiNote) const {
return midiNote >= 0 && midiNote < 128
@ -102,6 +115,7 @@ private:
double currentSampleRate = 44100.0;
double currentBpm = 120.0;
double arpSampleCount = 0.0;
std::atomic<float> rmsLevel{0.0f};
std::array<std::atomic<bool>, 128> activeNotes{};