Segfault on Execution, Exit Code: STATUS_ACCESS_VIOLATION
When running the beep example using an ASIO Host, on windows 10, the program segfaults in unsafe code space with the exit code of 0xc0000005, STATUS_ACCESS_VIOLATION.
I am using a Focusrite 2i2 Gen 2 as my asio host.
The same program executes perfectly fine with Wasapi, in ASIO this segfaults occurs around 70% of the time the program is run. I have also tested it with a rudimentary pulse wave, and triangle wave, and both of those work in Wasapi, but segfault 100% of the time in ASIO.
I'm not too sure how to debug this myself, although I am going to try.
Hello @poww10s,
Have you tried to release with caro build --release and run the executable?
I have the same problem as you if I just try to do a cargo run
If I release with cargo build --release and run the executable, it run's correctly, but no sound is outputted, and it doesn't sleep, suggesting to me that something is broken with how it handles asio. I've made a ton of progress on my program, but for now I'm limited to wasapi with cpal, which is a bit of a pain
I feel like the issue might have something to do with my focusrite using I16, but the example using F32 as it's output. I tried changing it around manually, but I'm a bit confused about how the Sample trait handles the conversion between types.
I'm stuck in the step as you. Worse, I have an error when I try to restart the program a second time and I have to unplug and plug in my USB sound card. I think the execution crashes without error and the resources are not freed.
What makes you think this is related to the I16 format? I think that's how ASIO works. My sound card is also in I16 with ASIO while it works in F32 with WASPI.
I don't have too much idea how to debug this behavior. If you have any ideas, don't hesitate to share them.
I know someone else used a debugger and found that it's segfaulting in unsafe code, but not in any rust unsafe code, but one of the Focusrite DLL's a driver I think. (#517)
I know just from using other applications with the drivers I'm pretty sure Focusrite default is I32 format, but because cpal currently only supports I16 it converts all formats it doesn't support to the ones it does.
#775 should have fixed this, if not, please write!