Commit Graph

68 Commits

Author SHA1 Message Date
Jelle Raaijmakers
35f4f5cf54 LibWeb: Implement AudioListener
This exposes BaseAudioContext.listener, which is a container for
parameters related to the configuration of an actual "listener" in 3D
space.

(cherry picked from commit 2a98f2a12d5069a2189fa38b4a7e158d84ee03ec)
2024-11-14 17:46:06 -05:00
Shannon Booth
224483b941 LibWeb: Add temp execution context for resolving promise in AudioContext
Fixes a crash seen on twitter.com, namely from the 'resume' function.

(cherry picked from commit 5d7a7a43c40f2413f6936ddd69794f8550172e09)
2024-11-13 19:32:02 -05:00
Jelle Raaijmakers
ec6803eb44 LibWeb: Implement pending promises in BaseAudioContext
Move the pending promises list from AudioContext to BaseAudioContext and
deal with all remaining FIXMEs.

(cherry picked from commit 2df3488840ccf8e8c560bde4826897c2023dbe29)
2024-11-13 19:32:02 -05:00
Pavel Shliak
df40a0cf2c LibAudio: Initialize GainNode properly
That helps to pass WPT tests
under /webaudio/the-audio-api/the-gainnode-interface/ctor-gain.html

(cherry picked from commit 4998385c7aeae21939f4ea24bb4f8c6eb477840b)
2024-11-13 10:17:34 -05:00
Jelle Raaijmakers
fb8870d710 LibWeb: Add barebones BaseAudioContext.decodeAudioData()
Implement just enough steps to get https://zty.pe/ working! :^)

(cherry picked from commit 14b2e5849d4b82aec6900253f6f035a9b356bad3)
2024-11-13 10:17:34 -05:00
Jelle Raaijmakers
4e0c54fa61 LibWeb: Accept JS::HeapFunction when queuing a media element task
This opens up the possibility of easier memory management in future
changes.

(cherry picked from commit 7b76438d579959edd800de14cb30c57eadb14669)
2024-11-13 10:17:34 -05:00
Jelle Raaijmakers
b5f61be76a LibWeb: Move 'queue a media element task' to BaseAudioContext
We need these steps to be available for the yet to be implemented
`BaseAudioContext.decodeAudioData()`.

(cherry picked from commit 177e5210e09ee4b5906e5d7db34154fae4ec76c6)
2024-11-13 10:17:34 -05:00
Jelle Raaijmakers
4a6281221e LibWeb: Remove unused include from AudioBuffer
(cherry picked from commit 273a46cc769d1ad614d974ca6c60fb4911e81a07)
2024-11-13 10:17:34 -05:00
Jelle Raaijmakers
d1a5ef62ce LibWeb: Correct AudioBuffer spec link
(cherry picked from commit 3df3977ca5f16ec3955e0222bc277fcf2619a915)
2024-11-13 10:17:34 -05:00
Pavel Shliak
3bbceb3a79 WebAudio: Initialize BiquadFilterNode properly
That helps to pass WPT tests
under webaudio/the-audio-api/the-biquadfilternode-interface/ctor-biquadfilter.html

(cherry picked from commit c78c7064228d41d2afddeba3a3900f0c772d7be4)
2024-11-12 04:24:21 -05:00
Pavel Shliak
a757259f32 LibAudio: Manage channelCount in DynamicsCompressorNode
That helps to pass more WPT tests
under /webaudio/the-audio-api/the-dynamicscompressornode-interface/ctor-dynamicscompressor.html

(cherry picked from commit 8ac60273a69cd900e744c375a5650438e9692b05)
2024-11-12 04:24:21 -05:00
Pavel Shliak
8818cca08a LibAudio: Manage channelCountMode in DynamicsCompressorNode
That helps to pass more WPT tests
under /webaudio/the-audio-api/the-dynamicscompressornode-interface/ctor-dynamicscompressor.html

