Subject: Re: Multiple channels of audio?
To: None <chris.wareham@eu.fkilogistex.com>
From: Brian A. Seklecki <lavalamp@spiritual-machines.org>
List: current-users
Date: 06/10/2004 13:31:15
> (http://jackit.sf.net/) does on Linux. It would be great if someone
> could port it to NetBSD, but it uses the horribly undocumented ALSA

ALSA isn't so bad(R); it's the fact that GTK/Gnome apps use ESD and
KDE/QT apps use ARTSD to add network transparency, which in-turn talk to
ALSA.

Eventually *BSD will require an ALSA compatibility layer, as the apps we
emulate and cross-compile will use that API exclusively. 

Let me propose this question: How does one deal with audio codecs w/ >2
channels, such as AC3.  Is it possible to have a platform independent
set of APIs for supporting surround sound? [application] -> [codec] ->
-> [uniform kernel interface] -> [hardware] ?

Notes from mplayer(1):

-channels <number>
 Change the number of playback channels, defaults to '2' if not
specified.  If
 the number of output channels is bigger than the  number  of  input 
channels
 empty channels are inserted (unless mixing from mono to stereo, then
the mono
 channel is repeated in both output channels).  If the number of output 
chan-
 nels  is smaller than the number of input channels, results depend on
the au-
 dio decoder (-afm).  MPlayer asks the decoder to decode  the  audio 
into  as
 many  channels  as  specified.  Now it's up to the decoder to fulfill
the re-
 quirement.  If the decoder outputs more channels than requested, the 
exceed-
 ing  channels  are  truncated.   This  is usually only important when
playing
 videos with AC3 audio (like DVDs).  In that case liba52 does the
decoding  by
 default  and correctly downmixes the audio into the requested number of
chan-
 nels.
 NOTE: This option is honored by codecs (AC3 only) filters (surround) 
and  ao
 drivers (OSS at least).

 Available options are:

          2    stereo
          4    surround
          6    full 5.1



-ac <[-]codec1,[-]codec2,...[,]>
 Specify a priority list of audio codecs to be used, according to their 
codec
 name in codecs.conf.  Use a '-' before the codec name to omit it.
 NOTE: See -ac help for a full list of available codecs.
 If the list has a trailing ',' it will fallback to codecs not listed.

 EXAMPLE:
          -ac mp3acm
               force l3codeca.acm MP3 codec
          -ac mad,
               try libmad first, then fallback to others
          -ac hwac3,a52,
               try  hardware  AC3  passthrough,  then software AC3
codec, then
               others
          -ac -ffmp3,
               try other codecs except FFmpeg's MP3 decoder


> audio layer by default.
> 
> Chris