mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-11 05:25:32 +03:00
LibWeb: Implement BaseAudioContext.createDynamicsCompressor
This commit is contained in:
parent
2a56df8ecd
commit
452ffa56dc
Notes:
sideshowbarker
2024-07-17 00:25:35 +09:00
Author: https://github.com/shannonbooth Commit: https://github.com/SerenityOS/serenity/commit/452ffa56dc Pull-request: https://github.com/SerenityOS/serenity/pull/24215
@ -0,0 +1,4 @@
|
||||
DynamicsCompressorNode
|
||||
AudioNode
|
||||
EventTarget
|
||||
Object
|
16
Tests/LibWeb/Text/input/WebAudio/DynamicsCompressorNode.html
Normal file
16
Tests/LibWeb/Text/input/WebAudio/DynamicsCompressorNode.html
Normal file
@ -0,0 +1,16 @@
|
||||
<script src="../include.js"></script>
|
||||
<script>
|
||||
test(() => {
|
||||
const audioContext = new OfflineAudioContext(1, 5000, 44100);
|
||||
|
||||
const compressor = audioContext.createDynamicsCompressor();
|
||||
|
||||
// Check prototype
|
||||
let prototype = Object.getPrototypeOf(compressor);
|
||||
|
||||
while (prototype) {
|
||||
println(prototype.constructor.name);
|
||||
prototype = Object.getPrototypeOf(prototype);
|
||||
}
|
||||
});
|
||||
</script>
|
@ -9,6 +9,7 @@
|
||||
#include <LibWeb/Bindings/Intrinsics.h>
|
||||
#include <LibWeb/HTML/EventNames.h>
|
||||
#include <LibWeb/WebAudio/BaseAudioContext.h>
|
||||
#include <LibWeb/WebAudio/DynamicsCompressorNode.h>
|
||||
#include <LibWeb/WebAudio/OscillatorNode.h>
|
||||
|
||||
namespace Web::WebAudio {
|
||||
@ -44,6 +45,13 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<OscillatorNode>> BaseAudioContext::create_o
|
||||
return OscillatorNode::create(realm(), *this);
|
||||
}
|
||||
|
||||
// https://webaudio.github.io/web-audio-api/#dom-baseaudiocontext-createdynamicscompressor
|
||||
WebIDL::ExceptionOr<JS::NonnullGCPtr<DynamicsCompressorNode>> BaseAudioContext::create_dynamics_compressor()
|
||||
{
|
||||
// Factory method for a DynamicsCompressorNode.
|
||||
return DynamicsCompressorNode::create(realm(), *this);
|
||||
}
|
||||
|
||||
// https://webaudio.github.io/web-audio-api/#dom-baseaudiocontext-createbuffer
|
||||
WebIDL::ExceptionOr<void> BaseAudioContext::verify_audio_options_inside_nominal_range(JS::Realm& realm, WebIDL::UnsignedLong number_of_channels, WebIDL::UnsignedLong length, float sample_rate)
|
||||
{
|
||||
|
@ -48,6 +48,7 @@ public:
|
||||
static WebIDL::ExceptionOr<void> verify_audio_options_inside_nominal_range(JS::Realm&, WebIDL::UnsignedLong number_of_channels, WebIDL::UnsignedLong length, float sample_rate);
|
||||
|
||||
WebIDL::ExceptionOr<JS::NonnullGCPtr<OscillatorNode>> create_oscillator();
|
||||
WebIDL::ExceptionOr<JS::NonnullGCPtr<DynamicsCompressorNode>> create_dynamics_compressor();
|
||||
|
||||
protected:
|
||||
explicit BaseAudioContext(JS::Realm&, float m_sample_rate = 0);
|
||||
|
@ -1,5 +1,6 @@
|
||||
#import <DOM/EventTarget.idl>
|
||||
#import <DOM/EventHandler.idl>
|
||||
#import <WebAudio/DynamicsCompressorNode.idl>
|
||||
#import <WebAudio/OscillatorNode.idl>
|
||||
|
||||
// https://www.w3.org/TR/webaudio/#enumdef-audiocontextstate
|
||||
@ -30,7 +31,7 @@ interface BaseAudioContext : EventTarget {
|
||||
// FIXME: ConstantSourceNode createConstantSource ();
|
||||
// FIXME: ConvolverNode createConvolver ();
|
||||
// FIXME: DelayNode createDelay (optional double maxDelayTime = 1.0);
|
||||
// FIXME: DynamicsCompressorNode createDynamicsCompressor ();
|
||||
DynamicsCompressorNode createDynamicsCompressor();
|
||||
// FIXME: GainNode createGain ();
|
||||
// FIXME: IIRFilterNode createIIRFilter (sequence<double> feedforward, sequence<double> feedback);
|
||||
OscillatorNode createOscillator();
|
||||
|
Loading…
Reference in New Issue
Block a user