[alsa-devel] Only one element for multichannel mixer controls please!

Takashi Iwai tiwai at suse.de
Mon Oct 27 11:48:47 CET 2008

At Mon, 27 Oct 2008 11:12:59 +0100 (CET),
Jaroslav Kysela wrote:
> On Mon, 27 Oct 2008, Takashi Iwai wrote:
> > At Mon, 27 Oct 2008 10:20:48 +0100 (CET),
> > Jaroslav Kysela wrote:
> > > 
> > > On Mon, 27 Oct 2008, Takashi Iwai wrote:
> > > 
> > > > IMHO, a big part of the problem is its overly complex layers and
> > > 
> > > I agree. Some layers should be merged and simplified.
> > > 
> > > > old-style mixer API (in addition to complete lack of documentation).
> > > 
> > > I don't understand what you mean old-style API. API inside alsa-lib or 
> > > smixer API for applications? If it's the second case, what you imagine as 
> > > right mixer API for apps?
> > 
> > In my mind, mostly about the external API:
> > - what if an element has 2 switches but 4 volumes?
> Do we need to handle such situation? If we start to describe the exact 
> routes we end in more deep hell. I would propose to leave mapping 1:1 and 
> join requests for 2 switches together (with eventual value change event 
> returned back to app). Eventually, we can return a volume/switch map to 
> application which controls are joined.

A primary question is: Is this mixer abstraction supposed to be as
generic as possible, or to make desktop-apps (not "pro-audio")
programmer's life happier?

> > - are common, playback and capture exclusive?
> It's just about to add one function returning this information.

Hmm, I'm confused.  There are cases that both independent playback and
capture volumes are provided, and the cases where volumes are
irrelevant with playback/capture direction.  I thought the "common"
corresponds to the latter.

> > - exclusive switch is often messy; whether it's a radio button or a list,
> >   it's a question of UI, not about API - a list is more appropriate
> We need to add this to documentation.

It's not about the documentation but about the implementation.
For example, the smixer gives exclusive switches from "Capture Source"
enum.  This is really annoying.

OTOH, the exiting apps already assume that these switches (but often
even don't check the exclusivity!), so we can't break this always.
This is why I think it sucks.  We stuck.  Yeah, we can say "fix apps".
But we know that this never works.

> > - why attach/deteach/load ops needed in addition to open/close?
> > - why hctl?
> > - what is mixer class and why necessary?
> > - why both snd_mixer_elem and snd_mixer_selem exist?
> It's exactly what I meant by simplification and merging. Anyway, all 
> mentioned things are mostly cosmetic. They imply no dramatic changes for 
> applications.

Yeah, I don't want to impact too much application side at all, too.
If we were allowed, we should rewrite every alsa-lib API :)

> > But, about internal API, too:
> > - the abstraction concept is nowhere documented
> > - the internal API is nowhere documented
> > - simple_none.c is still buggy (the common elements aren't handled
> >   properly any existing mixer apps including alsamixer)
> >
> > > > The plugin solution doesn't work well because you are tring to graft
> > > > orange and apple.
> > > 
> > > Please, explain.
> > 
> > Well, in your scenario, each driver writer is supposed to create a new
> > C smixer plugin.  But, providing both is a hard work because they are
> > really two different things.  In the current situation without any
> > good information how and what to do, grafting two different things
> > doesn't work well.
> > 
> > The plugin framework is pretty simple.  But, this means that you owe
> > so many things (almost everything) in the plugin itself.  That's why
> > no one can start on it.  At least, we need good examples codes and a
> > good helper library for that.
> I agree, it's time to create a helper library and some documentation (or 
> better documented code example).

Yep, but the helper library would be just the second step.  The first
step is to create a plugin that really works well.

HOWEVER: before we go on, maybe now is a good time to consider the
biggest problem we have.

Suppose you are an app programmer.  A common question would be:
  "how can I change the volume of my application?"  
Do you have an answer that works 100% reliably?  I don't.

A next question would be:
  "how can I set up a recording from the front mic on my application?"
I have no 100% working answer, too.

There would be more such simple question.  And I think we have no
answer to all of them.

Certainly the current API isn't designed to serve for such things.
Why?  *We* need the answer for that...



More information about the Alsa-devel mailing list