LibWeb: Implement AudioNode.numberOfInputs and .numberOfOutputs

This commit is contained in:
Jelle Raaijmakers 2024-10-08 12:03:50 +02:00 committed by Andreas Kling
parent d7a3bad2b4
commit 7b4f0d13ee
Notes: github-actions[bot] 2024-10-08 14:35:15 +00:00
8 changed files with 20 additions and 16 deletions

View file

@ -41,6 +41,8 @@ public:
double loop_start() const; double loop_start() const;
WebIDL::ExceptionOr<void> set_loop_end(double); WebIDL::ExceptionOr<void> set_loop_end(double);
double loop_end() const; double loop_end() const;
WebIDL::UnsignedLong number_of_inputs() override { return 0; }
WebIDL::UnsignedLong number_of_outputs() override { return 2; }
WebIDL::ExceptionOr<void> start(Optional<double>, Optional<double>, Optional<double>); WebIDL::ExceptionOr<void> start(Optional<double>, Optional<double>, Optional<double>);

View file

@ -23,6 +23,8 @@ public:
virtual ~AudioDestinationNode() override; virtual ~AudioDestinationNode() override;
WebIDL::UnsignedLong max_channel_count(); WebIDL::UnsignedLong max_channel_count();
WebIDL::UnsignedLong number_of_inputs() override { return 1; }
WebIDL::UnsignedLong number_of_outputs() override { return 1; }
static JS::NonnullGCPtr<AudioDestinationNode> construct_impl(JS::Realm&, JS::NonnullGCPtr<BaseAudioContext>); static JS::NonnullGCPtr<AudioDestinationNode> construct_impl(JS::Realm&, JS::NonnullGCPtr<BaseAudioContext>);

View file

@ -98,20 +98,6 @@ void AudioNode::disconnect(JS::NonnullGCPtr<AudioParam> destination_param, WebID
dbgln("FIXME: Implement AudioNode::disconnect(destination_param, output)"); dbgln("FIXME: Implement AudioNode::disconnect(destination_param, output)");
} }
// https://webaudio.github.io/web-audio-api/#dom-audionode-numberofinputs
WebIDL::UnsignedLong AudioNode::number_of_inputs()
{
dbgln("FIXME: Implement AudioNode::number_of_inputs()");
return 0;
}
// https://webaudio.github.io/web-audio-api/#dom-audionode-numberofoutputs
WebIDL::UnsignedLong AudioNode::number_of_outputs()
{
dbgln("FIXME: Implement AudioNode::number_of_outputs()");
return 0;
}
// https://webaudio.github.io/web-audio-api/#dom-audionode-channelcount // https://webaudio.github.io/web-audio-api/#dom-audionode-channelcount
WebIDL::ExceptionOr<void> AudioNode::set_channel_count(WebIDL::UnsignedLong channel_count) WebIDL::ExceptionOr<void> AudioNode::set_channel_count(WebIDL::UnsignedLong channel_count)
{ {

View file

@ -48,8 +48,11 @@ public:
return m_context; return m_context;
} }
WebIDL::UnsignedLong number_of_inputs(); // https://webaudio.github.io/web-audio-api/#dom-audionode-numberofinputs
WebIDL::UnsignedLong number_of_outputs(); virtual WebIDL::UnsignedLong number_of_inputs() = 0;
// https://webaudio.github.io/web-audio-api/#dom-audionode-numberofoutputs
virtual WebIDL::UnsignedLong number_of_outputs() = 0;
WebIDL::ExceptionOr<void> set_channel_count(WebIDL::UnsignedLong); WebIDL::ExceptionOr<void> set_channel_count(WebIDL::UnsignedLong);
WebIDL::UnsignedLong channel_count(); WebIDL::UnsignedLong channel_count();
WebIDL::ExceptionOr<void> set_channel_count_mode(Bindings::ChannelCountMode); WebIDL::ExceptionOr<void> set_channel_count_mode(Bindings::ChannelCountMode);

View file

