Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: James Courtier-Dutton <James@superbug.demon.co.uk>
To: Bill Kapralos <billk@cs.yorku.ca>
Cc: alsa-devel@lists.sourceforge.net
Subject: Re: Question Regarding Simple ALSA Stereo Output
Date: Wed, 23 Jun 2004 16:44:52 +0100	[thread overview]
Message-ID: <40D9A574.9020609@superbug.demon.co.uk> (raw)
In-Reply-To: <Pine.GSO.4.58.0406230944290.6839@blue.cs.yorku.ca>

Bill Kapralos wrote:
> Hello
> 
> I am failry new to Linux programming and recently started using the ALSA
> API for some software I am writing involving the output of sound to a apir
> of headphones. Using (and slightly modifying) a simple example found on
> the ALSA web site (Matthias Nagorni, "ALSA 0.9.0 Howto") I am able to
> open the auduio port and send data to it however,  I am having some
> difficulty with the output of stereo data.  In particular, I am
> initializing the device for interleaved output (e.g.
> SND_PCM_ACCESS_RW_INTERLEAVED) and specifying two channels (at 16 bit
> little endian format).  I then have some stereo data (which I "create"
> which is in interleaved format (e.g. first word (2-byte sample) is for the
> left channel, second for the right channel, third for the left etc... but
> when i do send this data to the audio device (using the "writei" function,
> I do not get the desired result.  It appears as if it is simply outputting
> the data assuming one channel e.g. the same signal is heard in both the
> left and right ear even when I have deliberately made the signals
> different (e.g. introduced a considerable delay to one channel etc.).
> Furthermore, when I explicitly set all left channel samples to "0" and the
> right channel samples to "non-zero", no sound is heard at all - it seems
> as if only the left channel data is being output which is of course all
> zero.  In contrast, if i set all the right channel samples to zero and the
> left channel samples to non-zero, the sound is heard.
> 
> I am really confused with this problem! It appears as if I cannot control
> what is sent to the left/right channel! Am i completely overlooking
> something here? I am really puzzled by what I initially thought of as a
> trivial matter!!!
> 
> Any help would be greatly appreciated! Thank You in advance!
> 
> Please reply to: billkATcs.yorku.ca (of course replace "AT" with "@".
> 
> Regards,
> 
> 

Please post your code to a url so we can look at it.
Alternatively, look at the sample code in
./alsa-lib/test/pcm.c
or
./alsa-utils/speaker-test/speaker-test.c

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

  parent reply	other threads:[~2004-06-23 15:44 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-06-23 13:57 Question Regarding Simple ALSA Stereo Output Bill Kapralos
2004-06-23 14:45 ` Clemens Ladisch
2004-06-23 15:04   ` Bill Kapralos
2004-06-23 15:18     ` Clemens Ladisch
2004-06-23 16:50     ` James Courtier-Dutton
2004-06-23 15:44 ` James Courtier-Dutton [this message]
     [not found] <Pine.GSO.4.58.0406231129100.6839@blue.cs.yorku.ca>
2004-06-23 16:10 ` Clemens Ladisch
     [not found] <E1Bd8zp-00028B-03@sc8-sf-list2.sourceforge.net>
2004-06-23 22:11 ` Tom Watson

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=40D9A574.9020609@superbug.demon.co.uk \
    --to=james@superbug.demon.co.uk \
    --cc=alsa-devel@lists.sourceforge.net \
    --cc=billk@cs.yorku.ca \
    /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