<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:st1="urn:schemas-microsoft-com:office:smarttags" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv=Content-Type content="text/html; charset=gb2312">
<meta name=Generator content="Microsoft Word 11 (filtered medium)">
<o:SmartTagType namespaceuri="urn:schemas-microsoft-com:office:smarttags"
name="chsdate"/>
<o:SmartTagType namespaceuri="urn:schemas-microsoft-com:office:smarttags"
name="PersonName"/>
<!--[if !mso]>
<style>
st1\:*{behavior:url(#default#ieooui) }
</style>
<![endif]-->
<style>
<!--
/* Font Definitions */
@font-face
        {font-family:宋体;
        panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
        {font-family:"\@宋体";
        panose-1:2 1 6 0 3 1 1 1 1 1;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        text-align:justify;
        text-justify:inter-ideograph;
        font-size:10.5pt;
        font-family:"Times New Roman";}
a:link, span.MsoHyperlink
        {color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {color:purple;
        text-decoration:underline;}
p.MsoPlainText, li.MsoPlainText, div.MsoPlainText
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:9.0pt;
        font-family:宋体;}
/* Page Definitions */
@page Section1
        {size:595.3pt 841.9pt;
        margin:72.0pt 126.65pt 72.0pt 126.65pt;
        layout-grid:15.6pt;}
div.Section1
        {page:Section1;}
-->
</style>
</head>
<body lang=ZH-CN link=blue vlink=purple style='text-justify-trim:punctuation'>
<div class=Section1 style='layout-grid:15.6pt'>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US style='font-size:
9.0pt'>Hi<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US style='font-size:
9.0pt'> </span><span lang=EN-US>Thanks for the Takashi's
idea.<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US style='font-size:
9.0pt'> </span><span lang=EN-US>It's agreement that controlling
the scenarios is needed in the alsa-lib. To the mobile device, the policy about
the router switch or volume control is so complex that we can't resolve all
issues by modified the alsa-lib.<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US style='font-size:
9.0pt'>Whether we can develop a simple server which carries out the policy? <o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US style='font-size:
9.0pt'>But we still need define the control element, it's very important to the
server's portability. Because the definition makes BSP to write driver which
have the same interface. <o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US><o:p> </o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US><o:p> </o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US style='font-size:
9.0pt'>-----</span>邮件原件<span lang=EN-US>-----<br>
</span>发件人<span lang=EN-US>: Takashi Iwai [mailto:tiwai@suse.de] <br>
</span>发送时间<span lang=EN-US>: <st1:chsdate IsROCDate="False" IsLunarDate="False"
Day="19" Month="10" Year="2007" w:st="on">2007<span lang=EN-US><span
lang=EN-US>年10</span></span><span lang=EN-US><span lang=EN-US>月19</span></span><span
lang=EN-US><span lang=EN-US>日</span></span></st1:chsdate> 17:15<br>
</span>收件人<span lang=EN-US>: Liam Girdwood<br>
</span>抄送<span lang=EN-US>: <st1:PersonName ProductID="Leijin Tang" w:st="on">Leijin
Tang</st1:PersonName>; alsa-devel; ohm-devel<br>
</span>主题<span lang=EN-US>: Re: [alsa-devel] [RFC] ALSA scenario API</span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US><o:p> </o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US style='font-size:
9.0pt'>At Wed, 17 Oct 2007 01:12:13 +0100,<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US style='font-size:
9.0pt'>Liam Girdwood wrote:<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US style='font-size:
9.0pt'>> <o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US style='font-size:
9.0pt'>> A little late with this but "better late than
never".....I did promise a<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US style='font-size:
9.0pt'>> few people that I would post what was imho needed for ALSA
scenarios.<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US style='font-size:
9.0pt'>> <o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US style='font-size:
9.0pt'>> Also, apologies for cross posting, but it some of this probably
applies<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US style='font-size:
9.0pt'>> to both lists... <o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US style='font-size:
9.0pt'>> <o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US style='font-size:
9.0pt'>> ALSA probably needs functionality to define and set audio usage<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US style='font-size:
9.0pt'>> scenarios. A scenario is simply a list of sound card mixer settings
for<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US style='font-size:
9.0pt'>> a given use case. This is quite important for mobile devices (e.g.<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US style='font-size:
9.0pt'>> Smartphones, GPS, PDA, etc) with complex audio routing and power<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US style='font-size:
9.0pt'>> requirements. Some example scenarios could be :-<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US style='font-size:
9.0pt'>> <o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US style='font-size:
9.0pt'>> "HiFi Headphone Playback"<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US style='font-size:
9.0pt'>> "HiFi Speaker Playback"<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US style='font-size:
9.0pt'>> "Handset Phone Call"<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US style='font-size:
9.0pt'>> "Headset Phone Call"<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US style='font-size:
9.0pt'>> etc...<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US style='font-size:
9.0pt'>> <o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US style='font-size:
9.0pt'>> Scenarios are changed atm by either manually setting each control
(e.g.<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US style='font-size:
9.0pt'>> using alsamixer or alsa-lib in apps) or by using alsactl to restore
a<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US style='font-size:
9.0pt'>> scenario. The above two methods are not very portable between
devices<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US style='font-size:
9.0pt'>> and applications. We would ideally like to just say "set Phone
Call<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US style='font-size:
9.0pt'>> Handset" for a regular handset phone call or "set HiFi
Headphones" for<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US style='font-size:
9.0pt'>> MP3 playback.<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US style='font-size:
9.0pt'>> <o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US style='font-size:
9.0pt'>> ALSA also needs to have functionality to alias mixer controls. This<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US style='font-size:
9.0pt'>> would allow a single master volume/mute control to be exposed to
user<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US style='font-size:
9.0pt'>> space and have it aliased to different hardware controls based upon
the<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US style='font-size:
9.0pt'>> current scenario. e.g. Many mobile devices have different physical<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US style='font-size:
9.0pt'>> volume controls for speaker and headphones. This makes it somewhat<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US style='font-size:
9.0pt'>> difficult for user space apps to change the correct volume (without<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US style='font-size:
9.0pt'>> being bound to the hardware). We would like to be able to just say
"set<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US style='font-size:
9.0pt'>> volume to 0dB" and have the alias take care of the correct
physical<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US style='font-size:
9.0pt'>> CODEC mixer for the current scenario.<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US style='font-size:
9.0pt'>> <o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US style='font-size:
9.0pt'>> Proposal:<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US style='font-size:
9.0pt'>> ========<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US style='font-size:
9.0pt'>> <o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US style='font-size:
9.0pt'>> 1. Add some new scenario functions to (s)alsa-lib. e.g.<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US style='font-size:
9.0pt'>> <o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US style='font-size:
9.0pt'>> snd_scenario_set();<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US style='font-size:
9.0pt'>> snd_scenario_get();<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US style='font-size:
9.0pt'>> snd_scenario_list();<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US style='font-size:
9.0pt'>> <o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US style='font-size:
9.0pt'>> _set() would set the scenario e.g.<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US style='font-size:
9.0pt'>> <o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US style='font-size:
9.0pt'>> snd_scenario_set(card, SND_VOICE_CALL_HANDSET);<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US style='font-size:
9.0pt'>> <o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US style='font-size:
9.0pt'>> We would need to have a list of standard scenarios so that
applications<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US style='font-size:
9.0pt'>> could be more portable. Vendor scenario's should also be supported.<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US style='font-size:
9.0pt'>> <o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US style='font-size:
9.0pt'>> _get() would return the current scenario.<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US style='font-size:
9.0pt'>> <o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US style='font-size:
9.0pt'>> _list() would return a list of supported scenarios for the given
device.<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US style='font-size:
9.0pt'>> <o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US style='font-size:
9.0pt'>> <o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US style='font-size:
9.0pt'>> 2. Add some new mixer alias functions to set/get the current
"master"<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US style='font-size:
9.0pt'>> volume/mute. e.g.<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US style='font-size:
9.0pt'>> <o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US style='font-size:
9.0pt'>> snd_kcontrol *snd_scenario_volume_set(card, type, volume);<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US style='font-size:
9.0pt'>> snd_kcontrol *snd_scenario_switch_set(card, type, switch);<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US style='font-size:
9.0pt'>> <o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US style='font-size:
9.0pt'>> where type is playback, capture, sidetone, bypass, etc<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US style='font-size:
9.0pt'>> <o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US style='font-size:
9.0pt'>> This would set the volume for the current scenario and would
guarantee<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US style='font-size:
9.0pt'>> always to get/set the _correct_ volume/switch.<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US style='font-size:
9.0pt'>> <o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US style='font-size:
9.0pt'>> 3. Add a new function to return the active PCM for a given
scenario.<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US style='font-size:
9.0pt'>> e.g.<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US style='font-size:
9.0pt'>> <o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US style='font-size:
9.0pt'>> snd_scenario_get_pcm(card, scenario);<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US style='font-size:
9.0pt'>> <o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US style='font-size:
9.0pt'>> Would return the given PCM for a particular scenario. i.e. the
WM9713<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US style='font-size:
9.0pt'>> driver has PCM 0.0 for high quality (higher power) audio (MP3), PCM
0.1<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US style='font-size:
9.0pt'>> for lower power voice and PCM 0.2 for lowest power and quality system<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US style='font-size:
9.0pt'>> sounds.<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US style='font-size:
9.0pt'>> <o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US style='font-size:
9.0pt'>> Note: scenarios may need to be more tightly bound to PCM's rather
than<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US style='font-size:
9.0pt'>> cards. <o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US style='font-size:
9.0pt'>> <o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US style='font-size:
9.0pt'>> 4. Define a file format to represent each scenario. Probably base
this<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US style='font-size:
9.0pt'>> upon alsactl's format as alsamixer could be used to quickly
generate<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US style='font-size:
9.0pt'>> good settings and then save them with alsactl. Alias, scenario
names and<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US style='font-size:
9.0pt'>> PCM would need to be added later somehow.<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US style='font-size:
9.0pt'>> <o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US style='font-size:
9.0pt'>> 5. (Optional) Allow scenarios to define active kcontrols. This
would<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US style='font-size:
9.0pt'>> allow tools like alsamixer to only display mixer controls for the
given<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US style='font-size:
9.0pt'>> scenario. Controls that don't effect the scenario would not be
rendered.<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US style='font-size:
9.0pt'>> (similar to alsamixers Playback|Capture|All tab)<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US style='font-size:
9.0pt'>> <o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US style='font-size:
9.0pt'>> 6. (OHM list) Add input driver (or similar) for sound card user
events.<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US style='font-size:
9.0pt'>> We need to be able to send events like "Headphone Jack
Insertion", "Mic<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US style='font-size:
9.0pt'>> Jack Insertion", etc to user space. This would allow changing
of<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US style='font-size:
9.0pt'>> scenario and power configuration depending on policy and
configuration. <o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US style='font-size:
9.0pt'>> <o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US style='font-size:
9.0pt'>> Just my 2p<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US style='font-size:
9.0pt'>> <o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US style='font-size:
9.0pt'>> Unfortunately I'm not in a position to implement any of this<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US style='font-size:
9.0pt'>> functionality. However, it's probably useful to folks working on
mobile<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US style='font-size:
9.0pt'>> devices. Maybe a good project for Google SoC.<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US><o:p> </o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US style='font-size:
9.0pt'>It's an interesting idea. Similar things are needed vastly for
other<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US style='font-size:
9.0pt'>purposes, such as speaker setup. But, my first thinking is whether
we<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US style='font-size:
9.0pt'>need this in the upper (user-space alsa-lib) level or in the driver<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US style='font-size:
9.0pt'>level.<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US><o:p> </o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US style='font-size:
9.0pt'>Certainly the driver must know at best what scenario is available and<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US style='font-size:
9.0pt'>how it should react. I've thought this kind of thing could be<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US style='font-size:
9.0pt'>implemented better, more elegantly, on user-space. But, thinking<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US style='font-size:
9.0pt'>twice, the driver implementation can be much easier in many cases.<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US style='font-size:
9.0pt'>Suppose the switching (aliasing) the control name depending on the<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US style='font-size:
9.0pt'>given scenario. The scenario state is global and must be stored in
a<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US style='font-size:
9.0pt'>global position. The easiest one is in the driver -- this will
solve<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US style='font-size:
9.0pt'>the access permission and race problem automatically, too, which the<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US style='font-size:
9.0pt'>shared-memory solution always suffers.<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US><o:p> </o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US style='font-size:
9.0pt'>Thus, it would be maybe good to implement the secnario as a control<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US style='font-size:
9.0pt'>element (not necessarily as a mixer element but we can give a<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US style='font-size:
9.0pt'>different IFACE attribute, e.g. SND_CTL_ELEM_IFACE_CARD). Then the<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US style='font-size:
9.0pt'>above snd_scenario_set/get/list functions becomes simple snd_ctl_*().<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US><o:p> </o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US><o:p> </o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US style='font-size:
9.0pt'>About PCM: if we implement again this kind of things in the driver, we<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US style='font-size:
9.0pt'>may have a virtual PCM stream for the default use and other fixed PCM<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US style='font-size:
9.0pt'>streams. They can be opened exclusively, and the default stream
opens<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US style='font-size:
9.0pt'>different H/W stream according to the current scenario. (BTW,
still a<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US style='font-size:
9.0pt'>question remains: when the scenario switch happens on the fly during a<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US style='font-size:
9.0pt'>PCM stream being used, what should be done?)<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US><o:p> </o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US style='font-size:
9.0pt'>Or, simply alsa-lib checks the current scenario value and chooses the<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US style='font-size:
9.0pt'>appropriate preset setup. This would work well (at least for<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US style='font-size:
9.0pt'>alsa-lib, not salsa-lib - such a complicated implementation is outside<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US style='font-size:
9.0pt'>the scope of salsa-lib). This user-space solution (for PCM) has<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US style='font-size:
9.0pt'>another advantage that it's easier to handle PCM setups for multiple<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US style='font-size:
9.0pt'>streams. For example, suppose we use "scenario" for
speaker setup.<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US style='font-size:
9.0pt'>emu10k1 uses multiple PCM streams for 4.0/5.1 surrounds, and the<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US style='font-size:
9.0pt'>driver-side implementation wouldn't work unless it reflects to<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US style='font-size:
9.0pt'>alsa-lib setup.<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US><o:p> </o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US><o:p> </o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US style='font-size:
9.0pt'>My another $0.02.<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US><o:p> </o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US><o:p> </o:p></span></font></p>
<p class=MsoPlainText><font size=1 face=宋体><span lang=EN-US style='font-size:
9.0pt'>Takashi<o:p></o:p></span></font></p>
</div>
</body>
</html>