alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Colin Guthrie <gmane@colin.guthr.ie>
To: Takashi Iwai <tiwai@suse.de>
Cc: alsa-devel@alsa-project.org
Subject: Re: "default" device. Is there a way to detect if it's a plugin, and if so which one?
Date: Mon, 04 Apr 2011 12:22:36 +0100	[thread overview]
Message-ID: <4D99A9FC.3080102@colin.guthr.ie> (raw)
In-Reply-To: <s5hhbaethc3.wl%tiwai@suse.de>

'Twas brillig, and Takashi Iwai at 04/04/11 11:57 did gyre and gimble:
> At Sun, 03 Apr 2011 13:22:34 +0100,
> Colin Guthrie wrote:
>>
>> Hi,
>>
>> If the user opens the "default" device in alsa, is there a way to find
>> out if that "device" is actually a plugin?
>>
>> i.e. is it possible to tell if you have opened the pulseaudio plugin via
>> alsa?
>>
>> There are various hacky ways (e.g. checking hints etc.) but that relies
>> on downstream packaging which certainly isn't fool proof.
> 
> There is no clean way, AFAIK.
> A new API would be needed.  For example, something like:
> 	snd_pcm_contains_type(pcm, SND_PCM_TYPE_EXTPLUG);
> 
> But checking whether PA-plugin is used is difficult with the API above
> because pulse plugin has no unique PCM type but it's a sub-plugin
> of extplug plugin...

Yeah I didn't think there was an easy way.

I guess just "strongly recommending" the distros use a hint when they
redirect the "default" makes sense.

I do this:
aplay      aplaymidi
[colin@jimmy build-master (master)]$ aplay -L
null
    Discard all samples (playback) or generate zero samples (capture)
pulse
    PulseAudio Sound Server
default
    Default ALSA Output (currently PulseAudio Sound Server)

....

SO that the "default" hint contains the word "PulseAudio" which apps
could check. It's obviously not fool proof, but if this is only for
"hinting" purposes at the app level anyway, then it's maybe good enough.

(FWIW, it's for a situation where hinting to the user that they are
going via ALSA, when an optional but more specific pulse output is
supported by the app and may be more appropriate).

Thanks for the info.

Col

-- 

Colin Guthrie
gmane(at)colin.guthr.ie
http://colin.guthr.ie/

Day Job:
  Tribalogic Limited [http://www.tribalogic.net/]
Open Source:
  Mageia Contributor [http://www.mageia.org/]
  PulseAudio Hacker [http://www.pulseaudio.org/]
  Trac Hacker [http://trac.edgewall.org/]

  reply	other threads:[~2011-04-04 11:22 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-03 12:22 "default" device. Is there a way to detect if it's a plugin, and if so which one? Colin Guthrie
2011-04-04 10:57 ` Takashi Iwai
2011-04-04 11:22   ` Colin Guthrie [this message]
2011-04-04 11:38 ` Sebastian H.

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=4D99A9FC.3080102@colin.guthr.ie \
    --to=gmane@colin.guthr.ie \
    --cc=alsa-devel@alsa-project.org \
    --cc=tiwai@suse.de \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).