From 5433e4fa6168d1d1407b0f88cf264685149c2886 Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Sun, 4 May 2014 22:24:10 -0700 Subject: [PATCH] Added loopStart, loopEnd and onended properties to AudioBufferSourceNode in the webaudioapi definition to match the latest W3C spec: http://www.w3.org/TR/webaudio/#AudioBufferSourceNode --- webaudioapi/waa-tests.ts | 3 +++ webaudioapi/waa.d.ts | 15 +++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/webaudioapi/waa-tests.ts b/webaudioapi/waa-tests.ts index 39d7549e3b..da19577f06 100644 --- a/webaudioapi/waa-tests.ts +++ b/webaudioapi/waa-tests.ts @@ -60,6 +60,9 @@ declare var footstepsBuffer: any; lowpassFilter.connect(wet1); dry1.connect(masterDry); wet1.connect(reverb); + source1.loop = true; + source1.loopStart = 0; + source1.loopEnd = 300; // Connect source2 var dry2 = context.createGain(); diff --git a/webaudioapi/waa.d.ts b/webaudioapi/waa.d.ts index cd53babc0c..e0112f078c 100644 --- a/webaudioapi/waa.d.ts +++ b/webaudioapi/waa.d.ts @@ -520,6 +520,21 @@ interface AudioBufferSourceNode extends AudioSourceNode { */ loop: boolean; + /** + * An optional value in seconds where looping should begin if the loop attribute is true. Its default value is 0, and it may usefully be set to any value between 0 and the duration of the buffer. + */ + loopStart: number; + + /** + * An optional value in seconds where looping should end if the loop attribute is true. Its default value is 0, and it may usefully be set to any value between 0 and the duration of the buffer. + */ + loopEnd: number; + + /** + * A property used to set the EventHandler for the ended event that is dispatched to AudioBufferSourceNode node types. When the playback of the buffer for an AudioBufferSourceNode is finished, an event of type Event will be dispatched to the event handler. + */ + onended: EventListener; + /** * Schedules a sound to playback at an exact time. *