Multizone Player System Dante Virtual Souncard Library Problem

pinarg

New member
Joined
May 19, 2025
Messages
1
Programming Experience
3-5
I started a .NET Core WPF project to develop a multi-zone player system for businesses such as hotels that have multiple areas/zones. To handle a large number of audio drivers and channels, I started working with Dante Virtual Soundcard (DVS), which provides two types of services: WDM mode and ASIO mode.


I've made some progress on my application. In my network, I have a switch and two Dante audio devices. One is located in my kitchen, connected to two speakers, and the other is in my room, also connected to two speakers. Using Dante Controller, I assigned the output channels of these devices: one is fixed to channels 3-4 and the other to 5-6.


In my WPF application, when the main screen loads, I programmatically read the available audio drivers. When I go to the player creation screen, I select which audio driver and which channel the player will use. For example, my kitchen player will use Dante Virtual Soundcard in ASIO mode and output through channels 3-4 (tx3-tx4), while the player in my room will use channels 5-6 (tx5-tx6).


I have used both NAudio and ManagedBass libraries for this software. However, I am experiencing the following issue: if DVS is running in ASIO mode, you can only call asio.init() once—only a single initialization is allowed. So, when I try to start one player, the playlist starts playing, but when I try to start another at the same time, I get a "Dante Virtual Soundcard already in use" error. In a different approach, whenever I start a player, I hear the same sound from all channels simultaneously.


After a lot of research, including consulting AI, I was advised to use the ManagedBass library, since Dante Virtual Soundcard allows only one instance per application when using NAudio, but with ManagedBass this problem might be solved. However, when I tried this, the sound was very distorted, noisy, and played in slow motion—I couldn’t get it to work properly.


I’m really stuck at this point. If anyone has experience with a similar setup, or with NAudio, ManagedBass, and DVS, I’d really appreciate any guidance. I’ve been struggling with this for a week now and my employer is starting to get frustrated. Your feedback is very important to me—thank you in advance.
 
*** removed unnecessary quote ***

I'd focus on both the technical limitations of DVS and the capabilities of NAudio and ManagedBass.
The "Dante Virtual Soundcard already in use" error when DVS is in ASIO mode and "only a single initialization is allowed" is the absolute key to your issue. This is not a limitation of NAudio or ManagedBass, but rather a fundamental design choice by Audinate for how DVS exposes its ASIO interface.

ASIO's Nature: ASIO (Audio Stream Input/Output) is designed for low-latency, high-performance audio. To achieve this, it often grants exclusive access to the audio hardware. This prevents other applications (or even other instances within the same application) from trying to seize control of the same audio channels, ensuring a clean and uninterrupted audio stream.

DVS Implementation: Audinate has implemented DVS to adhere to this ASIO principle. When you initialize DVS in ASIO mode, your application takes control of the entire DVS ASIO driver, even if you only intend to use a subset of its channels. Any subsequent attempt to initialize it will fail because it's already "in use."

WDM vs. ASIO: Your observation about WDM mode implies a key difference. WDM (Windows Driver Model) is a more general-purpose audio API. It allows multiple applications to share audio devices, but often with higher latency and less precise control compared to ASIO. If DVS's WDM mode allows multiple applications to use it concurrently, that's because WDM handles the mixing. However, for a multi-zone player system where you need precise channel control and low latency, ASIO is generally preferred.

Possibilities of Failure:​

Multiple Players, Separate asio.init() Calls (NAudio/ManagedBass): This is precisely where you hit the "Dante Virtual Soundcard already in use" error. Each time you try to start a new player instance that attempts to initialize DVS in ASIO mode, it's a new attempt to gain exclusive access, which fails.

Single asio.init(), All Channels Simultaneously: When you hear the same sound from all channels simultaneously, it's likely because you've successfully initialized DVS once, and then you're routing all your audio streams through that single initialized DVS instance. Without explicit channel mapping within your application to specific DVS output channels, the audio streams are being mixed together and sent to all available outputs by default, or your mixing logic isn't correctly implemented to target specific output channels.

ManagedBass and Distorted/Slow Audio: This is concerning. While ManagedBass is a powerful library, the distortion and slow motion suggest a mismatch in sample rates, buffer sizes, or a misconfiguration of the DVS device itself. It's possible that when you switched to ManagedBass, some default settings (e.g., sample rate) didn't align with DVS's capabilities, leading to these audio artifacts.

The Possible Fix To This: A Single ASIO Client with Internal Mixing and Routing​

The core principle you need to adopt is to have only one instance of your application initialize DVS in ASIO mode. Once initialized, your application becomes the "master" of DVS. You then need to perform all your audio mixing and channel routing within your application before sending the final mixed audio stream to DVS.

How I would approach this with NAudio or ManagedBass:

Centralized DVS ASIO Initialization:​

Your application should have a single, dedicated component or class responsible for initializing and managing the DVS ASIO driver. This component will call asio.init() (or its equivalent in ManagedBass) once when your application starts or when the first player requires DVS ASIO.

This component will expose the available DVS channels and a method to write audio data to specific channels.

Internal Audio Mixing and Routing:​

This is the crucial part. Instead of each player trying to control DVS directly, each player will generate its audio, and then pass it to your central DVS management component.

Player Audio Sources: Each "player" in your system (e.g., Kitchen Player, Room Player) will be responsible for loading and decoding its own audio files.

Sample Providers/Streams: Both NAudio and ManagedBass provide mechanisms for working with audio data as streams or sample providers. Each player will have its own independent audio stream.

Mixing Engine: You'll need an internal mixing engine, I know it's a pain. This engine will take the audio streams from all active players, mix them together, and then route the mixed audio to the correct DVS output channels.

Channel Mapping (Channels): When you initialize your Kitchen Player, you'll configure it to output to DVS channels 3-4. The Room Player will be configured for channels 5-6. Your mixing engine will be responsible for taking the audio from the Kitchen Player and ensuring it only goes to DVS channels 3-4, and similarly for the Room Player.

Silent Channels: If a player is not active, its corresponding DVS output channels should output silence (or be appropriately muted). Writing to DVS's Output Buffer:
The central DVS manager will receive a single, multi-channel audio buffer from your internal mixing engine. This buffer will contain the correctly mixed and routed audio for all active zones. This single buffer is then passed to the DVS ASIO driver. It's all something to look into and hopefully it will set you on the right path. Just remember the NAudio and ManagedBass will have it's own independant audio stream.
 
Last edited by a moderator:
Back
Top Bottom