Fix arp INVERT dropping an octave; invert Stab/Pinky patterns

This commit is contained in:
Armin 2026-08-13 03:47:46 +02:00
commit 502565156b

View file

@ -188,8 +188,7 @@ private:
if (pattern == AsPlayed) { if (pattern == AsPlayed) {
for (int n : heldNotes) { for (int n : heldNotes) {
for (int k = 0; k < octaves; ++k) { for (int k = 0; k < octaves; ++k) {
int off = (direction == DirectionUp ? 12 * k : -12 * k); addPitch(n + 12 * k, velocities[n]);
addPitch(n + off, velocities[n]);
} }
} }
} else { } else {
@ -197,8 +196,7 @@ private:
std::sort(sorted.begin(), sorted.end()); std::sort(sorted.begin(), sorted.end());
for (int n : sorted) { for (int n : sorted) {
for (int k = 0; k < octaves; ++k) { for (int k = 0; k < octaves; ++k) {
int off = (direction == DirectionUp ? 12 * k : -12 * k); addPitch(n + 12 * k, velocities[n]);
addPitch(n + off, velocities[n]);
} }
} }
} }
@ -288,13 +286,15 @@ private:
up = up > 127 ? 127 : up; up = up > 127 ? 127 : up;
float vel = heldNotes.empty() ? 0.9f : velocities[heldNotes.back()]; float vel = heldNotes.empty() ? 0.9f : velocities[heldNotes.back()];
NotePitch rest{restNote, vel}; NotePitch rest{restNote, vel};
int lo = (direction == DirectionDown) ? up : anchor;
int hi = (direction == DirectionDown) ? anchor : up;
order.clear(); order.clear();
if (pattern == PinkyUp) { if (pattern == PinkyUp) {
order = {{anchor, vel}, rest, {up, vel}, {anchor, vel}, order = {{lo, vel}, rest, {hi, vel}, {lo, vel},
rest, {up, vel}, {anchor, vel}, {anchor, vel}}; rest, {hi, vel}, {lo, vel}, {lo, vel}};
} else { } else {
order = {{up, vel}, rest, {anchor, vel}, {up, vel}, order = {{hi, vel}, rest, {lo, vel}, {hi, vel},
rest, {anchor, vel}, {up, vel}, {up, vel}}; rest, {lo, vel}, {hi, vel}, {hi, vel}};
} }
break; break;
} }
@ -311,27 +311,30 @@ private:
up = up > 127 ? 127 : up; up = up > 127 ? 127 : up;
float vel = heldNotes.empty() ? 0.9f : velocities[heldNotes.back()]; float vel = heldNotes.empty() ? 0.9f : velocities[heldNotes.back()];
NotePitch rest{restNote, vel}; NotePitch rest{restNote, vel};
// Invert swaps the lower/upper notes (C3 <-> C4) so the Stab
// patterns play upside down when direction is Down.
int lo = (direction == DirectionDown) ? up : anchor;
int hi = (direction == DirectionDown) ? anchor : up;
order.clear(); order.clear();
if (pattern == C3C4A) { if (pattern == C3C4A) {
order = {{anchor, vel}, {anchor, vel}, {up, vel}, {anchor, vel}, order = {{lo, vel}, {lo, vel}, {hi, vel}, {lo, vel},
{up, vel}, {anchor, vel}, rest, {up, vel}}; {hi, vel}, {lo, vel}, rest, {hi, vel}};
} else if (pattern == C3C4B) { } else if (pattern == C3C4B) {
order = {{up, vel}, {anchor, vel}, rest, {anchor, vel}, order = {{hi, vel}, {lo, vel}, rest, {lo, vel},
{anchor, vel}, {anchor, vel}, rest, {anchor, vel}}; {lo, vel}, {lo, vel}, rest, {lo, vel}};
} else if (pattern == C3C4C) { } else if (pattern == C3C4C) {
order = {{anchor, vel}, {anchor, vel}, rest, {up, vel}, order = {{lo, vel}, {lo, vel}, rest, {hi, vel},
rest, {anchor, vel}, rest, {anchor, vel}}; rest, {lo, vel}, rest, {lo, vel}};
} else if (pattern == C3C4D) { } else if (pattern == C3C4D) {
order = {{anchor, vel}, {anchor, vel}, {up, vel}, {anchor, vel}, order = {{lo, vel}, {lo, vel}, {hi, vel}, {lo, vel},
{anchor, vel}, {up, vel}, {anchor, vel}, {anchor, vel}, {lo, vel}, {hi, vel}, {lo, vel}, {lo, vel},
{up, vel}, {anchor, vel}, {anchor, vel}, {up, vel}, {hi, vel}, {lo, vel}, {lo, vel}, {hi, vel},
{anchor, vel}, {anchor, vel}, {anchor, vel}, {anchor, vel}}; {lo, vel}, {lo, vel}, {lo, vel}, {lo, vel}};
} else { } else {
NotePitch rest{restNote, vel}; order = {{lo, vel}, {lo, vel}, rest, {lo, vel},
order = {{anchor, vel}, {anchor, vel}, rest, {anchor, vel}, {lo, vel}, rest, {lo, vel}, {lo, vel},
{anchor, vel}, rest, {anchor, vel}, {anchor, vel}, rest, {lo, vel}, {lo, vel}, rest,
rest, {anchor, vel}, {anchor, vel}, rest, {lo, vel}, {lo, vel}, {lo, vel}, {lo, vel}};
{anchor, vel}, {anchor, vel}, {anchor, vel}, {anchor, vel}};
} }
break; break;
} }