aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/audiodestinationnode.rs
diff options
context:
space:
mode:
authorFernando Jiménez Moreno <ferjmoreno@gmail.com>2017-11-07 20:57:30 +0100
committerFernando Jiménez Moreno <ferjmoreno@gmail.com>2018-07-30 14:21:36 +0200
commit7ee42e4223dc970aeffc56ecddec2738c8340f8c (patch)
tree1f53a3dc650992ab7b84c9a9e0e748d11ca97a7d /components/script/dom/audiodestinationnode.rs
parentde48f25d0b0b5ecaf0499030f8617a3d37b3fde2 (diff)
downloadservo-7ee42e4223dc970aeffc56ecddec2738c8340f8c.tar.gz
servo-7ee42e4223dc970aeffc56ecddec2738c8340f8c.zip
Initial WebAudio API stubs
Diffstat (limited to 'components/script/dom/audiodestinationnode.rs')
-rw-r--r--components/script/dom/audiodestinationnode.rs41
1 files changed, 41 insertions, 0 deletions
diff --git a/components/script/dom/audiodestinationnode.rs b/components/script/dom/audiodestinationnode.rs
new file mode 100644
index 00000000000..a9e63cb2bb9
--- /dev/null
+++ b/components/script/dom/audiodestinationnode.rs
@@ -0,0 +1,41 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+use dom::audionode::{AudioNode, MAX_CHANNEL_COUNT};
+use dom::baseaudiocontext::BaseAudioContext;
+use dom::bindings::codegen::Bindings::AudioDestinationNodeBinding;
+use dom::bindings::codegen::Bindings::AudioDestinationNodeBinding::AudioDestinationNodeMethods;
+use dom::bindings::codegen::Bindings::AudioNodeBinding::AudioNodeOptions;
+use dom::bindings::reflector::reflect_dom_object;
+use dom::bindings::root::DomRoot;
+use dom::globalscope::GlobalScope;
+use dom_struct::dom_struct;
+
+#[dom_struct]
+pub struct AudioDestinationNode {
+ node: AudioNode,
+}
+
+impl AudioDestinationNode {
+ fn new_inherited(context: &BaseAudioContext,
+ options: &AudioNodeOptions) -> AudioDestinationNode {
+ AudioDestinationNode {
+ node: AudioNode::new_inherited(context, options, 1, 1),
+ }
+ }
+
+ #[allow(unrooted_must_root)]
+ pub fn new(global: &GlobalScope,
+ context: &BaseAudioContext,
+ options: &AudioNodeOptions) -> DomRoot<AudioDestinationNode> {
+ let node = AudioDestinationNode::new_inherited(context, options);
+ reflect_dom_object(Box::new(node), global, AudioDestinationNodeBinding::Wrap)
+ }
+}
+
+impl AudioDestinationNodeMethods for AudioDestinationNode {
+ fn MaxChannelCount(&self) -> u32 {
+ MAX_CHANNEL_COUNT
+ }
+}