(cherry picked from commit f2ed59879f7781019152a18740fc5743cc513016)
2024-11-12 04:24:21 -05:00
Jelle Raaijmakers
07b7693349 LibWeb: Implement AudioNode.channelCount
(cherry picked from commit cb212015505f9a029c282d13697c9bd7e33df513)
2024-11-11 19:54:09 -05:00
Jelle Raaijmakers
8c86f9ad75 LibWeb: Implement AudioNode.numberOfInputs and .numberOfOutputs
(cherry picked from commit 7b4f0d13eede588368189bb612ca9c90e2d56894)
2024-11-11 19:54:09 -05:00
Jelle Raaijmakers
7189d342f5 LibWeb: Forward declare AudioDestinationNode to break header loop
(cherry picked from commit d7a3bad2b4c08b02c3df73e6c344c6bf7dadcbeb)
2024-11-11 19:54:09 -05:00
bbb651
53e57868d2 WebAudio: Stub remainder of AudioBufferSourceNode
(cherry picked from commit 014a069157d3900d4f6149849d520f9cd9dbe0bf)
2024-07-29 06:30:08 -04:00
bbb651
6c93feee99 WebAudio: Stub AudioDestinationContext
And expose it through `BaseAudioContext::destination`

(cherry picked from commit 779e3072f93369cf3adef0379bf27ea55475b38b)
2024-07-29 06:30:08 -04:00
bbb651
ca1ff40d06 WebAudio: Import AudioNode directly in GainNode
(cherry picked from commit 9c1739842995ec3e98a4e13a89d4b066ebbb4391)
2024-07-29 06:30:08 -04:00
bbb651
1e66ec24fa WebAudio: BiquadFilterNode: Implement AudioParams and stub rest
(cherry picked from commit 150cef62a05b5eb028626352b54eb092cd7f2eef)
2024-07-29 06:30:08 -04:00
bbb651
e4959ef9f3 WebAudio: Stub/implement more of AudioNode
(cherry picked from commit 6d33cc2b3a3e8b2c570c80866c5aa666927d0ad5)
2024-07-29 06:30:08 -04:00
Shannon Booth
2dcb7ed910 WebAudio: Avoid throwing exception for stubbed AudioNode.connect
This stubs out enough to get https://athenacrisis.com/ far enough to
actually load :^)

(cherry picked from commit 52ccd69e49a26b5fd2747730e278503625eb71e7)
2024-07-28 20:21:18 -04:00
Shannon Booth
6b43561841 WebAudio: Avoid throwing exception for stubbed setValueAtTime
Instead, just log an error and continue on gracefully, returning an
instance of ourselves as spec'd.

(cherry picked from commit 52be4925bc3094d4e253649f0bf81dc520a9f390)
2024-07-28 20:21:18 -04:00
Shannon Booth
0ce3726d49 WebAudio: Add stub for AudioDestinationNode.destination
This is called by https://athenacrisis.com/ and passed through to
AudioNode.connect, which expects an AudioNode.

Implement this function enough so that we return an AudioNode so that
AudioNode.connect does not throw a TypeError.

(cherry picked from commit a51095f705c5a6bce2c291e8b51ac90182c63419)
2024-07-28 20:21:18 -04:00
Shannon Booth
ff5358d9b8 WebAudio: Add IDL interface for AudioDestinationNode
This is an AudioNode representing the final audio destination and is
what the user will ultimately hear.

This node is used as one of the connecting nodes in athenacrisis.com

Add a placeholder for the interface without anything backing it for now.

(cherry picked from commit 5eb80b8697d458ea2b70112a995e066f64b37ca6)
2024-07-28 20:21:18 -04:00
bbb651
a6ba31af93 WebAudio: Stub BiquadFilterNode
(cherry picked from commit 64663d53fa466dcb9b62becc352c92e3d932353b)
2024-07-23 13:06:46 -04:00
bbb651
db21801fbc WebAudio: Stub AudioBufferSourceNode
(cherry picked from commit 6672fb4b47ee0da35678f55088b4afdfce5fd10b)
2024-07-23 13:06:46 -04:00
Shannon Booth
6466fca20a LibWeb: Implement BaseAudioContext.createGain 2024-05-28 08:06:09 +02:00
Shannon Booth
1fa7235fec LibWeb: Add Implement GainNode interface
As with all other current audio nodes we still need to wire up the
inputs and outputs so it can be properly used in an audio context - but
this is enough to implement the public IDL interface.
2024-05-28 08:06:09 +02:00
Shannon Booth
71ccd8ad25 LibWeb: Implement BaseAudioContext.createBuffer
This is a simple factory function which effectively just calls the
AudioBuffer constructor.
2024-05-26 07:49:49 +02:00
Shannon Booth
17ae65cedc LibWeb: Implement AudioBuffer.copyToChannel 2024-05-26 07:48:37 +02:00
Tim Ledbetter
68a1a78a1a LibWeb: Use FIXME extended attribute where possible 2024-05-19 17:35:25 +02:00
Shannon Booth
4fe0cbcf85 LibWeb: Use 'FIXME' extended attribute where possible
This improves the debuggability of many live web pages :^)
2024-05-19 16:24:11 +02:00
Shannon Booth
3ccbc83168 LibWeb: Add a stubbed slot for DynamicsCompressorNode.reduction
For now, this slot is always 0 - (the default value per spec). But
once we start actually processing audio streams this internal slot
should be changed correspondingly.
2024-05-19 09:26:20 +02:00
Shannon Booth
cf615cbd1c LibWeb: Add AudioParams for DynamicsCompressorNode 2024-05-19 09:26:20 +02:00
Shannon Booth
452ffa56dc LibWeb: Implement BaseAudioContext.createDynamicsCompressor 2024-05-14 13:45:43 -04:00
Shannon Booth
2a56df8ecd LibWeb: Add scaffolding for DynamicsCompressorNode 2024-05-14 13:45:43 -04:00
Shannon Booth
5e7678d1c6 LibWeb: Implement AudioBuffer.copyFromChannel 2024-05-12 19:11:37 +02:00
Shannon Booth
94354ea7fb LibWeb: Clamp AudioParam's value between min and max
The spec isn't _super_ clear on how this is meant to be done, but the
way I understand this is that we should simply clamp the returned
'current value' between 'min' and 'max'.

