-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PannerNode always crashes #369
Comments
Hi @ggadwa, thanks for flagging this issue with us. |
Just in case it's a conflict in the libs I made this example by taking apart my game so the windowed loop remains, and then gathered a bit from one of your examples. Hit the button while this runs once and it'll play a sound and keep running, hit it the second time and it'll crash (for me, at least.) Three files, the cargo, the main, the lib. Hope this helps! === cargo === [package] [lib] [dependencies] [dependencies.image] [build-dependencies] === lib.rs === use winit::{event::*, event_loop::{ControlFlow, EventLoop}, window::{Window, WindowBuilder}}; pub async fn run() {
} === main.rs === use webaudio_test::run; fn main() { |
Thanks again. let context = AudioContext::default();
let panner = context.create_panner();
drop(panner);
println!("sleep");
std::thread::sleep(std::time::Duration::from_secs(1));
let mut panner = context.create_panner();
println!("sleep");
std::thread::sleep(std::time::Duration::from_secs(1)); For some reason, the |
Sorry for the big snippet, I wasn't sure what was potentially the problem. Note that in my game code, I am creating (and updating) a listener, and that code doesn't crash anything, without the panner create, if that helps at all. Thanks for this library, and glad I could help with a bug report! |
No worries, your snippet helped me narrow down the search. I have actually found the issue: whenever a new AudioPanner is added, we connect the AudioListener to it in the audio graph to make sure the panner renderer has access to the listener position/orientation. But we don't account for the panner to go out of scope and drop from the audio graph. The listener will still have a connection to it which can no longer be resolved. This makes the application crash. I'm working on a fix now |
Hey, no nothing particular to add on my side, except thanks @ggadwa for the feedback
ok (I might need some little help to figure out how to fix ircam-ismm/node-web-audio-api#37 then) |
Fix #369 - AudioListener would have a connection to a dropped PannerNode
I have released version 0.34 just now. @ggadwa there are some breaking changes in this release. Mainly most audio nodes must be mutable now, this is simply done changing - let src = ctx.create_buffer_source();
+ let mut src = ctx.create_buffer_source(); @b-ma sorry I missed your call for help over at the node bindings. I will have a look. It will be a bit tricky indeed |
Machine: AMD, 16 GB, Windows 10 Home, Rust 1.7, web-audio 0.33.0
I knew web audio from a javascript 3d development environment I made, so thank you for this project! While working in rust, calling this anywhere in my code:
let panner = ctx.create_panner();
Will eventually cause (usually when it's called a second time):
thread 'cpal_wasapi_out' panicked at 'called
Option::unwrap()
on aNone
value', C:\Users\ggadwa.cargo\registry\src\index.crates.io-6f17d22bba15001f\web-audio-api-0.33.0\src\render\graph.rs:261:14Note the panner is not connected to an output or connected from an input source, just calling create_panner() causes this. Note that if I instead use Panner::new with options the same thing happens, but more immediately (just when I call it the first time, or at least in my testing.)
Further notes: Creating a source, connecting it to an output, and playing it within the same code work perfectly; but within the same code creating a panner node will crash it, so it seems related specific to the panner node.
As I am new at Rust, it is possible this is some mistake on my part, i.e., a lifetime/de-allocation problem.
The text was updated successfully, but these errors were encountered: