diff --git a/Tone/core/Transport.js b/Tone/core/Transport.js index 7f963d13..4aebdd60 100644 --- a/Tone/core/Transport.js +++ b/Tone/core/Transport.js @@ -117,14 +117,6 @@ function(Tone){ */ this._scheduledEvents = {}; - /** - * The events to remove from the timelines. - * Each event is an object with an 'item' and a 'timeline'. - * @type {Array} - * @private - */ - this._eventsToRemove = []; - /** * The event ID counter * @type {Number} @@ -224,11 +216,6 @@ function(Tone){ this.trigger("loop", tickTime); } } - for (var i = 0; i < this._eventsToRemove.length; i++){ - var item = this._eventsToRemove[i]; - item.timeline.removeEvent(item.event); - } - this._eventsToRemove = []; var ticks = this._clock.ticks; //fire the next tick events if their time has come this._timeline.forEachAtTime(ticks, function(event){ @@ -342,7 +329,7 @@ function(Tone){ Tone.Transport.prototype.clear = function(eventId){ if (this._scheduledEvents.hasOwnProperty(eventId)){ var item = this._scheduledEvents[eventId.toString()]; - this._eventsToRemove.push(item); + item.timeline.removeEvent(item.event); delete this._scheduledEvents[eventId.toString()]; } return this;