feat: add octave and halftone transpose menus

This commit is contained in:
Armin 2026-07-14 01:19:44 +02:00
commit 6432ab060d
4 changed files with 43 additions and 2 deletions

View file

@ -11,6 +11,8 @@
#include <array>
#include <atomic>
const juce::StringArray& getSemitoneChoices();
class ChromaFlockProcessor : public juce::AudioProcessor {
public:
ChromaFlockProcessor();
@ -55,18 +57,20 @@ public:
void noteOn(int midiNote, float velocity) {
if (midiNote >= 0 && midiNote < 128)
activeNotes[midiNote].store(true, std::memory_order_relaxed);
synth.noteOn(1, midiNote, velocity);
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, midiNote, 0.0f, true);
synth.noteOff(1, juce::jlimit(0, 127, midiNote + getTransposeSemitones()), 0.0f, true);
}
bool isNoteActive(int midiNote) const {
return midiNote >= 0 && midiNote < 128
&& activeNotes[midiNote].load(std::memory_order_relaxed);
}
int getTransposeSemitones() const;
std::atomic<float> pitchBendValue{0.0f};
float getPitchBend() const { return pitchBendValue.load(std::memory_order_relaxed); }