All of lore.kernel.org
 help / color / mirror / Atom feed
From: Clemens Ladisch <clemens@ladisch.de>
To: Mike Frysinger <vapier@gentoo.org>
Cc: alsa-devel@alsa-project.org
Subject: Re: handling of dmix and non-dmix in the same configuration file
Date: Fri, 22 Feb 2008 14:50:18 +0100	[thread overview]
Message-ID: <47BED31A.606@ladisch.de> (raw)
In-Reply-To: <200802211804.39684.vapier@gentoo.org>

Mike Frysinger wrote:
> [...]
> but now we want to support dmix/dsnoop.  the overhead for dmix vs non-dmix is
> such that we make it optional.  if the user does not need software mixing,
> they can disable this overhead.  this leads to two (incompatible) alsa config
> files (in this case, for the AD1980 codec).  we're wondering if it's possible
> to have the right settings selected on the fly some how during runtime rather
> than having to select one file or the other.

Let's assume we have the following definitions:

AD1980.pcm.default_dmix_yes {
    ...
}
AD1980.pcm.default_dmix_no {
    ...
}

Then we can select one of them based on a setting in some configuration
file:

AD1980.pcm.default {
    @args [ CARD ]
    @args.CARD { type string }
    @func refer
    name {
        @func concat
        strings [
            "cards.AD1980.pcm.default_dmix_"
            {
                @func refer
                name defaults.use_AD1980_dmix
                default yes
            }
            ":CARD="
            $CARD
        ]
    }
}

To disable dmix, put the line
    defaults.use_AD1980_dmix no
into /etc/asound.conf or the user's ~/.asoundrc.

It is also possible to use the value of an environment variable:

AD1980.pcm.default {
    @args [ CARD ]
    @args.CARD { type string }
    @func refer
    name {
        @func concat
        strings [
            "cards.AD1980.pcm.default_dmix_"
            {
                @func getenv
                vars [ USE_AD1980_DMIX ]
                default yes
            }
            ":CARD="
            $CARD
        ]
    }
}

This environment variable must be set to "no" before starting the
respective application.

It is also possible to use the value of an environment variable but to
fall back to some configuration setting if the env var does not exist:

AD1980.pcm.default {
    @args [ CARD ]
    @args.CARD { type string }
    @func refer
    name {
        @func concat
        strings [
            "cards.AD1980.pcm.default_dmix_"
            {
                @func getenv
                vars [ USE_AD1980_DMIX ]
                default {
                    @func refer
                    name defaults.use_AD1980_dmix
                    default yes
                }
            }
            ":CARD="
            $CARD
        ]
    }
}


HTH
Clemens

      reply	other threads:[~2008-02-22 13:48 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-21 23:04 handling of dmix and non-dmix in the same configuration file Mike Frysinger
2008-02-22 13:50 ` Clemens Ladisch [this message]

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=47BED31A.606@ladisch.de \
    --to=clemens@ladisch.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=vapier@gentoo.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.