[LAD] ALSA FLoat sample format

Phil Frost indigo at bitglue.com
Thu Aug 16 13:04:29 UTC 2007


I am no alsa programming expert, but could it be that for some reason,
alsa is attempting to open a hardware device (hw:0, or such) rather than
a plugin device (such as plughw:0)? Or, perhaps it is opening the
default interface, which is an alias for hw:0. This default could have
changed between alsa versions.

Hardware devices will fail if an attempt is made to open them with
anything other than parameters which are directly supported by the
hardware. Plug devices however, will happly do things like convert
sample rates and formats, at the cost of some uncertainty of what
actually happens, and maybe some performance penalty.

On Thu, Aug 16, 2007 at 09:39:48AM +0200, Predrag Viceic wrote:
> Hi,
> 
> 
> For some unknown reason, I seem to be unable to set SND_PCM_FORMAT_FLOAT 
> format flag when initialising alsa driver. This happens with my both cards 
> (on is the laptops AC'97 Audio Controller and the other a similar onboard 
> cart)
> 
> This line used to work with alsa 0.9 but return an "Invalid argument" error 
> with alsa 1.0.14a :
> 
> snd_pcm_hw_params_set_format(alsa_pcm_handle, alsa_hwparams, 
> SND_PCM_FORMAT_FLOAT_LE)
> 
> If I remove this line, the driver gets initialised but as integer sample 
> format, which, of course, generates noise as I'm sending 32bit floats to the 
> output...
> 
> Example code at lines 1031-1041 :
> http://cvs.savannah.nongnu.org/viewvc/freecycle/src/soundplayer.cpp?annotate=1.19&root=freecycle
> 
> 
> Please, please help !
> 
> 
> Predrag
> 
> http://freecycle.redsteamrecords.com



More information about the Linux-audio-dev mailing list