All of lore.kernel.org
 help / color / mirror / Atom feed
From: James Courtier-Dutton <James@superbug.demon.co.uk>
To: alsa-devel@lists.sourceforge.net
Subject: alsa formats explained?
Date: Thu, 01 Jul 2004 13:51:38 +0100	[thread overview]
Message-ID: <40E408DA.1090403@superbug.demon.co.uk> (raw)

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

             reply	other threads:[~2004-07-01 12:51 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-07-01 12:51 James Courtier-Dutton [this message]
2004-07-01 12:49 ` alsa formats explained? Jaroslav Kysela

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=40E408DA.1090403@superbug.demon.co.uk \
    --to=james@superbug.demon.co.uk \
    --cc=alsa-devel@lists.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.