automation-events
Advanced tools
Comparing version 7.0.10 to 7.1.0
import { ISetValueCurveAutomationEvent } from '../interfaces'; | ||
export declare const createSetValueCurveAutomationEvent: (values: Float32Array, startTime: number, duration: number) => ISetValueCurveAutomationEvent; | ||
export declare const createSetValueCurveAutomationEvent: (values: number[] | Float32Array, startTime: number, duration: number) => ISetValueCurveAutomationEvent; | ||
//# sourceMappingURL=create-set-value-curve-automation-event.d.ts.map |
@@ -1,2 +0,2 @@ | ||
export declare const interpolateValue: (values: Float32Array, theoreticIndex: number) => number; | ||
export declare const interpolateValue: (values: number[] | Float32Array, theoreticIndex: number) => number; | ||
//# sourceMappingURL=interpolate-value.d.ts.map |
@@ -1,2 +0,2 @@ | ||
export declare const truncateValueCurve: (values: Float32Array, originalDuration: number, targetDuration: number) => Float32Array; | ||
export declare const truncateValueCurve: <Values extends number[] | Float32Array>(values: Values, originalDuration: number, targetDuration: number) => Values; | ||
//# sourceMappingURL=truncate-value-curve.d.ts.map |
@@ -5,3 +5,3 @@ import { interpolateValue } from './interpolate-value'; | ||
const truncatedLength = Math.floor((targetDuration / originalDuration) * length) + 1; | ||
const truncatedValues = new Float32Array(truncatedLength); | ||
const truncatedValues = values instanceof Float32Array ? new Float32Array(truncatedLength) : values.slice(0, truncatedLength); | ||
for (let i = 0; i < truncatedLength; i += 1) { | ||
@@ -8,0 +8,0 @@ const time = (i / (truncatedLength - 1)) * targetDuration; |
@@ -5,4 +5,4 @@ export interface ISetValueCurveAutomationEvent { | ||
readonly type: 'setValueCurve'; | ||
readonly values: Float32Array; | ||
readonly values: number[] | Float32Array; | ||
} | ||
//# sourceMappingURL=set-value-curve-automation-event.d.ts.map |
@@ -11,3 +11,3 @@ "use strict"; | ||
const truncatedLength = Math.floor(targetDuration / originalDuration * length) + 1; | ||
const truncatedValues = new Float32Array(truncatedLength); | ||
const truncatedValues = values instanceof Float32Array ? new Float32Array(truncatedLength) : values.slice(0, truncatedLength); | ||
for (let i = 0; i < truncatedLength; i += 1) { | ||
@@ -14,0 +14,0 @@ const time = i / (truncatedLength - 1) * targetDuration; |
@@ -92,3 +92,3 @@ { | ||
"types": "build/es2019/module.d.ts", | ||
"version": "7.0.10" | ||
"version": "7.1.0" | ||
} |
import { ISetValueCurveAutomationEvent } from '../interfaces'; | ||
export const createSetValueCurveAutomationEvent = ( | ||
values: Float32Array, | ||
values: number[] | Float32Array, | ||
startTime: number, | ||
@@ -6,0 +6,0 @@ duration: number |
@@ -1,2 +0,2 @@ | ||
export const interpolateValue = (values: Float32Array, theoreticIndex: number) => { | ||
export const interpolateValue = (values: number[] | Float32Array, theoreticIndex: number) => { | ||
const lowerIndex = Math.floor(theoreticIndex); | ||
@@ -3,0 +3,0 @@ const upperIndex = Math.ceil(theoreticIndex); |
import { interpolateValue } from './interpolate-value'; | ||
export const truncateValueCurve = (values: Float32Array, originalDuration: number, targetDuration: number): Float32Array => { | ||
export const truncateValueCurve = <Values extends number[] | Float32Array>( | ||
values: Values, | ||
originalDuration: number, | ||
targetDuration: number | ||
): Values => { | ||
const length = values.length; | ||
const truncatedLength = Math.floor((targetDuration / originalDuration) * length) + 1; | ||
const truncatedValues = new Float32Array(truncatedLength); | ||
const truncatedValues = values instanceof Float32Array ? new Float32Array(truncatedLength) : values.slice(0, truncatedLength); | ||
@@ -15,3 +19,3 @@ for (let i = 0; i < truncatedLength; i += 1) { | ||
return truncatedValues; | ||
return <Values>truncatedValues; | ||
}; |
@@ -8,3 +8,3 @@ export interface ISetValueCurveAutomationEvent { | ||
readonly values: Float32Array; | ||
readonly values: number[] | Float32Array; | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
167004
2070