From alsa-devel-owner@alsa.jcu.cz  Mon Oct  5 22:03:07 1998
Received: from entry.jcu.cz (IDENT:perex@entry.jcu.cz [160.217.1.111])
	by marvin.jcu.cz (8.9.1a/8.9.1) with SMTP id WAA26295;
	Mon, 5 Oct 1998 22:01:57 +0200
Date: Mon, 5 Oct 1998 22:01:51 +0200 (CEST)
From: Jaroslav Kysela <perex@jcu.cz>
To: "Christopher T. Lansdown" <lansdoct@screech.cs.alfred.edu>
cc: alsa-devel@jcu.cz
Subject: Re: Mono
In-Reply-To: <Pine.LNX.4.05.9810051445280.24132-100000@screech.cs.alfred.edu>
Message-ID: <Pine.LNX.3.96.981005215224.6913C-100000@entry.jcu.cz>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
Reply-To: alsa-devel@alsa.jcu.cz
Sender: alsa-devel-owner@alsa.jcu.cz
Precedence: list

On Mon, 5 Oct 1998, Christopher T. Lansdown wrote:

> Hi,
> 	If a channel isn't stereo, which channel (left or right), should
> the volume and mute be set in?  What happens if they differ?  Thanks.

OK. This is more complex question. ALSA driver differ between mono
channel, stereo channel with mono mute (AC'97 codecs for example) and
stereo channel with stereo mute.

Mono volume handling in driver:

  if ( !channel -> hw.stereo ) {
    right = left = (left + right) / 2;
  }

 ---> left and right should be set to same value for proper function

Application can check if channel is stereo by checking
SND_MIXER_CINFO_CAP_STEREO.

Mono mute handling:

    if ( channel -> hw.stereo && !channel -> hw.mmute ) {
      if ( device.flags & SND_MIXER_FLG_MUTE_LEFT ) mask |= SND_MIX_MUTE_LEFT;
      if ( device.flags & SND_MIXER_FLG_MUTE_RIGHT ) mask |= SND_MIX_MUTE_RIGHT
    } else {
      if ( device.flags & SND_MIXER_FLG_MUTE ) mask = SND_MIX_MUTE;
    }

 ---> if some mute flag (regardless if left or right) set -> result is
      mute otherwise is result unmute

Application should detect if mono mute is active by checking 
SND_MIXER_CINFO_CAP_MONOMUTE.

This combination should never occur:

	!SND_MIXER_CINFO_CAP_STEREO && !SND_MIXER_CINFO_CAP_MONOMUTE

							Jaroslav

-----
Jaroslav Kysela <perex@jcu.cz>
Academic Computer Centre, University of South Bohemia
Branisovska 31, C. Budejovice, CZ-370 05 Czech Republic


