Follow channel position definitions to mixer channel in mixer.h

mixer.h already contains some channel position definitions.
To be more consistent over all systems, better to follow the same
order for the new channel map, too.  But since UNKNOWN channel must be
zero but the definition in mixer.h contains -1 as UNKNOWN, simply
shift the value with 1.

If the conversion is required between SND_CHMAP and SND_MIXER_SCHN,
just increment/decrement 1.  Eventually I'll provide helper functions
for that...

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Add SND_CHMAP_NA and bit flag definitions

Signed-off-by: Takashi Iwai <tiwai@suse.de>
PCM: Introduce snd_pcm_chmap_t and snd_pcm_chmap_query_t

Instead of passing ambiguous integer array, define snd_pcm_chmap_t and
snd_pcm_chmap_query_t so that user can understand more easily which
element is for what.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
PCM: Implement snd_pcm_query_chmaps_from_hw()

This is a function similar like snd_pcm_query_chmaps() but performs
the query without a PCM handle.  The card, device and substream
numbers are passed as well as stream direction.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Fix duplicated channel entry in test/chmap.c

Signed-off-by: Takashi Iwai <tiwai@suse.de>
PCM: Fix prefix for snd_pcm_chmap_type enum members

Add _TYPE prefix to distinguish from the channel position.
Also add SND_CHMAP_TYPE_LAST entry pointing the last one like other
enums.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
PCM: Add string conversion helper functions for chmap

Added a few helper functions between chmap and string.
  snd_pcm_chmap_type_name() -- a string of the given chmap type
  snd_pcm_chmap_name() -- a string of the given channel position
  snd_pcm_chmap_print() -- print channel map on the given buffer
  snd_pcm_chmap_from_string() -- get a channel position from string
  snd_pcm_parse_string() -- parse the whole channel map from string

Signed-off-by: Takashi Iwai <tiwai@suse.de>
PCM: Add SND_CHMAP_API_VERSION definition

Just to make it easier for apps to support chmap conditionally via
simple ifdefs.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
PCM: Add snd_pcm_chmap_long_name()

Just return a more verbose name than snd_pcm_chmap_name(), but
including white spaces.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
PCM: Add query_chmaps support to multi plugin

Also fix some bugs in get_chmap().

Signed-off-by: Takashi Iwai <tiwai@suse.de>
PCM: Add chmap options to hw and null plugins

Add a config definition "chmap" to override (or enhance) the channel
maps.  So far, only a single channel map can be provided, and the
channel count consistency isn't strictly tested at all.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
PCM: Add the missing query_chmaps for route plugin

Also fix the channel count in get_chmap for route plugin.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Add chmap override definitions for Emu10k1, Audigy and Audigy2 cards

These cards won't provide the channel maps from the driver itself
because of the dynamic routing.  For simplicity, define chmaps in the
configurations, so that chmap querying of individual stereo streams
and combined multi streams works properly.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
PCM: Use compounds for overriding / enhancing chmaps

Instead of a single channel map, multiple channel maps can be provided
in a form of compound (array) to hw and null plugins.  In null
get_chmap, the channel map corresponding to the current channels is
copied from the given channel maps.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
conf: Add chmap definitions to TRIDENT and SI7018 configurations

Manually add the channel map definitions as the channel front/rear is
determined dynamically.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
test/chmap: Fix wrong malloc size

Signed-off-by: Takashi Iwai <tiwai@suse.de>
PCM: Define MONO and other channel map positions

Follow the new definitions in the kernel side.  MONO and others have
been added, and the order of position table was changed again.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
PCM: Fix the conversion from string to chmap position

Use strncasecmp() to allow lower cases, and also evaluate the inverted
phase suffix, too.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
PCM: A few doxygen fixes for chmap stuff

Signed-off-by: Takashi Iwai <tiwai@suse.de>