@ -29,6 +29,9 @@ class BiquadFilterNode : public AudioNode {
public: public:
virtual ~BiquadFilterNode() override; virtual ~BiquadFilterNode() override;
WebIDL::UnsignedLong number_of_inputs() override { return 1; }
WebIDL::UnsignedLong number_of_outputs() override { return 1; }
WebIDL::ExceptionOr<void> set_type(Bindings::BiquadFilterType); WebIDL::ExceptionOr<void> set_type(Bindings::BiquadFilterType);
Bindings::BiquadFilterType type() const; Bindings::BiquadFilterType type() const;
JS::NonnullGCPtr<AudioParam> frequency() const; JS::NonnullGCPtr<AudioParam> frequency() const;

View file

@ -30,6 +30,9 @@ public:
static WebIDL::ExceptionOr<JS::NonnullGCPtr<DynamicsCompressorNode>> create(JS::Realm&, JS::NonnullGCPtr<BaseAudioContext>, DynamicsCompressorOptions const& = {}); static WebIDL::ExceptionOr<JS::NonnullGCPtr<DynamicsCompressorNode>> create(JS::Realm&, JS::NonnullGCPtr<BaseAudioContext>, DynamicsCompressorOptions const& = {});
static WebIDL::ExceptionOr<JS::NonnullGCPtr<DynamicsCompressorNode>> construct_impl(JS::Realm&, JS::NonnullGCPtr<BaseAudioContext>, DynamicsCompressorOptions const& = {}); static WebIDL::ExceptionOr<JS::NonnullGCPtr<DynamicsCompressorNode>> construct_impl(JS::Realm&, JS::NonnullGCPtr<BaseAudioContext>, DynamicsCompressorOptions const& = {});
WebIDL::UnsignedLong number_of_inputs() override { return 1; }
WebIDL::UnsignedLong number_of_outputs() override { return 1; }
JS::NonnullGCPtr<AudioParam const> threshold() const { return m_threshold; } JS::NonnullGCPtr<AudioParam const> threshold() const { return m_threshold; }
JS::NonnullGCPtr<AudioParam const> knee() const { return m_knee; } JS::NonnullGCPtr<AudioParam const> knee() const { return m_knee; }
JS::NonnullGCPtr<AudioParam const> ratio() const { return m_ratio; } JS::NonnullGCPtr<AudioParam const> ratio() const { return m_ratio; }

View file

@ -27,6 +27,9 @@ public:
static JS::NonnullGCPtr<GainNode> create(JS::Realm&, JS::NonnullGCPtr<BaseAudioContext>, GainOptions const& = {}); static JS::NonnullGCPtr<GainNode> create(JS::Realm&, JS::NonnullGCPtr<BaseAudioContext>, GainOptions const& = {});
static JS::NonnullGCPtr<GainNode> construct_impl(JS::Realm&, JS::NonnullGCPtr<BaseAudioContext>, GainOptions const& = {}); static JS::NonnullGCPtr<GainNode> construct_impl(JS::Realm&, JS::NonnullGCPtr<BaseAudioContext>, GainOptions const& = {});
WebIDL::UnsignedLong number_of_inputs() override { return 1; }
WebIDL::UnsignedLong number_of_outputs() override { return 1; }
JS::NonnullGCPtr<AudioParam const> gain() const { return m_gain; } JS::NonnullGCPtr<AudioParam const> gain() const { return m_gain; }
protected: protected:

View file

@ -34,6 +34,8 @@ public:
WebIDL::ExceptionOr<void> set_type(Bindings::OscillatorType); WebIDL::ExceptionOr<void> set_type(Bindings::OscillatorType);
JS::NonnullGCPtr<AudioParam const> frequency() const { return m_frequency; } JS::NonnullGCPtr<AudioParam const> frequency() const { return m_frequency; }
WebIDL::UnsignedLong number_of_inputs() override { return 0; }
WebIDL::UnsignedLong number_of_outputs() override { return 1; }
protected: protected:
OscillatorNode(JS::Realm&, JS::NonnullGCPtr<BaseAudioContext>, OscillatorOptions const& = {}); OscillatorNode(JS::Realm&, JS::NonnullGCPtr<BaseAudioContext>, OscillatorOptions const& = {});