From 0b3e33fab510beeeb2e5d4ae872c28e6138e0729 Mon Sep 17 00:00:00 2001 From: Paul Adenot Date: Wed, 4 Nov 2026 16:37:28 +0100 Subject: [PATCH] Fix AudioBuffer constructor nits - Operate on [=this=] instead of a new object b, which was mixed with "this". - Size [[internal data]] in bytes: 4 per sample. - Call the dictionary fields members, and refer to options directly. - Update the CreateByteDataBlock link to tc39.es. Fixes #1135. --- index.bs | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/index.bs b/index.bs index 27fa43165..08becf433 100644 --- a/index.bs +++ b/index.bs @@ -3116,19 +3116,17 @@ Constructors
1. If any of the values in {{AudioBuffer/constructor()/options!!argument}} lie outside its nominal range, throw a {{NotSupportedError}} exception and abort the following steps. - 1. Let b be a new {{AudioBuffer}} object. - 1. Respectively assign the values of the attributes + 1. Respectively assign the values of the members {{AudioBufferOptions/numberOfChannels}}, {{AudioBufferOptions/length}}, - {{AudioBufferOptions/sampleRate}} of the {{AudioBufferOptions}} passed - in the constructor to the internal slots {{[[number of channels]]}}, {{[[length]]}}, {{[[sample rate]]}}. + {{AudioBufferOptions/sampleRate}} of {{AudioBuffer/constructor()/options!!argument}} + to [=this=]'s internal slots {{[[number of channels]]}}, {{[[length]]}}, {{[[sample rate]]}}. - 1. Set the internal slot {{[[internal data]]}} of this - {{AudioBuffer}} to the result of calling - CreateByteDataBlock({{[[length]]}} * {{[[number of channels]]}}). + 1. Set [=this=]'s {{[[internal data]]}} to the result of calling + + CreateByteDataBlock({{[[length]]}} * {{[[number of channels]]}} * 4). - Note: This initializes the underlying storage to zero. - - 1. Return b. + Note: This initializes the underlying storage to zero. Each + sample is a 32-bit float, i.e. 4 bytes.
         options: An {{AudioBufferOptions}} that determine the properties for this {{AudioBuffer}}.