Skip to content

Commit

Permalink
Opportunistic refreshing upon pitch bending.
Browse files Browse the repository at this point in the history
  • Loading branch information
PoneyClairDeLune committed Sep 20, 2023
1 parent ba5991d commit 75d9469
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions src/cambiare/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ let Cambiare = class extends RootDisplay {
#sectPart = [];
#sectMeta = {};
#noteEvents = [];
#pitchEvents = [];
#style = "block";
#drawNote(context, note, velo, state = 0, pitch = 0) {
// Param calculation
Expand Down Expand Up @@ -340,6 +341,13 @@ let Cambiare = class extends RootDisplay {
};
});
});
if (['line'].indexOf(upThis.#style) > -1) {
// Sift through pitch events
while (upThis.#pitchEvents.length > 0) {
let e = upThis.#pitchEvents.shift();
channels[e.part] = true;
};
};
// Sift through events fed
while (upThis.#noteEvents.length > 0) {
let e = upThis.#noteEvents.shift();
Expand Down Expand Up @@ -810,21 +818,15 @@ let Cambiare = class extends RootDisplay {
e.lsb.innerText = "";
e.notes.style.transform = "";
};
// Remove lingering notes
/*let removeIndex = [];
upThis.#notePool.forEach((e, i) => {
e.remove;
removeIndex.push(i);
});
removeIndex.forEach((e) => {
delete upThis.#notePool[e];
});*/
} catch (err) {};
});
upThis.addEventListener("note", ({data}) => {
upThis.#noteEvents.push(data);
//console.debug(data);
});
upThis.addEventListener("pitch", ({data}) => {
upThis.#pitchEvents.push(data);
});
};
};

Expand Down

0 comments on commit 75d9469

Please sign in to comment.