mirror of
https://codeberg.org/armin/chromaflock.git
synced 2026-09-01 04:10:47 +02:00
feat: add octave and halftone transpose menus
This commit is contained in:
parent
5cc704c1d1
commit
6432ab060d
4 changed files with 43 additions and 2 deletions
|
|
@ -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); }
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue