Skip to content

Commit

Permalink
bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ospreyelm committed Dec 21, 2023
1 parent a9b67a6 commit 788f35a
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 12 deletions.
3 changes: 2 additions & 1 deletion lab/static/js/src/components/midi.js
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,8 @@ define([
SUSTAINING = true;
} else if (state === "off") {
chord._sustain = false;
if (request_origin !== "ui") {
const PLAY_VIEW = false; // TO DO: UNISON BANKING FEATURE FOR PLAY VIEW ONLY
if (PLAY_VIEW && request_origin !== "ui") {
this.chords.puntUnison();
chord._unison_idx = null;
}
Expand Down
5 changes: 3 additions & 2 deletions lab/static/js/src/components/music/stave_notater.js
Original file line number Diff line number Diff line change
Expand Up @@ -687,8 +687,9 @@ define([
/* has precursor */
let precursor = history[idx - 1];
let current = history[idx];
if (precursor == current) display = "";
else {
if (precursor == current) {
// display = ""; // MAKE THIS A USER PREFERENCE AND EXERCISE PREFERENCE
} else {
let progression = [precursor, current];
let probe = substitutions
.map((sub_arr) => sub_arr[0].join(">"))
Expand Down
19 changes: 12 additions & 7 deletions lab/static/js/src/models/chord.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ define([
"lodash",
"microevent",
"app/config",
], function (_, MicroEvent, Config) {
"app/components/events",
], function (_, MicroEvent, Config, EVENTS) {
"use strict";

const VALID_STAFF_DISTRIBUTIONS = Config.get(
Expand Down Expand Up @@ -199,8 +200,8 @@ define([
_keys_down: this._keys_down
}

this.trigger("change", "note:on");
if (!_.isEqual(as_is, as_was)) {
this.trigger("change", "note:on");
return true;
} else {
return false;
Expand All @@ -219,14 +220,18 @@ define([
* @return {boolean} True if the note status changed, false otherwise.
*/
noteOff: function (notes) {
let manually_dampen = false;
if (_.isArray(notes)) {
var incoming = notes; // the midi numbers of notes that must be added
var outgoing = notes; // the midi numbers of notes that must be added
} else if (Number.isInteger(notes)) {
var incoming = [notes];
var outgoing = [notes];
} else if (!_.isArray(notes) && typeof notes === "object") {
var incoming = notes.notes;
var outgoing = notes.notes;
if (notes.hasOwnProperty("manuallyDampen")) {
manually_dampen = notes.manuallyDampen === true;
}
} else {
var incoming = [];
var outgoing = [];
console.log("Warning: Chord.noteOff did not receive midi numbers as expected!")
}

Expand Down Expand Up @@ -286,8 +291,8 @@ define([
_keys_down: this._keys_down
}

this.trigger("change", "note:on");
if (!_.isEqual(as_is, as_was)) {
this.trigger("change", "note:on");
return true;
} else {
return false;
Expand Down
4 changes: 2 additions & 2 deletions lab/static/js/src/models/chord_bank.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,8 @@ define(["lodash", "app/config", "microevent", "app/util", "./chord"], function (
// if (NO_DOUBLE_VISION === true) {
// } else {
var chord = new Chord();

chord.copy(current);
var notes_off = chord.dropDampers(); // important (see call in MidiComponent.onBankNotes)

if (request_origin !== "redistribute") {
// re-wires listeners to the current chord
Expand All @@ -129,7 +129,7 @@ define(["lodash", "app/config", "microevent", "app/util", "./chord"], function (

this.trigger("bank");

return;
return notes_off; // important (see call in MidiComponent.onBankNotes
},
puntUnison: function (request_origin = "unknown") {
if (!this._enableBanking || request_origin === "by_metronome" || request_origin === "ui") {
Expand Down

0 comments on commit 788f35a

Please sign in to comment.