From d463286891a21eabbe755161b1a853e34bb767a7 Mon Sep 17 00:00:00 2001 From: Quargs Greene Date: Sat, 1 Oct 2022 22:38:20 -0700 Subject: [PATCH] custom decay curve #1107 --- Tone/component/envelope/Envelope.ts | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/Tone/component/envelope/Envelope.ts b/Tone/component/envelope/Envelope.ts index 7530cbdf..f633c234 100644 --- a/Tone/component/envelope/Envelope.ts +++ b/Tone/component/envelope/Envelope.ts @@ -141,7 +141,7 @@ export class Envelope extends ToneAudioNode { /** * The automation curve type for the decay */ - private _decayCurve!: BasicEnvelopeCurve; + private _decayCurve!: InternalEnvelopeCurve; /** * The automation curve type for the release @@ -322,12 +322,11 @@ export class Envelope extends ToneAudioNode { * env.triggerAttack(); * }, 1, 1); */ - get decayCurve(): BasicEnvelopeCurve { - return this._decayCurve; + get decayCurve(): EnvelopeCurve { + return this._getCurve(this._decayCurve, "Out"); } set decayCurve(curve) { - assert(["linear", "exponential"].some(c => c === curve), `Invalid envelope curve: ${curve}`); - this._decayCurve = curve; + this._setCurve("_decayCurve", "Out", curve); } /** @@ -475,7 +474,7 @@ export class Envelope extends ToneAudioNode { } /** - * Render the envelope curve to an array of the given length. + * Render the envelope curve to an array of the given length. * Good for visualizing the envelope curve. Rescales the duration of the * envelope to fit the length. */