Skip to content

Commit eff43b7

Browse files
committed
apply mode to moveable pitch when using y to pitch block
1 parent a2e71ed commit eff43b7

File tree

1 file changed

+16
-8
lines changed

1 file changed

+16
-8
lines changed

js/blocks/PitchBlocks.js

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -764,10 +764,9 @@ function setupPitchBlocks(activity) {
764764
if (cblk1 === null) {
765765
return 5;
766766
}
767-
let lc = noteIdx;
767+
768768
// Calculate the offset relative to the current key.
769-
const idx = NOTENAMES.indexOf(obj[0][0]);
770-
lc -= idx;
769+
let lc = noteIdx - NOTENAMES.indexOf(obj[0][0]);
771770
if (lc < 0) {
772771
lc += modeLength;
773772
}
@@ -788,11 +787,20 @@ function setupPitchBlocks(activity) {
788787
if (cblk1 === null) {
789788
return ["sol", 4];
790789
}
791-
while (noteIdx < 0) {
792-
noteIdx += SOLFEGENAMES.length;
790+
791+
if (tur.singer.moveable) {
792+
// Calculate the offset relative to the current key.
793+
let lc = noteIdx - NOTENAMES.indexOf(obj[0][0]);
794+
if (lc < 0) {
795+
lc += modeLength;
796+
}
797+
return [thisScale[lc], o2];
798+
} else {
799+
while (noteIdx < 0) {
800+
noteIdx += SOLFEGENAMES.length;
801+
}
802+
return [SOLFEGENAMES[noteIdx], o2];
793803
}
794-
const sol = SOLFEGENAMES[noteIdx];
795-
return [sol, o2];
796804
} else {
797805
if (cblk1 === null) {
798806
return "G4";
@@ -1799,7 +1807,7 @@ function setupPitchBlocks(activity) {
17991807

18001808
let note, octave, cents;
18011809

1802-
// is the arg a scaledegree block?
1810+
// Is the arg a scaledegree block?
18031811
const c = activity.blocks.blockList[blk].connections[1];
18041812
let cname = null;
18051813
if (c !== null) {

0 commit comments

Comments
 (0)