Skip to content

Commit

Permalink
Merge branch 'currentPitch' of https://github.com/sksum/musicblocks i…
Browse files Browse the repository at this point in the history
…nto sksum-currentPitch
  • Loading branch information
walterbender committed Aug 29, 2020
2 parents e8f50d3 + 8e922e9 commit e49bef6
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 0 deletions.
5 changes: 5 additions & 0 deletions js/logo.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ class Logo {

this.temperamentSelected = [];
this.customTemperamentDefined = false;
this.specialArgs = [];

if (_THIS_IS_MUSIC_BLOCKS_) {
// Load the default synthesizer
Expand Down Expand Up @@ -1522,6 +1523,10 @@ class Logo {
)
);
}
if (logo.turtles.ithTurtle(turtle).singer.inNoteBlock.length > 0 &&
["pitchinhertz","currentpitch"].indexOf(logo.blocks.blockList[logo.blocks.blockList[blk].connections[i]].name) !== -1) {
logo.specialArgs.push([args, logo, turtle, blk, receivedArg, null, isflow]); //redo after noteBlock Ends
}
}
}

Expand Down
41 changes: 41 additions & 0 deletions js/turtle-singer.js
Original file line number Diff line number Diff line change
Expand Up @@ -2066,6 +2066,47 @@ class Singer {

if (last(tur.singer.inNoteBlock) !== null) {
__playnote();

if (logo.specialArgs.length > 0) {
let runAgainBlockParam = logo.specialArgs.pop()
let _ar = runAgainBlockParam
let blockN = _ar[3];

//update args for pitch in hertz and current pitch and then redo the flow block they are attatched to(print/storein etc).

let args = [];
for (let i = 1; i <= logo.blocks.blockList[blockN].protoblock.args; i++) {
if (logo.blocks.blockList[blockN].protoblock.dockTypes[i] === "in") {
if (logo.blocks.blockList[blockN].connections[i] == null) {
console.debug("skipping inflow args");
} else {
args.push(logo.blocks.blockList[blockN].connections[i]);
}
} else {
args.push(
logo.parseArg(
logo,
_ar[2],
logo.blocks.blockList[blockN].connections[i],
blockN,
_ar[4]
)
);
}
}
//args, logo, turtle, blk, receivedArg, null, isflow
if (typeof logo.blocks.blockList[blockN].protoblock.flow === "function") {
logo.blocks.blockList[blockN].protoblock.flow(
args,
_ar[1],
_ar[2],
_ar[3],
_ar[4],
_ar[5],
_ar[6]
);
}
}
}
}

Expand Down

0 comments on commit e49bef6

Please sign in to comment.