Skip to content

Commit

Permalink
Total remove playback
Browse files Browse the repository at this point in the history
  • Loading branch information
meganindya committed Jun 18, 2020
1 parent 6f5d1ee commit e98b2f9
Show file tree
Hide file tree
Showing 6 changed files with 0 additions and 1,332 deletions.
2 changes: 0 additions & 2 deletions js/SaveInterface.js
Original file line number Diff line number Diff line change
Expand Up @@ -213,8 +213,6 @@ function SaveInterface(PlanetInterface) {
this.saveWAV = function(filename) {
document.body.style.cursor = "wait";
this.filename = filename;
this.logo.playbackQueue = {};
this.logo.playbackTime = 0;
this.logo.compiling = true;
this.logo.recording = true;
console.debug("DURING SAVE WAV");
Expand Down
61 changes: 0 additions & 61 deletions js/activity.js
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,6 @@ function Activity() {
"utils/musicutils",
"utils/synthutils",
"utils/mathutils",
// 'activity/playbackbox',
"activity/pastebox",
"prefixfree.min"
];
Expand Down Expand Up @@ -2120,9 +2119,6 @@ function Activity() {
textMsg("Alt-E " + _("Erase"));
_allClear(false);
break;
case 80: // 'P'
// logo.playback(-1);
break;
case 82: // 'R'
textMsg("Alt-R " + _("Play"));
that._doFastButton();
Expand Down Expand Up @@ -2753,11 +2749,6 @@ function Activity() {
}
};

// function _doPlaybackBox() {
// // _hideBoxes();
// // playbackBox.init(turtleBlocksScale, playbackButton.x - 27, playbackButton.y, _makeButton, logo);
// };

/*
* @param {boolean} addStartBlock {if true adds a new start block to new project instance}
* @param {boolean} doNotSave {if true discards any changes to project}
Expand Down Expand Up @@ -2816,7 +2807,6 @@ function Activity() {

if (addStartBlock) {
console.debug("ADDING START BLOCK");
logo.playbackQueue = {};
blocks.loadNewBlocks(DATAOBJS);
_allClear(false);
} else if (!doNotSave) {
Expand Down Expand Up @@ -3161,7 +3151,6 @@ function Activity() {
// palettes.updatePalettes();
justLoadStart = function() {
console.debug("Loading start");
logo.playbackQueue = {};
blocks.loadNewBlocks(DATAOBJS);
};

Expand Down Expand Up @@ -3208,8 +3197,6 @@ function Activity() {

// Set flag to 1 to enable keyboard after MB finishes loading
keyboardEnableFlag = 1;

// playbackOnLoad();
}, 1000);
}

Expand Down Expand Up @@ -3243,7 +3230,6 @@ function Activity() {
blocks.palettes.dict[name].hideMenu(true);
}

logo.playbackQueue = {};
blocks.loadNewBlocks(JSON.parse(sessionData));
}
} catch (e) {
Expand Down Expand Up @@ -3610,9 +3596,6 @@ function Activity() {
/*
* We don't save blocks in the trash, so we need to
* consolidate the block list and remap the connections.
*
* Next, save the playback queue, but don't save the
* playback queue if we are saving to Lilypond.
*/
function prepareExport() {
let blockMap = [];
Expand Down Expand Up @@ -3775,28 +3758,6 @@ function Activity() {
}
}

// remap block connections

if (logo.runningLilypond) {
logo.playbackQueue = {};
}

let i = data.length;
if (i > 0) {
for (let turtle = 0; turtle < turtles.turtleList.length; turtle++) {
if (turtle in logo.playbackQueue) {
for (
let j = 0;
j < logo.playbackQueue[turtle].length;
j++
) {
data.push([i, turtle, logo.playbackQueue[turtle][j]]);
i += 1;
}
}
}
}

return JSON.stringify(data);
}

Expand Down Expand Up @@ -4845,22 +4806,6 @@ function Activity() {
_showHelp();
}

playbackOnLoad = function() {
/*
if (_THIS_IS_TURTLE_BLOCKS_) {
// Play playback queue if there is one.
for (turtle in logo.playbackQueue) {
if (logo.playbackQueue[turtle].length > 0) {
setTimeout(function () {
logo.playback(-1);
}, 3000);
break;
}
}
}
*/
};

function PlanetInterface(storage) {
this.planet = null;
this.iframe = null;
Expand Down Expand Up @@ -4957,7 +4902,6 @@ function Activity() {
}

let __afterLoad = function() {
// playbackOnLoad();
document.removeEventListener(
"finishedLoading",
__afterLoad
Expand All @@ -4972,7 +4916,6 @@ function Activity() {

try {
let obj = JSON.parse(data);
logo.playbackQueue = {};
blocks.loadNewBlocks(obj);
} catch (e) {
console.debug(
Expand Down Expand Up @@ -5353,7 +5296,6 @@ function Activity() {
if (!merging) {
// Wait for the old blocks to be removed.
let __listener = function(event) {
logo.playbackQueue = {};
blocks.loadNewBlocks(obj);
stage.removeAllEventListeners(
"trashsignal"
Expand All @@ -5380,7 +5322,6 @@ function Activity() {
}
} else {
merging = false;
logo.playbackQueue = {};
blocks.loadNewBlocks(obj);
}

Expand Down Expand Up @@ -5444,7 +5385,6 @@ function Activity() {
stage.removeAllEventListeners("trashsignal");

let __afterLoad = function() {
// playbackOnLoad();
document.removeEventListener(
"finishedLoading",
__afterLoad
Expand All @@ -5453,7 +5393,6 @@ function Activity() {

// Wait for the old blocks to be removed.
let __listener = function(event) {
logo.playbackQueue = {};
blocks.loadNewBlocks(obj);
stage.removeAllEventListeners("trashsignal");

Expand Down
67 changes: 0 additions & 67 deletions js/blocks.js
Original file line number Diff line number Diff line change
Expand Up @@ -5274,19 +5274,11 @@ function Blocks(activity) {
* return {void}
*/
this.loadNewBlocks = function(blockObjs) {
var playbackQueueStartsHere = null;

// Check for blocks connected to themselves,
// and for action blocks not connected to text blocks.
for (var b = 0; b < blockObjs.length; b++) {
var blkData = blockObjs[b];

// Check for playbackQueue
if (typeof blkData[1] === "number") {
playbackQueueStartsHere = b;
break;
}

for (var c in blkData[4]) {
if (blkData[4][c] === blkData[0]) {
console.debug(
Expand All @@ -5299,24 +5291,6 @@ function Blocks(activity) {
}
}

// Load any playback code into the queue...
if (playbackQueueStartsHere != null) {
for (var b = playbackQueueStartsHere; b < blockObjs.length; b++) {
var turtle = blockObjs[b][1];
if (turtle in this.logo.playbackQueue) {
this.logo.playbackQueue[turtle].push(blockObjs[b][2]);
} else {
this.logo.playbackQueue[turtle] = [blockObjs[b][2]];
}
}

// and remove the entries from the end of blockObjs.
var n = blockObjs.length;
for (var b = playbackQueueStartsHere; b < n; b++) {
blockObjs.pop();
}
}

// We'll need a list of existing storein and action names.
var currentActionNames = [];
var currentStoreinNames = [];
Expand Down Expand Up @@ -6681,47 +6655,6 @@ function Blocks(activity) {
}
}
}

if (playbackQueueStartsHere != null) {
var that = this;
setTimeout(function() {
// Now that we know how many turtles we have, we can make
// sure that the playback queue does not reference turtles
// that are not known to us.

// Find the first turtle not in the trash.
for (
var firstTurtle = 0;
firstTurtle < that.turtles.turtleList.length;
firstTurtle++
) {
if (!that.turtles.turtleList[firstTurtle].inTrash) {
break;
}
}

if (firstTurtle === that.turtles.turtleList.length) {
console.debug("Cannot find a turtle");
firstTurtle = 0;
}

// Is the first turtle in the playbackQueue?
if (!(firstTurtle in that.logo.playbackQueue)) {
for (turtle in that.logo.playbackQueue) {
console.debug(
"playbackQueue: remapping from " +
turtle +
" to " +
firstTurtle
);
that.logo.playbackQueue[firstTurtle] =
that.logo.playbackQueue[turtle];
delete that.logo.playbackQueue[turtle];
firstTurtle += 1;
}
}
}, 1500);
}
};

/*
Expand Down
Loading

0 comments on commit e98b2f9

Please sign in to comment.