Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upAdd AudioListener and PannerNode support #103
Merged
+816
−14
Conversation
|
r? @ferjm |
|
To be clear, I have not run/tested this code at all but it's 5:30 on Friday so I'll get to it next week. |
audio/src/listener.rs
Outdated
|
|
||
| fn get_param(&mut self, id: ParamType) -> &mut Param { | ||
| match id { | ||
| _ => panic!("Unknown param {:?} for AudioListenerNode", id), |
This comment has been minimized.
This comment has been minimized.
f9a119b
to
6c165bb
|
whoops, forgot to git add the file, so had to squash together all my commits for it. |
|
Ready for landing cc @ferjm |
67e4774
to
9fccb64
|
Nice! r=me with the comments addressed. Thanks! |
audio/src/panner_node.rs
Outdated
| fn default() -> Self { | ||
| PannerNodeOptions { | ||
| panning_model: PanningModel::EqualPower, | ||
| distance_model: DistanceModel::Linear, |
This comment has been minimized.
This comment has been minimized.
audio/src/panner_node.rs
Outdated
| Self { | ||
| channel_info: ChannelInfo { | ||
| count: 2, | ||
| mode: ChannelCountMode::Max, |
This comment has been minimized.
This comment has been minimized.
audio/src/panner_node.rs
Outdated
| self.orientation_z.update(info, tick) | ||
| } | ||
|
|
||
| /// Computes azimuthm elevation, and distance of source with respect to a |
This comment has been minimized.
This comment has been minimized.
audio/src/panner_node.rs
Outdated
| (azimuth, elevation, distance as f64) | ||
| } | ||
|
|
||
| fn cone_gain(&self, |
This comment has been minimized.
This comment has been minimized.
audio/src/panner_node.rs
Outdated
|
|
||
| let source_to_listener = normalize_zero(source_position - listener_position); | ||
| // Angle between the source orientation vector and the source-listener vector | ||
| let angle = 180. * source_to_listener.dot(normalized_source_orientation) / PI; |
This comment has been minimized.
This comment has been minimized.
ferjm
Aug 23, 2018
Member
We are missing an acos here:
let angle = 180. * source_to_listener.dot(normalized_source_orientation).acos() / PI;
audio/src/panner_node.rs
Outdated
| } | ||
|
|
||
| /// Computes azimuthm elevation, and distance of source with respect to a | ||
| /// given AudioListener's position, forward, up vectors |
This comment has been minimized.
This comment has been minimized.
|
Thanks! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Manishearth commentedAug 1, 2018
•
edited
This adds support for AudioListener and AudioPanner
I haven't tested it yet, but it's ready for preliminary review.