automation-events
Advanced tools
Comparing version 3.0.8 to 3.0.9
@@ -113,6 +113,6 @@ import { createExtendedExponentialRampToValueAutomationEvent } from '../functions/create-extended-exponential-ramp-to-value-automation-event'; | ||
} | ||
const lastAutomationEvent = this._automationEvents[this._automationEvents.length - 1]; | ||
const index = this._automationEvents.findIndex((automationEvent) => getEventTime(automationEvent) > time); | ||
const nextAutomationEvent = this._automationEvents[index]; | ||
const currentAutomationEvent = getEventTime(lastAutomationEvent) <= time ? lastAutomationEvent : this._automationEvents[index - 1]; | ||
const indexOfNextEvent = this._automationEvents.findIndex((automationEvent) => getEventTime(automationEvent) > time); | ||
const nextAutomationEvent = this._automationEvents[indexOfNextEvent]; | ||
const indexOfCurrentEvent = (indexOfNextEvent === -1 ? this._automationEvents.length : indexOfNextEvent) - 1; | ||
const currentAutomationEvent = this._automationEvents[indexOfCurrentEvent]; | ||
if (currentAutomationEvent !== undefined && | ||
@@ -123,3 +123,3 @@ isSetTargetAutomationEvent(currentAutomationEvent) && | ||
nextAutomationEvent.insertTime > time)) { | ||
return getTargetValueAtTime(time, getValueOfAutomationEventAtIndexAtTime(this._automationEvents, index - 2, currentAutomationEvent.startTime, this._defaultValue), currentAutomationEvent); | ||
return getTargetValueAtTime(time, getValueOfAutomationEventAtIndexAtTime(this._automationEvents, indexOfCurrentEvent - 1, currentAutomationEvent.startTime, this._defaultValue), currentAutomationEvent); | ||
} | ||
@@ -147,7 +147,7 @@ if (currentAutomationEvent !== undefined && | ||
if (nextAutomationEvent !== undefined && isExponentialRampToValueAutomationEvent(nextAutomationEvent)) { | ||
const [startTime, value] = getEndTimeAndValueOfPreviousAutomationEvent(this._automationEvents, index - 1, currentAutomationEvent, nextAutomationEvent, this._defaultValue); | ||
const [startTime, value] = getEndTimeAndValueOfPreviousAutomationEvent(this._automationEvents, indexOfCurrentEvent, currentAutomationEvent, nextAutomationEvent, this._defaultValue); | ||
return getExponentialRampValueAtTime(time, startTime, value, nextAutomationEvent); | ||
} | ||
if (nextAutomationEvent !== undefined && isLinearRampToValueAutomationEvent(nextAutomationEvent)) { | ||
const [startTime, value] = getEndTimeAndValueOfPreviousAutomationEvent(this._automationEvents, index - 1, currentAutomationEvent, nextAutomationEvent, this._defaultValue); | ||
const [startTime, value] = getEndTimeAndValueOfPreviousAutomationEvent(this._automationEvents, indexOfCurrentEvent, currentAutomationEvent, nextAutomationEvent, this._defaultValue); | ||
return getLinearRampValueAtTime(time, startTime, value, nextAutomationEvent); | ||
@@ -154,0 +154,0 @@ } |
@@ -258,13 +258,12 @@ (function (global, factory) { | ||
var lastAutomationEvent = this._automationEvents[this._automationEvents.length - 1]; | ||
var index = this._automationEvents.findIndex(function (automationEvent) { | ||
var indexOfNextEvent = this._automationEvents.findIndex(function (automationEvent) { | ||
return getEventTime(automationEvent) > time; | ||
}); | ||
var nextAutomationEvent = this._automationEvents[index]; | ||
var currentAutomationEvent = getEventTime(lastAutomationEvent) <= time ? lastAutomationEvent : this._automationEvents[index - 1]; | ||
var nextAutomationEvent = this._automationEvents[indexOfNextEvent]; | ||
var indexOfCurrentEvent = (indexOfNextEvent === -1 ? this._automationEvents.length : indexOfNextEvent) - 1; | ||
var currentAutomationEvent = this._automationEvents[indexOfCurrentEvent]; | ||
if (currentAutomationEvent !== undefined && isSetTargetAutomationEvent(currentAutomationEvent) && (nextAutomationEvent === undefined || !isAnyRampToValueAutomationEvent(nextAutomationEvent) || nextAutomationEvent.insertTime > time)) { | ||
return getTargetValueAtTime(time, getValueOfAutomationEventAtIndexAtTime(this._automationEvents, index - 2, currentAutomationEvent.startTime, this._defaultValue), currentAutomationEvent); | ||
return getTargetValueAtTime(time, getValueOfAutomationEventAtIndexAtTime(this._automationEvents, indexOfCurrentEvent - 1, currentAutomationEvent.startTime, this._defaultValue), currentAutomationEvent); | ||
} | ||
@@ -289,3 +288,3 @@ | ||
if (nextAutomationEvent !== undefined && isExponentialRampToValueAutomationEvent(nextAutomationEvent)) { | ||
var _getEndTimeAndValueOf = getEndTimeAndValueOfPreviousAutomationEvent(this._automationEvents, index - 1, currentAutomationEvent, nextAutomationEvent, this._defaultValue), | ||
var _getEndTimeAndValueOf = getEndTimeAndValueOfPreviousAutomationEvent(this._automationEvents, indexOfCurrentEvent, currentAutomationEvent, nextAutomationEvent, this._defaultValue), | ||
_getEndTimeAndValueOf2 = _slicedToArray__default['default'](_getEndTimeAndValueOf, 2), | ||
@@ -299,3 +298,3 @@ startTime = _getEndTimeAndValueOf2[0], | ||
if (nextAutomationEvent !== undefined && isLinearRampToValueAutomationEvent(nextAutomationEvent)) { | ||
var _getEndTimeAndValueOf3 = getEndTimeAndValueOfPreviousAutomationEvent(this._automationEvents, index - 1, currentAutomationEvent, nextAutomationEvent, this._defaultValue), | ||
var _getEndTimeAndValueOf3 = getEndTimeAndValueOfPreviousAutomationEvent(this._automationEvents, indexOfCurrentEvent, currentAutomationEvent, nextAutomationEvent, this._defaultValue), | ||
_getEndTimeAndValueOf4 = _slicedToArray__default['default'](_getEndTimeAndValueOf3, 2), | ||
@@ -302,0 +301,0 @@ _startTime = _getEndTimeAndValueOf4[0], |
@@ -145,11 +145,10 @@ "use strict"; | ||
const lastAutomationEvent = this._automationEvents[this._automationEvents.length - 1]; | ||
const indexOfNextEvent = this._automationEvents.findIndex(automationEvent => (0, _getEventTime.getEventTime)(automationEvent) > time); | ||
const index = this._automationEvents.findIndex(automationEvent => (0, _getEventTime.getEventTime)(automationEvent) > time); | ||
const nextAutomationEvent = this._automationEvents[indexOfNextEvent]; | ||
const indexOfCurrentEvent = (indexOfNextEvent === -1 ? this._automationEvents.length : indexOfNextEvent) - 1; | ||
const currentAutomationEvent = this._automationEvents[indexOfCurrentEvent]; | ||
const nextAutomationEvent = this._automationEvents[index]; | ||
const currentAutomationEvent = (0, _getEventTime.getEventTime)(lastAutomationEvent) <= time ? lastAutomationEvent : this._automationEvents[index - 1]; | ||
if (currentAutomationEvent !== undefined && (0, _setTargetAutomationEvent.isSetTargetAutomationEvent)(currentAutomationEvent) && (nextAutomationEvent === undefined || !(0, _anyRampToValueAutomationEvent.isAnyRampToValueAutomationEvent)(nextAutomationEvent) || nextAutomationEvent.insertTime > time)) { | ||
return (0, _getTargetValueAtTime.getTargetValueAtTime)(time, (0, _getValueOfAutomationEventAtIndexAtTime.getValueOfAutomationEventAtIndexAtTime)(this._automationEvents, index - 2, currentAutomationEvent.startTime, this._defaultValue), currentAutomationEvent); | ||
return (0, _getTargetValueAtTime.getTargetValueAtTime)(time, (0, _getValueOfAutomationEventAtIndexAtTime.getValueOfAutomationEventAtIndexAtTime)(this._automationEvents, indexOfCurrentEvent - 1, currentAutomationEvent.startTime, this._defaultValue), currentAutomationEvent); | ||
} | ||
@@ -174,3 +173,3 @@ | ||
if (nextAutomationEvent !== undefined && (0, _exponentialRampToValueAutomationEvent.isExponentialRampToValueAutomationEvent)(nextAutomationEvent)) { | ||
const [startTime, value] = (0, _getEndTimeAndValueOfPreviousAutomationEvent.getEndTimeAndValueOfPreviousAutomationEvent)(this._automationEvents, index - 1, currentAutomationEvent, nextAutomationEvent, this._defaultValue); | ||
const [startTime, value] = (0, _getEndTimeAndValueOfPreviousAutomationEvent.getEndTimeAndValueOfPreviousAutomationEvent)(this._automationEvents, indexOfCurrentEvent, currentAutomationEvent, nextAutomationEvent, this._defaultValue); | ||
return (0, _getExponentialRampValueAtTime.getExponentialRampValueAtTime)(time, startTime, value, nextAutomationEvent); | ||
@@ -180,3 +179,3 @@ } | ||
if (nextAutomationEvent !== undefined && (0, _linearRampToValueAutomationEvent.isLinearRampToValueAutomationEvent)(nextAutomationEvent)) { | ||
const [startTime, value] = (0, _getEndTimeAndValueOfPreviousAutomationEvent.getEndTimeAndValueOfPreviousAutomationEvent)(this._automationEvents, index - 1, currentAutomationEvent, nextAutomationEvent, this._defaultValue); | ||
const [startTime, value] = (0, _getEndTimeAndValueOfPreviousAutomationEvent.getEndTimeAndValueOfPreviousAutomationEvent)(this._automationEvents, indexOfCurrentEvent, currentAutomationEvent, nextAutomationEvent, this._defaultValue); | ||
return (0, _getLinearRampValueAtTime.getLinearRampValueAtTime)(time, startTime, value, nextAutomationEvent); | ||
@@ -183,0 +182,0 @@ } |
@@ -18,25 +18,26 @@ { | ||
"devDependencies": { | ||
"@babel/core": "^7.13.10", | ||
"@babel/core": "^7.13.14", | ||
"@babel/plugin-external-helpers": "^7.12.13", | ||
"@babel/plugin-transform-runtime": "^7.13.10", | ||
"@babel/preset-env": "^7.13.10", | ||
"@babel/register": "^7.13.8", | ||
"@babel/preset-env": "^7.13.12", | ||
"@babel/register": "^7.13.14", | ||
"@commitlint/cli": "^12.0.1", | ||
"@commitlint/config-angular": "^12.0.1", | ||
"@rollup/plugin-babel": "^5.3.0", | ||
"chai": "^4.3.3", | ||
"chai": "^4.3.4", | ||
"commitizen": "^4.2.3", | ||
"cz-conventional-changelog": "^3.3.0", | ||
"eslint": "^7.21.0", | ||
"eslint-config-holy-grail": "^49.0.2", | ||
"eslint": "^7.23.0", | ||
"eslint-config-holy-grail": "^49.0.3", | ||
"grunt": "^1.3.0", | ||
"grunt-babel": "^8.0.0", | ||
"grunt-cli": "^1.3.2", | ||
"grunt-cli": "^1.4.1", | ||
"grunt-contrib-clean": "^2.0.0", | ||
"grunt-sh": "^0.2.0", | ||
"husky": "^4.3.8", | ||
"karma": "^6.2.0", | ||
"karma": "^6.3.2", | ||
"karma-chrome-launcher": "^3.1.0", | ||
"karma-firefox-launcher": "^2.1.0", | ||
"karma-mocha": "^2.0.1", | ||
"karma-safari-launcher": "^1.0.0", | ||
"karma-sauce-launcher": "^4.3.5", | ||
@@ -46,14 +47,14 @@ "karma-sinon-chai": "^2.0.2", | ||
"load-grunt-config": "^3.0.1", | ||
"mocha": "^8.3.1", | ||
"mocha": "^8.3.2", | ||
"prettier": "^2.2.1", | ||
"pretty-quick": "^3.1.0", | ||
"rollup": "^2.41.1", | ||
"sinon": "^9.2.4", | ||
"sinon-chai": "^3.5.0", | ||
"ts-loader": "^8.0.18", | ||
"tsconfig-holy-grail": "^11.0.47", | ||
"rollup": "^2.44.0", | ||
"sinon": "^10.0.0", | ||
"sinon-chai": "^3.6.0", | ||
"ts-loader": "^8.1.0", | ||
"tsconfig-holy-grail": "^11.0.49", | ||
"tslint": "^6.1.3", | ||
"tslint-config-holy-grail": "^53.2.8", | ||
"tslint-config-holy-grail": "^53.2.11", | ||
"typescript": "^4.2.3", | ||
"webpack": "^5.24.4" | ||
"webpack": "^5.28.0" | ||
}, | ||
@@ -93,3 +94,3 @@ "engines": { | ||
"types": "build/es2019/module.d.ts", | ||
"version": "3.0.8" | ||
"version": "3.0.9" | ||
} |
@@ -163,6 +163,6 @@ import { createExtendedExponentialRampToValueAutomationEvent } from '../functions/create-extended-exponential-ramp-to-value-automation-event'; | ||
const lastAutomationEvent = this._automationEvents[this._automationEvents.length - 1]; | ||
const index = this._automationEvents.findIndex((automationEvent) => getEventTime(automationEvent) > time); | ||
const nextAutomationEvent = this._automationEvents[index]; | ||
const currentAutomationEvent = getEventTime(lastAutomationEvent) <= time ? lastAutomationEvent : this._automationEvents[index - 1]; | ||
const indexOfNextEvent = this._automationEvents.findIndex((automationEvent) => getEventTime(automationEvent) > time); | ||
const nextAutomationEvent = this._automationEvents[indexOfNextEvent]; | ||
const indexOfCurrentEvent = (indexOfNextEvent === -1 ? this._automationEvents.length : indexOfNextEvent) - 1; | ||
const currentAutomationEvent = this._automationEvents[indexOfCurrentEvent]; | ||
@@ -180,3 +180,3 @@ if ( | ||
this._automationEvents, | ||
index - 2, | ||
indexOfCurrentEvent - 1, | ||
currentAutomationEvent.startTime, | ||
@@ -222,3 +222,3 @@ this._defaultValue | ||
this._automationEvents, | ||
index - 1, | ||
indexOfCurrentEvent, | ||
currentAutomationEvent, | ||
@@ -235,3 +235,3 @@ nextAutomationEvent, | ||
this._automationEvents, | ||
index - 1, | ||
indexOfCurrentEvent, | ||
currentAutomationEvent, | ||
@@ -238,0 +238,0 @@ nextAutomationEvent, |
Sorry, the diff of this file is not supported yet
162327
2058
40