mirror of
https://github.com/servo/servo.git
synced 2025-08-04 05:00:08 +01:00
Add AudioParam connection support
This commit is contained in:
parent
841fedda4f
commit
00014b3f16
4 changed files with 49 additions and 10 deletions
8
Cargo.lock
generated
8
Cargo.lock
generated
|
@ -3076,7 +3076,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "servo-media"
|
name = "servo-media"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
source = "git+https://github.com/servo/media#d08d03f9b78827cc1516d8a3b8e94ffc9394c748"
|
source = "git+https://github.com/servo/media#9968654a5602adfcdc01d6a9ba9d54fd8b341eaf"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"servo-media-audio 0.1.0 (git+https://github.com/servo/media)",
|
"servo-media-audio 0.1.0 (git+https://github.com/servo/media)",
|
||||||
"servo-media-gstreamer 0.1.0 (git+https://github.com/servo/media)",
|
"servo-media-gstreamer 0.1.0 (git+https://github.com/servo/media)",
|
||||||
|
@ -3085,7 +3085,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "servo-media-audio"
|
name = "servo-media-audio"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
source = "git+https://github.com/servo/media#d08d03f9b78827cc1516d8a3b8e94ffc9394c748"
|
source = "git+https://github.com/servo/media#9968654a5602adfcdc01d6a9ba9d54fd8b341eaf"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"byte-slice-cast 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"byte-slice-cast 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"num-traits 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)",
|
"num-traits 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
@ -3097,7 +3097,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "servo-media-gstreamer"
|
name = "servo-media-gstreamer"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
source = "git+https://github.com/servo/media#d08d03f9b78827cc1516d8a3b8e94ffc9394c748"
|
source = "git+https://github.com/servo/media#9968654a5602adfcdc01d6a9ba9d54fd8b341eaf"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"byte-slice-cast 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"byte-slice-cast 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"gstreamer 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
"gstreamer 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
@ -3203,7 +3203,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "servo_media_derive"
|
name = "servo_media_derive"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
source = "git+https://github.com/servo/media#d08d03f9b78827cc1516d8a3b8e94ffc9394c748"
|
source = "git+https://github.com/servo/media#9968654a5602adfcdc01d6a9ba9d54fd8b341eaf"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"quote 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"quote 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"syn 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"syn 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
|
|
@ -97,8 +97,22 @@ impl AudioNodeMethods for AudioNode {
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://webaudio.github.io/web-audio-api/#dom-audionode-connect-destinationparam-output
|
// https://webaudio.github.io/web-audio-api/#dom-audionode-connect-destinationparam-output
|
||||||
fn Connect_(&self, _: &AudioParam, _: u32) -> Fallible<()> {
|
fn Connect_(&self, dest: &AudioParam, output: u32) -> Fallible<()> {
|
||||||
// TODO
|
if self.context != dest.context() {
|
||||||
|
return Err(Error::InvalidAccess);
|
||||||
|
}
|
||||||
|
|
||||||
|
if output >= self.NumberOfOutputs() {
|
||||||
|
return Err(Error::IndexSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
// servo-media takes care of ignoring duplicated connections.
|
||||||
|
|
||||||
|
self.context.audio_context_impl().connect_ports(
|
||||||
|
self.node_id().output(output),
|
||||||
|
dest.node_id().param(dest.param_type()),
|
||||||
|
);
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -143,14 +157,20 @@ impl AudioNodeMethods for AudioNode {
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://webaudio.github.io/web-audio-api/#dom-audionode-disconnect
|
// https://webaudio.github.io/web-audio-api/#dom-audionode-disconnect
|
||||||
fn Disconnect_____(&self, _: &AudioParam) -> ErrorResult {
|
fn Disconnect_____(&self, param: &AudioParam) -> ErrorResult {
|
||||||
// TODO
|
self.context
|
||||||
|
.audio_context_impl()
|
||||||
|
.disconnect_to(self.node_id(),
|
||||||
|
param.node_id().param(param.param_type()));
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://webaudio.github.io/web-audio-api/#dom-audionode-disconnect
|
// https://webaudio.github.io/web-audio-api/#dom-audionode-disconnect
|
||||||
fn Disconnect______(&self, _: &AudioParam, _: u32) -> ErrorResult {
|
fn Disconnect______(&self, param: &AudioParam, out: u32) -> ErrorResult {
|
||||||
// TODO
|
self.context
|
||||||
|
.audio_context_impl()
|
||||||
|
.disconnect_output_between_to(self.node_id().output(out),
|
||||||
|
param.node_id().param(param.param_type()));
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -78,6 +78,18 @@ impl AudioParam {
|
||||||
fn message_node(&self, message: AudioNodeMessage) {
|
fn message_node(&self, message: AudioNodeMessage) {
|
||||||
self.context.audio_context_impl().message_node(self.node, message);
|
self.context.audio_context_impl().message_node(self.node, message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn context(&self) -> &BaseAudioContext {
|
||||||
|
&self.context
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn node_id(&self) -> NodeId {
|
||||||
|
self.node
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn param_type(&self) -> ParamType {
|
||||||
|
self.param
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl AudioParamMethods for AudioParam {
|
impl AudioParamMethods for AudioParam {
|
||||||
|
|
|
@ -423,6 +423,13 @@ impl<T> PartialEq for Dom<T> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl<'a, T: DomObject> PartialEq<&'a T> for Dom<T> {
|
||||||
|
fn eq(&self, other: &&'a T) -> bool {
|
||||||
|
*self == Dom::from_ref(*other)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
impl<T> Eq for Dom<T> {}
|
impl<T> Eq for Dom<T> {}
|
||||||
|
|
||||||
impl<T> PartialEq for LayoutDom<T> {
|
impl<T> PartialEq for LayoutDom<T> {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue