VA.html 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  5. <meta name="Generator" content="XN-Docs v2.03 (http://ccgi.inspiration3.plus.com/ahk/xn-docs/)" />
  6. <title>Vista Audio Control Function Reference</title>
  7. <style type="text/css" media="all">
  8. /*<![CDATA[*/
  9. html {
  10. color: #333;
  11. background: #fff;
  12. font: .9em Calibri, Arial, Helvetica, sans-serif;
  13. }
  14. body { margin: 0em; min-width: 600px; }
  15. h1 {
  16. margin: 0em;
  17. color: #fff;
  18. background: #333;
  19. padding: .2em .5em;
  20. border-bottom: 1px solid #000;
  21. }
  22. h1 a {
  23. color: #fff !important;
  24. background: inherit;
  25. text-decoration: none;
  26. }
  27. h2 { border-bottom: 1px solid #ddd; }
  28. h3.command {
  29. background: #09c;
  30. padding: .7em;
  31. color: #fff;
  32. cursor: help;
  33. letter-spacing: .1em;
  34. font: bold 1.2em "Courier New", Courier, monospace;
  35. }
  36. a { color: #06c; }
  37. a:hover { color: #936; }
  38. table { font-size: 1em; }
  39. p.descr {
  40. margin: 1.5em;
  41. line-height: 1.5;
  42. }
  43. span.sub {
  44. color: #666;
  45. background: inherit;
  46. }
  47. p.descr span.sub:before { content: ">> "; }
  48. table.params span.sub {
  49. font-size: .75em;
  50. margin-right: .5em;
  51. }
  52. div#contents {
  53. width: 200px;
  54. float: right;
  55. border-left: 1px dashed #ddd;
  56. margin-top: 2em;
  57. overflow: auto;
  58. padding: 10px;
  59. }
  60. div#contents div { margin-left: 1em; }
  61. div#contents ul {
  62. list-style: square;
  63. padding-left: 1em;
  64. }
  65. div#contents *:first-child { margin-top: 0em; }
  66. div#page {
  67. position: relative;
  68. margin-left: 0px;
  69. margin-right: 230px;
  70. width: auto;
  71. }
  72. div#page > div:not(:target) { display: none; }
  73. div#page > div:target { display: block; }
  74. div.method {
  75. background: #fefefe;
  76. border: 1px solid #eee;
  77. margin-bottom: 2em;
  78. margin-left: 0.5em;
  79. padding: 1em;
  80. }
  81. div.method *:first-child { margin-top: 0em; }
  82. div#end {
  83. font-size: .9em;
  84. margin-top: 1em;
  85. border-top: 1px solid #000;
  86. padding: 1em;
  87. color: #fff;
  88. background: #666;
  89. }
  90. div#end a { color: #fff; }
  91. span.vers {
  92. font-size: .6em;
  93. color: #ccc;
  94. padding-left: .3em;
  95. }
  96. table.params {
  97. font-size: 1em;
  98. margin-left: 3em;
  99. }
  100. table.params th {
  101. text-align: left;
  102. background: #eee;
  103. padding: .2em;
  104. }
  105. table.params td {
  106. vertical-align: top;
  107. padding: .2em 1em .2em .5em;
  108. background: #fff;
  109. border: 1px solid #f3f3f3;
  110. }
  111. table.params td:first-child { background: #f3f3f3 !important; }
  112. table.params tr.returns td { background: #f3f3f3; }
  113. table.params tr.returns td:first-child { background: #fff !important; }
  114. table.dataset { margin-left: 3em; }
  115. table.dataset th {
  116. background: #eee;
  117. text-align: left;
  118. padding: .2em;
  119. }
  120. table.dataset td {
  121. vertical-align: top;
  122. padding: .2em 1em .2em .5em;
  123. }
  124. pre.code {
  125. padding: 1em;
  126. font-size: 1em;
  127. border: 1px dotted #999;
  128. background: #fff;
  129. margin-left: 2em;
  130. overflow: auto;
  131. }
  132. kbd { font: 1em "Courier New", Courier, monospace; }
  133. code, pre.code { font: .9em "Courier New", Courier, monospace; }
  134. pre.code em, code em {
  135. color: #060;
  136. font-style: normal;
  137. font-weight: bold;
  138. }
  139. pre.code kbd, code kbd {
  140. color: #c00;
  141. font-weight: normal;
  142. }
  143. pre.code var, code var {
  144. font-style: normal;
  145. font-weight: bold;
  146. color: #f80;
  147. }
  148. pre.code var.prc, code var.prc {
  149. font-weight: normal;
  150. color: #f00;
  151. font-style: italic;
  152. }
  153. pre.code strong, code strong { color: #039; }
  154. pre.code strong.res, code strong.res { color: #800000; }
  155. @media print {
  156. * {
  157. background: none !important;
  158. color: #000 !important;
  159. }
  160. p.descr span.sub, div#contents { display: none; }
  161. div#page { width: 100%; }
  162. div#page > div:not(:target) { display: block; }
  163. table.params, pre.code { margin: 0em; }
  164. div.method {
  165. border: none;
  166. margin: 1em 0em;
  167. padding: 0em;
  168. }
  169. pre.code { overflow: visible; }
  170. }
  171. /*]]>*/
  172. </style>
  173. <script type="text/javascript">
  174. /*<![CDATA[*/
  175. function tabsetup() {
  176. var a = document.getElementById('contents').getElementsByTagName('a'), i;
  177. tabswitch(window.location.hash);
  178. for (i in a) { a[i].onclick = tabswitch; }
  179. }
  180. function tabswitch(e) {
  181. var d = document.getElementById('page').getElementsByTagName('div'),
  182. h = typeof(e) == 'string' ? e : this.hash, id = h ? h.slice(1) : '', i;
  183. for (i = 0; i < d.length; i++) { if (d[i].className == 'method') { d[i].style.display = 'none'; } }
  184. if (id) { document.getElementById(id).style.display = 'block'; }
  185. }
  186. if (window.attachEvent) { window.attachEvent('onload', tabsetup); }
  187. /*]]>*/
  188. </script>
  189. </head>
  190. <body>
  191. <h1>
  192. <a href="http://www.autohotkey.com/forum/topic23792.html">Vista Audio Control Function Reference</a><span class="vers"> (version 2.3)</span>
  193. </h1>
  194. <div id="contents">
  195. <div>
  196. <h4>Master Controls</h4>
  197. <ul>
  198. <li>
  199. <a href="#VA_GetMasterVolume">VA_GetMasterVolume</a>
  200. </li>
  201. <li>
  202. <a href="#VA_SetMasterVolume">VA_SetMasterVolume</a>
  203. </li>
  204. <li>
  205. <a href="#VA_GetMasterChannelCount">VA_GetMasterChannelCount</a>
  206. </li>
  207. <li>
  208. <a href="#VA_GetMasterMute">VA_GetMasterMute</a>
  209. </li>
  210. <li>
  211. <a href="#VA_SetMasterMute">VA_SetMasterMute</a>
  212. </li>
  213. </ul>
  214. <h4>Subunit Controls</h4>
  215. <ul>
  216. <li>
  217. <a href="#VA_GetVolume">VA_GetVolume</a>
  218. </li>
  219. <li>
  220. <a href="#VA_SetVolume">VA_SetVolume</a>
  221. </li>
  222. <li>
  223. <a href="#VA_GetChannelCount">VA_GetChannelCount</a>
  224. </li>
  225. <li>
  226. <a href="#VA_GetMute">VA_GetMute</a>
  227. </li>
  228. <li>
  229. <a href="#VA_SetMute">VA_SetMute</a>
  230. </li>
  231. </ul>
  232. <h4>Advanced</h4>
  233. <ul>
  234. <li>
  235. <a href="#VA_GetAudioEndpointVolume">VA_GetAudioEndpointVolume</a>
  236. </li>
  237. <li>
  238. <a href="#VA_GetAudioMeter">VA_GetAudioMeter</a>
  239. </li>
  240. <li>
  241. <a href="#VA_GetDevice">VA_GetDevice</a>
  242. </li>
  243. <li>
  244. <a href="#VA_GetDeviceName">VA_GetDeviceName</a>
  245. </li>
  246. <li>
  247. <a href="#VA_GetDevicePeriod">VA_GetDevicePeriod</a>
  248. </li>
  249. <li>
  250. <a href="#VA_GetDeviceSubunit">VA_GetDeviceSubunit</a>
  251. </li>
  252. <li>
  253. <a href="#VA_EnumSubunits">VA_EnumSubunits</a>
  254. </li>
  255. <li>
  256. <a href="#VA_EnumSubunitsEx">VA_EnumSubunitsEx</a>
  257. </li>
  258. <li>
  259. <a href="#VA_FindSubunit">VA_FindSubunit</a>
  260. </li>
  261. <li>
  262. <a href="#VA_SetDefaultEndpoint">VA_SetDefaultEndpoint</a>
  263. </li>
  264. <li>
  265. <a href="#VA_dB2Scalar">VA_dB2Scalar</a>
  266. </li>
  267. <li>
  268. <a href="#VA_Scalar2dB">VA_Scalar2dB</a>
  269. </li>
  270. </ul>
  271. <h4>Other</h4>
  272. <ul>
  273. <li>
  274. <a href="#Interface%20Functions">Interface Functions</a>
  275. </li>
  276. </ul>
  277. </div>
  278. </div>
  279. <p class="descr"><br /><span class="sub">Browse through the topics in the contents list to the right.</span></p>
  280. <div id="page">
  281. <div class="method" id="VA_GetMasterVolume">
  282. <h2>VA_GetMasterVolume</h2>
  283. <p>Gets the master volume level of an audio endpoint device.</p>
  284. <h3 class="command">VA_GetMasterVolume(channel, device_desc)</h3>
  285. <h4>Parameters</h4>
  286. <table class="params">
  287. <tr class="returns">
  288. <td>
  289. <em>Returns</em>
  290. </td>
  291. <td>A value between 0.0 and 100.0, inclusive.</td>
  292. </tr>
  293. <tr>
  294. <td>channel</td>
  295. <td><span class="sub">(optional)</span>The one-based index of the channel to retrieve.</td>
  296. </tr>
  297. <tr>
  298. <td>device_desc</td>
  299. <td><span class="sub">(optional)</span>See <a href="#VA_GetDevice">VA_GetDevice</a>. Defaults to "playback".</td>
  300. </tr>
  301. </table>
  302. <h4>Remarks</h4>
  303. <p>Volume levels returned by this function follow the same curve as the Windows Vista Sound Mixer.</p>
  304. <h4>Example</h4>
  305. <pre class="code"><em>; Get the master volume of the default playback device.</em>
  306. volume := <strong>VA_GetMasterVolume</strong>()
  307. <em>; Get the volume of the first and second channels.</em>
  308. volume1 := <strong>VA_GetMasterVolume</strong>(1)
  309. volume2 := <strong>VA_GetMasterVolume</strong>(2)
  310. <em>; Get the master volume of a device by name.</em>
  311. lineout_volume := <strong>VA_GetMasterVolume</strong>(<kbd>""</kbd>, <kbd>"Line Out"</kbd>)
  312. <em>; Get the master volume of the default recording device.</em>
  313. recording_volume := <strong>VA_GetMasterVolume</strong>(<kbd>""</kbd>, <kbd>"capture"</kbd>)
  314. <strong>MsgBox</strong>, % <kbd>"Playback volume:`t"</kbd> volume
  315. . <kbd>"`n Channel 1:`t"</kbd> volume1
  316. . <kbd>"`n Channel 2:`t"</kbd> volume2
  317. . <kbd>"`nLine Out volume:`t"</kbd> lineout_volume
  318. . <kbd>"`nRecording volume:`t"</kbd> recording_volume
  319. </pre>
  320. </div>
  321. <div class="method" id="VA_SetMasterVolume">
  322. <h2>VA_SetMasterVolume</h2>
  323. <p>Sets the master volume level of an audio endpoint device.</p>
  324. <h3 class="command">VA_SetMasterVolume(vol, channel, device_desc)</h3>
  325. <h4>Parameters</h4>
  326. <table class="params">
  327. <tr>
  328. <td>vol</td>
  329. <td>A value between 0.0 and 100.0, inclusive.</td>
  330. </tr>
  331. <tr>
  332. <td>channel</td>
  333. <td><span class="sub">(optional)</span>The one-based index of the channel to adjust.</td>
  334. </tr>
  335. <tr>
  336. <td>device_desc</td>
  337. <td><span class="sub">(optional)</span>See <a href="#VA_GetDevice">VA_GetDevice</a>. Defaults to "playback".</td>
  338. </tr>
  339. </table>
  340. <h4>Remarks</h4>
  341. <p>Volume levels set by this function follow the same curve as the Windows Vista Sound Mixer.</p>
  342. </div>
  343. <div class="method" id="VA_GetMasterChannelCount">
  344. <h2>VA_GetMasterChannelCount</h2>
  345. <p>Gets the number of channels an audio endpoint device has.</p>
  346. <h3 class="command">VA_GetMasterChannelCount(device_desc)</h3>
  347. <h4>Parameters</h4>
  348. <table class="params">
  349. <tr>
  350. <td>device_desc</td>
  351. <td><span class="sub">(optional)</span>See <a href="#VA_GetDevice">VA_GetDevice</a>. Defaults to "playback".</td>
  352. </tr>
  353. </table>
  354. <h4>Example</h4>
  355. <pre class="code"><strong>Loop</strong> % <strong>VA_GetMasterChannelCount</strong>()
  356. Message .= <kbd>"Channel "</kbd> <strong class="res">A_Index</strong> <kbd>": "</kbd> <strong>VA_GetMasterVolume</strong>(<strong class="res">A_Index</strong>) <kbd>"`n"</kbd>
  357. <strong>MsgBox</strong> %Message%</pre>
  358. </div>
  359. <div class="method" id="VA_GetMasterMute">
  360. <h2>VA_GetMasterMute</h2>
  361. <p>Gets the mute status of an audio endpoint device.</p>
  362. <h3 class="command">VA_GetMasterMute(device_desc)</h3>
  363. <h4>Parameters</h4>
  364. <table class="params">
  365. <tr class="returns">
  366. <td>
  367. <em>Returns</em>
  368. </td>
  369. <td>True if the audio endpoint device is muted, otherwise false.</td>
  370. </tr>
  371. <tr>
  372. <td>device_desc</td>
  373. <td><span class="sub">(optional)</span>See <a href="#VA_GetDevice">VA_GetDevice</a>. Defaults to "playback".</td>
  374. </tr>
  375. </table>
  376. </div>
  377. <div class="method" id="VA_SetMasterMute">
  378. <h2>VA_SetMasterMute</h2>
  379. <p>Mutes or un-mutes an audio endpoint device.</p>
  380. <h3 class="command">VA_SetMasterMute(mute, device_desc)</h3>
  381. <h4>Parameters</h4>
  382. <table class="params">
  383. <tr>
  384. <td>mute</td>
  385. <td>True to mute; false to un-mute.</td>
  386. </tr>
  387. <tr>
  388. <td>device_desc</td>
  389. <td><span class="sub">(optional)</span>See <a href="#VA_GetDevice">VA_GetDevice</a>. Defaults to "playback".</td>
  390. </tr>
  391. </table>
  392. </div>
  393. <div class="method" id="VA_GetVolume">
  394. <h2>VA_GetVolume</h2>
  395. <p>Gets the volume level of a subunit.</p>
  396. <h3 class="command">VA_GetVolume(subunit_desc, channel, device_desc)</h3>
  397. <h4>Parameters</h4>
  398. <table class="params">
  399. <tr class="returns">
  400. <td>
  401. <em>Returns</em>
  402. </td>
  403. <td>A value between 0.0 and 100.0, inclusive.</td>
  404. </tr>
  405. <tr>
  406. <td>subunit_desc</td>
  407. <td><span class="sub">(optional)</span>See <a href="#VA_FindSubunit">VA_FindSubunit</a>. Defaults to "1".</td>
  408. </tr>
  409. <tr>
  410. <td>channel</td>
  411. <td><span class="sub">(optional)</span>The one-based index of the channel to retrieve.</td>
  412. </tr>
  413. <tr>
  414. <td>device_desc</td>
  415. <td><span class="sub">(optional)</span>See <a href="#VA_GetDevice">VA_GetDevice</a>. Defaults to "playback".</td>
  416. </tr>
  417. </table>
  418. <h4>Remarks</h4>
  419. <p>Volume levels returned by this function follow the same curve as the Sound applet in Control Panel, not the Sound Mixer.</p>
  420. <h4>Example</h4>
  421. <pre class="code"><em>; Note that subunit names are audio driver-specific.</em>
  422. <em>; The following will match "Line", "Line In", "Line Volume", etc.</em>
  423. linein_feedback := <strong>VA_GetVolume</strong>(<kbd>"Line"</kbd>)
  424. mic_feedback := <strong>VA_GetVolume</strong>(<kbd>"Mic"</kbd>, <kbd>""</kbd>, <kbd>"Line Out"</kbd>)
  425. <strong>MsgBox</strong>, % <kbd>"Line In feedback through default playback device: "</kbd> linein_feedback
  426. . <kbd>"`nMicrophone feedback through Line Out: "</kbd> mic_feedback
  427. . <kbd>"`n(Note: these may be muted.)"</kbd></pre>
  428. </div>
  429. <div class="method" id="VA_SetVolume">
  430. <h2>VA_SetVolume</h2>
  431. <p>Sets the volume level of a subunit.</p>
  432. <h3 class="command">VA_SetVolume(vol, subunit_desc, channel, device_desc)</h3>
  433. <h4>Parameters</h4>
  434. <table class="params">
  435. <tr>
  436. <td>vol</td>
  437. <td>A value between 0.0 and 100.0, inclusive.</td>
  438. </tr>
  439. <tr>
  440. <td>subunit_desc</td>
  441. <td><span class="sub">(optional)</span>See <a href="#VA_FindSubunit">VA_FindSubunit</a>. Defaults to "1".</td>
  442. </tr>
  443. <tr>
  444. <td>channel</td>
  445. <td><span class="sub">(optional)</span>The one-based index of the channel to retrieve.</td>
  446. </tr>
  447. <tr>
  448. <td>device_desc</td>
  449. <td><span class="sub">(optional)</span>See <a href="#VA_GetDevice">VA_GetDevice</a>. Defaults to "playback".</td>
  450. </tr>
  451. </table>
  452. <h4>Remarks</h4>
  453. <p>Volume levels set by this function follow the same curve as the Sound applet in Control Panel, not the Sound Mixer.</p>
  454. </div>
  455. <div class="method" id="VA_GetChannelCount">
  456. <h2>VA_GetChannelCount</h2>
  457. <p>Gets the number of channels a subunit has.</p>
  458. <h3 class="command">VA_GetChannelCount(subunit_desc, device_desc)</h3>
  459. <h4>Parameters</h4>
  460. <table class="params">
  461. <tr>
  462. <td>subunit_desc</td>
  463. <td><span class="sub">(optional)</span>See <a href="#VA_FindSubunit">VA_FindSubunit</a>. Defaults to "1".</td>
  464. </tr>
  465. <tr>
  466. <td>device_desc</td>
  467. <td><span class="sub">(optional)</span>See <a href="#VA_GetDevice">VA_GetDevice</a>. Defaults to "playback".</td>
  468. </tr>
  469. </table>
  470. </div>
  471. <div class="method" id="VA_GetMute">
  472. <h2>VA_GetMute</h2>
  473. <p>Gets the mute status of a subunit.</p>
  474. <h3 class="command">VA_GetMute(subunit_desc, device_desc)</h3>
  475. <h4>Parameters</h4>
  476. <table class="params">
  477. <tr class="returns">
  478. <td>
  479. <em>Returns</em>
  480. </td>
  481. <td>True if the subunit is muted, otherwise false.</td>
  482. </tr>
  483. <tr>
  484. <td>subunit_desc</td>
  485. <td><span class="sub">(optional)</span>See <a href="#VA_FindSubunit">VA_FindSubunit</a>. Defaults to "1".</td>
  486. </tr>
  487. <tr>
  488. <td>device_desc</td>
  489. <td><span class="sub">(optional)</span>See <a href="#VA_GetDevice">VA_GetDevice</a>. Defaults to "playback".</td>
  490. </tr>
  491. </table>
  492. </div>
  493. <div class="method" id="VA_SetMute">
  494. <h2>VA_SetMute</h2>
  495. <p>Mutes or un-mutes a subunit.</p>
  496. <h3 class="command">VA_SetMute(mute, subunit_desc, device_desc)</h3>
  497. <h4>Parameters</h4>
  498. <table class="params">
  499. <tr>
  500. <td>mute</td>
  501. <td>True to mute; false to un-mute.</td>
  502. </tr>
  503. <tr>
  504. <td>subunit_desc</td>
  505. <td><span class="sub">(optional)</span>See <a href="#VA_FindSubunit">VA_FindSubunit</a>. Defaults to "1".</td>
  506. </tr>
  507. <tr>
  508. <td>device_desc</td>
  509. <td><span class="sub">(optional)</span>See <a href="#VA_GetDevice">VA_GetDevice</a>. Defaults to "playback".</td>
  510. </tr>
  511. </table>
  512. </div>
  513. <div class="method" id="VA_GetAudioEndpointVolume">
  514. <h2>VA_GetAudioEndpointVolume</h2>
  515. <p>Gets a pointer to the <a href="http://msdn2.microsoft.com/en-us/library/aa964574(VS.85).aspx">IAudioEndpointVolume</a> interface of an audio endpoint device.</p>
  516. <h3 class="command">VA_GetAudioEndpointVolume(device_desc)</h3>
  517. <h4>Parameters</h4>
  518. <table class="params">
  519. <tr>
  520. <td>device_desc</td>
  521. <td><span class="sub">(optional)</span>See <a href="#VA_GetDevice">VA_GetDevice</a>. Defaults to "playback".</td>
  522. </tr>
  523. </table>
  524. <h4>Remarks</h4>
  525. <p>Use <code><strong>ObjRelease</strong>(pointer)</code> to release the interface pointer when it is no longer needed.</p>
  526. </div>
  527. <div class="method" id="VA_GetAudioMeter">
  528. <h2>VA_GetAudioMeter</h2>
  529. <p>Gets a pointer to the <a href="http://msdn2.microsoft.com/en-us/library/aa964578(VS.85).aspx">IAudioMeterInformation</a> interface of an audio endpoint device.</p>
  530. <h3 class="command">VA_GetAudioMeter(device_desc)</h3>
  531. <h4>Parameters</h4>
  532. <table class="params">
  533. <tr>
  534. <td>device_desc</td>
  535. <td><span class="sub">(optional)</span>See <a href="#VA_GetDevice">VA_GetDevice</a>. Defaults to "playback".</td>
  536. </tr>
  537. </table>
  538. <h4>Remarks</h4>
  539. <p>Use <code><strong>ObjRelease</strong>(pointer)</code> to release the interface pointer when it is no longer needed.</p>
  540. <h4>Example</h4>
  541. <pre class="code"><var class="prc">#SingleInstance</var>, Force
  542. MeterLength =<kbd> 30</kbd>
  543. audioMeter := <strong>VA_GetAudioMeter</strong>()
  544. <strong>VA_IAudioMeterInformation_GetMeteringChannelCount</strong>(audioMeter, channelCount)
  545. <em>; "The peak value for each channel is recorded over one device</em>
  546. <em>; period and made available during the subsequent device period."</em>
  547. <strong>VA_GetDevicePeriod</strong>(<kbd>"capture"</kbd>, devicePeriod)
  548. <strong>Loop</strong>
  549. {
  550. <em>; Get the peak value across all channels.</em>
  551. <strong>VA_IAudioMeterInformation_GetPeakValue</strong>(audioMeter, peakValue)
  552. meter := <strong>MakeMeter</strong>(peakValue, MeterLength)
  553. <em>; Get the peak values of all channels.</em>
  554. <strong>VarSetCapacity</strong>(peakValues, channelCount*4)
  555. <strong>VA_IAudioMeterInformation_GetChannelsPeakValues</strong>(audioMeter, channelCount, &peakValues)
  556. <strong>Loop</strong> %channelCount%
  557. meter .= <kbd>"`n"</kbd> <strong>MakeMeter</strong>(<strong>NumGet</strong>(peakValues, <strong class="res">A_Index</strong>*4-4, <kbd>"float"</kbd>), MeterLength)
  558. <strong>ToolTip</strong>, %meter%
  559. <strong>Sleep</strong>, %devicePeriod%
  560. }
  561. <strong>MakeMeter</strong>(fraction, size)
  562. {
  563. <strong>global</strong> MeterLength
  564. <strong>Loop</strong> % fraction*size
  565. meter .= <kbd>"|"</kbd>
  566. <strong>Loop</strong> % (1-fraction)*size
  567. meter .= <kbd>"."</kbd>
  568. meter .= <kbd>" "</kbd> fraction
  569. <strong>return</strong> meter
  570. }</pre>
  571. </div>
  572. <div class="method" id="VA_GetDevice">
  573. <h2>VA_GetDevice</h2>
  574. <p>Gets a pointer to the <a href="http://msdn2.microsoft.com/en-us/library/ms679028(VS.85).aspx">IMMDevice</a> interface of an audio endpoint device.</p>
  575. <h3 class="command">VA_GetDevice(device_desc)</h3>
  576. <h4>Parameters</h4>
  577. <table class="params">
  578. <tr>
  579. <td>device_desc</td>
  580. <td>device_id | device_number | ( friendly_name | 'playback' | 'capture' ) [ ':' index ]</td>
  581. </tr>
  582. </table>
  583. <h4>Remarks</h4>
  584. <p>Use <code><strong>ObjRelease</strong>(device)</code> to release the interface pointer when it is no longer needed.</p>
  585. <p>If device_desc is a device pointer returned by a previous call to VA_GetDevice, it is returned as-is. This behaviour is useful for other functions which accept a device_desc; these functions call VA_GetDevice internally.</p>
  586. <h4>Examples</h4>
  587. <pre class="code">device := <strong>VA_GetDevice</strong>(<kbd>"playback"</kbd>) <em>; default playback device</em>
  588. device := <strong>VA_GetDevice</strong>(<kbd>"playback:1"</kbd>) <em>; first playback device</em>
  589. device := <strong>VA_GetDevice</strong>(<kbd>"nvidia:2"</kbd>) <em>; second device whose name contains "nvidia"</em>
  590. device := <strong>VA_GetDevice</strong>(3) <em>; third device</em></pre>
  591. <pre class="code"><strong>VA_IMMDevice_GetId</strong>(device, device_id) <em>; get a device id from a device pointer</em>
  592. <em>;...</em>
  593. device := <strong>VA_GetDevice</strong>(device_id) <em>; get a device pointer from an id</em></pre>
  594. </div>
  595. <div class="method" id="VA_GetDeviceName">
  596. <h2>VA_GetDeviceName</h2>
  597. <p>Gets the friendly name of an audio endpoint device.</p>
  598. <h3 class="command">VA_GetDeviceName(device)</h3>
  599. <h4>Parameters</h4>
  600. <table class="params">
  601. <tr>
  602. <td>device</td>
  603. <td>A pointer to an <a href="http://msdn2.microsoft.com/en-us/library/ms679028(VS.85).aspx">IMMDevice</a> interface.</td>
  604. </tr>
  605. </table>
  606. </div>
  607. <div class="method" id="VA_GetDevicePeriod">
  608. <h2>VA_GetDevicePeriod</h2>
  609. <p>Retrieves the length of the periodic interval separating successive processing passes by the audio engine.</p>
  610. <h3 class="command">VA_GetDevicePeriod(device_desc, default_period, minimum_period)</h3>
  611. <h4>Parameters</h4>
  612. <table class="params">
  613. <tr class="returns">
  614. <td>
  615. <em>Returns</em>
  616. </td>
  617. <td>True on success, otherwise false.</td>
  618. </tr>
  619. <tr>
  620. <td>device_desc</td>
  621. <td>See <a href="#VA_GetDevice">VA_GetDevice</a>.</td>
  622. </tr>
  623. <tr>
  624. <td>default_period</td>
  625. <td><span class="sub">(out)</span> The default interval, in milliseconds.</td>
  626. </tr>
  627. <tr>
  628. <td>minimum_period</td>
  629. <td><span class="sub">(out)</span> The minimum interval, in milliseconds.</td>
  630. </tr>
  631. </table>
  632. </div>
  633. <div class="method" id="VA_GetDeviceSubunit">
  634. <h2>VA_GetDeviceSubunit</h2>
  635. <p>Finds a subunit of a device, given a device description.</p>
  636. <h3 class="command">VA_GetDeviceSubunit(device_desc, subunit_desc, subunit_iid)</h3>
  637. <h4>Parameters</h4>
  638. <table class="params">
  639. <tr class="returns">
  640. <td>
  641. <em>Returns</em>
  642. </td>
  643. <td>A pointer to the requested interface of a matching subunit, or 0 if none were found.</td>
  644. </tr>
  645. <tr>
  646. <td>device_desc</td>
  647. <td>See <a href="#VA_GetDevice">VA_GetDevice</a>.</td>
  648. </tr>
  649. <tr>
  650. <td>subunit_desc</td>
  651. <td>See <a href="#VA_FindSubunit">VA_FindSubunit</a> (target_desc).</td>
  652. </tr>
  653. <tr>
  654. <td>subunit_iid</td>
  655. <td>See <a href="#VA_FindSubunit">VA_FindSubunit</a> (target_iid).</td>
  656. </tr>
  657. </table>
  658. <h4>Remarks</h4>
  659. <p>See <a href="#VA_FindSubunit">VA_FindSubunit</a>.</p>
  660. </div>
  661. <div class="method" id="VA_EnumSubunits">
  662. <h2>VA_EnumSubunits</h2>
  663. <p>Enumerates matching subunits of a device.</p>
  664. <h3 class="command">VA_EnumSubunits(device, callback, target_name, target_iid)</h3>
  665. <h4>Parameters</h4>
  666. <table class="params">
  667. <tr class="returns">
  668. <td>
  669. <em>Returns</em>
  670. </td>
  671. <td>See <a href="#VA_EnumSubunitsEx">VA_EnumSubunitsEx</a>.</td>
  672. </tr>
  673. <tr>
  674. <td>device</td>
  675. <td>A pointer to an <a href="http://msdn2.microsoft.com/en-us/library/ms679028(VS.85).aspx">IMMDevice</a> interface.</td>
  676. </tr>
  677. <tr>
  678. <td>callback</td>
  679. <td>A callback accepting two parameters: part, interface.</td>
  680. </tr>
  681. <tr>
  682. <td>target_name</td>
  683. <td><span class="sub">(optional)</span>The full or partial friendly name of a subunit or subunits.</td>
  684. </tr>
  685. <tr>
  686. <td>target_iid</td>
  687. <td><span class="sub">(optional)</span>The ID of an interface which matching subunits must support.</td>
  688. </tr>
  689. </table>
  690. <h4>Remarks</h4>
  691. <p>See <a href="#VA_EnumSubunitsEx">VA_EnumSubunitsEx</a>.</p>
  692. </div>
  693. <div class="method" id="VA_EnumSubunitsEx">
  694. <h2>VA_EnumSubunitsEx</h2>
  695. <p>Enumerates matching subunits of a part (subunit or connector).</p>
  696. <h3 class="command">VA_EnumSubunitsEx(part, data_flow, callback, target_name, target_iid)</h3>
  697. <h4>Parameters</h4>
  698. <table class="params">
  699. <tr class="returns">
  700. <td>
  701. <em>Returns</em>
  702. </td>
  703. <td>See Remarks.</td>
  704. </tr>
  705. <tr>
  706. <td>part</td>
  707. <td>A pointer to an <a href="http://msdn2.microsoft.com/en-us/library/ms679050(VS.85).aspx">IPart</a> interface.</td>
  708. </tr>
  709. <tr>
  710. <td>data_flow</td>
  711. <td>0 to enumerate incoming parts; 1 to enumerate outgoing parts.</td>
  712. </tr>
  713. <tr>
  714. <td>callback</td>
  715. <td>A callback accepting two parameters: part, interface.</td>
  716. </tr>
  717. <tr>
  718. <td>target_name</td>
  719. <td><span class="sub">(optional)</span>The full or partial friendly name of a subunit or subunits.</td>
  720. </tr>
  721. <tr>
  722. <td>target_iid</td>
  723. <td><span class="sub">(optional)</span>The ID of an interface which matching subunits must support.</td>
  724. </tr>
  725. </table>
  726. <h4>Remarks</h4>
  727. <p>The callback is called once for each matching subunit. The callback's first parameter is a pointer to the subunit (<a href="http://msdn2.microsoft.com/en-us/library/ms679050(VS.85).aspx">IPart</a>), while the second parameter is a pointer to the required interface (or 0 if target_iid was omitted.) If the callback returns a non-zero value, enumeration is halted and the value is passed on to the caller.</p>
  728. </div>
  729. <div class="method" id="VA_FindSubunit">
  730. <h2>VA_FindSubunit</h2>
  731. <p>Finds a subunit of a device, given a device pointer.</p>
  732. <h3 class="command">VA_FindSubunit(device, target_desc, target_iid)</h3>
  733. <h4>Parameters</h4>
  734. <table class="params">
  735. <tr class="returns">
  736. <td>
  737. <em>Returns</em>
  738. </td>
  739. <td>If a matching subunit is found, the return value is a pointer to the requested interface. Otherwise, the return value is 0.</td>
  740. </tr>
  741. <tr>
  742. <td>device</td>
  743. <td>A pointer to an <a href="http://msdn2.microsoft.com/en-us/library/ms679028(VS.85).aspx">IMMDevice</a> interface.</td>
  744. </tr>
  745. <tr>
  746. <td>target_desc</td>
  747. <td>friendly_name | index | friendly_name:index</td>
  748. </tr>
  749. <tr>
  750. <td>target_iid</td>
  751. <td>An interface ID.</td>
  752. </tr>
  753. </table>
  754. <h4>Remarks</h4>
  755. <p>VA_FindSubunit requires a valid interface identifier. To retrieve a subunit by name alone, use <a href="#VA_EnumSubunits">VA_EnumSubunits</a> or <a href="#VA_EnumSubunitsEx">VA_EnumSubunitsEx</a>.</p>
  756. </div>
  757. <div class="method" id="VA_SetDefaultEndpoint">
  758. <p>Sets the default audio endpoint for a given role. Requires v2.3 or later.</p>
  759. <h3 class="command">VA_SetDefaultEndpoint(device_desc, role)</h3>
  760. <h4>Parameters</h4>
  761. <table class="params">
  762. <tr class="returns">
  763. <td>
  764. <em>Returns</em>
  765. </td>
  766. <td></td>
  767. </tr>
  768. <tr>
  769. <td>device_desc</td>
  770. <td>See <a href="#VA_GetDevice">VA_GetDevice</a>.</td>
  771. </tr>
  772. <tr>
  773. <td>role</td>
  774. <td>One of the following integer values:<br>
  775. <strong>0</strong>: eConsole - what Windows calls the "Default Device".<br>
  776. <strong>1</strong>: eMultimedia<br>
  777. <strong>2</strong>: eCommunications - what Windows calls the "Default Communication Device".</td>
  778. </tr>
  779. </table>
  780. <h4>Remarks</h4>
  781. <p>This function relies on undocumented interfaces and therefore isn't guaranteed to work.</p>
  782. </div>
  783. <div class="method" id="VA_dB2Scalar">
  784. <h2>VA_dB2Scalar</h2>
  785. <p>Converts a decibel value to a scalar value.</p>
  786. <h3 class="command">VA_dB2Scalar(dB, min_dB, max_dB)</h3>
  787. <h4>Parameters</h4>
  788. <table class="params">
  789. <tr class="returns">
  790. <td>
  791. <em>Returns</em>
  792. </td>
  793. <td>A value between 0.0 and 1.0.</td>
  794. </tr>
  795. <tr>
  796. <td>dB</td>
  797. <td>A decibel value.</td>
  798. </tr>
  799. <tr>
  800. <td>min_dB</td>
  801. <td>Minimum decibel value.</td>
  802. </tr>
  803. <tr>
  804. <td>max_dB</td>
  805. <td>Maximum decibel value.</td>
  806. </tr>
  807. </table>
  808. <h4>Remarks</h4>
  809. <p>The returned scalar value is usually consistent with values reported by the Sound applet in Control Panel, but not values reported by the Sound Mixer.</p>
  810. </div>
  811. <div class="method" id="VA_Scalar2dB">
  812. <h2>VA_Scalar2dB</h2>
  813. <p>Converts a scalar value to a decibel value.</p>
  814. <h3 class="command">VA_Scalar2dB(s, min_dB, max_dB)</h3>
  815. <h4>Parameters</h4>
  816. <table class="params">
  817. <tr class="returns">
  818. <td>
  819. <em>Returns</em>
  820. </td>
  821. <td>A decibel value.</td>
  822. </tr>
  823. <tr>
  824. <td>s</td>
  825. <td>A value between 0.0 and 1.0.</td>
  826. </tr>
  827. <tr>
  828. <td>min_dB</td>
  829. <td>Minimum decibel value.</td>
  830. </tr>
  831. <tr>
  832. <td>max_dB</td>
  833. <td>Maximum decibel value.</td>
  834. </tr>
  835. </table>
  836. </div>
  837. <div class="method" id="Interface Functions">
  838. <h2>Interface Functions</h2>
  839. <p>Functions with the naming pattern "VA_I<em>Interface</em>_<em>Function</em>" are direct equivalents of interface functions. These functions are defined under
  840. INTERFACE WRAPPERS in VA.ahk. For syntax and usage, see <a href="http://msdn2.microsoft.com/en-us/library/ms679156(VS.85).aspx">Core Audio APIs in Windows Vista (Programming Reference)</a>.</p>
  841. <h3 class="command">VA_I<em>Interface</em>_<em>Function</em></h3>
  842. <h4>Remarks</h4>
  843. <p>As of v2.0, interface wrappers for the following interfaces are included:</p>
  844. <ul>
  845. <li><a href="http://msdn.microsoft.com/en-us/library/ms679028">IMMDevice</a></li>
  846. <li><a href="http://msdn.microsoft.com/en-us/library/ms678970">IDeviceTopology</a></li>
  847. <li><a href="http://msdn.microsoft.com/en-us/library/ms678851">IConnector</a></li>
  848. <li><a href="http://msdn.microsoft.com/en-us/library/ms679050">IPart</a></li>
  849. <li><a href="http://msdn.microsoft.com/en-us/library/ms679063">IPartsList</a></li>
  850. <li><a href="http://msdn.microsoft.com/en-us/library/aa964574">IAudioEndpointVolume</a></li>
  851. <li><a href="http://msdn.microsoft.com/en-us/library/ms679067">IPerChannelDbLevel</a> (usable with <a href="http://msdn2.microsoft.com/en-us/library/ms678838(VS.85).aspx">IAudioVolumeLevel</a>)</li>
  852. <li><a href="http://msdn.microsoft.com/en-us/library/ms678773">IAudioMute</a></li>
  853. <li><a href="http://msdn.microsoft.com/en-us/library/ms678718">IAudioAutoGainControl</a></li>
  854. <li><a href="http://msdn.microsoft.com/en-us/library/aa964578">IAudioMeterInformation</a></li>
  855. </ul>
  856. <p>v2.1:</p>
  857. <ul>
  858. <li><a href="http://msdn.microsoft.com/en-us/library/dd370865">IAudioClient</a></li>
  859. <li><a href="http://msdn.microsoft.com/en-us/library/dd368246">IAudioSessionControl</a></li>
  860. <li><a href="http://msdn.microsoft.com/en-us/library/dd370948">IAudioSessionManager</a></li>
  861. </ul>
  862. <p>v2.1 on Windows 7 or later:</p>
  863. <ul>
  864. <li><a href="http://msdn.microsoft.com/en-us/library/dd368248">IAudioSessionControl2</a></li>
  865. <li><a href="http://msdn.microsoft.com/en-us/library/dd370950">IAudioSessionManager2</a></li>
  866. <li><a href="http://msdn.microsoft.com/en-us/library/dd368281">IAudioSessionEnumerator</a></li>
  867. </ul>
  868. <p>v2.2:</p>
  869. <ul>
  870. <li><a href="http://msdn.microsoft.com/en-us/library/dd371399">IMMDeviceEnumerator</a></li>
  871. <li><a href="http://msdn.microsoft.com/en-us/library/dd371396">IMMDeviceCollection</a></li>
  872. <li><a href="http://msdn.microsoft.com/en-us/library/dd371098">IControlInterface</a></li>
  873. </ul>
  874. </div>
  875. </div>
  876. <div style="clear: both;"></div>
  877. <div id="end">Copyright © Lexikos</div>
  878. </body>
  879. </html>