[alsa-devel] How to enforce 32bit access?
Takashi Iwai
tiwai at suse.de
Thu Oct 11 10:50:54 CEST 2007
At Wed, 10 Oct 2007 17:40:08 +0200,
Joachim Foerster wrote:
>
> On Wed, 2007-10-10 at 15:22 +0200, Takashi Iwai wrote:
> > > > At Fri, 05 Oct 2007 19:09:53 +0200,
> > > > Joachim Foerster wrote:
> > > > >
> > > > > Hi ALSA devs,
> > > > >
> > > > > meanwhile I tried to put a constraint on SNDRV_PCM_HW_PARAM_FRAME_BITS
> > > > > by the use of snd_pcm_hw_constraint_minmax() function with min=32 and
> > > > > max=32, but still no success - the ALSA Library still makes 16bit
> > > > > accesses, when playing mono (1 channel) files.
> > > > >
> > > > > Any ideas?
> > > >
> > > > Could you show the chain of plugins via aplay -v ?
> > > > I'm not sure which plugin requires S16. Possibly, the rate converter.
> > >
> > > bash-3.00# aplay -v -M ../Absage.wav
> > > Playing WAVE '../Absage.wav' : Signed 16 bit Little Endian, Rate 16000
> > > Hz, Mono
> >
> > Well, the sample itself is 16bit format, and your hardware *does*
> > support 16bit format. Why to be 32bit?
>
> Well actually, we are on a embedded system here. The bus is 32bit wide
> (Xilinx ML403, PowerPC 405, OBP). So, why waste resources with two 16bit
> accesses?
Because you programmed in such a way :)
> One sample is 16bits. But we have two channels (stereo only). Thus the
> controller expects a frame with 32bit data - two samples at the same
> time.
>
> Joachim
>
> PS: As soon as stereo .wav-files are used, there is no problem, because
> then the "conversion framework" and the Plug PCM are not used - just a
> plain memcpy which results in 32bit accesses.
The problem is that the driver still accepts the 16bit format mono
stream. That's what I pointed in my previous post. There is no
format conversion in alsa-lib at all. It's only channel expansion
from mono to stereo. The hardware accepts 16bit stereo. So, there is
nothing wrong from this viewpoint.
Maybe it's not about plugin but a problem of mmap with your device?
Plug PCM: Route conversion PCM (sformat=S16_LE)
Transformation table:
0 <- 0
1 <- 0
Its setup is:
stream : PLAYBACK
access : MMAP_INTERLEAVED
format : S16_LE
subformat : STD
channels : 1
rate : 16000
exact rate : 16000 (16000/1)
msbits : 16
buffer_size : 4096
period_size : 1024
period_time : 64000
tick_time : 4000
tstamp_mode : NONE
period_step : 1
sleep_min : 0
avail_min : 1024
xfer_align : 1024
start_threshold : 4096
stop_threshold : 4096
silence_threshold: 0
silence_size : 0
boundary : 1073741824
Slave: Hardware PCM card 0 'Lorenz' AC97 Digital Controller' device 0
subdevice 0
Its setup is:
stream : PLAYBACK
access : MMAP_INTERLEAVED
format : S16_LE
subformat : STD
channels : 2
rate : 16000
exact rate : 16000 (16000/1)
msbits : 16
buffer_size : 4096
period_size : 1024
period_time : 64000
tick_time : 4000
tstamp_mode : NONE
period_step : 1
sleep_min : 0
avail_min : 1024
xfer_align : 1024
start_threshold : 4096
stop_threshold : 4096
silence_threshold: 0
silence_size : 0
boundary : 1073741824
Takashi
More information about the Alsa-devel
mailing list