All of lore.kernel.org
 help / color / mirror / Atom feed
From: Clemens Ladisch <clemens@ladisch.de>
To: "Sean M. Pappalardo - D.J. Pegasus" <spappalardo@mixxx.org>,
	Portaudio Mailing List <portaudio@music.columbia.edu>,
	alsa-devel@alsa-project.org
Cc: mixxx-devel <mixxx-devel@lists.sourceforge.net>
Subject: Re: Recording devices opened mono still sending stereo causing corrupt audio
Date: Fri, 11 Oct 2013 14:33:33 +0200	[thread overview]
Message-ID: <5257F01D.3040908@ladisch.de> (raw)
In-Reply-To: <52575722.7060208@mixxx.org>

Sean M. Pappalardo - D.J. Pegasus wrote:
> the problem occurs when PA is asked to open just one channel of
> a sound input device yet the device seems to stream two anyway.

Many devices do not support mono streams.

> I'm suspecting there's a miscommunication between PA and ALSA

The communication between ALSA and PA works just fine; ALSA reports the
minimum number of channels, and PA saves this value.

What does not work is the communication between PA and the application;
PA has no mechanism to report the minimum number of channels.

Even worse, if some application tries to use a channel count that is too
low, PA cleverly replaces it with the minimum support channel count:

  self->numHostChannels = PA_MAX( params->channelCount, StreamDirection_In == streamDir ? devInfo->minInputChannels
          : devInfo->minOutputChannels );

and then does not bother to tell anybody about this.

This bug is especially egregious because PA does later check whether the
number of channels is actually supported by the device; the code above
ensures that this checks uses the wrong channel number.


Regards,
Clemens

  reply	other threads:[~2013-10-11 12:33 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-11  1:40 Recording devices opened mono still sending stereo causing corrupt audio Sean M. Pappalardo - D.J. Pegasus
2013-10-11 12:33 ` Clemens Ladisch [this message]
2013-10-11 15:45   ` Alan Horstmann
2013-10-11 17:04     ` Clemens Ladisch
2013-10-12  1:05   ` [alsa-devel] " Ross Bencina
2013-10-12  1:20     ` [Portaudio] " RJ Ryan
2013-10-11 13:07 ` Alan Horstmann

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=5257F01D.3040908@ladisch.de \
    --to=clemens@ladisch.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=mixxx-devel@lists.sourceforge.net \
    --cc=portaudio@music.columbia.edu \
    --cc=spappalardo@mixxx.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 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.