mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-08 01:00:05 +00:00
LibWeb: Implement the OscillatorNode.detune
attribute
This commit is contained in:
parent
ed46d247de
commit
72818300c0
Notes:
github-actions[bot]
2025-01-04 10:13:38 +00:00
Author: https://github.com/tcl3
Commit: 72818300c0
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3122
Reviewed-by: https://github.com/shannonbooth ✅
3 changed files with 9 additions and 1 deletions
|
@ -4,6 +4,7 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <AK/Math.h>
|
||||
#include <LibWeb/Bindings/Intrinsics.h>
|
||||
#include <LibWeb/Bindings/OscillatorNodePrototype.h>
|
||||
#include <LibWeb/WebAudio/AudioParam.h>
|
||||
|
@ -43,6 +44,7 @@ WebIDL::ExceptionOr<GC::Ref<OscillatorNode>> OscillatorNode::construct_impl(JS::
|
|||
OscillatorNode::OscillatorNode(JS::Realm& realm, GC::Ref<BaseAudioContext> context, OscillatorOptions const& options)
|
||||
: AudioScheduledSourceNode(realm, context)
|
||||
, m_frequency(AudioParam::create(realm, options.frequency, -context->nyquist_frequency(), context->nyquist_frequency(), Bindings::AutomationRate::ARate))
|
||||
, m_detune(AudioParam::create(realm, options.detune, -1200 * AK::log2(NumericLimits<float>::max()), 1200 * AK::log2(NumericLimits<float>::max()), Bindings::AutomationRate::ARate))
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -83,6 +85,7 @@ void OscillatorNode::visit_edges(Cell::Visitor& visitor)
|
|||
{
|
||||
Base::visit_edges(visitor);
|
||||
visitor.visit(m_frequency);
|
||||
visitor.visit(m_detune);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue