updateeeees

This commit is contained in:
Armin 2026-08-13 03:39:39 +02:00
commit 462891fb11
5 changed files with 69 additions and 99 deletions

View file

@ -210,37 +210,6 @@ private:
[](const NotePitch& a, const NotePitch& b) { return a.note < b.note; });
int n = static_cast<int>(seq.size());
// "Down" patterns (and any harmony pattern with Direction Down) always
// descend from each held note through the chord tones of the octave
// below it: root, fifth below, third below, then the next octave's
// root. Built from the held notes directly so nothing ever plays
// above them.
bool wantDownFigure = hasHarmony()
&& (direction == DirectionDown || pattern == Down || pattern == DownMajor);
if (wantDownFigure) {
std::vector<NotePitch> down;
int thirdBelow = 12 - harmonyThird();
std::vector<int> tops(heldNotes.begin(), heldNotes.end());
std::sort(tops.begin(), tops.end(), [](int a, int b) { return a > b; });
for (int root : tops) {
if (std::find(tops.begin(), tops.end(), root + 12) != tops.end())
continue;
float vel = velocities[root];
for (int k = 0; k < octaves; ++k) {
auto pushClamped = [&](int pitch) {
pitch = pitch < 0 ? 0 : (pitch > 127 ? 127 : pitch);
down.push_back({pitch, vel});
};
pushClamped(root - 12 * k);
if (k < octaves - 1) {
pushClamped(root - 12 * k - 5);
pushClamped(root - 12 * k - thirdBelow);
}
}
}
return down;
}
std::vector<NotePitch> order;
auto push = [&](int i) { order.push_back(seq[i]); };
@ -341,16 +310,17 @@ private:
int up = anchor + 12;
up = up > 127 ? 127 : up;
float vel = heldNotes.empty() ? 0.9f : velocities[heldNotes.back()];
NotePitch rest{restNote, vel};
order.clear();
if (pattern == C3C4A) {
order = {{anchor, vel}, {anchor, vel}, {up, vel}, {anchor, vel},
{up, vel}, {anchor, vel}, {anchor, vel}, {up, vel}};
{up, vel}, {anchor, vel}, rest, {up, vel}};
} else if (pattern == C3C4B) {
order = {{up, vel}, {anchor, vel}, {anchor, vel}, {anchor, vel},
{anchor, vel}, {anchor, vel}, {anchor, vel}, {anchor, vel}};
order = {{up, vel}, {anchor, vel}, rest, {anchor, vel},
{anchor, vel}, {anchor, vel}, rest, {anchor, vel}};
} else if (pattern == C3C4C) {
order = {{anchor, vel}, {anchor, vel}, {anchor, vel}, {up, vel},
{anchor, vel}, {anchor, vel}, {anchor, vel}, {anchor, vel}};
order = {{anchor, vel}, {anchor, vel}, rest, {up, vel},
rest, {anchor, vel}, rest, {anchor, vel}};
} else if (pattern == C3C4D) {
order = {{anchor, vel}, {anchor, vel}, {up, vel}, {anchor, vel},
{anchor, vel}, {up, vel}, {anchor, vel}, {anchor, vel},