mirror of
https://codeberg.org/armin/chromaflock.git
synced 2026-09-01 04:10:47 +02:00
updateeeees
This commit is contained in:
parent
8768d13338
commit
462891fb11
5 changed files with 69 additions and 99 deletions
|
|
@ -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},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue