All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: alsa formats explained?
  2004-07-01 12:51 alsa formats explained? James Courtier-Dutton
@ 2004-07-01 12:49 ` Jaroslav Kysela
  0 siblings, 0 replies; 2+ messages in thread
From: Jaroslav Kysela @ 2004-07-01 12:49 UTC (permalink / raw)
  To: James Courtier-Dutton; +Cc: alsa-devel

On Thu, 1 Jul 2004, James Courtier-Dutton wrote:

> I need to send 32bits for each sample to a sound card.
> The contents of the value is LE.
> The card only takes notice of the high 24bits. 0xffffff00
> 
> Which alsa format string should I use in the alsa driver to tell 
> alsa-lib to send samples in this format.
> 
> I want alsa-lib to be able to do the correct conversions:
> E.g. 8bit samples -> 0xff000000
>      16bit samples -> 0xffff0000
>      24bit samples -> 0xffffff00
>      32bit samples -> 0xffffffff  (but the lower 8 bits 0x000000ff will 
> be dropped by the hardware.)
> 
> I think I should use S32_LE, but I wanted to verify that here first.

Correct.

> I can find a bit of the alsa docs explaining this, but it seems a bit 
> unclear to me. Maybe a diagram should be added or something like this:
> S32_LE,  alsa-lib sends to the hardware 24bit samples -> 0xffffff00
> S24_LE,  alsa-lib sends to the hardware 24bit samples -> 0x00ffffff
> (^ I think it works like that ^)

Correct.

> Here is what I found:
> "24-bit linear samples are using three low bytes from the 32-bit word. 
> When hardware uses 24-bit format in 32-bit linear samples (the low byte 
> is ignored), then the sample format is 32-bit, and the msbits_per_sample 
> member from the snd_pcm_channel_setup_t structure shows count of most 
> significant bits being used (24 in this case). The other formats (for 
> example 20-bit linear sample stored in the 32-bit linear sample) may 
> follow this example as well."

What's unclear?

						Jaroslav

-----
Jaroslav Kysela <perex@suse.cz>
Linux Kernel Sound Maintainer
ALSA Project, SUSE Labs


-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training.
Attend Black Hat Briefings & Training, Las Vegas July 24-29 - 
digital self defense, top technical experts, no vendor pitches, 
unmatched networking opportunities. Visit www.blackhat.com

^ permalink raw reply	[flat|nested] 2+ messages in thread

* alsa formats explained?
@ 2004-07-01 12:51 James Courtier-Dutton
  2004-07-01 12:49 ` Jaroslav Kysela
  0 siblings, 1 reply; 2+ messages in thread
From: James Courtier-Dutton @ 2004-07-01 12:51 UTC (permalink / raw)
  To: alsa-devel

I need to send 32bits for each sample to a sound card.
The contents of the value is LE.
The card only takes notice of the high 24bits. 0xffffff00

Which alsa format string should I use in the alsa driver to tell 
alsa-lib to send samples in this format.

I want alsa-lib to be able to do the correct conversions:
E.g. 8bit samples -> 0xff000000
     16bit samples -> 0xffff0000
     24bit samples -> 0xffffff00
     32bit samples -> 0xffffffff  (but the lower 8 bits 0x000000ff will 
be dropped by the hardware.)

I think I should use S32_LE, but I wanted to verify that here first.

I can find a bit of the alsa docs explaining this, but it seems a bit 
unclear to me. Maybe a diagram should be added or something like this:
S32_LE,  alsa-lib sends to the hardware 24bit samples -> 0xffffff00
S24_LE,  alsa-lib sends to the hardware 24bit samples -> 0x00ffffff
(^ I think it works like that ^)

Here is what I found:
"24-bit linear samples are using three low bytes from the 32-bit word. 
When hardware uses 24-bit format in 32-bit linear samples (the low byte 
is ignored), then the sample format is 32-bit, and the msbits_per_sample 
member from the snd_pcm_channel_setup_t structure shows count of most 
significant bits being used (24 in this case). The other formats (for 
example 20-bit linear sample stored in the 32-bit linear sample) may 
follow this example as well."

Cheers
James


-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training.
Attend Black Hat Briefings & Training, Las Vegas July 24-29 - 
digital self defense, top technical experts, no vendor pitches, 
unmatched networking opportunities. Visit www.blackhat.com

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2004-07-01 12:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-07-01 12:51 alsa formats explained? James Courtier-Dutton
2004-07-01 12:49 ` Jaroslav Kysela

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.