User Tools

Site Tools


interrogating_20the_20audio_20mixer

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

interrogating_20the_20audio_20mixer [2018/03/31 13:19]
127.0.0.1 external edit
interrogating_20the_20audio_20mixer [2018/04/15 11:51] (current)
richardrussell Added syntax highlighting
Line 1: Line 1:
 =====Interrogating the audio mixer===== =====Interrogating the audio mixer=====
  
-//by Richard Russell, June 2010//\\ \\ **Note: On Windows Vista and Windows 7 each running application has its own independent audio mixer. The code listed here will work correctly, but the mixer interrogated is that for the specific application.**\\ \\  The article [[/​Controlling%20the%20audio%20mixer|Controlling the audio mixer]] explains how to control the volume of Wave, Synth and CD outputs and the level of CD, Microphone and Line inputs (and often several others) using the **FN_mixerset** routine. The **FN_mixerget** function listed at the end of this article allows you to interrogate the settings of the various mixer controls. The function should be called using code similar to the following:\\ +//by Richard Russell, June 2010//\\ \\ **Note: On Windows Vista and Windows 7 each running application has its own independent audio mixer. The code listed here will work correctly, but the mixer interrogated is that for the specific application.**\\ \\  The article [[/​Controlling%20the%20audio%20mixer|Controlling the audio mixer]] explains how to control the volume of Wave, Synth and CD outputs and the level of CD, Microphone and Line inputs (and often several others) using the **FN_mixerset** routine. The **FN_mixerget** function listed at the end of this article allows you to interrogate the settings of the various mixer controls. The function should be called using code similar to the following: 
 + 
 +<code bb4w>
         setting% = FN_mixerget(Dest%,​ Source%, Control%)         setting% = FN_mixerget(Dest%,​ Source%, Control%)
-The routine returns the current setting of the control (typically 0-65535 for Volume).\\ \\  The parameters are as follows:\\ \\ +</​code>​ 
 + 
 +The routine returns the current setting of the control (typically 0-65535 for Volume).\\ \\  The parameters are as follows:
  
   * **"​Dest%"​** - The destination for the control, which will generally be either the **Speaker Output** (= **4**) or the **Recording Input** (= **7**).   * **"​Dest%"​** - The destination for the control, which will generally be either the **Speaker Output** (= **4**) or the **Recording Input** (= **7**).
   * **"​Source%"​** - The audio source for the control, for example the **Line Input** (= **&​1002**),​ **Microphone** (= **&​1003**),​ **Synthesizer** (= **&​1004**),​ **CD** (= **&​1005**) or **Wave Output** (= **&​1008**).   * **"​Source%"​** - The audio source for the control, for example the **Line Input** (= **&​1002**),​ **Microphone** (= **&​1003**),​ **Synthesizer** (= **&​1004**),​ **CD** (= **&​1005**) or **Wave Output** (= **&​1008**).
   * **"​Control%"​** - The control type, which will generally be **Volume** (= **&​50030001**).   * **"​Control%"​** - The control type, which will generally be **Volume** (= **&​50030001**).
-\\  ​For other possible values consult the Microsoft documentation.\\ \\  So for example to interrogate the **Microphone recording level** you could use code like this:\\ + 
 +For other possible values consult the Microsoft documentation.\\ \\  So for example to interrogate the **Microphone recording level** you could use code like this: 
 + 
 +<code bb4w>
         miclevel% = FN_mixerget(7,​ &1003, &​50030001)         miclevel% = FN_mixerget(7,​ &1003, &​50030001)
-To read the **CD Player output volume**:\\ +</​code>​ 
 + 
 +To read the **CD Player output volume**: 
 + 
 +<code bb4w>
         cdvolume% = FN_mixerget(4,​ &1005, &​50030001)         cdvolume% = FN_mixerget(4,​ &1005, &​50030001)
-To read a **Master Volume** setting (which does not have a specific source) set the **"​Source%"​** parameter to zero. So to discover the **Master speaker volume** you could do:\\ +</​code>​ 
 + 
 +To read a **Master Volume** setting (which does not have a specific source) set the **"​Source%"​** parameter to zero. So to discover the **Master speaker volume** you could do: 
 + 
 +<code bb4w>
         master% = FN_mixerget(4,​ 0, &​50030001)         master% = FN_mixerget(4,​ 0, &​50030001)
-Finally here is the code for **FN_mixerget** itself:\\ +</​code>​ 
 + 
 +Finally here is the code for **FN_mixerget** itself: 
 + 
 +<code bb4w>
         DEF FN_mixerget(dest%,​ source%, ctrl%)         DEF FN_mixerget(dest%,​ source%, ctrl%)
         LOCAL hmx%, res%, ndevs%, dev%, src%, level%, MixerLine{}         LOCAL hmx%, res%, ndevs%, dev%, src%, level%, MixerLine{}
Line 103: Line 122:
  
         = MixerControlDetailsData.dwValue%         = MixerControlDetailsData.dwValue%
 +</​code>​
interrogating_20the_20audio_20mixer.txt · Last modified: 2018/04/15 11:51 by richardrussell