fluid-dev
[Top][All Lists]
Advanced

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

Re: [fluid-dev] Fluidsynth + Portaudio device selection


From: Pedro Lopez-Cabanillas
Subject: Re: [fluid-dev] Fluidsynth + Portaudio device selection
Date: Mon, 4 Jun 2012 22:35:24 +0200
User-agent: KMail/1.13.5 (Linux/2.6.34.10-0.6-desktop; KDE/4.4.4; i686; ; )

On Monday 04 June 2012, Massimo Callegari wrote:
> Hi Pedro,
> sorry it took a while. I had not much time and a little bit of troubles in 
compiling in Windows.
> 
> All sorted...BUT...
> 
> Fluidsynth sorts the device list, so the original PortAudio index gets lost 
!
> For example, Fluidysnth returns this list:
>   ASIO4ALL v2
>   Driver audio principale
>   Fast Track Pro Out 1/2
>   Fast Track Pro Out 1/2
>   Fast Track Pro Out 3/4
>   Fast Track Pro Out 3/4
>   M-Audio USB ASIO
>   PortAudio Default
>   Realtek HD Audio output
>   Realtek HD Audio output
> 
> My application wants to output on M-Audio USB ASIO, so index 6.
> 
> When I try to look for index 6 this is the list Fluidsynth get from 
PortAudio:
> 
>  PortAudio device 0 name: Driver primario di acquisizione suoni. Channels: 0
>  PortAudio device 1 name: Fast Track Pro In 1/2. Channels: 0
>  PortAudio device 2 name: Realtek HD Audio Input. Channels: 0
>  PortAudio device 3 name: Fast Track Pro In S/PDIF. Channels: 0
>  PortAudio device 4 name: Driver audio principale. Channels: 2
>  PortAudio device 5 name: Fast Track Pro Out 1/2. Channels: 2
>  PortAudio device 6 name: Realtek HD Audio output. Channels: 8
>  PortAudio device 7 name: Fast Track Pro Out 3/4. Channels: 2
>  PortAudio device 8 name: ASIO4ALL v2. Channels: 8
>  PortAudio device 9 name: M-Audio USB ASIO. Channels: 4
>  PortAudio device 10 name: Realtek HD Audio Input. Channels: 0
>  PortAudio device 11 name: Realtek HD Audio output. Channels: 8
>  PortAudio device 12 name: Fast Track Pro In 1/2. Channels: 0
>  PortAudio device 13 name: Fast Track Pro In S/PDIF. Channels: 0
>  PortAudio device 14 name: Fast Track Pro Out 1/2. Channels: 2
>  PortAudio device 15 name: Fast Track Pro Out 3/4. Channels: 2
> 
> Counting only the devices with Channels >= 2, index 6 is "Realtek HD Audio 
output".
> 
> I should sort the list again when looking for the device index, but I don't 
know if it makes sense.
> 
> Have you got any idea ? Maybe there's another solution, easier and faster.

Yes, the settings list (and other FluidSynth lists) are alphabetically sorted 
when you iterate the list elements. This happens since FluidSynth 1.1.0 IIRC.

Anyway, the index that matters for PortAudio is the #9 that you get in the 
second list. This is the number that you need to open that device, not the 
index from the FluidSynth list.

I think that an easier solution for you would be to concatenate the device 
number and the device name for each device before adding it to the settings. I 
mean something like this in fluid_portaudio_driver_settings():

  char deviceName[256];
  // ...
  for (i = 0; i < numDevices; i++)
  {
    deviceInfo = Pa_GetDeviceInfo (i);
    if ( deviceInfo->maxOutputChannels >= 2 ) {
      snprintf (deviceName, sizeof(deviceName), "#%02d_%s", 
                i, deviceInfo->name);
      fluid_settings_add_option (settings, "audio.portaudio.device",
                                 deviceName);
    }
  }

You need to do something in new_fluid_portaudio_driver() as well, when 
comparing the actual setting value to each PortAudio device name. This is 
needed for programs like Qsynth. 

Regards,
Pedro



reply via email to

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