[alsa-devel] [RFC] Channel mapping API (take 2)

Takashi Iwai tiwai at suse.de
Thu Sep 6 13:56:08 CEST 2012


At Thu, 6 Sep 2012 19:47:16 +0800,
Raymond Yau wrote:
> 
> 2012-9-4 下午11:47 於 "Takashi Iwai" <tiwai at suse.de> 寫道:
> >
> > Hi,
> >
> > my proposal for channel mapping API seems accepted fairly well through
> > discussions at Plumbers, so I continued to work on it and uploaded the
> > updated version.
> >
> > The kernel part is found in sound-unstable tree topic/tlv-chmap branch
> >   git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-unstable.git
> >
> > and the alsa-lib part is found in github tree topic/chmap branch
> >   git://git.github.com/tiwai/alsa-lib.git
> >
> > The updated parts are:
> >
> > - SNDRV_CHMAP_NA was newly added, indicating the channel is not
> >   available or silent.
> >
> > - The channel position value is masked in lower 16bit.
> >   The upper bits are used for more channel attributes as bit flags.
> >
> >   #define SNDRV_CHMAP_POSITION_MASK     0xffff
> >
> >   The phase inverted channel has this bit:
> >   #define SNDRV_CHMAP_PHASE_INVERSE     (0x01 << 16)
> >
> >   And the driver-specific non-standard channel position has this:
> >   #define SNDRV_CHMAP_DRIVER_SPEC       (0x02 << 16)
> >
> > - The alsa-lib API functions use snd_pcm_chmap_query_t and
> >   snd_pcm_chmap_t instead of ambiguous integer arrays.
> >
> > ================================================================
> > /** the channel map header */
> > typedef struct snd_pcm_chmap {
> >         unsigned int channels;
> >         unsigned int pos[0];
> > } snd_pcm_chmap_t;
> >
> > /** the header of array items returned from snd_pcm_query_chmaps() */
> > typedef struct snd_pcm_chmap_query {
> >         enum snd_pcm_chmap_type type;
> >         snd_pcm_chmap_t map;
> > } snd_pcm_chmap_query_t;
> >
> >
> > snd_pcm_chmap_query_t **snd_pcm_query_chmaps(snd_pcm_t *pcm);
> > void snd_pcm_free_chmaps(snd_pcm_chmap_query_t **maps);
> > snd_pcm_chmap_t *snd_pcm_get_chmap(snd_pcm_t *pcm);
> > int snd_pcm_set_chmap(snd_pcm_t *pcm, const snd_pcm_chmap_t *map);
> > ================================================================
> >
> > The rest aren't so much changed.  Only slight bug fixes.
> >
> > A big remaining question is whether the current kernel-side
> > implementation is OK.  We may add some PCM ops pointer instead of the
> > current style using the direct control tlv/read/write override.
> > But the kernel-side API can be changed even later, so I don't worry
> > about it so much for now, as long as we can keep the ABI definition.
> >
> >
> some hda codec support AC_WCAP_LR_SWAP (e.g. the "Swap Center/LFE" switch)
> 
> git.kernel.org/?p=linux/kernel/git/tiwai/sound.git;a=commit;h=0fb87bb474f978446786263deff6263284e6e011
> 
> does your implementation have two channel maps for surround 5.1 for these
> idt codecs?

No.  Feel free to send a patch.

> how about the channal map of those internal subwoofer of notebook and those
> external subwoofer (e.g. sonicmaster subwoofer )  alc663 using asus-mode4
> 
> https://bugs.launchpad.net/ubuntu/+source/alsa-driver/+bug/871808

This should be advertised to match with the current configuration.
It's yet another homework after the framework is integrated.


Takashi


More information about the Alsa-devel mailing list