Odd problem with focusrite scarlett 2i2

I was listening to music through focusrite scarlett 2i2 while doing some light programming using sdl3, and at some point the 2i2 just… gave up. Didn’t play audio. Didn’t show the audio level light even. Windows seemed to think everything is fine, though. After poking the 2i2’s settings a bit it (toggling what outputs should be exposed to windows), it came back alive. So, a driver issue, most likely.

I’ve been in contact with focusrite’s support about this, naturally, which lead to interesting rabbit hole regarding windows and audio latency, but that’s beside the point - I was interested in why the whole device seems to give up. When it comes to optimizing a computer for audio, I fear my development rig (with all of its various development toolchains) is a lost cause.

When starting my sdl3 app a couple dozen times, the 2i2 goes silent. I told the support that if their driver team wants to talk to me, I’m available.

Aaanyhow, I wonder what in SDL3’s init (because I’m fairly sure it’s init) could be the culprit. I just do SDL_Init(SDL_INIT_VIDEO | SDL_INIT_EVENTS) - nothing seems to point to audio. Maybe some USB related thing?

I already wrote that on Mastodon, but for sake of completeness: I can imagine that it could be related to SDL probing your HID devices (to find input devices), probably via hid_enumerate().

Not sure if that should even happen with Joysticks disabled, though, but investigating in that direction is probably worth a try: First by checking if it even gets called at all, then maybe stub it out and see if that resolves the problem. Or try building SDL3 without HID, it has several CMake options related to this that are enabled by default.

On further testing it appears that this has nothing to do with SDL, and it’s the visual studio debugger attaching that causes the issue.

First, I tried to step into SDL_Init, and the audio stopped before I managed to step in. Second, I’ve tried to run a release build of my little test app directly dozens of times without issue.

So mark this down as a false alarm. Apologies.

Does it happen when not running the Debug build in a debugger?

I presume you mean if I use a release build? Yes. The application doesn’t need to even properly start for the audio to cut off.

No, I mean when it’s a debug build. You can just start them from explorer like any executable?
Or does Windows automatically attach a debugger to any such executable? (Windows is not my primary platform)

Yeah, no problems when launching the debug build from a command prompt dozens of times. It’s the debugger.

Ok :slight_smile:
I guess it’s up to Focusrite and Microsoft to debug this - good luck!
Hopefully the information that it’s the VS debugger makes this more urgent to Focusrite