fluid-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[fluid-dev] Fluidsynth + Portaudio device selection


From: Massimo Callegari
Subject: [fluid-dev] Fluidsynth + Portaudio device selection
Date: Sun, 20 May 2012 22:53:46 +0200

Hi,
I am using Fluidsynth + Portaudio through a Java JNI.
 
However, there is one thing I noticed that makes the use of Portaudio not fully working.
As you know, Portaudio can be compiled with several audio type support in it. For example in Windows you can build a DLL with DirectSound+ASIO+WDM-SK all in one.
This is very good because it saves space and because Java is very bad in unloading DLLs...
 
But here's the bad news. When Fluidsynth selects an audio device, it does it by name. So if different PA drivers return the same name (very common thing), then Fluidsynth will select the first name that matches the PA devices list.
 
Here's the code of fluid_portaudio.c that does it:
 
    for (i = 0; i < numDevices; i++)
    {
      deviceInfo = Pa_GetDeviceInfo (i);
 
      if (strcmp (device, deviceInfo->name) == 0)
      {
        outputParams.device = i;
        break;
      }
    }
 
In my case the list Portaudio returns is the following:
 
 ID: 0, Name: Driver primario di acquisizione suoni,  Type: Direct Sound
 ID: 1, Name: Fast Track Pro In 1/2, Type: Direct Sound
 ID: 2, Name: Realtek HD Audio Input, Type: Direct Sound
 ID: 3, Name: Fast Track Pro In S/PDIF, Type: Direct Sound
 ID: 4, Name: Driver audio principale, Type: Direct Sound
 ID: 5, Name: Fast Track Pro Out 1/2, Type: Direct Sound
 ID: 6, Name: Realtek HD Audio output, Type: Direct Sound
 ID: 7, Name: Fast Track Pro Out 3/4, Type: Direct Sound
 ID: 8, Name: ASIO4ALL v2, Type: ASIO
 ID: 9, Name: M-Audio USB ASIO, Type: ASIO
 ID: 10, Name: Realtek HD Audio Input, Type: Windows WDM-KS
 ID: 11, Name: Realtek HD Audio output, Type: Windows WDM-KS
 ID: 12, Name: Fast Track Pro In 1/2, Type: Windows WDM-KS
 ID: 13, Name: Fast Track Pro In S/PDIF, Type: Windows WDM-KS
 ID: 14, Name: Fast Track Pro Out 1/2, Type: Windows WDM-KS
 ID: 15, Name: Fast Track Pro Out 3/4, Type: Windows WDM-KS
 
So if my application wants to use device 14 it can't, cause Fluidsynth will select 5, cause of the name match.
 
Since Portaudio devices can be selected by index (PaDeviceIndex) it would make more sense if Fluidsynth would do the same.
 
The easiest way to fix this is probably to set the index through a Fluidysnth setting (like "audio.portaudio.device_index"). Don't know if this makes sense to you.
 
Any suggestion ?
 
Thanks and regards,
Massimo

reply via email to

[Prev in Thread] Current Thread [Next in Thread]