Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
116 changes: 58 additions & 58 deletions js/abc.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,35 +123,35 @@ const processABCNotes = function(logo, turtle) {
counter = 0;
break;
case "begin articulation":
articulation = true;
break;
case "end articulation":
articulation = false;
break;
case "begin crescendo":
logo.notationNotes[turtle] += "!<(!";
break;
case "end crescendo":
logo.notationNotes[turtle] += "!<)!";
break;
case "begin decrescendo":
logo.notationNotes[turtle] += "!>(!";
break;
case "end decrescendo":
logo.notationNotes[turtle] += "!<(!";
break;
case "begin slur":
queueSlur = true;
break;
case "end slur":
logo.notationNotes[turtle] += "";
break;
case "tie":
logo.notationNotes[turtle] += "";
break;
case "meter":
logo.notationNotes[turtle] +=
"M:" +
// articulation = true;
// break;
// case "end articulation":
// articulation = false;
// break;
// case "begin crescendo":
// logo.notationNotes[turtle] += "!<(!";
// break;
// case "end crescendo":
// // logo.notationNotes[turtle] += "!<)!";
// break;
// case "begin decrescendo":
// logo.notationNotes[turtle] += "!>(!";
// break;
// case "end decrescendo":
// logo.notationNotes[turtle] += "!<(!";
// break;
// case "begin slur":
// queueSlur = true;
// break;
// case "end slur":
// logo.notationNotes[turtle] += "";
// break;
// case "tie":
// logo.notationNotes[turtle] += "";
// break;
// case "meter":
// logo.notationNotes[turtle] +=
// "M:" +
logo.notation.notationStaging[turtle][i + 1] +
"/" +
logo.notation.notationStaging[turtle][i + 2] +
Expand Down Expand Up @@ -311,25 +311,25 @@ const processABCNotes = function(logo, turtle) {
if (obj[NOTATIONTUPLETVALUE] > 0) {
if (incompleteTuplet === 0) {
const tupletFraction = toFraction(tupletDuration /
targetDuration);
logo.notationNotes[turtle] +=
"(" + tupletFraction[0] + ":" + tupletFraction[1] + "";
i += __processTuplet(
logo, turtle, i, obj[NOTATIONTUPLETVALUE]) - 1;
} else {
const tupletFraction = toFraction(
obj[NOTATIONTUPLETVALUE] / incompleteTuplet);
logo.notationNotes[turtle] +=
"(" + tupletFraction[0] + ":" + tupletFraction[1] + "";
i += __processTuplet(logo, turtle, i, incompleteTuplet) - 1;
}

targetDuration = 0;
tupletDuration = 0;
} else {
if (typeof notes === "object") {
if (notes.length > 1) {
logo.notationNotes[turtle] += "[";
// targetDuration);
// logo.notationNotes[turtle] +=
// "(" + tupletFraction[0] + ":" + tupletFraction[1] + "";
// i += __processTuplet(
// logo, turtle, i, obj[NOTATIONTUPLETVALUE]) - 1;
// } else {
// const tupletFraction = toFraction(
// obj[NOTATIONTUPLETVALUE] / incompleteTuplet);
// logo.notationNotes[turtle] +=
// "(" + tupletFraction[0] + ":" + tupletFraction[1] + "";
// i += __processTuplet(logo, turtle, i, incompleteTuplet) - 1;
// }

// targetDuration = 0;
// tupletDuration = 0;
// } else {
// if (typeof notes === "object") {
// if (notes.length > 1) {
// logo.notationNotes[turtle] += "[";
}

for (let ii = 0; ii < notes.length; ii++) {
Expand Down Expand Up @@ -426,16 +426,16 @@ const saveAbcOutput = function(activity) {
// for (const t in activity.logo.notation.notationStaging) {
// turtleCount += 1;
// }
// eslint-disable-next-line no-console
// console.debug("saving as abc: " + turtleCount);

for (const t in activity.logo.notation.notationStaging) {
activity.logo.notationOutput +=
"K:" + activity.turtles.ithTurtle(t).singer.keySignature
.toUpperCase()
.replace(" ", "")
.replace("♭", "b")
.replace("♯", "#") + "\n";
// // eslint-disable-next-line no-console
// // console.debug("saving as abc: " + turtleCount);

// for (const t in activity.logo.notation.notationStaging) {
// activity.logo.notationOutput +=
// "K:" + activity.turtles.ithTurtle(t).singer.keySignature
// .toUpperCase()
// .replace(" ", "")
// .replace("♭", "b")
// .replace("♯", "#") + "\n";
processABCNotes(activity.logo, t);
activity.logo.notationOutput += activity.logo.notationNotes[t];
}
Expand Down
136 changes: 68 additions & 68 deletions js/activity.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,74 +169,74 @@ if (_THIS_IS_MUSIC_BLOCKS_) {
"widgets/pitchslider",
"widgets/musickeyboard",
"widgets/timbre",
"widgets/oscilloscope",
"widgets/sampler",
"activity/lilypond",
"activity/abc",
"activity/mxml"
];
MYDEFINES = MYDEFINES.concat(MUSICBLOCKS_EXTRAS);
}

// Create a global variable from the Activity obj to provide access to
// blocks, logo, palettes, and turtles for plugins and js-export.
let globalActivity;

/**
* Performs analysis on the project using the global activity.
* @returns {object} - The analysis result.
*/
const doAnalyzeProject = function() {
return analyzeProject(globalActivity);
};

/**
* Represents an activity in the application.
*/
class Activity {
/**
* Creates an Activity instance.
*/
constructor() {
globalActivity = this;

this.cellSize = 55;
this.searchSuggestions = [];
this.homeButtonContainer;

this.msgTimeoutID = null;
this.msgText = null;
this.errorMsgTimeoutID = null;
this.errorMsgText = null;
this.errorMsgArrow = null;
this.errorArtwork = {};

this.cartesianBitmap = null;
this.polarBitmap = null;
this.trebleBitmap = null;
this.trebleSharpBitmap = [null, null, null, null, null, null, null];
this.trebleFlatBitmap = [null, null, null, null, null, null, null];
this.grandBitmap = null;
this.grandSharpBitmap = [null, null, null, null, null, null, null];
this.grandFlatBitmap = [null, null, null, null, null, null, null];
this.sopranoBitmap = null;
this.sopranoSharpBitmap = [null, null, null, null, null, null, null];
this.sopranoFlatBitmap = [null, null, null, null, null, null, null];
this.altoBitmap = null;
this.altoSharpBitmap = [null, null, null, null, null, null, null];
this.altoFlatBitmap = [null, null, null, null, null, null, null];
this.tenorBitmap = null;
this.tenorSharpBitmap = [null, null, null, null, null, null, null];
this.tenorFlatBitmap = [null, null, null, null, null, null, null];
this.bassBitmap = null;
this.bassSharpBitmap = [null, null, null, null, null, null, null];
this.bassFlatBitmap = [null, null, null, null, null, null, null];

const ERRORARTWORK = [
"emptybox",
"emptyheap",
"negroot",
"noinput",
// "widgets/oscilloscope",
// "widgets/sampler",
// "activity/lilypond",
// "activity/abc",
// "activity/mxml"
// ];
// MYDEFINES = MYDEFINES.concat(MUSICBLOCKS_EXTRAS);
// }

// // Create a global variable from the Activity obj to provide access to
// // blocks, logo, palettes, and turtles for plugins and js-export.
// let globalActivity;

// /**
// * Performs analysis on the project using the global activity.
// * @returns {object} - The analysis result.
// */
// const doAnalyzeProject = function() {
// return analyzeProject(globalActivity);
// };

// /**
// * Represents an activity in the application.
// */
// class Activity {
// /**
// * Creates an Activity instance.
// */
// constructor() {
// globalActivity = this;

// this.cellSize = 55;
// this.searchSuggestions = [];
// this.homeButtonContainer;

// this.msgTimeoutID = null;
// this.msgText = null;
// this.errorMsgTimeoutID = null;
// this.errorMsgText = null;
// this.errorMsgArrow = null;
// this.errorArtwork = {};

// this.cartesianBitmap = null;
// this.polarBitmap = null;
// this.trebleBitmap = null;
// this.trebleSharpBitmap = [null, null, null, null, null, null, null];
// this.trebleFlatBitmap = [null, null, null, null, null, null, null];
// this.grandBitmap = null;
// this.grandSharpBitmap = [null, null, null, null, null, null, null];
// this.grandFlatBitmap = [null, null, null, null, null, null, null];
// this.sopranoBitmap = null;
// this.sopranoSharpBitmap = [null, null, null, null, null, null, null];
// this.sopranoFlatBitmap = [null, null, null, null, null, null, null];
// this.altoBitmap = null;
// this.altoSharpBitmap = [null, null, null, null, null, null, null];
// this.altoFlatBitmap = [null, null, null, null, null, null, null];
// this.tenorBitmap = null;
// this.tenorSharpBitmap = [null, null, null, null, null, null, null];
// this.tenorFlatBitmap = [null, null, null, null, null, null, null];
// this.bassBitmap = null;
// this.bassSharpBitmap = [null, null, null, null, null, null, null];
// this.bassFlatBitmap = [null, null, null, null, null, null, null];

// const ERRORARTWORK = [
// "emptybox",
// "emptyheap",
// "negroot",
// "noinput",
"zerodivide",
"notanumber",
"nostack",
Expand Down
102 changes: 51 additions & 51 deletions js/block.js
Original file line number Diff line number Diff line change
Expand Up @@ -250,57 +250,57 @@ class Block {
this.overrideName = overrideName;

this.name = protoblock.name;
this.activity = this.blocks.activity;

this.collapsed = false; // Is this collapsible block collapsed?
this.inCollapsed = false; // Is this block in a collapsed stack?
this.trash = false; // Is this block in the trash?
this.loadComplete = false; // Has the block finished loading?
this.label = null; // Editable textview in DOM.
this.labelattr = null; // Editable textview in DOM.
this.text = null; // A dynamically generated text label on block itself.
this.value = null; // Value for number, text, and media blocks.
this.privateData = null; // A block may have some private data,
// e.g., nameboxes use this field to store
// the box name associated with the block.
this.customID = null; // Used by custom temperaments.
this.image = protoblock.image; // The file path of the image.
this.imageBitmap = null;
this.controller = null; // Note blocks get a controller

// All blocks have at a container and least one bitmap.
this.container = null;
this.bounds = null;
this.width = 0;
this.height = 0;
this.hitHeight = 0;
this.bitmap = null;
this.highlightBitmap = null;
this.disconnectedBitmap = null;
this.disconnectedHighlightBitmap = null;

// The svg from which the bitmaps are generated
this.artwork = null;
this.collapseArtwork = null;

// Start and Action blocks has a collapse button
this.collapseButtonBitmap = null;
this.expandButtonBitmap = null;
this.collapseBlockBitmap = null;
this.highlightCollapseBlockBitmap = null;
this.collapseText = null;

this.size = 1; // Proto size is copied here.
this.docks = []; // Proto dock is copied here.
this.connections = [];

// Keep track of clamp count for blocks with clamps.
this.clampCount = [1, 1];
this.argClampSlots = [1];

// Some blocks have some post process after they are first loaded.
this.postProcess = null;
this.postProcessArg = this;
// this.activity = this.blocks.activity;

// this.collapsed = false; // Is this collapsible block collapsed?
// this.inCollapsed = false; // Is this block in a collapsed stack?
// this.trash = false; // Is this block in the trash?
// this.loadComplete = false; // Has the block finished loading?
// this.label = null; // Editable textview in DOM.
// this.labelattr = null; // Editable textview in DOM.
// this.text = null; // A dynamically generated text label on block itself.
// this.value = null; // Value for number, text, and media blocks.
// this.privateData = null; // A block may have some private data,
// // e.g., nameboxes use this field to store
// // the box name associated with the block.
// this.customID = null; // Used by custom temperaments.
// this.image = protoblock.image; // The file path of the image.
// this.imageBitmap = null;
// this.controller = null; // Note blocks get a controller

// // All blocks have at a container and least one bitmap.
// this.container = null;
// this.bounds = null;
// this.width = 0;
// this.height = 0;
// this.hitHeight = 0;
// this.bitmap = null;
// this.highlightBitmap = null;
// this.disconnectedBitmap = null;
// this.disconnectedHighlightBitmap = null;

// // The svg from which the bitmaps are generated
// this.artwork = null;
// this.collapseArtwork = null;

// // Start and Action blocks has a collapse button
// this.collapseButtonBitmap = null;
// this.expandButtonBitmap = null;
// this.collapseBlockBitmap = null;
// this.highlightCollapseBlockBitmap = null;
// this.collapseText = null;

// this.size = 1; // Proto size is copied here.
// this.docks = []; // Proto dock is copied here.
// this.connections = [];

// // Keep track of clamp count for blocks with clamps.
// this.clampCount = [1, 1];
// this.argClampSlots = [1];

// // Some blocks have some post process after they are first loaded.
// this.postProcess = null;
// this.postProcessArg = this;

// Lock on label change
this._labelLock = false;
Expand Down
Loading