From c4aeb1560d6db542fbbff5e8cb8d325ba1982da2 Mon Sep 17 00:00:00 2001 From: Gabriel Brito Date: Thu, 10 Oct 2024 14:18:53 -0700 Subject: [PATCH 01/11] Adding the interrupted state --- index.bs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/index.bs b/index.bs index 7cbb11c22..5ece00608 100644 --- a/index.bs +++ b/index.bs @@ -718,7 +718,8 @@ for="BaseAudioContext">[[control thread state]] that take values from enum AudioContextState { "suspended", "running", - "closed" + "closed", + "interrupted" }; @@ -746,6 +747,12 @@ enum AudioContextState { This context has been released, and can no longer be used to process audio. All system audio resources have been released. + + + "interrupted" + + This context is currently interrupted and cannot process audio + until the interruption ends. @@ -11534,7 +11541,7 @@ and a rendering thread. The control thread is the thread from which the {{AudioContext}} is instantiated, and from which authors -manipulate the audio graph, that is, from where the operation on a +manipulate the audio graph, that is, from where the operations on a {{BaseAudioContext}} are invoked. The rendering thread is the thread on which the actual audio output is computed, in reaction to the calls from the control thread. It can be a @@ -11641,7 +11648,7 @@ The algorithm for rendering a block of audio from a {{BaseAudioContext}} in the algorithm of rendering a graph. The {{AudioContext}} rendering thread is driven by a -system-level audio callback, that is periodically +system-level audio callback, that is periodically called at regular intevals. Each call has a system-level audio callback buffer size, which is a varying number of sample-frames that needs to be computed on time before the next system-level audio callback arrives. From e1a5f2d1b7809e7af56203d5ef2e6a48457bb5cb Mon Sep 17 00:00:00 2001 From: Gabriel Brito Date: Thu, 7 Nov 2024 18:30:35 -0800 Subject: [PATCH 02/11] Adding algo steps for the interrupted state --- index.bs | 90 ++++++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 81 insertions(+), 9 deletions(-) diff --git a/index.bs b/index.bs index 5ece00608..1303b72bd 100644 --- a/index.bs +++ b/index.bs @@ -1969,26 +1969,40 @@ Methods 1. If [=this=]'s [=relevant global object=]'s [=associated Document=] is not [=fully active=] then return [=a promise rejected with=] "{{InvalidStateError}}" {{DOMException}}. - 1. Let promise be a new Promise. + 2. Let promise be a new Promise. - 2. If the {{[[control thread state]]}} on the - {{AudioContext}} is closed reject the + 3. If the {{[[control thread state]]}} on the + {{AudioContext}} is closed or interrupted reject the promise with {{InvalidStateError}}, abort these steps, returning promise. - 3. Set {{[[suspended by user]]}} to false. + 4. Set {{[[suspended by user]]}} to false. + + 4. If the {{BaseAudioContext/state}} attribute of the {{AudioContext}} is "{{AudioContextState/suspended}}" and the {{[[control thread state]]}} on the + {{AudioContext}} is interrupted: - 4. If the context is not allowed to start, append + 1. + queue a media element task to execute the following steps: + + 1. Set the {{BaseAudioContext/state}} attribute of the {{AudioContext}} to "{{AudioContextState/interrupted}}". + + 2. [=Queue a media element task=] to [=fire an event=] named + {{BaseAudioContext/statechange}} at the {{AudioContext}}. + + 2. Reject the promise with {{InvalidStateError}}, abort these steps, + returning promise. + + 5. If the context is not allowed to start, append promise to {{BaseAudioContext/[[pending promises]]}} and {{AudioContext/[[pending resume promises]]}} and abort these steps, returning promise. - 5. Set the {{[[control thread state]]}} on the + 6. Set the {{[[control thread state]]}} on the {{AudioContext}} to running. - 6. Queue a control message to resume the {{AudioContext}} with promise. + 7. Queue a control message to resume the {{AudioContext}} with promise. - 7. Return promise. + 8. Return promise.
@@ -4078,7 +4092,7 @@ Methods scheduled parameter changes with times greater than or equal to {{AudioParam/cancelAndHoldAtTime()/cancelTime!!argument}}. However, in addition, the automation value that would have happened at {{AudioParam/cancelAndHoldAtTime()/cancelTime!!argument}} is - then proprogated for all future time until other automation + then propagated for all future time until other automation events are introduced. The behavior of the timeline in the face of @@ -11968,6 +11982,64 @@ running the algorithm for an {{AudioNode}}, using an input buffer and the value(s) of the {{AudioParam}}(s) of this {{AudioNode}} as the input for this algorithm. +

Handling an interruption on the {{AudioContext}}

+ +The {{AudioContext}} |audioContext| performs the following steps on the rendering thread when an interruption happens. + +1. If the |audioContext|'s {{[[rendering thread state]]}} is closed or interrupted: + + 1. Abort these steps. + +1. If the |audioContext|'s {{[[rendering thread state]]}} is running: + + 1. Attempt to release system resources. + + 1. [=Queue a media element task=] to execute the following steps: + + 1. Set the |audioContext|'s {{[[control thread state]]}} to interrupted. + + 1. [=Fire an event=] named {{BaseAudioContext/statechange}} at the |audioContext|. + +1. If the |audioContext|'s {{[[rendering thread state]]}} is suspended: + + 1. [=Queue a media element task=] to execute the following steps: + + 1. Set the |audioContext|'s {{[[control thread state]]}} to interrupted. + +1. Set the |audioContext|'s {{[[rendering thread state]]}} to interrupted. + +Note: If the {{AudioContext}} is suspended a {{BaseAudioContext/statechange}} event is not fired for privacy reasons to avoid over-sharing user activity - e.g. when a phone call comes in or when the screen gets locked. + +The {{AudioContext}} |audioContext| performs the following steps on the rendering thread when the interruption ends. + +1. If the |audioContext|'s {{[[rendering thread state]]}} is not interrupted: + + 1. Abort these steps. + +1. If the |audioContext|'s {{[[rendering thread state]]}} was running before the interruption or if the the |audioContext|'s {{[[rendering thread state]]}} was suspended and {{AudioContext/resume}} was called during the interruption: + + 1. Attempt to acquire system resources. + + 2. Set the {{[[rendering thread state]]}} on the {{AudioContext}} to running. + + 3. Start rendering the audio graph. + + 4. [=Queue a media element task=] to execute the following steps: + + 1. If the {{BaseAudioContext/state}} attribute of the {{AudioContext}} is not already "{{AudioContextState/running}}": + + 1. Set the |audioContext|'s {{[[control thread state]]}} to running. + + 1. [=Fire an event=] named {{BaseAudioContext/statechange}} at the |audioContext|. + +1. If the |audioContext|'s {{[[rendering thread state]]}} was suspended before the interruption: + + 1. Set the {{[[rendering thread state]]}} on the {{AudioContext}} to suspended. + + 2. [=Queue a media element task=] to execute the following steps: + + 1. Set the |audioContext|'s {{[[control thread state]]}} to suspended. +

Handling an error from System Audio Resources on the {{AudioContext}}

From bcb20f498396e724230a652bb512ec8dc20bf1af Mon Sep 17 00:00:00 2001 From: Gabriel Brito Date: Fri, 8 Nov 2024 17:45:05 -0800 Subject: [PATCH 03/11] improve algorithms --- index.bs | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/index.bs b/index.bs index 1303b72bd..bab7478dd 100644 --- a/index.bs +++ b/index.bs @@ -752,7 +752,7 @@ enum AudioContextState { "interrupted" This context is currently interrupted and cannot process audio - until the interruption ends. + until the [=interruption=] ends.
@@ -1972,37 +1972,36 @@ Methods 2. Let promise be a new Promise. 3. If the {{[[control thread state]]}} on the - {{AudioContext}} is closed or interrupted reject the + {{AudioContext}} is closed reject the promise with {{InvalidStateError}}, abort these steps, returning promise. 4. Set {{[[suspended by user]]}} to false. - 4. If the {{BaseAudioContext/state}} attribute of the {{AudioContext}} is "{{AudioContextState/suspended}}" and the {{[[control thread state]]}} on the - {{AudioContext}} is interrupted: + 5. If the {{[[control thread state]]}} on the + {{AudioContext}} is suspended and there is an ongoing [=interruption=]: + + 1. Queue a media element task to execute the following steps: - 1. - queue a media element task to execute the following steps: - 1. Set the {{BaseAudioContext/state}} attribute of the {{AudioContext}} to "{{AudioContextState/interrupted}}". 2. [=Queue a media element task=] to [=fire an event=] named {{BaseAudioContext/statechange}} at the {{AudioContext}}. - + 2. Reject the promise with {{InvalidStateError}}, abort these steps, returning promise. - 5. If the context is not allowed to start, append + 6. If the context is not allowed to start, append promise to {{BaseAudioContext/[[pending promises]]}} and {{AudioContext/[[pending resume promises]]}} and abort these steps, returning promise. - 6. Set the {{[[control thread state]]}} on the + 7. Set the {{[[control thread state]]}} on the {{AudioContext}} to running. - 7. Queue a control message to resume the {{AudioContext}} with promise. + 8. Queue a control message to resume the {{AudioContext}} with promise. - 8. Return promise. + 9. Return promise.
@@ -11984,6 +11983,11 @@ buffer and the value(s) of the {{AudioParam}}(s) of this

Handling an interruption on the {{AudioContext}}

+An interruption is an event generated by the user agent when it needs to halt audio playback for +an {{AudioContext}}. For example, The user agent may create an interruption when another application +requests exclusive access to the audio output hardware. This could happen when there is an incoming +call from a VoIP application. + The {{AudioContext}} |audioContext| performs the following steps on the rendering thread when an interruption happens. 1. If the |audioContext|'s {{[[rendering thread state]]}} is closed or interrupted: @@ -12010,13 +12014,13 @@ The {{AudioContext}} |audioContext| performs the following steps on the rende Note: If the {{AudioContext}} is suspended a {{BaseAudioContext/statechange}} event is not fired for privacy reasons to avoid over-sharing user activity - e.g. when a phone call comes in or when the screen gets locked. -The {{AudioContext}} |audioContext| performs the following steps on the rendering thread when the interruption ends. +The {{AudioContext}} |audioContext| performs the following steps on the rendering thread when the [=interruption=] ends. 1. If the |audioContext|'s {{[[rendering thread state]]}} is not interrupted: 1. Abort these steps. -1. If the |audioContext|'s {{[[rendering thread state]]}} was running before the interruption or if the the |audioContext|'s {{[[rendering thread state]]}} was suspended and {{AudioContext/resume}} was called during the interruption: +1. If the |audioContext|'s {{[[rendering thread state]]}} was running before the [=interruption=] or if the the |audioContext|'s {{[[rendering thread state]]}} was suspended and {{AudioContext/resume}} was called during the [=interruption=]: 1. Attempt to acquire system resources. @@ -12032,7 +12036,7 @@ The {{AudioContext}} |audioContext| performs the following steps on the rende 1. [=Fire an event=] named {{BaseAudioContext/statechange}} at the |audioContext|. -1. If the |audioContext|'s {{[[rendering thread state]]}} was suspended before the interruption: +1. If the |audioContext|'s {{[[rendering thread state]]}} was suspended before the [=interruption=]: 1. Set the {{[[rendering thread state]]}} on the {{AudioContext}} to suspended. From ad456d077999e1b3e9a62c994d910203ab41d71a Mon Sep 17 00:00:00 2001 From: Gabriel Brito Date: Mon, 24 Feb 2025 14:01:12 -0800 Subject: [PATCH 04/11] Addressing formatting feedback --- index.bs | 79 ++++++++++++++++++++++---------------------------------- 1 file changed, 31 insertions(+), 48 deletions(-) diff --git a/index.bs b/index.bs index bab7478dd..e58b43a71 100644 --- a/index.bs +++ b/index.bs @@ -1249,8 +1249,7 @@ Methods 2. Reject promise with error, and remove it from {{BaseAudioContext/[[pending promises]]}}. - 3. - Queue a media element task to invoke + 3. [=Queue a media element task=] to invoke {{BaseAudioContext/decodeAudioData()/errorCallback!!argument}} with |error|. 5. Return promise. @@ -1286,8 +1285,7 @@ Methods [[WEBCODECS]]. 4. If |can decode| is `false`, - - queue a media element task to execute the following steps: + [=Queue a media element task=] to execute the following steps: 1. Let error be a DOMException whose name is {{EncodingError}}. @@ -1307,8 +1305,7 @@ Methods the sample-rate of {{BaseAudioContext/decodeAudioData(audioData, successCallback, errorCallback)/audioData!!argument}}. - 2. - queue a media element task to execute the following steps: + 2. [=Queue a media element task=] to execute the following steps: 1. Let buffer be an {{AudioBuffer}} containing the final result @@ -1811,15 +1808,13 @@ Methods There is no need to notify the control thread in this case.
- 4. - queue a media element task to execute the following steps: + 4. [=Queue a media element task=] to execute the following steps: 1. Resolve promise. 2. If the {{BaseAudioContext/state}} attribute of the {{AudioContext}} is not already "{{AudioContextState/closed}}": 1. Set the {{BaseAudioContext/state}} attribute of the {{AudioContext}} to "{{AudioContextState/closed}}". - 1. - queue a media element task to fire + 1. [=Queue a media element task=] to fire an event named {{BaseAudioContext/statechange}} at the {{AudioContext}}. @@ -1969,39 +1964,39 @@ Methods 1. If [=this=]'s [=relevant global object=]'s [=associated Document=] is not [=fully active=] then return [=a promise rejected with=] "{{InvalidStateError}}" {{DOMException}}. - 2. Let promise be a new Promise. + 1. Let promise be a new Promise. - 3. If the {{[[control thread state]]}} on the + 1. If the {{[[control thread state]]}} on the {{AudioContext}} is closed reject the promise with {{InvalidStateError}}, abort these steps, returning promise. - 4. Set {{[[suspended by user]]}} to false. + 1. Set {{[[suspended by user]]}} to false. - 5. If the {{[[control thread state]]}} on the + 1. If the {{[[control thread state]]}} on the {{AudioContext}} is suspended and there is an ongoing [=interruption=]: 1. Queue a media element task to execute the following steps: 1. Set the {{BaseAudioContext/state}} attribute of the {{AudioContext}} to "{{AudioContextState/interrupted}}". - 2. [=Queue a media element task=] to [=fire an event=] named + 1. [=Queue a media element task=] to [=fire an event=] named {{BaseAudioContext/statechange}} at the {{AudioContext}}. - 2. Reject the promise with {{InvalidStateError}}, abort these steps, + 1. Reject the promise with {{InvalidStateError}}, abort these steps, returning promise. - 6. If the context is not allowed to start, append + 1. If the context is not allowed to start, append promise to {{BaseAudioContext/[[pending promises]]}} and {{AudioContext/[[pending resume promises]]}} and abort these steps, returning promise. - 7. Set the {{[[control thread state]]}} on the + 1. Set the {{[[control thread state]]}} on the {{AudioContext}} to running. - 8. Queue a control message to resume the {{AudioContext}} with promise. + 1. Queue a control message to resume the {{AudioContext}} with promise. - 9. Return promise. + 1. Return promise.
@@ -2018,8 +2013,7 @@ Methods 3. Start rendering the audio graph. 4. In case of failure, - - queue a media element task to execute the following steps: + [=Queue a media element task=] to execute the following steps: 1. Reject all promises from {{AudioContext/[[pending resume promises]]}} in order, then clear {{AudioContext/[[pending resume promises]]}}. @@ -2027,8 +2021,7 @@ Methods 2. Additionally, remove those promises from {{BaseAudioContext/[[pending promises]]}}. - 5. - queue a media element task to execute the following steps: + 5. [=Queue a media element task=] to execute the following steps: 1. Resolve all promises from {{AudioContext/[[pending resume promises]]}} in order. 1. Clear {{AudioContext/[[pending resume promises]]}}. Additionally, remove those @@ -2102,8 +2095,7 @@ Methods 2. Set the {{[[rendering thread state]]}} on the {{AudioContext}} to suspended. - 3. - queue a media element task to execute the following steps: + 3. [=Queue a media element task=] to execute the following steps: 1. Resolve promise. @@ -2175,15 +2167,13 @@ Methods 1. If both |sinkId| and {{AudioContext/[[sink ID]]}} are a type of {{DOMString}}, and they are equal to each other, - - queue a media element task to resolve |p| and abort these steps. + [=Queue a media element task=] to resolve |p| and abort these steps. 1. If |sinkId| is a type of {{AudioSinkOptions}} and {{AudioContext/[[sink ID]]}} is a type of {{AudioSinkInfo}}, and {{AudioSinkOptions/type}} in |sinkId| and {{AudioSinkInfo/type}} in {{AudioContext/[[sink ID]]}} are equal, - - queue a media element task to resolve |p| and abort these steps. + [=Queue a media element task=] to resolve |p| and abort these steps. 1. Let |wasRunning| be true. @@ -2199,8 +2189,7 @@ Methods 1. Set the {{[[rendering thread state]]}} on the {{AudioContext}} to "suspended". - 1. - Queue a media element task to execute the following steps: + 1. [=Queue a media element task=] to execute the following steps: 1. If the {{BaseAudioContext/state}} attribute of the {{AudioContext}} is not already "{{AudioContextState/suspended}}": @@ -2221,8 +2210,7 @@ Methods In case of failure, reject |p| with "{{InvalidAccessError}}" abort the following steps. - 1. - Queue a media element task to execute the following steps: + 1. [=Queue a media element task=] to execute the following steps: 1. If |sinkId| is a type of {{DOMString}}, set {{AudioContext/[[sink ID]]}} to |sinkId|. Abort these steps. @@ -2248,8 +2236,7 @@ Methods 1. Set the {{[[rendering thread state]]}} on the {{AudioContext}} to "running". - 1. - Queue a media element task to execute the following steps: + 1. [=Queue a media element task=] to execute the following steps: 1. If the {{BaseAudioContext/state}} attribute of the {{AudioContext}} is not already "{{AudioContextState/running}}": @@ -2624,8 +2611,7 @@ Methods buffer.
  • Once the rendering is complete, - - queue a media element task to execute the following steps: + [=Queue a media element task=] to execute the following steps:
    1. Resolve the promise created by {{startRendering()}} @@ -2689,11 +2675,9 @@ Methods 2. Start rendering the audio graph. 3. In case of failure, - - queue a media element task to reject |promise| and abort the remaining steps. + [=Queue a media element task=] to reject |promise| and abort the remaining steps. - 4. - queue a media element task to execute the following steps: + 4. [=Queue a media element task=] to execute the following steps: 1. Resolve promise. @@ -10548,8 +10532,7 @@ Methods node name to processor constructor map of the associated {{AudioWorkletGlobalScope}}. - 1. - queue a media element task to append the key-value pair |name| → + 1. [=Queue a media element task=] to append the key-value pair |name| → |parameterDescriptorSequence| to the node name to parameter descriptor map of the associated {{BaseAudioContext}}.
  • @@ -12024,11 +12007,11 @@ The {{AudioContext}} |audioContext| performs the following steps on the rende 1. Attempt to acquire system resources. - 2. Set the {{[[rendering thread state]]}} on the {{AudioContext}} to running. + 1. Set the {{[[rendering thread state]]}} on the {{AudioContext}} to running. - 3. Start rendering the audio graph. + 1. Start rendering the audio graph. - 4. [=Queue a media element task=] to execute the following steps: + 1. [=Queue a media element task=] to execute the following steps: 1. If the {{BaseAudioContext/state}} attribute of the {{AudioContext}} is not already "{{AudioContextState/running}}": @@ -12040,7 +12023,7 @@ The {{AudioContext}} |audioContext| performs the following steps on the rende 1. Set the {{[[rendering thread state]]}} on the {{AudioContext}} to suspended. - 2. [=Queue a media element task=] to execute the following steps: + 1. [=Queue a media element task=] to execute the following steps: 1. Set the |audioContext|'s {{[[control thread state]]}} to suspended. From 00e44abf45f745b78dddeff271f68982bd3a1a80 Mon Sep 17 00:00:00 2001 From: Gabriel Brito Date: Mon, 24 Feb 2025 14:47:43 -0800 Subject: [PATCH 05/11] Wrapping lines to be 80 char length --- index.bs | 99 ++++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 64 insertions(+), 35 deletions(-) diff --git a/index.bs b/index.bs index e58b43a71..8a5dcd8bd 100644 --- a/index.bs +++ b/index.bs @@ -1962,7 +1962,10 @@ Methods When resume is called, execute these steps: - 1. If [=this=]'s [=relevant global object=]'s [=associated Document=] is not [=fully active=] then return [=a promise rejected with=] "{{InvalidStateError}}" {{DOMException}}. + 1. If [=this=]'s [=relevant global object=]'s + [=associated Document=] is not [=fully active=] then return + [=a promise rejected with=] "{{InvalidStateError}}" + {{DOMException}}. 1. Let promise be a new Promise. @@ -1973,26 +1976,28 @@ Methods 1. Set {{[[suspended by user]]}} to false. - 1. If the {{[[control thread state]]}} on the - {{AudioContext}} is suspended and there is an ongoing [=interruption=]: + 1. If the {{[[control thread state]]}} on the {{AudioContext}} is + suspended and there is an ongoing + [=interruption=]: 1. Queue a media element task to execute the following steps: - 1. Set the {{BaseAudioContext/state}} attribute of the {{AudioContext}} to "{{AudioContextState/interrupted}}". + 1. Set the {{BaseAudioContext/state}} attribute of the + {{AudioContext}} to "{{AudioContextState/interrupted}}". 1. [=Queue a media element task=] to [=fire an event=] named - {{BaseAudioContext/statechange}} at the {{AudioContext}}. + {{BaseAudioContext/statechange}} at the {{AudioContext}}. - 1. Reject the promise with {{InvalidStateError}}, abort these steps, - returning promise. + 1. Reject the promise with {{InvalidStateError}}, abort these + steps, returning promise. 1. If the context is not allowed to start, append - promise to {{BaseAudioContext/[[pending promises]]}} and - {{AudioContext/[[pending resume promises]]}} and abort these steps, returning - promise. + promise to {{BaseAudioContext/[[pending promises]]}} + and {{AudioContext/[[pending resume promises]]}} and abort + these steps, returning promise. - 1. Set the {{[[control thread state]]}} on the - {{AudioContext}} to running. + 1. Set the {{[[control thread state]]}} on the {{AudioContext}} to + running. 1. Queue a control message to resume the {{AudioContext}} with promise. @@ -11966,66 +11971,90 @@ buffer and the value(s) of the {{AudioParam}}(s) of this

    Handling an interruption on the {{AudioContext}}

    -An interruption is an event generated by the user agent when it needs to halt audio playback for -an {{AudioContext}}. For example, The user agent may create an interruption when another application -requests exclusive access to the audio output hardware. This could happen when there is an incoming -call from a VoIP application. +An interruption is an event generated by the user agent when it needs +to halt audio playback for an {{AudioContext}}. For example, The user agent may +create an interruption when another application requests exclusive access to the +audio output hardware. This could happen when there is an incoming call from a +VoIP application. -The {{AudioContext}} |audioContext| performs the following steps on the rendering thread when an interruption happens. +The {{AudioContext}} |audioContext| performs the following steps on the +rendering thread when an interruption happens. -1. If the |audioContext|'s {{[[rendering thread state]]}} is closed or interrupted: +1. If the |audioContext|'s {{[[rendering thread state]]}} is closed + or interrupted: 1. Abort these steps. -1. If the |audioContext|'s {{[[rendering thread state]]}} is running: +1. If the |audioContext|'s {{[[rendering thread state]]}} is + running: 1. Attempt to release system resources. 1. [=Queue a media element task=] to execute the following steps: - 1. Set the |audioContext|'s {{[[control thread state]]}} to interrupted. + 1. Set the |audioContext|'s {{[[control thread state]]}} to + interrupted. - 1. [=Fire an event=] named {{BaseAudioContext/statechange}} at the |audioContext|. + 1. [=Fire an event=] named {{BaseAudioContext/statechange}} at the + |audioContext|. -1. If the |audioContext|'s {{[[rendering thread state]]}} is suspended: +1. If the |audioContext|'s {{[[rendering thread state]]}} is + suspended: 1. [=Queue a media element task=] to execute the following steps: - 1. Set the |audioContext|'s {{[[control thread state]]}} to interrupted. + 1. Set the |audioContext|'s {{[[control thread state]]}} to + interrupted. -1. Set the |audioContext|'s {{[[rendering thread state]]}} to interrupted. +1. Set the |audioContext|'s {{[[rendering thread state]]}} to + interrupted. -Note: If the {{AudioContext}} is suspended a {{BaseAudioContext/statechange}} event is not fired for privacy reasons to avoid over-sharing user activity - e.g. when a phone call comes in or when the screen gets locked. +Note: If the {{AudioContext}} is suspended a +{{BaseAudioContext/statechange}} event is not fired for privacy reasons to avoid +over-sharing user activity - e.g. when a phone call comes in or when the screen +gets locked. -The {{AudioContext}} |audioContext| performs the following steps on the rendering thread when the [=interruption=] ends. +The {{AudioContext}} |audioContext| performs the following steps on the +rendering thread when the [=interruption=] ends. -1. If the |audioContext|'s {{[[rendering thread state]]}} is not interrupted: +1. If the |audioContext|'s {{[[rendering thread state]]}} is not + interrupted: 1. Abort these steps. -1. If the |audioContext|'s {{[[rendering thread state]]}} was running before the [=interruption=] or if the the |audioContext|'s {{[[rendering thread state]]}} was suspended and {{AudioContext/resume}} was called during the [=interruption=]: +1. If the |audioContext|'s {{[[rendering thread state]]}} was + running before the [=interruption=] or if the the + |audioContext|'s {{[[rendering thread state]]}} was suspended + and {{AudioContext/resume}} was called during the [=interruption=]: 1. Attempt to acquire system resources. - 1. Set the {{[[rendering thread state]]}} on the {{AudioContext}} to running. + 1. Set the {{[[rendering thread state]]}} on the {{AudioContext}} to + running. 1. Start rendering the audio graph. 1. [=Queue a media element task=] to execute the following steps: - 1. If the {{BaseAudioContext/state}} attribute of the {{AudioContext}} is not already "{{AudioContextState/running}}": + 1. If the {{BaseAudioContext/state}} attribute of the {{AudioContext}} + is not already "{{AudioContextState/running}}": - 1. Set the |audioContext|'s {{[[control thread state]]}} to running. + 1. Set the |audioContext|'s {{[[control thread state]]}} to + running. - 1. [=Fire an event=] named {{BaseAudioContext/statechange}} at the |audioContext|. + 1. [=Fire an event=] named {{BaseAudioContext/statechange}} at the + |audioContext|. -1. If the |audioContext|'s {{[[rendering thread state]]}} was suspended before the [=interruption=]: +1. If the |audioContext|'s {{[[rendering thread state]]}} was + suspended before the [=interruption=]: - 1. Set the {{[[rendering thread state]]}} on the {{AudioContext}} to suspended. + 1. Set the {{[[rendering thread state]]}} on the {{AudioContext}} to + suspended. 1. [=Queue a media element task=] to execute the following steps: - 1. Set the |audioContext|'s {{[[control thread state]]}} to suspended. + 1. Set the |audioContext|'s {{[[control thread state]]}} to + suspended.

    Handling an error from System Audio Resources on the {{AudioContext}}

    From 8e8db2a183a9528864add47e9af1eecf97db7331 Mon Sep 17 00:00:00 2001 From: Gabriel Brito Date: Mon, 24 Feb 2025 15:01:28 -0800 Subject: [PATCH 06/11] Only change 'Queue a media element task' for modified sections --- index.bs | 51 ++++++++++++++++++++++++++++++++++----------------- 1 file changed, 34 insertions(+), 17 deletions(-) diff --git a/index.bs b/index.bs index 8a5dcd8bd..6278b3666 100644 --- a/index.bs +++ b/index.bs @@ -1249,7 +1249,8 @@ Methods 2. Reject promise with error, and remove it from {{BaseAudioContext/[[pending promises]]}}. - 3. [=Queue a media element task=] to invoke + 3. + Queue a media element task to invoke {{BaseAudioContext/decodeAudioData()/errorCallback!!argument}} with |error|. 5. Return promise. @@ -1285,7 +1286,8 @@ Methods [[WEBCODECS]]. 4. If |can decode| is `false`, - [=Queue a media element task=] to execute the following steps: + + queue a media element task to execute the following steps: 1. Let error be a DOMException whose name is {{EncodingError}}. @@ -1305,7 +1307,8 @@ Methods the sample-rate of {{BaseAudioContext/decodeAudioData(audioData, successCallback, errorCallback)/audioData!!argument}}. - 2. [=Queue a media element task=] to execute the following steps: + 2. + queue a media element task to execute the following steps: 1. Let buffer be an {{AudioBuffer}} containing the final result @@ -1808,13 +1811,15 @@ Methods There is no need to notify the control thread in this case. - 4. [=Queue a media element task=] to execute the following steps: + 4. + queue a media element task to execute the following steps: 1. Resolve promise. 2. If the {{BaseAudioContext/state}} attribute of the {{AudioContext}} is not already "{{AudioContextState/closed}}": 1. Set the {{BaseAudioContext/state}} attribute of the {{AudioContext}} to "{{AudioContextState/closed}}". - 1. [=Queue a media element task=] to fire + 1. + queue a media element task to fire an event named {{BaseAudioContext/statechange}} at the {{AudioContext}}. @@ -2018,7 +2023,8 @@ Methods 3. Start rendering the audio graph. 4. In case of failure, - [=Queue a media element task=] to execute the following steps: + + queue a media element task to execute the following steps: 1. Reject all promises from {{AudioContext/[[pending resume promises]]}} in order, then clear {{AudioContext/[[pending resume promises]]}}. @@ -2026,7 +2032,8 @@ Methods 2. Additionally, remove those promises from {{BaseAudioContext/[[pending promises]]}}. - 5. [=Queue a media element task=] to execute the following steps: + 5. + queue a media element task to execute the following steps: 1. Resolve all promises from {{AudioContext/[[pending resume promises]]}} in order. 1. Clear {{AudioContext/[[pending resume promises]]}}. Additionally, remove those @@ -2100,7 +2107,8 @@ Methods 2. Set the {{[[rendering thread state]]}} on the {{AudioContext}} to suspended. - 3. [=Queue a media element task=] to execute the following steps: + 3. + queue a media element task to execute the following steps: 1. Resolve promise. @@ -2172,13 +2180,15 @@ Methods 1. If both |sinkId| and {{AudioContext/[[sink ID]]}} are a type of {{DOMString}}, and they are equal to each other, - [=Queue a media element task=] to resolve |p| and abort these steps. + + queue a media element task to resolve |p| and abort these steps. 1. If |sinkId| is a type of {{AudioSinkOptions}} and {{AudioContext/[[sink ID]]}} is a type of {{AudioSinkInfo}}, and {{AudioSinkOptions/type}} in |sinkId| and {{AudioSinkInfo/type}} in {{AudioContext/[[sink ID]]}} are equal, - [=Queue a media element task=] to resolve |p| and abort these steps. + + queue a media element task to resolve |p| and abort these steps. 1. Let |wasRunning| be true. @@ -2194,7 +2204,8 @@ Methods 1. Set the {{[[rendering thread state]]}} on the {{AudioContext}} to "suspended". - 1. [=Queue a media element task=] to execute the following steps: + 1. + Queue a media element task to execute the following steps: 1. If the {{BaseAudioContext/state}} attribute of the {{AudioContext}} is not already "{{AudioContextState/suspended}}": @@ -2215,7 +2226,8 @@ Methods In case of failure, reject |p| with "{{InvalidAccessError}}" abort the following steps. - 1. [=Queue a media element task=] to execute the following steps: + 1. + Queue a media element task to execute the following steps: 1. If |sinkId| is a type of {{DOMString}}, set {{AudioContext/[[sink ID]]}} to |sinkId|. Abort these steps. @@ -2241,7 +2253,8 @@ Methods 1. Set the {{[[rendering thread state]]}} on the {{AudioContext}} to "running". - 1. [=Queue a media element task=] to execute the following steps: + 1. + Queue a media element task to execute the following steps: 1. If the {{BaseAudioContext/state}} attribute of the {{AudioContext}} is not already "{{AudioContextState/running}}": @@ -2616,7 +2629,8 @@ Methods buffer.
  • Once the rendering is complete, - [=Queue a media element task=] to execute the following steps: + + queue a media element task to execute the following steps:
    1. Resolve the promise created by {{startRendering()}} @@ -2680,9 +2694,11 @@ Methods 2. Start rendering the audio graph. 3. In case of failure, - [=Queue a media element task=] to reject |promise| and abort the remaining steps. + + queue a media element task to reject |promise| and abort the remaining steps. - 4. [=Queue a media element task=] to execute the following steps: + 4. + queue a media element task to execute the following steps: 1. Resolve promise. @@ -10537,7 +10553,8 @@ Methods node name to processor constructor map of the associated {{AudioWorkletGlobalScope}}. - 1. [=Queue a media element task=] to append the key-value pair |name| → + 1. + queue a media element task to append the key-value pair |name| → |parameterDescriptorSequence| to the node name to parameter descriptor map of the associated {{BaseAudioContext}}. From b13f9238139d0518730e2c69438c96f0ac4d0285 Mon Sep 17 00:00:00 2001 From: Gabriel Brito Date: Mon, 24 Feb 2025 16:10:53 -0800 Subject: [PATCH 07/11] remove unnecessary example --- index.bs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/index.bs b/index.bs index 6278b3666..158ba739b 100644 --- a/index.bs +++ b/index.bs @@ -11991,10 +11991,9 @@ buffer and the value(s) of the {{AudioParam}}(s) of this An interruption is an event generated by the user agent when it needs to halt audio playback for an {{AudioContext}}. For example, The user agent may create an interruption when another application requests exclusive access to the -audio output hardware. This could happen when there is an incoming call from a -VoIP application. +audio output hardware. -The {{AudioContext}} |audioContext| performs the following steps on the +The {{AudioContext}} |context| performs the following steps on the rendering thread when an interruption happens. 1. If the |audioContext|'s {{[[rendering thread state]]}} is closed From b2562c9c21e2cb14b6a62edd2c52f51a427c4870 Mon Sep 17 00:00:00 2001 From: Gabriel Brito Date: Mon, 3 Mar 2025 17:00:50 -0800 Subject: [PATCH 08/11] Rewording text to better match with Audio Session spec --- index.bs | 42 ++++++++++++++++++++++++------------------ 1 file changed, 24 insertions(+), 18 deletions(-) diff --git a/index.bs b/index.bs index 158ba739b..e5bd48e54 100644 --- a/index.bs +++ b/index.bs @@ -11993,36 +11993,39 @@ to halt audio playback for an {{AudioContext}}. For example, The user agent may create an interruption when another application requests exclusive access to the audio output hardware. -The {{AudioContext}} |context| performs the following steps on the -rendering thread when an interruption happens. +When an [=interruption=] happens, the user agent must Queue a control message +to interrupt the {{AudioContext}}. -1. If the |audioContext|'s {{[[rendering thread state]]}} is closed +Running a control message to interrupt an {{AudioContext}} |context| +means running these steps on the rendering thread: + +1. If the |context|'s {{[[rendering thread state]]}} is closed or interrupted: 1. Abort these steps. -1. If the |audioContext|'s {{[[rendering thread state]]}} is +1. If the |context|'s {{[[rendering thread state]]}} is running: 1. Attempt to release system resources. 1. [=Queue a media element task=] to execute the following steps: - 1. Set the |audioContext|'s {{[[control thread state]]}} to + 1. Set the |context|'s {{[[control thread state]]}} to interrupted. 1. [=Fire an event=] named {{BaseAudioContext/statechange}} at the - |audioContext|. + |context|. -1. If the |audioContext|'s {{[[rendering thread state]]}} is +1. If the |context|'s {{[[rendering thread state]]}} is suspended: 1. [=Queue a media element task=] to execute the following steps: - 1. Set the |audioContext|'s {{[[control thread state]]}} to + 1. Set the |context|'s {{[[control thread state]]}} to interrupted. -1. Set the |audioContext|'s {{[[rendering thread state]]}} to +1. Set the |context|'s {{[[rendering thread state]]}} to interrupted. Note: If the {{AudioContext}} is suspended a @@ -12030,17 +12033,20 @@ Note: If the {{AudioContext}} is suspended a over-sharing user activity - e.g. when a phone call comes in or when the screen gets locked. -The {{AudioContext}} |audioContext| performs the following steps on the -rendering thread when the [=interruption=] ends. +When an [=interruption=] ends, the user agent must Queue a control message +to end the {{AudioContext}} interruption. + +Running a control message to end an {{AudioContext}} |context| +[=interruption=] means running these steps on the rendering thread: -1. If the |audioContext|'s {{[[rendering thread state]]}} is not +1. If the |context|'s {{[[rendering thread state]]}} is not interrupted: 1. Abort these steps. -1. If the |audioContext|'s {{[[rendering thread state]]}} was +1. If the |context|'s {{[[rendering thread state]]}} was running before the [=interruption=] or if the the - |audioContext|'s {{[[rendering thread state]]}} was suspended + |context|'s {{[[rendering thread state]]}} was suspended and {{AudioContext/resume}} was called during the [=interruption=]: 1. Attempt to acquire system resources. @@ -12055,13 +12061,13 @@ The {{AudioContext}} |audioContext| performs the following steps on the 1. If the {{BaseAudioContext/state}} attribute of the {{AudioContext}} is not already "{{AudioContextState/running}}": - 1. Set the |audioContext|'s {{[[control thread state]]}} to + 1. Set the |context|'s {{[[control thread state]]}} to running. 1. [=Fire an event=] named {{BaseAudioContext/statechange}} at the - |audioContext|. + |context|. -1. If the |audioContext|'s {{[[rendering thread state]]}} was +1. If the |context|'s {{[[rendering thread state]]}} was suspended before the [=interruption=]: 1. Set the {{[[rendering thread state]]}} on the {{AudioContext}} to @@ -12069,7 +12075,7 @@ The {{AudioContext}} |audioContext| performs the following steps on the 1. [=Queue a media element task=] to execute the following steps: - 1. Set the |audioContext|'s {{[[control thread state]]}} to + 1. Set the |context|'s {{[[control thread state]]}} to suspended.

      From 075aad20f1f7db6d8710701faaf6a10dac39a248 Mon Sep 17 00:00:00 2001 From: Gabriel Brito Date: Mon, 3 Mar 2025 18:31:09 -0800 Subject: [PATCH 09/11] Add links to interruption definitions --- index.bs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/index.bs b/index.bs index e5bd48e54..a754fd011 100644 --- a/index.bs +++ b/index.bs @@ -11993,10 +11993,11 @@ to halt audio playback for an {{AudioContext}}. For example, The user agent may create an interruption when another application requests exclusive access to the audio output hardware. -When an [=interruption=] happens, the user agent must Queue a control message +When an [=interruption=] happens, the user agent must queue a control message to interrupt the {{AudioContext}}. -Running a control message to interrupt an {{AudioContext}} |context| +Running a control message to interrupt an {{AudioContext}} |context| means running these steps on the rendering thread: 1. If the |context|'s {{[[rendering thread state]]}} is closed @@ -12033,8 +12034,11 @@ Note: If the {{AudioContext}} is suspended a over-sharing user activity - e.g. when a phone call comes in or when the screen gets locked. -When an [=interruption=] ends, the user agent must Queue a control message -to end the {{AudioContext}} interruption. +When an [=interruption=] ends, the user agent must queue a control message +to end the +{{AudioContext}} interruption. + +Linear pulse code modulation Running a control message to end an {{AudioContext}} |context| [=interruption=] means running these steps on the rendering thread: From b29754125445abd931d434474000b4a5f77cd13e Mon Sep 17 00:00:00 2001 From: Gabriel Brito Date: Fri, 14 Mar 2025 22:07:59 -0700 Subject: [PATCH 10/11] addressing review feedback --- index.bs | 90 ++++++++++++++++++++++++++++++++------------------------ 1 file changed, 52 insertions(+), 38 deletions(-) diff --git a/index.bs b/index.bs index a754fd011..3f93bfbaa 100644 --- a/index.bs +++ b/index.bs @@ -709,10 +709,12 @@ Each {{BaseAudioContext}} has a unique media element event task source. Additionally, a {{BaseAudioContext}} has several private slots [[rendering thread state]] and [[control thread state]] that take values from -{{AudioContextState}}, and that are both initially set to "suspended" -, and a private slot -[[render quantum size]] that is an unsigned integer. +for="BaseAudioContext">[[control thread state]] that take values +from {{AudioContextState}}, and that are both initially set to "suspended" +, [[interrupt end return state]] + that also take values from {{AudioContextState}} and is initially set to +`null` and a private slot [[render quantum +size]] that is an unsigned integer.
       enum AudioContextState {
      @@ -1549,6 +1551,8 @@ Constructors

      1. Set a {{[[rendering thread state]]}} to suspended on |context|. + + 1. Set {{[[interrupt end return state]]}} to `null` on |context|. 1. Let |messageChannel| be a new {{MessageChannel}}. @@ -1980,15 +1984,19 @@ Methods returning promise. 1. Set {{[[suspended by user]]}} to false. + + 1. If the context's {{BaseAudioContext/state}} attribute is + "{{AudioContextState/suspended}}" and the context's + {{[[control thread state]]}} is + "{{AudioContextState/interrupted}}", then: - 1. If the {{[[control thread state]]}} on the {{AudioContext}} is - suspended and there is an ongoing - [=interruption=]: - - 1. Queue a media element task to execute the following steps: + 1. Queue a media element task to execute the following steps: 1. Set the {{BaseAudioContext/state}} attribute of the {{AudioContext}} to "{{AudioContextState/interrupted}}". + + 1. Set the {{[[interrupt end return state]]}} slot to + "{{AudioContextState/running}}". 1. [=Queue a media element task=] to [=fire an event=] named {{BaseAudioContext/statechange}} at the {{AudioContext}}. @@ -2105,14 +2113,19 @@ Methods 1. Attempt to release system resources. - 2. Set the {{[[rendering thread state]]}} on the {{AudioContext}} to suspended. + 1. If the {{[[rendering thread state]]}} on the {{AudioContext}} is + "{{AudioContextState/interrupted}}", queue a media element + task to set the {{[[interrupt end return state]]}} slot to + "{{AudioContextState/suspended}}". - 3. - queue a media element task to execute the following steps: + 1. Set the {{[[rendering thread state]]}} on the {{AudioContext}} to + "{{AudioContextState/suspended}}". + + 1. Queue a media element task to execute the following steps: 1. Resolve promise. - 2. If the {{BaseAudioContext/state}} + 1. If the {{BaseAudioContext/state}} attribute of the {{AudioContext}} is not already "{{AudioContextState/suspended}}": 1. Set the {{BaseAudioContext/state}} attribute of the {{AudioContext}} to "{{AudioContextState/suspended}}". @@ -11993,70 +12006,69 @@ to halt audio playback for an {{AudioContext}}. For example, The user agent may create an interruption when another application requests exclusive access to the audio output hardware. -When an [=interruption=] happens, the user agent must queue a control message +When an [=interruption=] happens, the user agent MUST queue a control message to interrupt the {{AudioContext}}. Running a control message to interrupt an {{AudioContext}} |context| means running these steps on the rendering thread: -1. If the |context|'s {{[[rendering thread state]]}} is closed - or interrupted: - - 1. Abort these steps. +1. If the |context|'s {{[[rendering thread state]]}} is + {{AudioContextState/closed}} or {{AudioContextState/interrupted}}, abort + these steps. 1. If the |context|'s {{[[rendering thread state]]}} is - running: + {{AudioContextState/running}}: 1. Attempt to release system resources. 1. [=Queue a media element task=] to execute the following steps: 1. Set the |context|'s {{[[control thread state]]}} to - interrupted. + {{AudioContextState/interrupted}}. + + 1. Set the |context|'s {{[[interrupt end return state]]}} slot to + "{{AudioContextState/running}}". 1. [=Fire an event=] named {{BaseAudioContext/statechange}} at the |context|. 1. If the |context|'s {{[[rendering thread state]]}} is - suspended: + {{AudioContextState/suspended}}: 1. [=Queue a media element task=] to execute the following steps: 1. Set the |context|'s {{[[control thread state]]}} to - interrupted. + {{AudioContextState/interrupted}}. + + 1. Set the |context|'s {{[[interrupt end return state]]}} slot to + "{{AudioContextState/suspended}}". 1. Set the |context|'s {{[[rendering thread state]]}} to - interrupted. + {{AudioContextState/interrupted}}. -Note: If the {{AudioContext}} is suspended a +Note: If the {{AudioContext}} is {{AudioContextState/suspended}} a {{BaseAudioContext/statechange}} event is not fired for privacy reasons to avoid over-sharing user activity - e.g. when a phone call comes in or when the screen gets locked. -When an [=interruption=] ends, the user agent must queue a control message +When an [=interruption=] ends, the user agent MUST queue a control message to end the {{AudioContext}} interruption. -Linear pulse code modulation - Running a control message to end an {{AudioContext}} |context| [=interruption=] means running these steps on the rendering thread: 1. If the |context|'s {{[[rendering thread state]]}} is not - interrupted: + {{AudioContextState/interrupted}}, abort these steps. - 1. Abort these steps. - -1. If the |context|'s {{[[rendering thread state]]}} was - running before the [=interruption=] or if the the - |context|'s {{[[rendering thread state]]}} was suspended - and {{AudioContext/resume}} was called during the [=interruption=]: +1. If the |context|'s {{[[interrupt end return state]]}} is + "{{AudioContextState/running}}": 1. Attempt to acquire system resources. 1. Set the {{[[rendering thread state]]}} on the {{AudioContext}} to - running. + "{{AudioContextState/running}}". 1. Start rendering the audio graph. @@ -12066,13 +12078,13 @@ Running a control message to end an {{AudioContext}} |context| is not already "{{AudioContextState/running}}": 1. Set the |context|'s {{[[control thread state]]}} to - running. + "{{AudioContextState/running}}". 1. [=Fire an event=] named {{BaseAudioContext/statechange}} at the |context|. -1. If the |context|'s {{[[rendering thread state]]}} was - suspended before the [=interruption=]: +1. If the |context|'s {{[[interrupt end return state]]}} is + "{{AudioContextState/suspended}}" 1. Set the {{[[rendering thread state]]}} on the {{AudioContext}} to suspended. @@ -12082,6 +12094,8 @@ Running a control message to end an {{AudioContext}} |context| 1. Set the |context|'s {{[[control thread state]]}} to suspended. +1. Set the |context|'s {{[[interrupt end return state]]}} to `null`. +

      Handling an error from System Audio Resources on the {{AudioContext}}

      From 08fb3cd126ea9d72c2c9bdd322b20b07d08e997e Mon Sep 17 00:00:00 2001 From: Gabriel Brito Date: Mon, 17 Mar 2025 10:54:53 -0700 Subject: [PATCH 11/11] Rename internal slot to 'state before interruption' --- index.bs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/index.bs b/index.bs index 3f93bfbaa..254d34d30 100644 --- a/index.bs +++ b/index.bs @@ -711,7 +711,7 @@ Additionally, a {{BaseAudioContext}} has several private slots [[rendering thread state]] and [[control thread state]] that take values from {{AudioContextState}}, and that are both initially set to "suspended" -, [[interrupt end return state]] +, [[state before interruption]] that also take values from {{AudioContextState}} and is initially set to `null` and a private slot [[render quantum size]] that is an unsigned integer. @@ -1552,7 +1552,7 @@ Constructors 1. Set a {{[[rendering thread state]]}} to suspended on |context|. - 1. Set {{[[interrupt end return state]]}} to `null` on |context|. + 1. Set {{[[state before interruption]]}} to `null` on |context|. 1. Let |messageChannel| be a new {{MessageChannel}}. @@ -1995,7 +1995,7 @@ Methods 1. Set the {{BaseAudioContext/state}} attribute of the {{AudioContext}} to "{{AudioContextState/interrupted}}". - 1. Set the {{[[interrupt end return state]]}} slot to + 1. Set the {{[[state before interruption]]}} slot to "{{AudioContextState/running}}". 1. [=Queue a media element task=] to [=fire an event=] named @@ -2115,7 +2115,7 @@ Methods 1. If the {{[[rendering thread state]]}} on the {{AudioContext}} is "{{AudioContextState/interrupted}}", queue a media element - task to set the {{[[interrupt end return state]]}} slot to + task to set the {{[[state before interruption]]}} slot to "{{AudioContextState/suspended}}". 1. Set the {{[[rendering thread state]]}} on the {{AudioContext}} to @@ -12027,7 +12027,7 @@ means running these steps on the rendering thread: 1. Set the |context|'s {{[[control thread state]]}} to {{AudioContextState/interrupted}}. - 1. Set the |context|'s {{[[interrupt end return state]]}} slot to + 1. Set the |context|'s {{[[state before interruption]]}} slot to "{{AudioContextState/running}}". 1. [=Fire an event=] named {{BaseAudioContext/statechange}} at the @@ -12041,7 +12041,7 @@ means running these steps on the rendering thread: 1. Set the |context|'s {{[[control thread state]]}} to {{AudioContextState/interrupted}}. - 1. Set the |context|'s {{[[interrupt end return state]]}} slot to + 1. Set the |context|'s {{[[state before interruption]]}} slot to "{{AudioContextState/suspended}}". 1. Set the |context|'s {{[[rendering thread state]]}} to @@ -12062,7 +12062,7 @@ Running a control message to end an {{AudioContext}} |context| 1. If the |context|'s {{[[rendering thread state]]}} is not {{AudioContextState/interrupted}}, abort these steps. -1. If the |context|'s {{[[interrupt end return state]]}} is +1. If the |context|'s {{[[state before interruption]]}} is "{{AudioContextState/running}}": 1. Attempt to acquire system resources. @@ -12083,7 +12083,7 @@ Running a control message to end an {{AudioContext}} |context| 1. [=Fire an event=] named {{BaseAudioContext/statechange}} at the |context|. -1. If the |context|'s {{[[interrupt end return state]]}} is +1. If the |context|'s {{[[state before interruption]]}} is "{{AudioContextState/suspended}}" 1. Set the {{[[rendering thread state]]}} on the {{AudioContext}} to @@ -12094,7 +12094,7 @@ Running a control message to end an {{AudioContext}} |context| 1. Set the |context|'s {{[[control thread state]]}} to suspended. -1. Set the |context|'s {{[[interrupt end return state]]}} to `null`. +1. Set the |context|'s {{[[state before interruption]]}} to `null`.

      Handling an error from System Audio Resources on the {{AudioContext}}