Skip to contentSkip to conversation

Detecting the sample format in the driver

DISCUSSION Adrian McMenamin 3 participants 4 messages Mar 19, 2006 – Mar 20, 2006

lore
Share & tools
lore
#0 lore raw

for some reason this isn't working for me - and I need to set hardware channel parameters on the basis of the sample.

My hardware plays signed 8 bit, signed 16 bit little endian and 8 bit adaptive differential PCM and I have this set...

.formats =

	    (SNDRV_PCM_FMTBIT_S8 | SNDRV_PCM_FMTBIT_S16_LE |
	     SNDRV_PCM_FMTBIT_IMA_ADPCM),

But when I try to detect the format...

	if ((substream->runtime)->format == SNDRV_PCM_FMTBIT_S16_LE)
		channel->sfmt = SM_16BIT;

It doesn't seem to work.

I am assuming the alsa subsystem ought to process the stream for me - ie any 16 bit stream will turn up as SNDRV_PCM_FMTBIT_S16_LE - is that right? And if it is, why isn't it working?

-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642

#1 lore raw
Quoted 20 lines · Adrian McMenamin

for some reason this isn't working for me - and I need to set hardware channel parameters on the basis of the sample.

My hardware plays signed 8 bit, signed 16 bit little endian and 8 bit adaptive differential PCM and I have this set...

.formats =

	    (SNDRV_PCM_FMTBIT_S8 | SNDRV_PCM_FMTBIT_S16_LE |
	     SNDRV_PCM_FMTBIT_IMA_ADPCM),

But when I try to detect the format...

	if ((substream->runtime)->format == SNDRV_PCM_FMTBIT_S16_LE)
		channel->sfmt = SM_16BIT;
Quoted 6 lines

It doesn't seem to work.

I am assuming the alsa subsystem ought to process the stream for me - ie any 16 bit stream will turn up as SNDRV_PCM_FMTBIT_S16_LE - is that right? And if it is, why isn't it working?

What does snd_pcm_format_width(runtime->format) return (check emupcm.c for examples)?

Lee

-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642

#2 lore raw
In reply to Adrian McMenamin
Quoted 1 line · Adrian McMenamin
	if ((substream->runtime)->format == SNDRV_PCM_FMTBIT_S16_LE)

This should be SNDRV_PCM_FORMAT_S16_LE.

HTH
Clemens

-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642

#3 lore raw
Quoted 6 lines · Clemens Ladisch
Quoted 1 line · Adrian McMenamin
	if ((substream->runtime)->format == SNDRV_PCM_FMTBIT_S16_LE)

This should be SNDRV_PCM_FORMAT_S16_LE.

Which works! Thanks.

-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642