All of lore.kernel.org
 help / color / mirror / Atom feed
* handling of dmix and non-dmix in the same configuration file
@ 2008-02-21 23:04 Mike Frysinger
  2008-02-22 13:50 ` Clemens Ladisch
  0 siblings, 1 reply; 2+ messages in thread
From: Mike Frysinger @ 2008-02-21 23:04 UTC (permalink / raw)
  To: alsa-devel


[-- Attachment #1.1: Type: text/plain, Size: 1327 bytes --]

on the Blackfin processor, we have an "almost-but-not-quite" AC97 interface 
(called a "SPORT").  the trouble is that we can hook up AC97 codecs, but in 
order to properly communicate with codecs, we need to repacketize the 
communication between the higher alsa layers and the actual SPORT.  great ... 
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.

the dmix config:
AD1980.pcm.default {
	@args [ CARD ]
	@args.CARD {
		type string
	}
	type asym
	playback.pcm {
		type plug
		slave.pcm {
			@func concat
			strings [ "dmix:CARD=" $CARD ]
		}
	}
	capture.pcm {
		type plug
		slave.pcm {
			@func concat
			strings [ "dsnoop:CARD=" $CARD ]
		}
	}
}

the non-dmix config:
AD1980.pcm.default {
	type plug
	slave {
		pcm {
			type mmap_emul
			slave {
				pcm {
					type hw
					card 0
					format S16_LE
					rate 48000
					channels 2
					sync_ptr_ioctl 1
				}
			}
		}
	}
}
-mike

[-- Attachment #1.2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 827 bytes --]

[-- Attachment #2: Type: text/plain, Size: 160 bytes --]

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: handling of dmix and non-dmix in the same configuration file
  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
  0 siblings, 0 replies; 2+ messages in thread
From: Clemens Ladisch @ 2008-02-22 13:50 UTC (permalink / raw)
  To: Mike Frysinger; +Cc: alsa-devel

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-02-22 13:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 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.