Firefox does not appear to do this clamping, but Chrome does.
2024-05-04 14:01:38 +02:00
Shannon Booth
e2b5ff2450 LibWeb: Implement OscillatorNode.frequency
Which is an AudioParam clamped by the nyquist_frequency.
2024-05-04 14:01:38 +02:00
Shannon Booth
5f57596520 LibWeb: Pass through sample rate in OfflineAudioContext constructor
I can't actually spot in the spec where it explicitly says to pass this
through (unlike the AudioContext constructor) - but clearly this needs
to be passed through for an OfflineAudioContext to actually have a
sample rate!
2024-05-04 14:01:38 +02:00
Shannon Booth
303958a803 LibWeb: Add BaseAudioContext::nyquist_frequency helper function
As a convenient shorthand :^)
2024-05-04 14:01:38 +02:00
Shannon Booth
099c9e4a7e LibWeb: Implement OscillatorNode.type
This is a simple getter and setter of the OscillatorType enum, with
error checking to not allow 'custom', as that should only be changed
through 'setPeriodicWave()'.
2024-05-04 14:01:38 +02:00
Shannon Booth
b48ba823b9 LibWeb: Implement AudioNode.context
This is just a simple getter which returns the audio context that
created this audio node.
2024-05-04 14:01:38 +02:00
Shannon Booth
97576d27b9 LibWeb: Add constructor for OscillatorNode
This is still missing a bunch of spec steps to construct the
audio node based on the parameters of the OscillatorNode, but it is at
least enough to construct an object to be able to add a basic test which
can get built upon as more is implemented.
2024-05-04 14:01:38 +02:00
Shannon Booth
1678f43c38 LibWeb: Implement BaseAudioContext.createOscillator
Which currently will always throw an exception as it is unimplemented
under the hood - but this gives all of the plumbing we need in order to
create a oscillator node as used in the reduced turnstyle testcase.
2024-05-02 07:49:23 +02:00
Shannon Booth
a83f4216a5 LibWeb: Add stub IDL interface for OscillatorNode
This source node generates a periodic wave form.
2024-05-02 07:49:23 +02:00
Shannon Booth
c9b2c1c747 LibWeb: Add stub IDL interface for AudioScheduledSourceNode
This is a base class of a few different audio nodes, most notably for
our immediate needs - OscillatorNode.
2024-05-02 07:49:23 +02:00
Shannon Booth
6661c68b28 LibWeb: Add stub IDL interface for AudioNode
An AudioNode is the fundamental building block used in 'Audio
Contexts'. In our immediate case, the audio node we are working towards
implementing is an oscillating source node.
2024-05-02 07:49:23 +02:00
Shannon Booth
5ae0ac7b73 LibWeb: Add stub IDL interface for AudioParam
An AudioParam is a fundamental building block in WebAudio as it controls
the value of an individual parameter of an AudioNode, such as volume.
2024-05-02 07:49:23 +02:00
Shannon Booth
b1b7e2324a LibWeb: Add stub IDL interface for PeriodicWave
PeriodicWave represents an arbitrary periodic waveform to be used
with an OscillatorNode.
2024-05-02 07:49:23 +02:00