Skip to content

Audio devices iterates in Windows when Jamulus starts and when joining to a server #3430

Open

Description

@alekeyspiano

Describe the bug

When I run Jamulus or when I join to a new server, selected audio device in windows changes and iterates selecting all available devices and a few seconds later returns to the initial device selected.

To Reproduce

I have a BehringerXAIR in my PC that have 4 devices, XAIR 1 2 | XAIR 3 4 | XAIR 5 6 , etc. I assign 3 4 one to Jamulus and 1 2 to windows, but when I start Jamulus or join to a server. The device selected in windows change and iterates became crazy and I lose all sound except Jamulus during a few seconds or a minute, causing losing audio in OBS, Google Chrome, Spotify, etc...

Expected behavior

To don't iterate this and keep the same device selected in windows.

Screenshots

This place becomes crazy
image

This is ok
image

Operating system

Windows 10 22H2

Version of Jamulus

Jamulus 3.11.0

Additional context

This don't allow me and other colleagues to stream our Jamulus performance on Twitch and it is very annoying for us

Activity

  1. softins commented on Nov 27, 2024

    @softins
    Member

    Can you show us the display when you click on Configuración Dispositivo ASIO?

  2. alekeyspiano commented on Nov 27, 2024

    @alekeyspiano
    Author

    Yes Sure!
    image

    Also a screenshot of all my devices

    image

  3. softins commented on Dec 2, 2024

    @softins
    Member

    @alekeyspiano could you try something and let us know the result? (Not something to fix it, but to help us know where to look)

    1. Make a Jamulus connection to a server, and wait for the audio device to stop iterating.
    2. While still connected, open the Settings window, and change one of the settings: Calidad Audio, Retardo Buffer or Buffers Red Pequeños, while watching the audio device in Windows.

    Does the audio device start iterating when you change one of those settings? Or not?

    Also, you mentioned the iteration issue causes loss of sound in OBS, Chrome, Spotify, etc. Do you still get the device iteration if nothing else is running except Jamulus?

  4. alekeyspiano commented on Dec 3, 2024

    @alekeyspiano
    Author

    Hello, I did some tests:

    1- Applying "Calidad Audio": iterates on Windows main devices: several cuts of sound during 45 secs
    2- Idem applying "Buffers Red Pequeños"

    This occurs when I open or connect Jamulus after I have the other softwares opened.

    When I open Jamulus before, audio cuts are during 4 or 5 secs. But if I leave a server and try to connect other one, then we are in the first scenario.

    If nothing else is running I can't check it because I have no audio to view if I have cuts or not. Always Jamulus is sounding because is always well assigned and well routing in all cases, but I have been using Jamulus for 4 years and this issue appeared since the last year. Probably a Windows updating or Jamulus updating that include changes in the audio management.

    Other colleagues presents the same issue. We are almost 10 people streaming music on twitch and collaborating by Jamulus.

  5. softins commented on Dec 3, 2024

    @softins
    Member

    OK, thanks. Those tests help narrow down where to look in the code. No ideas yet as to the cause.

  6. teseo commented on Dec 3, 2024

    @teseo

    Same issue here.

    Thanks for opening this issue.

  7. softins commented on Dec 4, 2024

    @softins
    Member

    It would be very helpful if anyone who is experiencing this issue has the time to try older versions of Jamulus such as 3.10.0 or 3.9.1, and let us know whether they exhibit the same problem.

    That would help us to identify whether this is a new problem or one that has always been there.

    Also @pljones, you probably have the most complex PC-based setup out of the team members. Could you see if you can observe the same issue as described?

  8. pljones commented on Dec 4, 2024

    @pljones
    Collaborator

    There was something done to try to find a working Audio device (i.e. one that said OK when asked to open at 48000 samples per second). I'd check whether any such device exists first.

  9. softins commented on Dec 5, 2024

    @softins
    Member

    @alekeyspiano sorry, more questions, since I don't have a setup that can demonstrate the issue, and am currently just looking for clues in the code.

    • When the devices iterate, do they do so too fast to see, or at a slower rate?
    • Can you see whether the iteration includes the non-ASIO devices, or just the ASIO ones?
    • Are you able to video the iteration on your phone (from before it starts until after it stops), and post a link to the video?

    You said it only started doing this in the last year or so. It would be hugely helpful to us if you can identify an earlier version that does not show the problem, as mentioned above.

  10. alekeyspiano commented on Dec 7, 2024

    @alekeyspiano
    Author

    I am going to test with Jamulus 9.0 and say conclusions in the following post.

  11. alekeyspiano commented on Dec 7, 2024

    @alekeyspiano
    Author

    Hello, the same issue with older versions.

    1- The iteration is very fast, in this case only iterates between 2 devices (same device different channel inputs) I will attached a video recorded from my cellphone.
    2- In this test does not occured but other times, I could see my webcam audio device that is not an ASIO device.

    In the next post I will attach the video to see more details about the test.

  12. alekeyspiano commented on Dec 7, 2024

    @alekeyspiano
    Author

    This is the video link (expires in 7 days)

    https://we.tl/t-a80RBBbPbX

    In this video you can see that I have open Spotube (similar to spotify, and same behaviour that happens in OBS too) with audio routing to my OUT 7-8 BEHRINGER AIR.

    Jamulus is routed to OUT 3-4 BEHRINGER AIR
    Main windows audio as you can see in the video is routed by default, and have OUT 1-2 BEHRINGER AIR

    When I connect to a server (as you can see in the video) spotube audio stop, and devices iterates fast some seconds. Also my main windows device switches from 1-2 to 5-6 several times.

    Moreless 20-25 secs after, audio returns and everything is OK.

    The more apps I have open the more time audio cut I have.

    Tested in the 9.0 version but also happens in 11.0. I evidence this issue after some Windows updates last year but I am not sure if this is the cause or is only coincidence.

    A colleague that have Jamulus in MAC evidence the same Issue. Other people who I asked told me that the audio cut is only 1 sec. This happen to me when only jamulus is opened, but more time when open more apps that manage audio.

  13. ann0see commented on Jan 24, 2025

    @ann0see
    Member

    I'd suspect that https://github.com/jamulussoftware/jamulus/blob/main/src/sound/asio/sound.cpp will give us a solution. Maybe something with CheckDeviceCapabilites() and the suspected "find supported device" algorithm?

    Otherwise, we iterate in LoadAndInitializeDriver

  14. added this to the Release 4.0.0 milestone on Apr 26, 2026
  15. mcfnord commented on Jul 19, 2026

    @mcfnord
    Contributor

    Partial root cause (static analysis, per the request in #3804). Half of this is verified in the code; the other half needs someone with the hardware, and there's a concrete experiment below to close it.

    What Jamulus verifiably does on the reported triggers (startup and joining a server):

    1. CClient::Init() initializes the sound driver four times per call — three frame-size probes plus the real init (client.cpp#L1105-L1122). On the ASIO backend each Sound.Init() is a full ASIODisposeBuffers/ASIOCreateBuffers cycle on the driver. Init() runs at startup, on every connect, and on every device/setting change. A code comment already flags the pattern (#L1114: "iOS needs 1 init only, now: 9 inits at launch <- slow").
    2. If the stored driver fails to load at startup, LoadAndInitializeFirstValidDriver() (soundbase.cpp#L205) walks every ASIO driver in the system, fully ASIOInit-ing each in turn until one succeeds — i.e., it briefly opens every audio device in sequence.

    What Jamulus verifiably does not do: touch the Windows default-device selection. There is no WASAPI/MMDevice code anywhere in the ASIO backend, so Jamulus cannot be changing the Windows output device directly.

    The unverified half (hypothesis, not confirmed): the visible cycling of the Windows default device would then be the X-AIR driver's reaction to being repeatedly initialized/disposed — many ASIO drivers claim the hardware exclusively, so their WDM endpoints drop and re-enumerate, and Windows walks its default-device fallback chain (XAIR 1/2 → 3/4 → 5/6 → …), which is exactly the "iterating" in the screenshot.

    Experiment to confirm (needs the Behringer hardware): open Windows Event Viewer or a device-notification watcher, start Jamulus, and check whether each default-device hop coincides with an audio endpoint remove/arrive event for the X-AIR WDM devices during Jamulus's init window. If yes, the driver-endpoint mechanism is confirmed and the Jamulus-side mitigation is clear either way: collapse the 4× init to a single one (the existing TODO) and skip re-init on join when no audio settings changed — that shrinks the disruption window by ~4× even though the endpoint behavior itself belongs to the driver.

  16. removed this from the Release 4.1.0 milestone on Jul 20, 2026
  17. mcfnord commented on Aug 3, 2026

    @mcfnord
    Contributor

    MY LLM WROTE:

    On a real Focusrite ASIO interface Jamulus makes 40 CSound::Init() calls before the main window exists — 12.6 s of a 14.9 s startup with nothing on screen, since CSettings::Load runs before ClientDlg.show(). The cost is not per call: ASIOCreateBuffers takes ~360 ms when the requested buffer size changes and ~0 ms when it does not, and startup makes 35 changes. ASIO4ALL runs the same 40 calls at ~0.4 ms and starts in 1.8 s.

    The count is ours, not the driver's: CClient::Init() calls Sound.Init() 4× (3 are frame-size probes), and ReadSettingsFromXML calls CClient::Init() 10×, once per sound setter.

    Two independent fixes, both built and measured, 5 interleaved launches per arm:

    arm window (median) CSound::Init calls
    stock 14 900 ms 40
    coalesce the settings-load batch 4 367 ms 8
    cache the frame-size probes 3 664 ms 13
    both 3 237 ms 5

    Coalescing (~30 lines): CClient::SuspendInit()/ResumeInit(), ReadSettingsFromXML wraps its sound section; a suspended Init() records the request and resume runs it once. No reordering, no setter signature changes. Caching (25 lines): one bFraSiFactProbeValid, cleared in SetSndCrdDev() and at the top of OnSndCrdReinitRequest() — the second is required, kAsioBufferSizeChange reaches Init() there with no SetDev. Caching wins with more calls because the ones it removes are the size-changing ones.

    Checks: non-default channel mapping round-trips byte-identical, 348 packets/s at the server (baseline 337–339), shutdown unchanged, ASIO4ALL unchanged at 1.7–1.9 s throughout. Invalidation tested by switching device at runtime and counting probes after — stock 4, cache+invalidate 4, invalidation deleted 1, that last arm so the test is able to fail.

    Is this the shape you want before I write a PR, and one PR or two?

  18. pljones commented on Aug 3, 2026

    @pljones
    Collaborator

    I like the idea of "gating" the Init() calls during settings load - that sounds very sensible.

    I'd say do them in two separate PRs, too.

    In either case, I'd like to see a clearer explanation of how they address the issue as described.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    • Status
      Triage

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions