All of lore.kernel.org
 help / color / mirror / Atom feed
From: Florian Schmidt <mista.tapas@gmx.net>
To: Linus Torvalds <torvalds@osdl.org>
Cc: Takashi Iwai <tiwai@suse.de>, Jaroslav Kysela <perex@suse.cz>,
	Paul Davis <paul@linuxaudiosystems.com>,
	alsa-devel@lists.sourceforge.net
Subject: Re: The ALSA Situation
Date: Fri, 12 Nov 2004 23:06:17 +0100	[thread overview]
Message-ID: <20041112230617.41c5073e@mango.fruits.de> (raw)
In-Reply-To: <Pine.LNX.4.58.0411120741300.2301@ppc970.osdl.org>

On Fri, 12 Nov 2004 07:50:58 -0800 (PST)
Linus Torvalds <torvalds@osdl.org> wrote:

> I won't argue against that. I don't actually mind EBUSY myself. At least
> it's a pretty obvious error condition, and together with some (alternate)  
> mixing interface - whether user or kernel mode - I don't think there is
> anything fundamentally wrong with just saying "I'm busy, I can't take you
> right now".

Hi,

for whatever it's worth i completely agree with just using EBUSY when the
device is not available for a program (no additional open allowed by the
hw). This blocking behaviour is the single most irritating aspect of ALSA.

> 
> My arguments have really been against blocking. And to some degree an 
> argument against people thinking it's _good_ to set individual parameters. 

Historically seen there's a long tradition for sound applications to choose
their own parameters as different applications serve vastly different
purposes and thus imply different paramaters to be used.

A low latency realtime effects box program will need completely different
periodsize and periodcount settings than a program without realtime needs
like a highly reliable harddisc recorder. The former will use a very small
periodsize and a periodcount of 2 (or the minimum available by the hw), the
latter will use the opposite (large periodsizes and a high periodcount).

The need for software mixing is somewhat orthogonal to this, as it enforces
a particular set of settings on all programs using this software mixing
device. The software mixing device might still allow the programs to use
their own set of parameters, but this would require some sort of
conversion/translation (and of course a program, using a periodsize/count
smaller than the ones the software mixing device uses to communicate with
the hw, doesn't gain anything by doing so).

For compatibility issues this translation/conversion is a must and since
ALSA aims to provide full compatibility for OSS apps, the software mixing
and conversion must be available to the OSS emulation layer as well.

The current "ALSA situation" looks like follows (correct me people if i talk
BS):

1. ALSA infrastructure kernel modules (pcm, seq, ctl, other voodoo stuff)
2. ALSA driver modules (using 1.)
3. ALSA OSS emulation modules (using 2. used directly by OSS apps)
4. ALSA-lib (using 2. used by ALSA apps)
5. ALSA-oss-lib (using 4. LD_PRELOAD hack to make OSS apps use ALSA-lib)

ALSA does provide software mixing and conversion routines. But these reside
in ALSA-lib, thus to make use of them systemwide, both ALSA apps and OSS
apps need to go through ALSA-lib. This is a natural thing for ALSA apps as
it was designed this way. For OSS apps one needs to use the ALSA-oss-lib
(5]), which is a hack and doesn't work with all OSS apps, as there is no way
to LD_PRELOAD symbols which are not resolved at runtime (excuse my possibly
wrong terminology).

IMHO it would be better to have the software mixing and conversion code in a
place where the ALSA OSS emulation modules can make use of them. I don't
know how feasible it is to call userspace stuff from the kernel space, but i
can imagine it's rather difficult. Thus the software mixing and conversion
stuff should live in the kernel.

I'm not arguing against having plugin functionality in ALSA-lib per se.
There's many uses for this (effects, routing between alsa apps), but i think
the fundamental mixing/conversion stuff is really needed in the kernel.

So how to add this functionality to ALSA with the least effort and breakage?
Personally i think the following is the best approach:

1. ALSA infrastructure kernel modules (pcm, seq, ctl, other voodoo stuff) 
2. ALSA driver modules (using 1. one instance for every real soundcard driver) 
3. ALSA virtual soundcard modules (using 2. sw mixing plus conversion for 2.) 
4. ALSA OSS emulation modules (using 2 or 3. used directly by OSS apps) 
5. ALSA-lib (using 2 or 3. used by ALSA apps) 

The ALSA virtual soundcard module (3.) would look to ALSA-lib or to the ALSA
OSS emulation modules just like a normal soundcard. When used it "opens" the
underlying ALSA driver module and provides software mixing and conversion by
allowing umlimited open's and arbitrary parameters to all applications using
it either through the OSS emulation modules or ALSA-lib.

Actually thanks to the design of ALSA, this is really all that needs to be
done to provide software mixing to all OSS apps and to all ALSA apps. The
distribution/user would only have to make sure that the virtual soundcard
module is loaded for the card and that both OSS emu modules and ALSA-lib use
it as default. For professional users neeeddng direct access to the hardware
they still have the option of using the real ALSA driver (as long as it's not
in use by the virtual soundcard module of course).

Sadly i have no idea about how difficult it would be to code up such a
virtual soundcard module, but i suppose some of the
resampling/mixing/conversion code in ALSA-lib can be reused. I have never
attempted to program a module, so i leave judgement about this idea to the
gurus :)

What other ways to intergrate this into the ALSA structure are there? And
how much effort do they take? In the end it all comes down to developer
time. I own a hardware mixing capable soundcard, so i can happily live with
the current ALSA state, but IMHO this is a very important thing missing for
the completely positive ALSA experience. ALSA has improved the situation for
a serious linux musician/audio user tremendously over OSS (which was really
a crutch). The final missing building block is providing an equally positive
experience to the laptop user with his crappy soundcard needing bleeps and
music at the same time..

(putting on flame suit, have at it ;))

   Florian Schmidt


-------------------------------------------------------
This SF.Net email is sponsored by: InterSystems CACHE
FREE OODBMS DOWNLOAD - A multidimensional database that combines
robust object and relational technologies, making it a perfect match
for Java, C++,COM, XML, ODBC and JDBC. www.intersystems.com/match8

  reply	other threads:[~2004-11-12 22:06 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-11-10  0:24 The ALSA Situation Eugenia Loli-Queru
2004-11-10  1:50 ` Paul Davis
2004-11-10  2:38   ` Eugenia Loli-Queru
2004-11-10  2:55     ` Paul Davis
2004-11-10  5:59     ` Lee Revell
2004-11-10 23:22       ` James Courtier-Dutton
2004-11-10 10:57     ` Jaroslav Kysela
2004-11-10 16:09       ` Lee Revell
2004-11-10 16:43       ` Linus Torvalds
2004-11-10 17:30         ` Takashi Iwai
2004-11-10 18:08           ` Linus Torvalds
2004-11-10 17:45         ` Jaroslav Kysela
2004-11-10 18:15           ` Linus Torvalds
2004-11-10 18:41             ` Paul Davis
2004-11-10 19:09               ` Linus Torvalds
2004-11-10 21:13                 ` Paul Davis
2004-11-10 22:34                   ` Linus Torvalds
2004-11-10 23:53                     ` Fernando Pablo Lopez-Lezcano
2004-11-11  6:32                     ` Jaroslav Kysela
2004-11-11  6:42                       ` Linus Torvalds
2004-11-11 16:34                         ` Takashi Iwai
2004-11-11 16:58                           ` Linus Torvalds
2004-11-11 17:25                             ` Takashi Iwai
2004-11-11 18:23                               ` Linus Torvalds
2004-11-11 22:34                                 ` Manuel Jander
2004-11-12  8:57                                   ` Takashi Iwai
2004-11-12  8:51                                 ` Takashi Iwai
2004-11-12 15:50                                   ` Linus Torvalds
2004-11-12 22:06                                     ` Florian Schmidt [this message]
2004-11-13  1:15                                       ` Manuel Jander
2004-11-13 10:38                                         ` Jaroslav Kysela
2004-11-14  4:00                                           ` Manuel Jander
2004-11-20  2:16                                           ` Configuration system and Resource Manager. Was: " Manuel Jander
2004-11-13 10:42                                       ` Jaroslav Kysela
2004-11-13 12:11                                         ` Florian Schmidt
2004-11-13 18:01                                           ` Linus Torvalds
2004-12-02  1:48                                         ` Florian Schmidt
2004-11-12  9:07                                 ` Giuliano Pochini
2004-11-11 22:52                           ` Manuel Jander
2004-11-12 13:44                             ` Takashi Iwai
2004-11-10 22:00             ` Hannu Savolainen
2004-11-10 17:13 ` Giuliano Pochini
     [not found] <20041110235502.6C8211D2B2D@sc8-sf-uberspam1.sourceforge.net>
2004-11-11  8:56 ` Andreas Mohr
2004-11-11 15:50   ` Manuel Jander
     [not found] <20041112040611.8390B1D2669@sc8-sf-uberspam1.sourceforge.net>
2004-11-12  8:24 ` Andreas Mohr
2004-11-12 13:33   ` Manuel Jander
2004-11-12 15:06   ` Clemens Ladisch

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20041112230617.41c5073e@mango.fruits.de \
    --to=mista.tapas@gmx.net \
    --cc=alsa-devel@lists.sourceforge.net \
    --cc=paul@linuxaudiosystems.com \
    --cc=perex@suse.cz \
    --cc=tiwai@suse.de \
    --cc=torvalds@osdl.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.