[Top][All Lists]

[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: Tue, 5 Jun 2012 23:08:03 +0200
User-agent: KMail/1.13.5 (Linux/; KDE/4.4.4; i686; ; )

On Tuesday 05 June 2012, Massimo Callegari wrote:
> Hi again !
> After debugging a while I found the cause of this.
> I needed to register the parallel list name "audio.portaudio.dev_idx_list" 
> to fluid_settings !

Correct, all settings must be registered. However, that setting is not 
required. See below.
> Now the index lookup seems to be working fine. Attached the new file.
> This solution still looks quite complicated to me but for now it is working.
> If you like the implementation, then you can remove/replace all the fprintf 
> I left in the code.

We don't use fprintf() for debugging, there is a FLUID_LOG macro with the 
argument FLUID_DBG for that.

> Basically, for the application point of view, I've added the 
> "audio.portaudio.index" key to select a device by index (the Fluidsynth 
> index) and not by name.

But you didn't register this "audio.portaudio.index" setting. It should be 
registered as an integer: fluid_settings_register_int().

No, I don't like that solution. You don't need a parallel list at all. If the 
user has set "audio.portaudio.index" to some value, then you only need to 
check that it is in range (0 to numDevices) and has outputs. For instance:

if (fluid_settings_getint (settings, "audio.portaudio.index", &device_index))
  if (device_index >= 0 && device_index <= numDevices)  
     deviceInfo = Pa_GetDeviceInfo (device_index);
     if (deviceInfo && deviceInfo->maxOutputChannels >= 2 )
        outputParams.device = device_index;
        FLUID_LOG (FLUID_DBG, "Selected PortAudio index: %d Device: %s\n",
                   device_index, deviceInfo->name);       

The option "audio.portaudio.index" may be useful for some use cases, but the 
problem for Qsynth users remains: PortAudio may return the same name for two 
different indexes (one for DirectSound, and another for WDMKS) so FluidSynth 
will remember only one option. The only general solution for this problem is 
modifying the strings stored as options for "audio.portaudio.device", 
including the device type, index, both, or whatever else.

> Another thing. When I started to compile Fluidsynth+PortAudio in Windows I 
> had troubles with the unistd.h header and Visual C. Since only "bzero" was 
> used from it, I converted it to "memset(0)". (please have a look at this: 
> http://stackoverflow.com/questions/4813267/problem-with-unistd-h-in-vc )

I guess that nobody compiled PortAudio in Windows lately. First, bzero() 
belongs to <strings.h>, http://linux.die.net/man/3/bzero , but you are right 
replacing it with memset.

OTOH, the <unistd.h> header inclusion should be protected (instead of removed)

#include <unistd.h>

HAVE_UNISTD_H is defined (or not) in the cmake generated header "config.h"


reply via email to

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