Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: James Courtier-Dutton <James@superbug.co.uk>
To: Adrian McMenamin <adrian@mcmen.demon.co.uk>
Cc: alsa-devel@alsa-project.org
Subject: Re: Stereo or mono - how to tell, what to do?
Date: Sun, 12 Mar 2006 21:56:33 +0000	[thread overview]
Message-ID: <44149911.1030309@superbug.co.uk> (raw)
In-Reply-To: <1142194467.19034.6.camel@localhost.localdomain>

Adrian McMenamin wrote:
> I want to add the capacity to play stereo samples to my Dreamcast sound
> driver.
>
> The hardware does not support interleaved samples and in the OSS driver
> I simply separated out the input stream into two different buffers and
> transferred them separately into the hardware's memory. Can I do the
> same with ALSA or is there some middle layer magic I should be aware of?
>   
You can get alsa-lib to send either interleaved or non-interleaved 
samples to your driver.
You just tell alsa-lib which format you like, and set the 
snd_pcm_hardware .info parameter.
I have not looked into how alsa-lib informs the driver of the 
non-interleaved nature of the samples. You might have to look into that 
yourself.
Probably something in the snd_pcm_runtime structure.
> And how can my driver tell if the incoming samples are stereo or not. In
> OSS this was all done through the SNDCTL_DSP_STEREO and
> SNDCTL_DSP_CHANNELS ioctls, how do I do it in ALSA (I need to inform the
> hardware to expect two channels and not one).
>
> Adrian
>
>   
You get all that information from the prepare() callback.
The parameter passed is struct snd_pcm_substream *substream.
substream->runtime->rate
substream->runtime->format
substream->runtime->channels
substream->runtime->buffer_size
substream->runtime->period_size
substream->runtime->periods





-------------------------------------------------------
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

      reply	other threads:[~2006-03-12 21:56 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-03-12 20:14 Stereo or mono - how to tell, what to do? Adrian McMenamin
2006-03-12 21:56 ` James Courtier-Dutton [this message]

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=44149911.1030309@superbug.co.uk \
    --to=james@superbug.co.uk \
    --cc=adrian@mcmen.demon.co.uk \
    --cc=alsa-devel@alsa-project.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox