Andersama / obs-asio

ASIO plugin for OBS-Studio
GNU General Public License v3.0
664 stars 43 forks source link

obs-asio (Juce) versus ReaRoute #112

Open Zarto opened 2 years ago

Zarto commented 2 years ago

Plugin Version obs-asio 3.1.0 (Juce version)

Describe the bug Here's my setup :

Foobar --(Rearoute 3/4)--> Reaper --(Rearoute 1/2)--> obs-asio -> OBS

Everything was working fine with OBS 26 and previous version of obs-asio (based on bassasio ?).

Since I updated to OBS 27 and obs-asio 3.1.0 (Juce version) my setup still works (I can hear music from Foobar and my VSTi), but as soon as I launch OBS with an obs-asio source set to ReaRoute, the sound from Foobar almost stops (while the time counter just goes on in a normal way), I just can hear milliseconds of sound sometimes. If I make a record in OBS the problem is present in the recorded video. The sounds from Reaper (coming from a VSTi) still work flawlessly. As soon as I close OBS the Foobar sound works again as intended instantly.

I set a DSP resampler in Foobar to 48 Khz. I tried to resample at 44 Khz, and to dither to 16 or 24 bits but the problem is the same.

My soundcard is a M-Audio Fastrack Pro

My OBS logs are huge, and since it plays sounds from Reaper correctly I thought it wouldn't help. But if you ask I'll paste it to you.

To Reproduce Steps to reproduce the behavior: 1 - In Foobar set the output to ASIO, route Left to ReaRoute 3 and Right to ReaRoute 4 2 - In Reaper add a track, active the red record button at the left of the track, click the arrow to the right of IN FX and chose Input Stereo -> ReaRoute 3+ReaRoute 4 3 - In Reaper open the Routing Matrix and click the master output / ReaRoute 1+2 cell 4 - Play anything on Foobar : it should work 5 - Install obs-asio then launch OBS 6 - Add an ASIO Input Capture source and double click on it 7 - As soon as I chose ReaRoute ASIO (x64) in the Device list the sound from Foobar stops, just some very short bits of the sound can be heard every some seconds 8 - The only way to get the play fixed is to close OBS (deleting the source won't work).

Expected behavior No sound stop when I launch OBS with obs-asio installed

Additional context The problem won't happen if I chose my Fastrack Pro Asio in OBS -> ASIO Input Capture (but this is not what I need).

When I try to link Foobar to OBS this way : Foobar --(Rearoute 3/4)--> obs-asio -> OBS The obs-asio ASIO Input Capture vu meter never moves. I'm not sure why it doesn't work at all ...

Zarto commented 2 years ago

I found a workaround that might help you understand what's wrong : Using my usual setup Foobar's sound fails as soon as OBS with an obs-asio source is set to ReaRoute (sometimes it feels like very slow playing, sometimes it is choppy).

Sometimes it works, sometimes I have to try again the whole procedure (sometimes 10 tries or more are necessary), then the playback works correctly.

Andersama commented 2 years ago

It sounds like you're having issues with the device having potentially its settings changed and a reset message not being handled, "slow" playback probably is a sample rate mismatch. I dropped those settings from the Juce plugin because in theory the api / device should pick whatever the device is currently working with and just "work". You might want to revert to the previous version.

Zarto commented 2 years ago

Thank you for answering. Unfortunately the problem is the same using the M-Audio device or not using it (Waveout to not ASIO internal soundcard in Reaper). As I said everything works perfectly as long as obs-asio is not in use, and everything works perfectly including obs-asio after using my workaround ( https://github.com/Andersama/obs-asio/issues/112#issuecomment-1059205399 )

Andersama commented 2 years ago

Well I can't say for sure, but I used to use foobar with asio at one point and I remember it not playing nice when other applications were using asio. I might've been doing the same thing to fix it too, been too long. The sound "stopping" would be the application failing to establish a connection with the device and it's callback function for handling audio, normally it's in response to an asio reset message, which is effectively the hardware device's way of telling any currently connected application that it's changning it's working settings. For me for example whenever an application connects to asio there's a slight pop which makes it obvious, it might be that foobar just panics when the reset message is received and waits for user input to reconnect.

The "slow" playback could be it not processing the reset message at all and continuing playback with the wrong settings. You'd definitely notice that between 48khz and 44.1khz.

That's also why I suspect the bass version would work better because it functions like most daws where it requests the specific set of settings, which presumably you've got consistent across everything. Pretty sure the standard for asio only sends reset messages when the settings have changed.

Andersama commented 2 years ago

Reading this back I'm realizing I might've been too in the weeds to explain this clearly, the trick you're doing to get things to work would effectively be spamming the device to change it's settings and at some point or other you might be getting lucky when the reset message is handled properly.

That's why I suspect the bass version would just work, it picks the settings to start and (like the Juce version) should also handle reset messages, but it shouldn't have a problem with an initial mismatch.