Browse Source

upload spike scripts

ChesTeRcs 6 years ago
parent
commit
9615247ed8
100 changed files with 10861 additions and 0 deletions
  1. 14 0
      DotNet/Examples/1) DotNet_Start/1) DotNet_Start().au3
  2. 14 0
      DotNet/Examples/1) DotNet_Start/2) DotNet_Start( 'v2.0.50727' ).au3
  3. 14 0
      DotNet/Examples/1) DotNet_Start/3) DotNet_Start( 'v3.0' ) - Error.au3
  4. 14 0
      DotNet/Examples/1) DotNet_Start/4) DotNet_Start( 'x' ) - Error.au3
  5. 16 0
      DotNet/Examples/2) DotNet_StartDomain/1) DotNet_StartDomain.au3
  6. 16 0
      DotNet/Examples/2) DotNet_StartDomain/2) DotNet_StartDomain (compile me).au3
  7. 16 0
      DotNet/Examples/2) DotNet_StartDomain/3) DotNet_StartDomain.au3
  8. 29 0
      DotNet/Examples/3) DotNet_StopDomain/1) DotNet_StopDomain.au3
  9. 15 0
      DotNet/Examples/4) DotNet_LoadAssembly/1) DotNet_LoadAssembly (default domain).au3
  10. 15 0
      DotNet/Examples/4) DotNet_LoadAssembly/2) DotNet_LoadAssembly (compile me).au3
  11. 20 0
      DotNet/Examples/4) DotNet_LoadAssembly/3) DotNet_LoadAssembly (user domain).au3
  12. BIN
      DotNet/Examples/4) DotNet_LoadAssembly/XPTable.dll
  13. 16 0
      DotNet/Examples/5) DotNet_LoadCScode/1) DotNet_LoadCScode.au3
  14. 13 0
      DotNet/Examples/5) DotNet_LoadCScode/2) DotNet_LoadCScode (assembly error).au3
  15. 4 0
      DotNet/Examples/5) DotNet_LoadCScode/2) DotNet_LoadCScode (assembly error).txt
  16. 13 0
      DotNet/Examples/5) DotNet_LoadCScode/3) DotNet_LoadCScode (C# syntax error).au3
  17. 6 0
      DotNet/Examples/5) DotNet_LoadCScode/CodeCS (C# syntax error).cs
  18. 4 0
      DotNet/Examples/5) DotNet_LoadCScode/CodeCS (C# syntax error).txt
  19. 6 0
      DotNet/Examples/5) DotNet_LoadCScode/CodeCS.cs
  20. 81 0
      DotNet/Examples/5) DotNet_LoadCScode/ufbSoundDetect.cs
  21. 16 0
      DotNet/Examples/6) DotNet_LoadVBcode/1) DotNet_LoadVBcode.au3
  22. 15 0
      DotNet/Examples/6) DotNet_LoadVBcode/2) DotNet_LoadVBcode (method error).au3
  23. 11 0
      DotNet/Examples/6) DotNet_LoadVBcode/2) DotNet_LoadVBcode (method error).txt
  24. 6 0
      DotNet/Examples/6) DotNet_LoadVBcode/CodeVB.vb
  25. 14 0
      DotNet/Examples/7) DotNet_CreateObject/1) DotNet_CreateObject.au3
  26. 6 0
      DotNet/Examples/7) DotNet_CreateObject/CodeVB.vb
  27. 174 0
      DotNet/Includes/AccVarsUtilities.au3
  28. 60 0
      DotNet/Includes/AccessingVariables.au3
  29. 35 0
      DotNet/Includes/COMUtils.au3
  30. 193 0
      DotNet/Includes/DotNet.au3
  31. 1200 0
      DotNet/Includes/DotNetAll.au3
  32. 44 0
      DotNet/Includes/DotNetUtils.au3
  33. 298 0
      DotNet/Includes/Interfaces.au3
  34. 117 0
      DotNet/Includes/SafeArray.au3
  35. 237 0
      DotNet/Includes/Variant.au3
  36. 914 0
      VA-2.3/VA.ahk
  37. 914 0
      VA-2.3/VA.ahk.bak
  38. 890 0
      VA-2.3/VA.html
  39. 65 0
      sandbox.au3
  40. 193 0
      soundDetect.au3
  41. 35 0
      soundDetect2.au3
  42. 153 0
      soundDetect3.au3
  43. 14 0
      soundDetect4-sandbox.au3
  44. 543 0
      sourceCode/BuildProcessTemplates/DefaultTemplate.11.1.xaml
  45. 0 0
      sourceCode/BuildProcessTemplates/LabDefaultTemplate.11.xaml
  46. 76 0
      sourceCode/BuildProcessTemplates/UpgradeTemplate.xaml
  47. 34 0
      sourceCode/trunk/Code/CoreAudio.sln
  48. 209 0
      sourceCode/trunk/Code/CoreAudio.vsmdi
  49. 49 0
      sourceCode/trunk/Code/CoreAudio/Constants/AUDCLNT_SESSIONFLAGS_XXX.cs
  50. 57 0
      sourceCode/trunk/Code/CoreAudio/Constants/AUDCLNT_STREAMFLAGS_XXX.cs
  51. 36 0
      sourceCode/trunk/Code/CoreAudio/Constants/ComCLSIDs.cs
  52. 91 0
      sourceCode/trunk/Code/CoreAudio/Constants/ComIIDs.cs
  53. 57 0
      sourceCode/trunk/Code/CoreAudio/Constants/DEVICE_STATE_XXX.cs
  54. 47 0
      sourceCode/trunk/Code/CoreAudio/Constants/ENDPOINT_HARDWARE_SUPPORT_XXX.cs
  55. 96 0
      sourceCode/trunk/Code/CoreAudio/Constants/PropertyKeys.cs
  56. 157 0
      sourceCode/trunk/Code/CoreAudio/CoreAudio.csproj
  57. 49 0
      sourceCode/trunk/Code/CoreAudio/Enumerations/AUDCLNT_BUFFERFLAGS.cs
  58. 43 0
      sourceCode/trunk/Code/CoreAudio/Enumerations/AUDCLNT_SHAREMODE.cs
  59. 63 0
      sourceCode/trunk/Code/CoreAudio/Enumerations/AudioSessionDisconnectReason.cs
  60. 48 0
      sourceCode/trunk/Code/CoreAudio/Enumerations/AudioSessionState.cs
  61. 63 0
      sourceCode/trunk/Code/CoreAudio/Enumerations/ConnectorType.cs
  62. 43 0
      sourceCode/trunk/Code/CoreAudio/Enumerations/DataFlow.cs
  63. 48 0
      sourceCode/trunk/Code/CoreAudio/Enumerations/EDataFlow.cs
  64. 48 0
      sourceCode/trunk/Code/CoreAudio/Enumerations/ERole.cs
  65. 88 0
      sourceCode/trunk/Code/CoreAudio/Enumerations/EndpointFormFactor.cs
  66. 43 0
      sourceCode/trunk/Code/CoreAudio/Enumerations/KSJACK_SINK_CONNECTIONTYPE.cs
  67. 43 0
      sourceCode/trunk/Code/CoreAudio/Enumerations/PartType.cs
  68. 144 0
      sourceCode/trunk/Code/CoreAudio/Externals/CLSCTX.cs
  69. 85 0
      sourceCode/trunk/Code/CoreAudio/Externals/IPropertyStore.cs
  70. 45 0
      sourceCode/trunk/Code/CoreAudio/Externals/PROPERTYKEY.cs
  71. 95 0
      sourceCode/trunk/Code/CoreAudio/Externals/PROPVARIANT.cs
  72. 48 0
      sourceCode/trunk/Code/CoreAudio/Externals/STGM.cs
  73. 251 0
      sourceCode/trunk/Code/CoreAudio/Interfaces/Definitions.cs
  74. 53 0
      sourceCode/trunk/Code/CoreAudio/Interfaces/IAudioAutoGainControl.cs
  75. 35 0
      sourceCode/trunk/Code/CoreAudio/Interfaces/IAudioBass.cs
  76. 72 0
      sourceCode/trunk/Code/CoreAudio/Interfaces/IAudioCaptureClient.cs
  77. 53 0
      sourceCode/trunk/Code/CoreAudio/Interfaces/IAudioChannelConfig.cs
  78. 160 0
      sourceCode/trunk/Code/CoreAudio/Interfaces/IAudioClient.cs
  79. 61 0
      sourceCode/trunk/Code/CoreAudio/Interfaces/IAudioClock.cs
  80. 44 0
      sourceCode/trunk/Code/CoreAudio/Interfaces/IAudioClock2.cs
  81. 42 0
      sourceCode/trunk/Code/CoreAudio/Interfaces/IAudioClockAdjustment.cs
  82. 221 0
      sourceCode/trunk/Code/CoreAudio/Interfaces/IAudioEndpointVolume.cs
  83. 43 0
      sourceCode/trunk/Code/CoreAudio/Interfaces/IAudioEndpointVolumeCallback.cs
  84. 240 0
      sourceCode/trunk/Code/CoreAudio/Interfaces/IAudioEndpointVolumeEx.cs
  85. 53 0
      sourceCode/trunk/Code/CoreAudio/Interfaces/IAudioInputSelector.cs
  86. 53 0
      sourceCode/trunk/Code/CoreAudio/Interfaces/IAudioLoudness.cs
  87. 71 0
      sourceCode/trunk/Code/CoreAudio/Interfaces/IAudioMeterInformation.cs
  88. 36 0
      sourceCode/trunk/Code/CoreAudio/Interfaces/IAudioMidrange.cs
  89. 53 0
      sourceCode/trunk/Code/CoreAudio/Interfaces/IAudioMute.cs
  90. 53 0
      sourceCode/trunk/Code/CoreAudio/Interfaces/IAudioOutputSelector.cs
  91. 53 0
      sourceCode/trunk/Code/CoreAudio/Interfaces/IAudioPeakMeter.cs
  92. 56 0
      sourceCode/trunk/Code/CoreAudio/Interfaces/IAudioRenderClient.cs
  93. 143 0
      sourceCode/trunk/Code/CoreAudio/Interfaces/IAudioSessionControl.cs
  94. 170 0
      sourceCode/trunk/Code/CoreAudio/Interfaces/IAudioSessionControl2.cs
  95. 53 0
      sourceCode/trunk/Code/CoreAudio/Interfaces/IAudioSessionEnumerator.cs
  96. 113 0
      sourceCode/trunk/Code/CoreAudio/Interfaces/IAudioSessionEvents.cs
  97. 61 0
      sourceCode/trunk/Code/CoreAudio/Interfaces/IAudioSessionManager.cs
  98. 111 0
      sourceCode/trunk/Code/CoreAudio/Interfaces/IAudioSessionManager2.cs
  99. 42 0
      sourceCode/trunk/Code/CoreAudio/Interfaces/IAudioSessionNotification.cs
  100. 87 0
      sourceCode/trunk/Code/CoreAudio/Interfaces/IAudioStreamVolume.cs

+ 14 - 0
DotNet/Examples/1) DotNet_Start/1) DotNet_Start().au3

@@ -0,0 +1,14 @@
+#include "..\..\Includes\DotNet.au3"
+
+Opt( "MustDeclareVars", 1 )
+
+Example()
+
+Func Example()
+	; Start the latest version of .NET Framework
+	; DotNet_Start() is automatically called by the other functions in DotNet.au3
+	; You only have to call DotNet_Start() if you need an older version of .NET Framework
+	DotNet_Start()
+	If @error Then Return ConsoleWrite( "DotNet_Start ERR" & @CRLF )
+	ConsoleWrite( "DotNet_Start OK" & @CRLF )
+EndFunc

+ 14 - 0
DotNet/Examples/1) DotNet_Start/2) DotNet_Start( 'v2.0.50727' ).au3

@@ -0,0 +1,14 @@
+#include "..\..\Includes\DotNet.au3"
+
+Opt( "MustDeclareVars", 1 )
+
+Example()
+
+Func Example()
+	; Start version "v2.0.50727" of .NET Framework
+	; DotNet_Start() is automatically called by the other functions in DotNet.au3
+	; You only have to call DotNet_Start() if you need an older version of .NET Framework
+	DotNet_Start( "v2.0.50727" )
+	If @error Then Return ConsoleWrite( "DotNet_Start ERR" & @CRLF )
+	ConsoleWrite( "DotNet_Start OK" & @CRLF )
+EndFunc

+ 14 - 0
DotNet/Examples/1) DotNet_Start/3) DotNet_Start( 'v3.0' ) - Error.au3

@@ -0,0 +1,14 @@
+#include "..\..\Includes\DotNet.au3"
+
+Opt( "MustDeclareVars", 1 )
+
+Example()
+
+Func Example()
+	; Start version "v3.0" of .NET Framework
+	; DotNet_Start() is automatically called by the other functions in DotNet.au3
+	; You only have to call DotNet_Start() if you need an older version of .NET Framework
+	DotNet_Start( "v3.0" )
+	If @error Then Return ConsoleWrite( "DotNet_Start ERR" & @CRLF )
+	ConsoleWrite( "DotNet_Start OK" & @CRLF )
+EndFunc

+ 14 - 0
DotNet/Examples/1) DotNet_Start/4) DotNet_Start( 'x' ) - Error.au3

@@ -0,0 +1,14 @@
+#include "..\..\Includes\DotNet.au3"
+
+Opt( "MustDeclareVars", 1 )
+
+Example()
+
+Func Example()
+	; Start version "x" of .NET Framework
+	; DotNet_Start() is automatically called by the other functions in DotNet.au3
+	; You only have to call DotNet_Start() if you need an older version of .NET Framework
+	DotNet_Start( "x" )
+	If @error Then Return ConsoleWrite( "DotNet_Start ERR" & @CRLF )
+	ConsoleWrite( "DotNet_Start OK" & @CRLF )
+EndFunc

+ 16 - 0
DotNet/Examples/2) DotNet_StartDomain/1) DotNet_StartDomain.au3

@@ -0,0 +1,16 @@
+#include "..\..\Includes\DotNetUtils.au3"
+
+Opt( "MustDeclareVars", 1 )
+
+Example()
+
+Func Example()
+	Local $oMyDomain
+	; Creates and starts a user domain to run .NET code
+	; A default domain is automatically created by the other functions in DotNet.au3
+	; You only need to call DotNet_StartDomain() if you want to specify a base directory for the domain
+	DotNet_StartDomain( $oMyDomain )
+	If Not IsObj( $oMyDomain ) Then Return ConsoleWrite( "DotNet_StartDomain ERR" & @CRLF )
+	ConsoleWrite( "DotNet_StartDomain OK" & @CRLF )
+	DotNet_ListDomainsEx()
+EndFunc

+ 16 - 0
DotNet/Examples/2) DotNet_StartDomain/2) DotNet_StartDomain (compile me).au3

@@ -0,0 +1,16 @@
+#include "..\..\Includes\DotNetUtils.au3"
+
+Opt( "MustDeclareVars", 1 )
+
+Example()
+
+Func Example()
+	Local $oMyDomain
+	; Creates and starts a user domain to run .NET code
+	; A default domain is automatically created by the other functions in DotNet.au3
+	; You only need to call DotNet_StartDomain() if you want to specify a base directory for the domain
+	DotNet_StartDomain( $oMyDomain )
+	If Not IsObj( $oMyDomain ) Then Return ConsoleWrite( "DotNet_StartDomain ERR" & @CRLF )
+	ConsoleWrite( "DotNet_StartDomain OK" & @CRLF )
+	DotNet_ListDomainsEx()
+EndFunc

+ 16 - 0
DotNet/Examples/2) DotNet_StartDomain/3) DotNet_StartDomain.au3

@@ -0,0 +1,16 @@
+#include "..\..\Includes\DotNetUtils.au3"
+
+Opt( "MustDeclareVars", 1 )
+
+Example()
+
+Func Example()
+	Local $oMyDomain
+	; Creates and starts a user domain to run .NET code
+	; A default domain is automatically created by the other functions in DotNet.au3
+	; You only need to call DotNet_StartDomain() if you want to specify a base directory for the domain
+	DotNet_StartDomain( $oMyDomain, "MyDomain", "C:\Windows\Temp" )
+	If Not IsObj( $oMyDomain ) Then Return ConsoleWrite( "DotNet_StartDomain ERR" & @CRLF )
+	ConsoleWrite( "DotNet_StartDomain OK" & @CRLF )
+	DotNet_ListDomainsEx()
+EndFunc

+ 29 - 0
DotNet/Examples/3) DotNet_StopDomain/1) DotNet_StopDomain.au3

@@ -0,0 +1,29 @@
+#include "..\..\Includes\DotNetUtils.au3"
+
+Opt( "MustDeclareVars", 1 )
+
+Example()
+
+Func Example()
+	Local $oMyDomain
+
+	DotNet_StartDomain( $oMyDomain, "MyDomain", "C:\Windows\Temp" )
+	If Not IsObj( $oMyDomain ) Then Return ConsoleWrite( "DotNet_StartDomain ERR" & @CRLF )
+	ConsoleWrite( "DotNet_StartDomain OK" & @CRLF )
+	DotNet_ListDomainsEx()
+
+	; Unloads .NET assemblies loaded into the user domain and stops the domain
+	DotNet_StopDomain( $oMyDomain )
+	ConsoleWrite( "DotNet_StopDomain OK" & @CRLF )
+	DotNet_ListDomainsEx()
+
+	DotNet_StartDomain( $oMyDomain, "MyDomain", "C:\Windows\Temp" )
+	If Not IsObj( $oMyDomain ) Then Return ConsoleWrite( "DotNet_StartDomain ERR" & @CRLF )
+	ConsoleWrite( "DotNet_StartDomain OK" & @CRLF )
+	DotNet_ListDomainsEx()
+
+	; Unloads .NET assemblies loaded into the user domain and stops the domain
+	DotNet_StopDomain( $oMyDomain )
+	ConsoleWrite( "DotNet_StopDomain OK" & @CRLF )
+	DotNet_ListDomainsEx()
+EndFunc

+ 15 - 0
DotNet/Examples/4) DotNet_LoadAssembly/1) DotNet_LoadAssembly (default domain).au3

@@ -0,0 +1,15 @@
+#include "..\..\Includes\DotNetUtils.au3"
+
+Opt( "MustDeclareVars", 1 )
+
+Example()
+
+Func Example()
+	; Loads a .NET assembly DLL-file into the default domain
+	Local $oXPTable = DotNet_LoadAssembly( "XPTable.dll" )
+	If @error Then Return ConsoleWrite( "DotNet_LoadAssembly ERR" & @CRLF )
+	ConsoleWrite( "DotNet_LoadAssembly OK" & @CRLF )
+	DotNet_ListDomainsEx()
+	DotNet_ListAssembliesEx()
+	#forceref $oXPTable
+EndFunc

+ 15 - 0
DotNet/Examples/4) DotNet_LoadAssembly/2) DotNet_LoadAssembly (compile me).au3

@@ -0,0 +1,15 @@
+#include "..\..\Includes\DotNetUtils.au3"
+
+Opt( "MustDeclareVars", 1 )
+
+Example()
+
+Func Example()
+	; Loads a .NET assembly DLL-file into the default domain
+	Local $oXPTable = DotNet_LoadAssembly( "XPTable.dll" )
+	If @error Then Return ConsoleWrite( "DotNet_LoadAssembly ERR" & @CRLF )
+	ConsoleWrite( "DotNet_LoadAssembly OK" & @CRLF )
+	DotNet_ListDomainsEx()
+	DotNet_ListAssembliesEx()
+	#forceref $oXPTable
+EndFunc

+ 20 - 0
DotNet/Examples/4) DotNet_LoadAssembly/3) DotNet_LoadAssembly (user domain).au3

@@ -0,0 +1,20 @@
+#include "..\..\Includes\DotNetUtils.au3"
+
+Opt( "MustDeclareVars", 1 )
+
+Example()
+
+Func Example()
+	Local $oMyDomain
+	; Create and start a user domain to run .NET code
+	; Set a base directory to load .NET assemblies into the domain
+	DotNet_StartDomain( $oMyDomain, "MyDomain", @ScriptDir )
+	DotNet_ListDomainsEx()
+
+	; Loads a .NET assembly DLL-file into a user domain
+	Local $oXPTable = DotNet_LoadAssembly( "XPTable.dll", $oMyDomain )
+	If @error Then Return ConsoleWrite( "DotNet_LoadAssembly ERR" & @CRLF )
+	ConsoleWrite( "DotNet_LoadAssembly OK" & @CRLF )
+	DotNet_ListAssembliesEx( $oMyDomain )
+	#forceref $oXPTable
+EndFunc

BIN
DotNet/Examples/4) DotNet_LoadAssembly/XPTable.dll


+ 16 - 0
DotNet/Examples/5) DotNet_LoadCScode/1) DotNet_LoadCScode.au3

@@ -0,0 +1,16 @@
+#include "..\..\Includes\DotNet.au3"
+
+Opt( "MustDeclareVars", 1 )
+
+Example()
+
+Func Example()
+	; Compiles C# source code on the fly
+	; Creates a .NET assembly DLL-file in memory
+	; Loads the memory assembly file into the default domain
+	Local $oCode = DotNet_LoadCScode( FileRead( "ufbSoundDetect.cs" ), "System.Windows.Forms.dll" ) ; You must add the "System.Windows.Forms.dll"
+	If @error Then Return ConsoleWrite( "DotNet_LoadCScode ERR" & @CRLF )                   ; assembly because of line 1 in the C# code.
+	ConsoleWrite( "DotNet_LoadCScode OK" & @CRLF )
+	Local $oFoo = DotNet_CreateObject( $oCode, "Foo" ) ; $oFoo is an object of the "Foo" class in the C# code
+	If IsObj( $oFoo ) Then $oFoo.Test()                ; Test is a method (function) of the $oFoo object
+EndFunc

+ 13 - 0
DotNet/Examples/5) DotNet_LoadCScode/2) DotNet_LoadCScode (assembly error).au3

@@ -0,0 +1,13 @@
+#include "..\..\Includes\DotNet.au3"
+
+Opt( "MustDeclareVars", 1 )
+
+Example()
+
+Func Example()
+	Local $oCode = DotNet_LoadCScode( FileRead( "CodeCS.cs" ) ) ; Missing "System.Windows.Forms.dll" assembly
+	If @error Then Return ConsoleWrite( "DotNet_LoadCScode ERR" & @CRLF )
+	ConsoleWrite( "DotNet_LoadCScode OK" & @CRLF )
+	Local $oFoo = DotNet_CreateObject( $oCode, "Foo" )
+	If IsObj( $oFoo ) Then $oFoo.Test()
+EndFunc

+ 4 - 0
DotNet/Examples/5) DotNet_LoadCScode/2) DotNet_LoadCScode (assembly error).txt

@@ -0,0 +1,4 @@
+Line: 1
+Column: 14
+CS0234: The type or namespace name 'Windows' does not exist in the namespace 'System' (are you missing an assembly reference?)
+DotNet_LoadCScode ERR

+ 13 - 0
DotNet/Examples/5) DotNet_LoadCScode/3) DotNet_LoadCScode (C# syntax error).au3

@@ -0,0 +1,13 @@
+#include "..\..\Includes\DotNet.au3"
+
+Opt( "MustDeclareVars", 1 )
+
+Example()
+
+Func Example()
+	Local $oCode = DotNet_LoadCScode( FileRead( "CodeCS (C# syntax error).cs" ), "System.Windows.Forms.dll" )
+	If @error Then Return ConsoleWrite( "DotNet_LoadCScode ERR" & @CRLF )
+	ConsoleWrite( "DotNet_LoadCScode OK" & @CRLF )
+	Local $oFoo = DotNet_CreateObject( $oCode, "Foo" )
+	If IsObj( $oFoo ) Then $oFoo.Test()
+EndFunc

+ 6 - 0
DotNet/Examples/5) DotNet_LoadCScode/CodeCS (C# syntax error).cs

@@ -0,0 +1,6 @@
+using System.Windows.Forms;
+class Foo {
+	public void Test() {
+		MessageBox.Show( "Hello world from C#!" ) // Syntax error: Missing semicolon at the end of the code line
+	}
+}

+ 4 - 0
DotNet/Examples/5) DotNet_LoadCScode/CodeCS (C# syntax error).txt

@@ -0,0 +1,4 @@
+Line: 4
+Column: 44
+CS1002: ; expected
+DotNet_LoadCScode ERR

+ 6 - 0
DotNet/Examples/5) DotNet_LoadCScode/CodeCS.cs

@@ -0,0 +1,6 @@
+using System.Windows.Forms;
+class Foo {
+	public void Test() {
+		MessageBox.Show( "Hello world from C#!" );
+	}
+}

+ 81 - 0
DotNet/Examples/5) DotNet_LoadCScode/ufbSoundDetect.cs

@@ -0,0 +1,81 @@
+using CoreAudioApi;
+using System;
+using System.Diagnostics;
+using System.Linq;
+using System.Threading;
+using System.Threading.Tasks;
+
+class Ears
+    {
+        private MMDevice _sndDevice;
+        private readonly LimitedCollection<int> _volumeQueue;
+        private int _tickrate = 50; //ms pause between sound checks
+
+        private const int MaxVolumeQueueLength = 5;
+
+        public Ears()
+        {
+            _volumeQueue = new LimitedCollection<int>(MaxVolumeQueueLength) {0};
+        }
+
+        public async Task<bool> Listen(int millisecondsToListen, CancellationToken cancellationToken)
+        {
+            var stopwatch = new Stopwatch();
+            stopwatch.Start();
+            var sndDevEnum = new MMDeviceEnumerator();
+            _sndDevice = Properties.Settings.Default.AudioDevice != ""
+                ? sndDevEnum.GetDevice(Properties.Settings.Default.AudioDevice)
+                : sndDevEnum.GetDefaultAudioEndpoint(EDataFlow.eRender, ERole.eMultimedia);
+            Func<bool> heardFish;
+            if (Properties.Settings.Default.AverageSound)
+                heardFish = ListenTimerTickAvg;
+            else
+                heardFish = ListenTimerTick;
+
+            while (stopwatch.ElapsedMilliseconds <= millisecondsToListen) {
+                await Task.Delay(_tickrate, cancellationToken);
+                if (heardFish()) {
+                    return true;
+                }
+            }
+            return false;
+        }
+
+        private bool ListenTimerTick() {
+            // Get the current level
+            var currentVolumnLevel = (int)(_sndDevice.AudioMeterInformation.MasterPeakValue * 100);
+
+            if (currentVolumnLevel >= Properties.Settings.Default.SplashLimit)
+                return true;
+
+            return false;
+        }
+
+        private bool ListenTimerTickAvg()
+        {
+            // Get the current level
+            var currentVolumnLevel = (int)(_sndDevice.AudioMeterInformation.MasterPeakValue * 100);
+            var avgVol = GetAverageVolume();
+            var hear = false;
+
+            // Determine if the current level is high enough to be a fish
+            if (currentVolumnLevel - avgVol >= Properties.Settings.Default.SplashLimit) {
+                Serilog.Log.Information("Hear: {av},{cvl},{queue}", avgVol, currentVolumnLevel, _volumeQueue);
+                hear = true;
+            }
+
+            // Keep a running queue of the last X sounds as a reference point
+            _volumeQueue.Add(currentVolumnLevel);
+            return hear;
+
+        }
+
+        private int GetAverageVolume()
+        {
+            return (int)_volumeQueue.Average();
+        }
+
+		public void Test() {
+			MessageBox.Show( "Hello world from C#!" );
+		}
+    }

+ 16 - 0
DotNet/Examples/6) DotNet_LoadVBcode/1) DotNet_LoadVBcode.au3

@@ -0,0 +1,16 @@
+#include "..\..\Includes\DotNet.au3"
+
+Opt( "MustDeclareVars", 1 )
+
+Example()
+
+Func Example()
+	; Compiles VB source code on the fly
+	; Creates a .NET assembly DLL-file in memory
+	; Loads the memory assembly file into the default domain
+	Local $oCode = DotNet_LoadVBcode( FileRead( "CodeVB.vb" ), "System.Windows.Forms.dll" ) ; You must add the "System.Windows.Forms.dll"
+	If @error Then Return ConsoleWrite( "DotNet_LoadVBcode ERR" & @CRLF )                   ; assembly because of line 1 in the VB code.
+	ConsoleWrite( "DotNet_LoadVBcode OK" & @CRLF )
+	Local $oFoo = DotNet_CreateObject( $oCode, "Foo" ) ; $oFoo is an object of the "Foo" class in the VB code
+	If IsObj( $oFoo ) Then $oFoo.Test()                ; Test is a method (function) of the $oFoo object
+EndFunc

+ 15 - 0
DotNet/Examples/6) DotNet_LoadVBcode/2) DotNet_LoadVBcode (method error).au3

@@ -0,0 +1,15 @@
+#include "..\..\Includes\DotNet.au3"
+
+Opt( "MustDeclareVars", 1 )
+
+Example()
+
+Func Example()
+	Local $oComErrFunc = ObjEvent( "AutoIt.Error", "ComErrFunc" ) ; See COMUtils.au3
+	Local $oCode = DotNet_LoadVBcode( FileRead( "CodeVB.vb" ), "System.Windows.Forms.dll" )
+	If @error Then Return ConsoleWrite( "DotNet_LoadVBcode ERR" & @CRLF )
+	ConsoleWrite( "DotNet_LoadVBcode OK" & @CRLF )
+	Local $oFoo = DotNet_CreateObject( $oCode, "Foo" )
+	If IsObj( $oFoo ) Then $oFoo.Tst() ; Typing error: Tst instead of Test
+	#forceref $oComErrFunc
+EndFunc

+ 11 - 0
DotNet/Examples/6) DotNet_LoadVBcode/2) DotNet_LoadVBcode (method error).txt

@@ -0,0 +1,11 @@
+DotNet_LoadVBcode OK
+2) DotNet_LoadVBcode (method error).au3(13): ==> COM Error intercepted!
+	Err.number is: 		0x80020006
+	Err.windescription:	Unknown name.
+	Err.description is: 	
+	Err.source is: 		
+	Err.helpfile is: 	
+	Err.helpcontext is: 	
+	Err.lastdllerror is: 	0
+	Err.scriptline is: 	13
+	Err.retcode is: 	0x00000000

+ 6 - 0
DotNet/Examples/6) DotNet_LoadVBcode/CodeVB.vb

@@ -0,0 +1,6 @@
+Imports System.Windows.Forms
+Class Foo
+	Public Sub Test()
+		MessageBox.Show( "Hello world from VB!" )
+	End Sub
+End Class

+ 14 - 0
DotNet/Examples/7) DotNet_CreateObject/1) DotNet_CreateObject.au3

@@ -0,0 +1,14 @@
+#include "..\..\Includes\DotNet.au3"
+
+Opt( "MustDeclareVars", 1 )
+
+Example()
+
+Func Example()
+	Local $oCode = DotNet_LoadVBcode( FileRead( "CodeVB.vb" ), "System.Windows.Forms.dll" )
+	If @error Then Return ConsoleWrite( "DotNet_LoadVBcode ERR" & @CRLF )
+	ConsoleWrite( "DotNet_LoadVBcode OK" & @CRLF )
+	; Creates an object as an instance of the "Foo" class
+	Local $oFoo = DotNet_CreateObject( $oCode, "Foo" )
+	If IsObj( $oFoo ) Then $oFoo.Test()
+EndFunc

+ 6 - 0
DotNet/Examples/7) DotNet_CreateObject/CodeVB.vb

@@ -0,0 +1,6 @@
+Imports System.Windows.Forms
+Class Foo
+	Public Sub Test()
+		MessageBox.Show( "Hello world from VB!" )
+	End Sub
+End Class

+ 174 - 0
DotNet/Includes/AccVarsUtilities.au3

@@ -0,0 +1,174 @@
+#include-once
+#include "AccessingVariables.au3"
+
+; --- AccVars_ArrayToSafeArray ---
+
+; The AutoIt array and the safearray are arrays of variants
+Func AccVars_ArrayToSafeArray( ByRef $aArray, ByRef $pSafeArray )
+	AccessVariables01( AccVars_ArrayToSafeArrayConvert, $aArray )
+	AccVars_ArrayToSafeArrayData( $pSafeArray )
+EndFunc
+
+Func AccVars_ArrayToSafeArrayConvert( $pArray )
+	; <<<< On function entry the native AutoIt array is converted to a safearray contained in a variant >>>>
+
+	; Get safearray pointer
+	Local $pSafeArrayFromArray = DllStructGetData( DllStructCreate( "ptr", $pArray + 8 ), 1 )
+
+	Local $pSafeArray
+	SafeArrayCopy( $pSafeArrayFromArray, $pSafeArray )
+	If @error Then Return SetError(1,0,0)
+
+	AccVars_ArrayToSafeArrayData( $pSafeArray, 1 )
+EndFunc
+
+Func AccVars_ArrayToSafeArrayData( ByRef $pSafeArray, $bSet = 0 )
+	Static $pStaticSafeArray
+	If $bSet Then
+		$pStaticSafeArray = $pSafeArray
+	Else
+		$pSafeArray = $pStaticSafeArray
+	EndIf
+EndFunc
+
+
+; --- AccVars_SafeArrayToArray ---
+
+; The safearray and the AutoIt array are arrays of variants
+Func AccVars_SafeArrayToArray( ByRef $pSafeArray, ByRef $aArray )
+	AccessVariables02( AccVars_SafeArrayToArrayConvert, $pSafeArray, $aArray )
+EndFunc
+
+Func AccVars_SafeArrayToArrayConvert( $pvSafeArray, $pArray )
+
+	; --- Get safearray information ---
+
+	; $pvSafeArray is a variant that contains a pointer
+	Local $pSafeArray = DllStructGetData( DllStructCreate( "ptr", $pvSafeArray + 8 ), 1 )
+
+	; Array type
+	Local $iVarType
+	SafeArrayGetVartype( $pSafeArray, $iVarType )
+	Switch $iVarType
+		Case $VT_I2, $VT_I4   ; Signed integers
+		Case $VT_R4, $VT_R8   ; 4/8 bytes floats
+		Case $VT_BSTR         ; Basic string
+		Case $VT_BOOL         ; Boolean type
+		Case $VT_UI4, $VT_UI8 ; 4/8 bytes unsigned integers
+		Case $VT_VARIANT      ; Variant data type
+		Case $VT_UNKNOWN      ; IUnknown pointer
+			; $pSafeArray is not compatible with a native AutoIt array
+			; Convert $pSafeArray to a compatible safearray in $pSafeArray2
+			Local $tSafeArray = DllStructCreate( $tagSAFEARRAY, $pSafeArray )
+			Local $tSafeArrayBound = DllStructCreate( $tagSAFEARRAYBOUND )
+			Local $iElements = DllStructGetData( $tSafeArray, "cElements" )
+			DllStructSetData( $tSafeArrayBound, "cElements", $iElements )
+			DllStructSetData( $tSafeArrayBound, "lLbound", DllStructGetData( $tSafeArray, "lLbound" ) )
+			Local $pSafeArray2 = SafeArrayCreate( $VT_VARIANT, 1, $tSafeArrayBound ), $pArrayData, $pArrayData2
+			SafeArrayAccessData( $pSafeArray2, $pArrayData2 )
+			SafeArrayAccessData( $pSafeArray, $pArrayData )
+			$iVarType = @AutoItX64 ? $VT_UI8 : $VT_UI4
+			Local $iVarSize = @AutoItX64 ? 24 : 16
+			Local $iPtrSize = @AutoItX64 ? 8 : 4
+			For $i = 0 To $iElements - 1 ; Set variant type and data
+				DllStructSetData( DllStructCreate( "word", $pArrayData2 + $i * $iVarSize ), 1, $iVarType )
+				DllStructSetData( DllStructCreate( "uint_ptr", 8 + $pArrayData2 + $i * $iVarSize ), 1, DllStructGetData( DllStructCreate( "ptr", $pArrayData + $i * $iPtrSize ), 1 ) )
+			Next
+			SafeArrayUnaccessData( $pSafeArray )
+			SafeArrayUnaccessData( $pSafeArray2 )
+			SafeArrayCopy( $pSafeArray2, $pSafeArray )
+			SafeArrayDestroy( $pSafeArray2 )
+		Case Else
+			Return SetError(1,0,0)
+	EndSwitch
+
+	; --- Set $pArray to match an array ---
+
+	; Set vt element to $VT_ARRAY + $iVarType
+	DllStructSetData( DllStructCreate( "word", $pArray ), 1, $VT_ARRAY + $iVarType )
+
+	; Set data element to safearray pointer
+	DllStructSetData( DllStructCreate( "ptr", $pArray + 8 ), 1, $pSafeArray )
+
+	; <<<< On function exit the safearray contained in a variant is converted to a native AutoIt array >>>>
+EndFunc
+
+
+; --- AccVars_ArrayToSafeArrayOfVartype ---
+
+; The returned safearray is an array of the specified variant type
+Func AccVars_ArrayToSafeArrayOfVartype( ByRef $aArray, $iVartype )
+	Local $tsaBound = DllStructCreate( $tagSAFEARRAYBOUND ), $pSafeArray, $pSafeArrayData, $iArray = UBound( $aArray ), $iPtrSize = @AutoItX64 ? 8 : 4
+	DllStructSetData( $tsaBound, "cElements", $iArray )
+	DllStructSetData( $tsaBound, "lLbound", 0 )
+	$pSafeArray = SafeArrayCreate( $iVartype, 1, $tsaBound )
+	SafeArrayAccessData( $pSafeArray, $pSafeArrayData )
+	For $i = 0 To $iArray - 1
+		DllStructSetData( DllStructCreate( "ptr", $pSafeArrayData + $iPtrSize * $i ), 1, SysAllocString( $aArray[$i] ) )
+	Next
+	SafeArrayUnaccessData( $pSafeArray )
+	Return $pSafeArray
+EndFunc
+
+
+; --- AccVars_SafeArrayToSafeArrayOfVariant ---
+
+; Returns a safearray with one variant element
+; The variant element contains the input safearray
+Func AccVars_SafeArrayToSafeArrayOfVariant( ByRef $pSafeArrayIn )
+	Local $iVartype, $tsaBound = DllStructCreate( $tagSAFEARRAYBOUND ), $pSafeArrayOut, $pSafeArrayOutData
+	SafeArrayGetVartype( $pSafeArrayIn, $iVartype )
+	DllStructSetData( $tsaBound, "cElements", 1 )
+	DllStructSetData( $tsaBound, "lLbound", 0 )
+	$pSafeArrayOut = SafeArrayCreate( $VT_VARIANT, 1, $tsaBound )
+	SafeArrayAccessData( $pSafeArrayOut, $pSafeArrayOutData )
+	DllStructSetData( DllStructCreate( "word", $pSafeArrayOutData ), 1, $iVartype + $VT_ARRAY )
+	DllStructSetData( DllStructCreate( "ptr", $pSafeArrayOutData + 8 ), 1, $pSafeArrayIn )
+	SafeArrayUnaccessData( $pSafeArrayOut )
+	Return $pSafeArrayOut
+EndFunc
+
+
+; --- AccVars_VariantToVariable ---
+
+Func AccVars_VariantToVariable( ByRef $pVariant )
+	Switch DllStructGetData( DllStructCreate( "word", $pVariant ), 1 )
+		Case $VT_I4, $VT_I8 ; 4/8 bytes signed integer
+			Return DllStructGetData( DllStructCreate( "int", $pVariant + 8 ), 1 )
+		Case $VT_R8 ; 8 bytes double
+			Return DllStructGetData( DllStructCreate( "double", $pVariant + 8 ), 1 )
+		Case $VT_BSTR ; Basic string
+			Return SysReadString( DllStructGetData( DllStructCreate( "ptr", $pVariant + 8 ), 1 ) )
+		Case $VT_BOOL ; 2 bytes boolean
+			Return DllStructGetData( DllStructCreate( "short", $pVariant + 8 ), 1 )
+		Case $VT_UI4, $VT_UI8 ; 4/8 bytes unsigned integer
+			Return DllStructGetData( DllStructCreate( "ptr", $pVariant + 8 ), 1 )
+		Case Else
+			Return SetError(1,0,0)
+	EndSwitch
+EndFunc
+
+
+; --- AccVars_VariableToVariant ---
+
+Func AccVars_VariableToVariant( $vVariable, ByRef $pVariant )
+	Switch VarGetType( $vVariable )
+		Case "Bool"
+			DllStructSetData( DllStructCreate( "word", $pVariant ), 1, $VT_BOOL )
+			DllStructSetData( DllStructCreate( "short", $pVariant + 8 ), 1, $vVariable )
+		Case "Double"
+			DllStructSetData( DllStructCreate( "word", $pVariant ), 1, $VT_R8 )
+			DllStructSetData( DllStructCreate( "double", $pVariant + 8 ), 1, $vVariable )
+		Case "Int32"
+			DllStructSetData( DllStructCreate( "word", $pVariant ), 1, $VT_I4 )
+			DllStructSetData( DllStructCreate( "int", $pVariant + 8 ), 1, $vVariable )
+		Case "Ptr"
+			DllStructSetData( DllStructCreate( "word", $pVariant ), 1, @AutoItX64 ? $VT_UI8 : $VT_UI4 )
+			DllStructSetData( DllStructCreate( "ptr", $pVariant + 8 ), 1, $vVariable )
+		Case "String"
+			DllStructSetData( DllStructCreate( "word", $pVariant ), 1, $VT_BSTR )
+			DllStructSetData( DllStructCreate( "ptr", $pVariant + 8 ), 1, SysAllocString( $vVariable ) )
+		Case Else
+			Return SetError(1,0,0)
+	EndSwitch
+EndFunc

+ 60 - 0
DotNet/Includes/AccessingVariables.au3

@@ -0,0 +1,60 @@
+#include-once
+#include "Variant.au3"
+#include "SafeArray.au3"
+#include "COMUtils.au3"
+
+Global $oAccVars_Object = AccVars_Init(), $hAccVars_MethodFunc
+
+
+; --- The first part of the UDF creates $oAccVars_Object and implements method functions ---
+
+Func AccVars_Init()
+	; Three locals copied from "IUIAutomation MS framework automate chrome, FF, IE, ...." by junkew
+	; https://www.autoitscript.com/forum/index.php?showtopic=153520
+	Local $sCLSID_CUIAutomation = "{FF48DBA4-60EF-4201-AA87-54103EEF594E}"
+	Local $sIID_IUIAutomation = "{30CBE57D-D9D0-452A-AB13-7AC5AC4825EE}"
+	Local $stag_IUIAutomation = _
+		"AccVars_VariableToVariant01 hresult(variant*);" & _
+		"AccVars_VariableToVariant02 hresult(variant*;variant*);"
+
+	; Create AccVars object (Automation object)
+  Local $oAccVars_Object = ObjCreateInterface( $sCLSID_CUIAutomation, $sIID_IUIAutomation, $stag_IUIAutomation )
+  If Not IsObj( $oAccVars_Object ) Then Return SetError(1,0,1)
+
+	; Replace original methods with AccVars_VariableToVariantXY methods
+	Local $pVariableToVariant, $pAccessVariable = Ptr( $oAccVars_Object() ), $sFuncName, $sFuncParams = "ptr", $iOffset, $iPtrSize = @AutoItX64 ? 8 : 4
+	For $i = 1 To 2
+		$sFuncName = "AccVars_VariableToVariant" & StringFormat( "%02i", $i )
+		$sFuncParams &= ";ptr*"
+		$iOffset = ( 3 + $i - 1 ) * $iPtrSize
+		$pVariableToVariant = DllCallbackGetPtr( DllCallbackRegister( $sFuncName, "long", $sFuncParams ) )
+		ReplaceVTableFuncPtr( $pAccessVariable, $iOffset, $pVariableToVariant )
+	Next
+
+	Return $oAccVars_Object
+EndFunc
+
+Func AccVars_VariableToVariant01( $pSelf, $pVariant01 )
+	$hAccVars_MethodFunc( $pVariant01 )
+	Return 0 ; $S_OK (COM constant)
+	#forceref $pSelf
+EndFunc
+
+Func AccVars_VariableToVariant02( $pSelf, $pVariant01, $pVariant02 )
+	$hAccVars_MethodFunc( $pVariant01, $pVariant02 )
+	Return 0 ; $S_OK (COM constant)
+	#forceref $pSelf
+EndFunc
+
+
+; --- The last part of the UDF creates a set of easy to use functions to call the object methods ---
+
+Func AccessVariables01( $hAccVars_Method, ByRef $vVariable01 )
+	$hAccVars_MethodFunc = $hAccVars_Method
+	$oAccVars_Object.AccVars_VariableToVariant01( $vVariable01 )
+EndFunc
+
+Func AccessVariables02( $hAccVars_Method, ByRef $vVariable01, ByRef $vVariable02 )
+	$hAccVars_MethodFunc = $hAccVars_Method
+	$oAccVars_Object.AccVars_VariableToVariant02( $vVariable01, $vVariable02 )
+EndFunc

+ 35 - 0
DotNet/Includes/COMUtils.au3

@@ -0,0 +1,35 @@
+#include-once
+
+Func CoCreateInstance( $rclsid, $pUnkOuter, $ClsContext, $riid, ByRef $ppv )
+	Local $aRet = DllCall( "ole32.dll", "long", "CoCreateInstance", "struct*", $rclsid, "ptr", $pUnkOuter, "dword", $ClsContext, "struct*", $riid, "ptr*", 0 )
+	If @error Then Return SetError(1,0,1)
+	$ppv = $aRet[5]
+	Return $aRet[0]
+EndFunc
+
+; Add these lines to a script to activate the error handler:
+;Local $oComErrFunc = ObjEvent( "AutoIt.Error", "ComErrFunc" )
+;#forceref $oComErrFunc
+Func ComErrFunc( $oError )
+ConsoleWrite( @ScriptName & "(" & $oError.scriptline & "): ==> COM Error intercepted!" & @CRLF & _
+	@TAB & "Err.number is: " & @TAB & @TAB & "0x" & Hex( $oError.number ) & @CRLF & _
+	@TAB & "Err.windescription:" & @TAB & $oError.windescription & _
+	@TAB & "Err.description is: " & @TAB & $oError.description & @CRLF & _
+	@TAB & "Err.source is: " & @TAB & @TAB & $oError.source & @CRLF & _
+	@TAB & "Err.helpfile is: " & @TAB & $oError.helpfile & @CRLF & _
+	@TAB & "Err.helpcontext is: " & @TAB & $oError.helpcontext & @CRLF & _
+	@TAB & "Err.lastdllerror is: " & @TAB & $oError.lastdllerror & @CRLF & _
+	@TAB & "Err.scriptline is: " & @TAB & $oError.scriptline & @CRLF & _
+	@TAB & "Err.retcode is: " & @TAB & "0x" & Hex( $oError.retcode ) & @CRLF )
+EndFunc
+
+; Copied from "Hooking into the IDispatch interface" by monoceres
+; https://www.autoitscript.com/forum/index.php?showtopic=107678
+Func ReplaceVTableFuncPtr( $pVTable, $iOffset, $pNewFunc )
+	Local $pPointer = DllStructGetData( DllStructCreate( "ptr", $pVTable ), 1 ) + $iOffset, $PAGE_EXECUTE_READWRITE = 0x40
+	Local $pOldFunc = DllStructGetData( DllStructCreate( "ptr", $pPointer ), 1 ) ; Get the original function pointer in VTable
+	Local $aRet = DllCall( "Kernel32.dll", "int", "VirtualProtect", "ptr", $pPointer, "long", @AutoItX64 ? 8 : 4, "dword", $PAGE_EXECUTE_READWRITE, "dword*", 0 ) ; Unprotect memory
+	DllStructSetData( DllStructCreate( "ptr", $pPointer ), 1, $pNewFunc ) ; Replace function pointer in VTable with $pNewFunc function pointer
+	DllCall( "Kernel32.dll", "int", "VirtualProtect", "ptr", $pPointer, "long", @AutoItX64 ? 8 : 4, "dword", $aRet[4], "dword*", 0 ) ; Protect memory
+	Return $pOldFunc ; Return original function pointer
+EndFunc

+ 193 - 0
DotNet/Includes/DotNet.au3

@@ -0,0 +1,193 @@
+#include-once
+#include "Interfaces.au3"
+#include "AccVarsUtilities.au3"
+
+Func DotNet_Start( $sVersion = "" )
+	Static $pRuntimeHost = 0, $oRuntimeHost
+	If $pRuntimeHost Then Return $oRuntimeHost
+
+	If $sVersion = "" Then
+		Local $sPath = @WindowsDir & "\Microsoft.NET\Framework" & ( @AutoItX64 ? "64" : "" ) & "\"
+		Local $hSearch = FileFindFirstFile( $sPath & "v?.*" ), $sFolder
+		If $hSearch <> -1 Then
+			While 1
+				$sFolder = FileFindNextFile( $hSearch )
+				Local $iError = @error, $iExtended = @extended
+				If $iExtended = 1 And FileExists( $sPath & $sFolder & "\mscorlib.dll" ) And $sVersion < $sFolder Then $sVersion = $sFolder
+				If $iError Then ExitLoop
+			WEnd
+		EndIf
+	ElseIf Not FileExists( @WindowsDir & "\Microsoft.NET\Framework" & ( @AutoItX64 ? "64" : "" ) & "\" & $sVersion ) Then
+		Return SetError( 1,0,0 )
+	EndIf
+
+	Local Const $tagGUID = "struct; ulong Data1;ushort Data2;ushort Data3;byte Data4[8]; endstruct"
+
+	Local $tCLSID_CorRuntimeHost = DllStructCreate( $tagGUID )
+	GUIDFromStringEx( $sCLSID_CorRuntimeHost, $tCLSID_CorRuntimeHost )
+
+	Local $tIID_ICorRuntimeHost = DllStructCreate( $tagGUID )
+	GUIDFromStringEx( $sIID_ICorRuntimeHost, $tIID_ICorRuntimeHost )
+
+	Local $aRet = DllCall( "MSCorEE.dll", "long", "CorBindToRuntimeEx", "wstr", $sVersion, "ptr", NULL, "dword", 0, _
+	                       "struct*", $tCLSID_CorRuntimeHost, "struct*", $tIID_ICorRuntimeHost, "ptr*", 0 )
+	If Not ( @error = 0 And $aRet[0] = 0 And $aRet[6] ) Then Return SetError( 1,0,0 )
+
+	$pRuntimeHost = $aRet[6]
+	$oRuntimeHost = ObjCreateInterface( $pRuntimeHost, $sIID_ICorRuntimeHost, $sTag_ICorRuntimeHost )
+	Return $oRuntimeHost
+EndFunc
+
+Func DotNet_StartDomain( ByRef $oAppDomain, $sFriendlyName = "", $sBaseDirectory = "" )
+	Local $oDefDomain = DotNet_GetDefaultDomain()
+
+	Local $pType, $oType
+	$oDefDomain.GetType( $pType )
+	$oType = ObjCreateInterface( $pType, $sIID__Type, $sTag__Type )
+
+	Local $psaEmpty = SafeArrayCreateEmpty( $VT_VARIANT )
+	Local $aArguments[5], $pSafeArray
+	$aArguments[0] = $sFriendlyName
+	$aArguments[2] = $sBaseDirectory
+	$aArguments[4] = False
+	AccVars_ArrayToSafeArray( $aArguments, $pSafeArray )
+
+	$oType.InvokeMember_3( "CreateDomain", $BindingFlags_DefaultValue, $psaEmpty, $psaEmpty, $pSafeArray, $oAppDomain )
+EndFunc
+
+Func DotNet_StopDomain( ByRef $oAppDomain )
+	Local $oRuntimeHost = DotNet_Start()
+	$oRuntimeHost.UnloadDomain( Ptr( $oAppDomain ) )
+	$oAppDomain = 0
+EndFunc
+
+; Internal function
+Func DotNet_GetDefaultDomain()
+	Static $pDefDomain = 0, $oDefDomain
+	If $pDefDomain Then Return $oDefDomain
+
+	Local $oRuntimeHost = DotNet_Start()
+	$oRuntimeHost.Start()
+
+	$oRuntimeHost.GetDefaultDomain( $pDefDomain )
+	$oDefDomain = ObjCreateInterface( $pDefDomain, $sIID__AppDomain, $sTag__AppDomain )
+	Return $oDefDomain
+EndFunc
+
+Func DotNet_LoadAssembly( $sAssemblyName, $oAppDomain = 0 )
+	If Not $oAppDomain Then $oAppDomain = DotNet_GetDefaultDomain()
+
+	Local $pType, $oType
+	$oAppDomain.GetType( $pType )
+	$oType = ObjCreateInterface( $pType, $sIID__Type, $sTag__Type )
+
+	Local $pAssembly, $oAssembly
+	$oType.get_Assembly( $pAssembly )
+	$oAssembly = ObjCreateInterface( $pAssembly, $sIID__Assembly, $sTag__Assembly )
+
+	Local $pAssemblyType, $oAssemblyType
+	$oAssembly.GetType( $pAssemblyType )
+	$oAssemblyType = ObjCreateInterface( $pAssemblyType, $sIID__Type, $sTag__Type )
+
+	Local $aAssemblyName = [ $sAssemblyName ], $pSafeArray
+	AccVars_ArrayToSafeArray( $aAssemblyName, $pSafeArray )
+
+	Local $pNetCode
+	$oAssemblyType.InvokeMember_3( "LoadFrom", $BindingFlags_DefaultValue, 0, 0, $pSafeArray, $pNetCode )
+	; We first try to load the .NET assembly with the LoadFrom method
+
+	; If LoadFrom method fails, we try to load the .NET assembly using the LoadWithPartialName method
+	If Not Ptr( $pNetCode ) Then
+		Local $iPos = StringInStr( $sAssemblyName, ".", Default, -1 )
+		If StringRight( $sAssemblyName, StringLen( $sAssemblyName ) - $iPos ) = "dll" Then _ ; Use name of .NET assembly without DLL-
+			$sAssemblyName = StringLeft( $sAssemblyName, $iPos - 1 )                           ; extension in LoadWithPartialName method.
+		$aAssemblyName[0] = $sAssemblyName
+		AccVars_ArrayToSafeArray( $aAssemblyName, $pSafeArray )
+		$oAssemblyType.InvokeMember_3( "LoadWithPartialName", $BindingFlags_DefaultValue, 0, 0, $pSafeArray, $pNetCode )
+		; LoadWithPartialName searches for the .NET assembly in the path given by $sBaseDirectory in DotNet_StartDomain
+	EndIf
+
+	If Not Ptr( $pNetCode ) Then Return SetError( 2,0,0 )
+	Return ObjCreateInterface( $pNetCode, $sIID__Assembly, $sTag__Assembly )
+EndFunc
+
+Func DotNet_LoadCScode( $sCode, $sReferences = "", $oAppDomain = 0, $sFileName = "", $sCompilerOptions = "" )
+	Local $oNetCode = DotNet_LoadCode( $sCode, $sReferences, "System", "Microsoft.CSharp.CSharpCodeProvider", $oAppDomain, $sFileName, $sCompilerOptions )
+	If @error Then Return SetError( @error,0,0 )
+	Return $oNetCode
+EndFunc
+
+Func DotNet_LoadVBcode( $sCode, $sReferences = "", $oAppDomain = 0, $sFileName = "", $sCompilerOptions = "" )
+	Local $oNetCode = DotNet_LoadCode( $sCode, $sReferences, "System", "Microsoft.VisualBasic.VBCodeProvider", $oAppDomain, $sFileName, $sCompilerOptions )
+	If @error Then Return SetError( @error,0,0 )
+	Return $oNetCode
+EndFunc
+
+; Internal function
+Func DotNet_LoadCode( $sCode, $sReferences, $sProviderAssembly, $sProviderType, $oAppDomain = 0, $sFileName = "", $sCompilerOptions = "" )
+	If Not $oAppDomain Then $oAppDomain = DotNet_GetDefaultDomain()
+
+	Local $oAsmProvider, $oCodeProvider, $oCodeCompiler, $oAsmSystem, $oPrms
+	If IsObj( $oAppDomain ) Then $oAsmProvider = DotNet_LoadAssembly( $sProviderAssembly, $oAppDomain )
+	If IsObj( $oAsmProvider ) Then $oAsmProvider.CreateInstance( $sProviderType, $oCodeProvider )
+	If IsObj( $oCodeProvider ) Then $oCodeCompiler = $oCodeProvider.CreateCompiler()
+	If IsObj( $oCodeCompiler ) Then $oAsmSystem = $sProviderAssembly = "System" ? $oAsmProvider : DotNet_LoadAssembly( "System", $oAppDomain )
+	If Not IsObj( $oAsmSystem ) Then Return SetError( 3,0,0 )
+
+	Local $aReferences = StringSplit( StringStripWS( StringRegExpReplace( $sReferences, "\s*\|\s*", "|" ), 3 ), "|", 2 ) ; 3 = $STR_STRIPLEADING + $STR_STRIPTRAILING, 2 = $STR_NOCOUNT
+	Local $pSafeArray = AccVars_ArrayToSafeArrayOfVartype( $aReferences, $VT_BSTR )
+	Local $psaVariant = AccVars_SafeArrayToSafeArrayOfVariant( $pSafeArray )
+	Local $psaEmpty = SafeArrayCreateEmpty( $VT_VARIANT )
+
+	; Create $oPrms object
+	$oAsmSystem.CreateInstance_3( "System.CodeDom.Compiler.CompilerParameters", True, 0, 0, $psaVariant, 0, $psaEmpty, $oPrms )
+	If Not IsObj( $oPrms ) Then Return SetError( 4,0,0 )
+
+	; Set parameters for compiler
+	$oPrms.OutputAssembly = $sFileName
+	$oPrms.GenerateInMemory = ( $sFileName = "" )
+	$oPrms.GenerateExecutable = ( StringRight( $sFileName, 4 ) = ".exe" )
+	$oPrms.CompilerOptions = $sCompilerOptions
+	$oPrms.IncludeDebugInformation = True
+
+	; Compile code
+	Local $oCompilerRes = $oCodeCompiler.CompileAssemblyFromSource( $oPrms, $sCode )
+
+	; Compiler errors?
+	If $oCompilerRes.Errors.Count() Then
+		Local $b = False
+		For $err In $oCompilerRes.Errors
+			If $b Then ConsoleWrite( @CRLF )
+			ConsoleWrite( "Line: " & $err.Line & @CRLF & "Column: " & $err.Column & @CRLF & $err.ErrorNumber & ": " & $err.ErrorText & @CRLF )
+			$b = True
+		Next
+		Return SetError( 5,0,0 )
+	EndIf
+
+	If $sFileName Then
+		Return $oCompilerRes.PathToAssembly()
+	Else
+		Local $pNetCode = $oCompilerRes.CompiledAssembly()
+		Return ObjCreateInterface( $pNetCode, $sIID__Assembly, $sTag__Assembly )
+	EndIf
+EndFunc
+
+Func DotNet_CreateObject( ByRef $oNetCode, $sClassName, $v3 = Default, $v4 = Default, $v5 = Default, $v6 = Default, $v7 = Default, $v8 = Default, $v9 = Default )
+	Local $aParams = [ $v3, $v4, $v5, $v6, $v7, $v8, $v9 ], $oObject = 0
+
+	If @NumParams = 2 Then
+		$oNetCode.CreateInstance_2( $sClassName, True, $oObject )
+		Return $oObject
+	EndIf
+
+	Local $iArgs = @NumParams - 2, $aArgs[$iArgs], $pSafeArray
+	For $i = 0 To $iArgs - 1
+		$aArgs[$i] = $aParams[$i]
+	Next
+	AccVars_ArrayToSafeArray( $aArgs, $pSafeArray )
+
+	Local $psaEmpty = SafeArrayCreateEmpty( $VT_VARIANT )
+
+	$oNetCode.CreateInstance_3( $sClassName, True, 0, 0, $pSafeArray, 0, $psaEmpty, $oObject )
+	Return $oObject
+EndFunc

+ 1200 - 0
DotNet/Includes/DotNetAll.au3

@@ -0,0 +1,1200 @@
+#include-once
+
+; ####################################################################################################
+; ###                                                                                              ###
+; ###                                         Variant.au3                                          ###
+; ###                                                                                              ###
+; ####################################################################################################
+
+; >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+
+; Copied from AutoItObject.au3 by the AutoItObject-Team: monoceres, trancexx, Kip, ProgAndy
+; https://www.autoitscript.com/forum/index.php?showtopic=110379
+
+Global Const $tagVARIANT = "word vt;word r1;word r2;word r3;ptr data; ptr"
+; The structure takes up 16/24 bytes when running 32/64 bit
+; Space for the data element at the end represents 2 pointers
+; This is 8 bytes running 32 bit and 16 bytes running 64 bit
+
+Global Const $VT_EMPTY            = 0  ; 0x0000
+Global Const $VT_NULL             = 1  ; 0x0001
+Global Const $VT_I2               = 2  ; 0x0002
+Global Const $VT_I4               = 3  ; 0x0003
+Global Const $VT_R4               = 4  ; 0x0004
+Global Const $VT_R8               = 5  ; 0x0005
+Global Const $VT_CY               = 6  ; 0x0006
+Global Const $VT_DATE             = 7  ; 0x0007
+Global Const $VT_BSTR             = 8  ; 0x0008
+Global Const $VT_DISPATCH         = 9  ; 0x0009
+Global Const $VT_ERROR            = 10 ; 0x000A
+Global Const $VT_BOOL             = 11 ; 0x000B
+Global Const $VT_VARIANT          = 12 ; 0x000C
+Global Const $VT_UNKNOWN          = 13 ; 0x000D
+Global Const $VT_DECIMAL          = 14 ; 0x000E
+Global Const $VT_I1               = 16 ; 0x0010
+Global Const $VT_UI1              = 17 ; 0x0011
+Global Const $VT_UI2              = 18 ; 0x0012
+Global Const $VT_UI4              = 19 ; 0x0013
+Global Const $VT_I8               = 20 ; 0x0014
+Global Const $VT_UI8              = 21 ; 0x0015
+Global Const $VT_INT              = 22 ; 0x0016
+Global Const $VT_UINT             = 23 ; 0x0017
+Global Const $VT_VOID             = 24 ; 0x0018
+Global Const $VT_HRESULT          = 25 ; 0x0019
+Global Const $VT_PTR              = 26 ; 0x001A
+Global Const $VT_SAFEARRAY        = 27 ; 0x001B
+Global Const $VT_CARRAY           = 28 ; 0x001C
+Global Const $VT_USERDEFINED      = 29 ; 0x001D
+Global Const $VT_LPSTR            = 30 ; 0x001E
+Global Const $VT_LPWSTR           = 31 ; 0x001F
+Global Const $VT_RECORD           = 36 ; 0x0024
+Global Const $VT_INT_PTR          = 37 ; 0x0025
+Global Const $VT_UINT_PTR         = 38 ; 0x0026
+Global Const $VT_FILETIME         = 64 ; 0x0040
+Global Const $VT_BLOB             = 65 ; 0x0041
+Global Const $VT_STREAM           = 66 ; 0x0042
+Global Const $VT_STORAGE          = 67 ; 0x0043
+Global Const $VT_STREAMED_OBJECT  = 68 ; 0x0044
+Global Const $VT_STORED_OBJECT    = 69 ; 0x0045
+Global Const $VT_BLOB_OBJECT      = 70 ; 0x0046
+Global Const $VT_CF               = 71 ; 0x0047
+Global Const $VT_CLSID            = 72 ; 0x0048
+Global Const $VT_VERSIONED_STREAM = 73 ; 0x0049
+Global Const $VT_BSTR_BLOB        = 0xFFF
+Global Const $VT_VECTOR           = 0x1000
+Global Const $VT_ARRAY            = 0x2000
+Global Const $VT_BYREF            = 0x4000
+Global Const $VT_RESERVED         = 0x8000
+Global Const $VT_ILLEGAL          = 0xFFFF
+Global Const $VT_ILLEGALMASKED    = 0xFFF
+Global Const $VT_TYPEMASK         = 0xFFF
+
+; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
+
+
+;Global Const $tagVARIANT = "word vt;word r1;word r2;word r3;ptr data; ptr"
+; The structure takes up 16/24 bytes when running 32/64 bit
+; Space for the data element at the end represents 2 pointers
+; This is 8 bytes running 32 bit and 16 bytes running 64 bit
+
+#cs
+DECIMAL structure
+https://msdn.microsoft.com/en-us/library/windows/desktop/ms221061(v=vs.85).aspx
+
+From oledb.h:
+typedef struct tagDEC {
+    USHORT wReserved;			; vt,     2 bytes
+    union {								; r1,     2 bytes
+        struct {
+            BYTE scale;
+            BYTE sign;
+        };
+        USHORT signscale;
+    };
+    ULONG Hi32;						; r2, r3, 4 bytes
+    union {								; data,   8 bytes
+        struct {
+#ifdef _MAC
+            ULONG Mid32;
+            ULONG Lo32;
+#else
+            ULONG Lo32;
+            ULONG Mid32;
+#endif
+        };
+        ULONGLONG Lo64;
+    };
+} DECIMAL;
+#ce
+
+Global Const $tagDEC = "word wReserved;byte scale;byte sign;uint Hi32;uint Lo32;uint Mid32"
+
+
+; >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+
+; Variant functions
+; Copied from AutoItObject.au3 by the AutoItObject-Team: monoceres, trancexx, Kip, ProgAndy
+; https://www.autoitscript.com/forum/index.php?showtopic=110379
+
+; #FUNCTION# ====================================================================================================================
+; Name...........: VariantClear
+; Description ...: Clears the value of a variant
+; Syntax.........: VariantClear($pvarg)
+; Parameters ....: $pvarg       - the VARIANT to clear
+; Return values .: Success      - 0
+;                  Failure      - nonzero
+; Author ........: Prog@ndy
+; Modified.......:
+; Remarks .......:
+; Related .......: VariantFree
+; Link ..........: http://msdn.microsoft.com/en-us/library/ms221165.aspx
+; Example .......:
+; ===============================================================================================================================
+Func VariantClear($pvarg)
+	; Author: Prog@ndy
+	Local $aCall = DllCall("OleAut32.dll", "long", "VariantClear", "ptr", $pvarg)
+	If @error Then Return SetError(1, 0, 1)
+	Return $aCall[0]
+EndFunc
+
+; #FUNCTION# ====================================================================================================================
+; Name...........: VariantCopy
+; Description ...: Copies a VARIANT to another
+; Syntax.........: VariantCopy($pvargDest, $pvargSrc)
+; Parameters ....: $pvargDest   - Destionation variant
+;                  $pvargSrc    - Source variant
+; Return values .: Success      - 0
+;                  Failure      - nonzero
+; Author ........: Prog@ndy
+; Modified.......:
+; Remarks .......:
+; Related .......: VariantRead
+; Link ..........: http://msdn.microsoft.com/en-us/library/ms221697.aspx
+; Example .......:
+; ===============================================================================================================================
+Func VariantCopy($pvargDest, $pvargSrc)
+	; Author: Prog@ndy
+	Local $aCall = DllCall("OleAut32.dll", "long", "VariantCopy", "ptr", $pvargDest, 'ptr', $pvargSrc)
+	If @error Then Return SetError(1, 0, 1)
+	Return $aCall[0]
+EndFunc
+
+; #FUNCTION# ====================================================================================================================
+; Name...........: VariantInit
+; Description ...: Initializes a variant.
+; Syntax.........: VariantInit($pvarg)
+; Parameters ....: $pvarg       - the VARIANT to initialize
+; Return values .: Success      - 0
+;                  Failure      - nonzero
+; Author ........: Prog@ndy
+; Modified.......:
+; Remarks .......:
+; Related .......: VariantClear
+; Link ..........: http://msdn.microsoft.com/en-us/library/ms221402.aspx
+; Example .......:
+; ===============================================================================================================================
+Func VariantInit($pvarg)
+	; Author: Prog@ndy
+	Local $aCall = DllCall("OleAut32.dll", "long", "VariantInit", "ptr", $pvarg)
+	If @error Then Return SetError(1, 0, 1)
+	Return $aCall[0]
+EndFunc
+
+; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
+
+
+Func VariantChangeType( $pVarDest, $pVarSrc, $wFlags, $vt )
+	Local $aRet = DllCall( "OleAut32.dll", "long", "VariantChangeType", "ptr", $pVarDest, "ptr", $pVarSrc, "word", $wFlags, "word", $vt )
+	If @error Then Return SetError(1,0,1)
+	Return $aRet[0]
+EndFunc
+
+Func VariantChangeTypeEx( $pVarDest, $pVarSrc, $lcid, $wFlags, $vt )
+	Local $aRet = DllCall( "OleAut32.dll", "long", "VariantChangeTypeEx", "ptr", $pVarDest, "ptr", $pVarSrc, "word", $lcid, "word", $wFlags, "word", $vt )
+	If @error Then Return SetError(1,0,1)
+	Return $aRet[0]
+EndFunc
+
+Func VarAdd( $pVarLeft, $pVarRight, $pVarResult )
+	Local $aRet = DllCall( "OleAut32.dll", "long", "VarAdd", "ptr", $pVarLeft, "ptr", $pVarRight, "ptr", $pVarResult )
+	If @error Then Return SetError(1,0,1)
+	Return $aRet[0]
+EndFunc
+
+Func VarSub( $pVarLeft, $pVarRight, $pVarResult )
+	Local $aRet = DllCall( "OleAut32.dll", "long", "VarSub", "ptr", $pVarLeft, "ptr", $pVarRight, "ptr", $pVarResult )
+	If @error Then Return SetError(1,0,1)
+	Return $aRet[0]
+EndFunc
+
+
+; >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+
+; BSTR (basic string) functions
+; Copied from AutoItObject.au3 by the AutoItObject-Team: monoceres, trancexx, Kip, ProgAndy
+; https://www.autoitscript.com/forum/index.php?showtopic=110379
+
+Func SysAllocString( $str )
+	Local $aRet = DllCall( "OleAut32.dll", "ptr", "SysAllocString", "wstr", $str )
+	If @error Then Return SetError(1, 0, 0)
+	Return $aRet[0]
+EndFunc
+
+Func SysFreeString( $pBSTR )
+	If Not $pBSTR Then Return SetError(1, 0, 0)
+	DllCall( "OleAut32.dll", "none", "SysFreeString", "ptr", $pBSTR )
+	If @error Then Return SetError(2, 0, 0)
+EndFunc
+
+Func SysReadString( $pBSTR, $iLen = -1 )
+	If Not $pBSTR Then Return SetError(1, 0, "")
+	If $iLen < 1 Then $iLen = SysStringLen( $pBSTR )
+	If $iLen < 1 Then Return SetError(2, 0, "")
+	Return DllStructGetData( DllStructCreate( "wchar[" & $iLen & "]", $pBSTR ), 1 )
+EndFunc
+
+Func SysStringLen( $pBSTR )
+	If Not $pBSTR Then Return SetError(1, 0, 0)
+	Local $aRet = DllCall( "OleAut32.dll", "uint", "SysStringLen", "ptr", $pBSTR )
+	If @error Then Return SetError(2, 0, 0)
+	Return $aRet[0]
+EndFunc
+
+
+; ####################################################################################################
+; ###                                                                                              ###
+; ###                                        SafeArray.au3                                         ###
+; ###                                                                                              ###
+; ####################################################################################################
+
+; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
+
+Global Const $tagSAFEARRAYBOUND = _
+	"ulong  cElements;"  & _ ; The number of elements in the dimension.
+	"long   lLbound;"        ; The lower bound of the dimension.
+
+Global Const $tagSAFEARRAY = _
+	"ushort cDims;"      & _ ; The number of dimensions.
+	"ushort fFeatures;"  & _ ; Flags, see below.
+	"ulong  cbElements;" & _ ; The size of an array element.
+	"ulong  cLocks;"     & _ ; The number of times the array has been locked without a corresponding unlock.
+	"ptr    pvData;"     & _ ; The data.
+	$tagSAFEARRAYBOUND       ; One $tagSAFEARRAYBOUND for each dimension.
+
+; fFeatures flags
+Global Const $FADF_AUTO        = 0x0001 ; An array that is allocated on the stack.
+Global Const $FADF_STATIC      = 0x0002 ; An array that is statically allocated.
+Global Const $FADF_EMBEDDED    = 0x0004 ; An array that is embedded in a structure.
+Global Const $FADF_FIXEDSIZE   = 0x0010 ; An array that may not be resized or reallocated.
+Global Const $FADF_RECORD      = 0x0020 ; An array that contains records. When set, there will be a pointer to the IRecordInfo interface at negative offset 4 in the array descriptor.
+Global Const $FADF_HAVEIID     = 0x0040 ; An array that has an IID identifying interface. When set, there will be a GUID at negative offset 16 in the safearray descriptor. Flag is set only when FADF_DISPATCH or FADF_UNKNOWN is also set.
+Global Const $FADF_HAVEVARTYPE = 0x0080 ; An array that has a variant type. The variant type can be retrieved with SafeArrayGetVartype.
+Global Const $FADF_BSTR        = 0x0100 ; An array of BSTRs.
+Global Const $FADF_UNKNOWN     = 0x0200 ; An array of IUnknown*.
+Global Const $FADF_DISPATCH    = 0x0400 ; An array of IDispatch*.
+Global Const $FADF_VARIANT     = 0x0800 ; An array of VARIANTs.
+Global Const $FADF_RESERVED    = 0xF008 ; Bits reserved for future use.
+
+
+
+; >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+
+; Safearray functions
+; Copied from AutoItObject.au3 by the AutoItObject-Team: monoceres, trancexx, Kip, ProgAndy
+; https://www.autoitscript.com/forum/index.php?showtopic=110379
+
+Func SafeArrayCreate($vType, $cDims, $rgsabound)
+	; Author: Prog@ndy
+	Local $aCall = DllCall("OleAut32.dll", "ptr", "SafeArrayCreate", "dword", $vType, "uint", $cDims, 'struct*', $rgsabound)
+	If @error Then Return SetError(1, 0, 0)
+	Return $aCall[0]
+EndFunc
+
+Func SafeArrayDestroy($pSafeArray)
+	; Author: Prog@ndy
+	Local $aCall = DllCall("OleAut32.dll", "int", "SafeArrayDestroy", "ptr", $pSafeArray)
+	If @error Then Return SetError(1, 0, 1)
+	Return $aCall[0]
+EndFunc
+
+Func SafeArrayAccessData($pSafeArray, ByRef $pArrayData)
+	; Author: Prog@ndy
+	Local $aCall = DllCall("OleAut32.dll", "int", "SafeArrayAccessData", "ptr", $pSafeArray, 'ptr*', 0)
+	If @error Then Return SetError(1, 0, 1)
+	$pArrayData = $aCall[2]
+	Return $aCall[0]
+EndFunc
+
+Func SafeArrayUnaccessData($pSafeArray)
+	; Author: Prog@ndy
+	Local $aCall = DllCall("OleAut32.dll", "int", "SafeArrayUnaccessData", "ptr", $pSafeArray)
+	If @error Then Return SetError(1, 0, 1)
+	Return $aCall[0]
+EndFunc
+
+Func SafeArrayGetUBound($pSafeArray, $iDim, ByRef $iBound)
+	; Author: Prog@ndy
+	Local $aCall = DllCall("OleAut32.dll", "int", "SafeArrayGetUBound", "ptr", $pSafeArray, 'uint', $iDim, 'long*', 0)
+	If @error Then Return SetError(1, 0, 1)
+	$iBound = $aCall[3]
+	Return $aCall[0]
+EndFunc
+
+Func SafeArrayGetLBound($pSafeArray, $iDim, ByRef $iBound)
+	; Author: Prog@ndy
+	Local $aCall = DllCall("OleAut32.dll", "int", "SafeArrayGetLBound", "ptr", $pSafeArray, 'uint', $iDim, 'long*', 0)
+	If @error Then Return SetError(1, 0, 1)
+	$iBound = $aCall[3]
+	Return $aCall[0]
+EndFunc
+
+Func SafeArrayGetDim($pSafeArray)
+	Local $aResult = DllCall("OleAut32.dll", "uint", "SafeArrayGetDim", "ptr", $pSafeArray)
+	If @error Then Return SetError(1, 0, 0)
+	Return $aResult[0]
+EndFunc
+
+; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
+
+
+
+Func SafeArrayCopy( $pSafeArrayIn, ByRef $pSafeArrayOut )
+	Local $aRet = DllCall( "OleAut32.dll", "int", "SafeArrayCopy", "ptr", $pSafeArrayIn, "ptr*", 0 )
+	If @error Then Return SetError(1,0,1)
+	$pSafeArrayOut = $aRet[2]
+	Return $aRet[0]
+EndFunc
+
+Func SafeArrayCreateEmpty( $vType )
+	Local $tsaBound = DllStructCreate( $tagSAFEARRAYBOUND )
+	DllStructSetData( $tsaBound, "cElements", 0 )
+	DllStructSetData( $tsaBound, "lLbound", 0 )
+	Return SafeArrayCreate( $vType, 0, $tsaBound )
+EndFunc
+
+Func SafeArrayDestroyData( $pSafeArray )
+	Local $aRet = DllCall( "OleAut32.dll", "int", "SafeArrayDestroyData", "ptr", $pSafeArray )
+	If @error Then Return SetError(1,0,1)
+	Return $aRet[0]
+EndFunc
+
+Func SafeArrayGetVartype( $pSafeArray, ByRef $vt )
+	Local $aRet = DllCall( "OleAut32.dll", "int", "SafeArrayGetVartype", "ptr", $pSafeArray, "ptr*", 0 )
+	If @error Then Return SetError(1,0,1)
+	$vt = $aRet[2]
+	Return $aRet[0]
+EndFunc
+
+
+; ####################################################################################################
+; ###                                                                                              ###
+; ###                                         COMUtils.au3                                         ###
+; ###                                                                                              ###
+; ####################################################################################################
+
+Func CoCreateInstance( $rclsid, $pUnkOuter, $ClsContext, $riid, ByRef $ppv )
+	Local $aRet = DllCall( "ole32.dll", "long", "CoCreateInstance", "struct*", $rclsid, "ptr", $pUnkOuter, "dword", $ClsContext, "struct*", $riid, "ptr*", 0 )
+	If @error Then Return SetError(1,0,1)
+	$ppv = $aRet[5]
+	Return $aRet[0]
+EndFunc
+
+; Add these lines to a script to activate the error handler:
+;Local $oComErrFunc = ObjEvent( "AutoIt.Error", "ComErrFunc" )
+;#forceref $oComErrFunc
+Func ComErrFunc( $oError )
+ConsoleWrite( @ScriptName & "(" & $oError.scriptline & "): ==> COM Error intercepted!" & @CRLF & _
+	@TAB & "Err.number is: " & @TAB & @TAB & "0x" & Hex( $oError.number ) & @CRLF & _
+	@TAB & "Err.windescription:" & @TAB & $oError.windescription & _
+	@TAB & "Err.description is: " & @TAB & $oError.description & @CRLF & _
+	@TAB & "Err.source is: " & @TAB & @TAB & $oError.source & @CRLF & _
+	@TAB & "Err.helpfile is: " & @TAB & $oError.helpfile & @CRLF & _
+	@TAB & "Err.helpcontext is: " & @TAB & $oError.helpcontext & @CRLF & _
+	@TAB & "Err.lastdllerror is: " & @TAB & $oError.lastdllerror & @CRLF & _
+	@TAB & "Err.scriptline is: " & @TAB & $oError.scriptline & @CRLF & _
+	@TAB & "Err.retcode is: " & @TAB & "0x" & Hex( $oError.retcode ) & @CRLF )
+EndFunc
+
+; Copied from "Hooking into the IDispatch interface" by monoceres
+; https://www.autoitscript.com/forum/index.php?showtopic=107678
+Func ReplaceVTableFuncPtr( $pVTable, $iOffset, $pNewFunc )
+	Local $pPointer = DllStructGetData( DllStructCreate( "ptr", $pVTable ), 1 ) + $iOffset, $PAGE_EXECUTE_READWRITE = 0x40
+	Local $pOldFunc = DllStructGetData( DllStructCreate( "ptr", $pPointer ), 1 ) ; Get the original function pointer in VTable
+	Local $aRet = DllCall( "Kernel32.dll", "int", "VirtualProtect", "ptr", $pPointer, "long", @AutoItX64 ? 8 : 4, "dword", $PAGE_EXECUTE_READWRITE, "dword*", 0 ) ; Unprotect memory
+	DllStructSetData( DllStructCreate( "ptr", $pPointer ), 1, $pNewFunc ) ; Replace function pointer in VTable with $pNewFunc function pointer
+	DllCall( "Kernel32.dll", "int", "VirtualProtect", "ptr", $pPointer, "long", @AutoItX64 ? 8 : 4, "dword", $aRet[4], "dword*", 0 ) ; Protect memory
+	Return $pOldFunc ; Return original function pointer
+EndFunc
+
+
+; ####################################################################################################
+; ###                                                                                              ###
+; ###                                    AccessingVariables.au3                                    ###
+; ###                                                                                              ###
+; ####################################################################################################
+
+Global $oAccVars_Object = AccVars_Init(), $hAccVars_MethodFunc
+
+
+; --- The first part of the UDF creates $oAccVars_Object and implements method functions ---
+
+Func AccVars_Init()
+	; Three locals copied from "IUIAutomation MS framework automate chrome, FF, IE, ...." by junkew
+	; https://www.autoitscript.com/forum/index.php?showtopic=153520
+	Local $sCLSID_CUIAutomation = "{FF48DBA4-60EF-4201-AA87-54103EEF594E}"
+	Local $sIID_IUIAutomation = "{30CBE57D-D9D0-452A-AB13-7AC5AC4825EE}"
+	Local $stag_IUIAutomation = _
+		"AccVars_VariableToVariant01 hresult(variant*);" & _
+		"AccVars_VariableToVariant02 hresult(variant*;variant*);"
+
+	; Create AccVars object (Automation object)
+  Local $oAccVars_Object = ObjCreateInterface( $sCLSID_CUIAutomation, $sIID_IUIAutomation, $stag_IUIAutomation )
+  If Not IsObj( $oAccVars_Object ) Then Return SetError(1,0,1)
+
+	; Replace original methods with AccVars_VariableToVariantXY methods
+	Local $pVariableToVariant, $pAccessVariable = Ptr( $oAccVars_Object() ), $sFuncName, $sFuncParams = "ptr", $iOffset, $iPtrSize = @AutoItX64 ? 8 : 4
+	For $i = 1 To 2
+		$sFuncName = "AccVars_VariableToVariant" & StringFormat( "%02i", $i )
+		$sFuncParams &= ";ptr*"
+		$iOffset = ( 3 + $i - 1 ) * $iPtrSize
+		$pVariableToVariant = DllCallbackGetPtr( DllCallbackRegister( $sFuncName, "long", $sFuncParams ) )
+		ReplaceVTableFuncPtr( $pAccessVariable, $iOffset, $pVariableToVariant )
+	Next
+
+	Return $oAccVars_Object
+EndFunc
+
+Func AccVars_VariableToVariant01( $pSelf, $pVariant01 )
+	$hAccVars_MethodFunc( $pVariant01 )
+	Return 0 ; $S_OK (COM constant)
+	#forceref $pSelf
+EndFunc
+
+Func AccVars_VariableToVariant02( $pSelf, $pVariant01, $pVariant02 )
+	$hAccVars_MethodFunc( $pVariant01, $pVariant02 )
+	Return 0 ; $S_OK (COM constant)
+	#forceref $pSelf
+EndFunc
+
+
+; --- The last part of the UDF creates a set of easy to use functions to call the object methods ---
+
+Func AccessVariables01( $hAccVars_Method, ByRef $vVariable01 )
+	$hAccVars_MethodFunc = $hAccVars_Method
+	$oAccVars_Object.AccVars_VariableToVariant01( $vVariable01 )
+EndFunc
+
+Func AccessVariables02( $hAccVars_Method, ByRef $vVariable01, ByRef $vVariable02 )
+	$hAccVars_MethodFunc = $hAccVars_Method
+	$oAccVars_Object.AccVars_VariableToVariant02( $vVariable01, $vVariable02 )
+EndFunc
+
+
+; ####################################################################################################
+; ###                                                                                              ###
+; ###                                     AccVarsUtilities.au3                                     ###
+; ###                                                                                              ###
+; ####################################################################################################
+
+; --- AccVars_ArrayToSafeArray ---
+
+; The AutoIt array and the safearray are arrays of variants
+Func AccVars_ArrayToSafeArray( ByRef $aArray, ByRef $pSafeArray )
+	AccessVariables01( AccVars_ArrayToSafeArrayConvert, $aArray )
+	AccVars_ArrayToSafeArrayData( $pSafeArray )
+EndFunc
+
+Func AccVars_ArrayToSafeArrayConvert( $pArray )
+	; <<<< On function entry the native AutoIt array is converted to a safearray contained in a variant >>>>
+
+	; Get safearray pointer
+	Local $pSafeArrayFromArray = DllStructGetData( DllStructCreate( "ptr", $pArray + 8 ), 1 )
+
+	Local $pSafeArray
+	SafeArrayCopy( $pSafeArrayFromArray, $pSafeArray )
+	If @error Then Return SetError(1,0,0)
+
+	AccVars_ArrayToSafeArrayData( $pSafeArray, 1 )
+EndFunc
+
+Func AccVars_ArrayToSafeArrayData( ByRef $pSafeArray, $bSet = 0 )
+	Static $pStaticSafeArray
+	If $bSet Then
+		$pStaticSafeArray = $pSafeArray
+	Else
+		$pSafeArray = $pStaticSafeArray
+	EndIf
+EndFunc
+
+
+; --- AccVars_SafeArrayToArray ---
+
+; The safearray and the AutoIt array are arrays of variants
+Func AccVars_SafeArrayToArray( ByRef $pSafeArray, ByRef $aArray )
+	AccessVariables02( AccVars_SafeArrayToArrayConvert, $pSafeArray, $aArray )
+EndFunc
+
+Func AccVars_SafeArrayToArrayConvert( $pvSafeArray, $pArray )
+
+	; --- Get safearray information ---
+
+	; $pvSafeArray is a variant that contains a pointer
+	Local $pSafeArray = DllStructGetData( DllStructCreate( "ptr", $pvSafeArray + 8 ), 1 )
+
+	; Array type
+	Local $iVarType
+	SafeArrayGetVartype( $pSafeArray, $iVarType )
+	Switch $iVarType
+		Case $VT_I2, $VT_I4   ; Signed integers
+		Case $VT_R4, $VT_R8   ; 4/8 bytes floats
+		Case $VT_BSTR         ; Basic string
+		Case $VT_BOOL         ; Boolean type
+		Case $VT_UI4, $VT_UI8 ; 4/8 bytes unsigned integers
+		Case $VT_VARIANT      ; Variant data type
+		Case $VT_UNKNOWN      ; IUnknown pointer
+			; $pSafeArray is not compatible with a native AutoIt array
+			; Convert $pSafeArray to a compatible safearray in $pSafeArray2
+			Local $tSafeArray = DllStructCreate( $tagSAFEARRAY, $pSafeArray )
+			Local $tSafeArrayBound = DllStructCreate( $tagSAFEARRAYBOUND )
+			Local $iElements = DllStructGetData( $tSafeArray, "cElements" )
+			DllStructSetData( $tSafeArrayBound, "cElements", $iElements )
+			DllStructSetData( $tSafeArrayBound, "lLbound", DllStructGetData( $tSafeArray, "lLbound" ) )
+			Local $pSafeArray2 = SafeArrayCreate( $VT_VARIANT, 1, $tSafeArrayBound ), $pArrayData, $pArrayData2
+			SafeArrayAccessData( $pSafeArray2, $pArrayData2 )
+			SafeArrayAccessData( $pSafeArray, $pArrayData )
+			$iVarType = @AutoItX64 ? $VT_UI8 : $VT_UI4
+			Local $iVarSize = @AutoItX64 ? 24 : 16
+			Local $iPtrSize = @AutoItX64 ? 8 : 4
+			For $i = 0 To $iElements - 1 ; Set variant type and data
+				DllStructSetData( DllStructCreate( "word", $pArrayData2 + $i * $iVarSize ), 1, $iVarType )
+				DllStructSetData( DllStructCreate( "uint_ptr", 8 + $pArrayData2 + $i * $iVarSize ), 1, DllStructGetData( DllStructCreate( "ptr", $pArrayData + $i * $iPtrSize ), 1 ) )
+			Next
+			SafeArrayUnaccessData( $pSafeArray )
+			SafeArrayUnaccessData( $pSafeArray2 )
+			SafeArrayCopy( $pSafeArray2, $pSafeArray )
+			SafeArrayDestroy( $pSafeArray2 )
+		Case Else
+			Return SetError(1,0,0)
+	EndSwitch
+
+	; --- Set $pArray to match an array ---
+
+	; Set vt element to $VT_ARRAY + $iVarType
+	DllStructSetData( DllStructCreate( "word", $pArray ), 1, $VT_ARRAY + $iVarType )
+
+	; Set data element to safearray pointer
+	DllStructSetData( DllStructCreate( "ptr", $pArray + 8 ), 1, $pSafeArray )
+
+	; <<<< On function exit the safearray contained in a variant is converted to a native AutoIt array >>>>
+EndFunc
+
+
+; --- AccVars_ArrayToSafeArrayOfVartype ---
+
+; The returned safearray is an array of the specified variant type
+Func AccVars_ArrayToSafeArrayOfVartype( ByRef $aArray, $iVartype )
+	Local $tsaBound = DllStructCreate( $tagSAFEARRAYBOUND ), $pSafeArray, $pSafeArrayData, $iArray = UBound( $aArray ), $iPtrSize = @AutoItX64 ? 8 : 4
+	DllStructSetData( $tsaBound, "cElements", $iArray )
+	DllStructSetData( $tsaBound, "lLbound", 0 )
+	$pSafeArray = SafeArrayCreate( $iVartype, 1, $tsaBound )
+	SafeArrayAccessData( $pSafeArray, $pSafeArrayData )
+	For $i = 0 To $iArray - 1
+		DllStructSetData( DllStructCreate( "ptr", $pSafeArrayData + $iPtrSize * $i ), 1, SysAllocString( $aArray[$i] ) )
+	Next
+	SafeArrayUnaccessData( $pSafeArray )
+	Return $pSafeArray
+EndFunc
+
+
+; --- AccVars_SafeArrayToSafeArrayOfVariant ---
+
+; Returns a safearray with one variant element
+; The variant element contains the input safearray
+Func AccVars_SafeArrayToSafeArrayOfVariant( ByRef $pSafeArrayIn )
+	Local $iVartype, $tsaBound = DllStructCreate( $tagSAFEARRAYBOUND ), $pSafeArrayOut, $pSafeArrayOutData
+	SafeArrayGetVartype( $pSafeArrayIn, $iVartype )
+	DllStructSetData( $tsaBound, "cElements", 1 )
+	DllStructSetData( $tsaBound, "lLbound", 0 )
+	$pSafeArrayOut = SafeArrayCreate( $VT_VARIANT, 1, $tsaBound )
+	SafeArrayAccessData( $pSafeArrayOut, $pSafeArrayOutData )
+	DllStructSetData( DllStructCreate( "word", $pSafeArrayOutData ), 1, $iVartype + $VT_ARRAY )
+	DllStructSetData( DllStructCreate( "ptr", $pSafeArrayOutData + 8 ), 1, $pSafeArrayIn )
+	SafeArrayUnaccessData( $pSafeArrayOut )
+	Return $pSafeArrayOut
+EndFunc
+
+
+; --- AccVars_VariantToVariable ---
+
+Func AccVars_VariantToVariable( ByRef $pVariant )
+	Switch DllStructGetData( DllStructCreate( "word", $pVariant ), 1 )
+		Case $VT_I4, $VT_I8 ; 4/8 bytes signed integer
+			Return DllStructGetData( DllStructCreate( "int", $pVariant + 8 ), 1 )
+		Case $VT_R8 ; 8 bytes double
+			Return DllStructGetData( DllStructCreate( "double", $pVariant + 8 ), 1 )
+		Case $VT_BSTR ; Basic string
+			Return SysReadString( DllStructGetData( DllStructCreate( "ptr", $pVariant + 8 ), 1 ) )
+		Case $VT_BOOL ; 2 bytes boolean
+			Return DllStructGetData( DllStructCreate( "short", $pVariant + 8 ), 1 )
+		Case $VT_UI4, $VT_UI8 ; 4/8 bytes unsigned integer
+			Return DllStructGetData( DllStructCreate( "ptr", $pVariant + 8 ), 1 )
+		Case Else
+			Return SetError(1,0,0)
+	EndSwitch
+EndFunc
+
+
+; --- AccVars_VariableToVariant ---
+
+Func AccVars_VariableToVariant( $vVariable, ByRef $pVariant )
+	Switch VarGetType( $vVariable )
+		Case "Bool"
+			DllStructSetData( DllStructCreate( "word", $pVariant ), 1, $VT_BOOL )
+			DllStructSetData( DllStructCreate( "short", $pVariant + 8 ), 1, $vVariable )
+		Case "Double"
+			DllStructSetData( DllStructCreate( "word", $pVariant ), 1, $VT_R8 )
+			DllStructSetData( DllStructCreate( "double", $pVariant + 8 ), 1, $vVariable )
+		Case "Int32"
+			DllStructSetData( DllStructCreate( "word", $pVariant ), 1, $VT_I4 )
+			DllStructSetData( DllStructCreate( "int", $pVariant + 8 ), 1, $vVariable )
+		Case "Ptr"
+			DllStructSetData( DllStructCreate( "word", $pVariant ), 1, @AutoItX64 ? $VT_UI8 : $VT_UI4 )
+			DllStructSetData( DllStructCreate( "ptr", $pVariant + 8 ), 1, $vVariable )
+		Case "String"
+			DllStructSetData( DllStructCreate( "word", $pVariant ), 1, $VT_BSTR )
+			DllStructSetData( DllStructCreate( "ptr", $pVariant + 8 ), 1, SysAllocString( $vVariable ) )
+		Case Else
+			Return SetError(1,0,0)
+	EndSwitch
+EndFunc
+
+
+; ####################################################################################################
+; ###                                                                                              ###
+; ###                                        Interfaces.au3                                        ###
+; ###                                                                                              ###
+; ####################################################################################################
+
+Global Const $sCLSID_CorRuntimeHost = "{CB2F6723-AB3A-11D2-9C40-00C04FA30A3E}"
+Global Const $tCLSID_CorRuntimeHost = CLSIDFromString( $sCLSID_CorRuntimeHost )
+Global Const $sIID_ICorRuntimeHost = "{CB2F6722-AB3A-11D2-9C40-00C04FA30A3E}"
+Global Const $tIID_ICorRuntimeHost = CLSIDFromString( $sIID_ICorRuntimeHost )
+Global Const $sTag_ICorRuntimeHost = _
+	"CreateLogicalThreadState hresult();" & _
+	"DeleteLogicalThreadState hresult();" & _
+	"SwitchInLogicalThreadState hresult();" & _
+	"SwitchOutLogicalThreadState hresult();" & _
+	"LocksHeldByLogicalThread hresult();" & _
+	"MapFile hresult();" & _
+	"GetConfiguration hresult();" & _
+	"Start hresult();" & _
+	"Stop hresult();" & _
+	"CreateDomain hresult();" & _
+	"GetDefaultDomain hresult(ptr*);" & _
+	"EnumDomains hresult(ptr*);" & _
+	"NextDomain hresult(ptr;ptr*);" & _
+	"CloseEnum hresult();" & _
+	"CreateDomainEx hresult();" & _
+	"CreateDomainSetup hresult();" & _
+	"CreateEvidence hresult();" & _
+	"UnloadDomain hresult(ptr);" & _
+	"CurrentDomain hresult();"
+
+Global Const $sIID_IDispatch = "{00020400-0000-0000-C000-000000000046}"
+Global Const $sTag_IDispatch = _
+	"GetTypeInfoCount hresult(dword*);" & _
+	"GetTypeInfo hresult(dword;dword;ptr*);" & _
+	"GetIDsOfNames hresult(ptr;ptr;dword;dword;ptr);" & _
+	"Invoke hresult(dword;ptr;dword;word;ptr;ptr;ptr;ptr);"
+
+; The interfaces _AppDomain, _Type and _Assembly below that starts with
+; an underscore are the interfaces that can be used from unmanaged code.
+
+Global Const $sIID__AppDomain = "{05F696DC-2B29-3663-AD8B-C4389CF2A713}"
+Global Const $sTag__AppDomain = _
+	$sTag_IDispatch & _
+	"get_ToString hresult();" & _
+	"Equals hresult();" & _
+	"GetHashCode hresult();" & _
+	"GetType hresult(ptr*);" & _
+	"InitializeLifetimeService hresult();" & _
+	"GetLifetimeService hresult();" & _
+	"get_Evidence hresult();" & _
+	"add_DomainUnload hresult();" & _
+	"remove_DomainUnload hresult();" & _
+	"add_AssemblyLoad hresult();" & _
+	"remove_AssemblyLoad hresult();" & _
+	"add_ProcessExit hresult();" & _
+	"remove_ProcessExit hresult();" & _
+	"add_TypeResolve hresult();" & _
+	"remove_TypeResolve hresult();" & _
+	"add_ResourceResolve hresult();" & _
+	"remove_ResourceResolve hresult();" & _
+	"add_AssemblyResolve hresult();" & _
+	"remove_AssemblyResolve hresult();" & _
+	"add_UnhandledException hresult();" & _
+	"remove_UnhandledException hresult();" & _
+	"DefineDynamicAssembly hresult();" & _
+	"DefineDynamicAssembly_2 hresult();" & _
+	"DefineDynamicAssembly_3 hresult();" & _
+	"DefineDynamicAssembly_4 hresult();" & _
+	"DefineDynamicAssembly_5 hresult();" & _
+	"DefineDynamicAssembly_6 hresult();" & _
+	"DefineDynamicAssembly_7 hresult();" & _
+	"DefineDynamicAssembly_8 hresult();" & _
+	"DefineDynamicAssembly_9 hresult();" & _
+	"CreateInstance hresult(bstr;bstr;object*);" & _
+	"CreateInstanceFrom hresult();" & _
+	"CreateInstance_2 hresult();" & _
+	"CreateInstanceFrom_2 hresult();" & _
+	"CreateInstance_3 hresult(bstr;bstr;bool;int;ptr;ptr;ptr;ptr;ptr;ptr*);" & _
+	"CreateInstanceFrom_3 hresult();" & _
+	"Load hresult();" & _
+	"Load_2 hresult();" & _
+	"Load_3 hresult();" & _
+	"Load_4 hresult();" & _
+	"Load_5 hresult();" & _
+	"Load_6 hresult();" & _
+	"Load_7 hresult();" & _
+	"ExecuteAssembly hresult();" & _
+	"ExecuteAssembly_2 hresult();" & _
+	"ExecuteAssembly_3 hresult();" & _
+	"get_FriendlyName hresult(bstr*);" & _
+	"get_BaseDirectory hresult(bstr*);" & _
+	"get_RelativeSearchPath hresult();" & _
+	"get_ShadowCopyFiles hresult();" & _
+	"GetAssemblies hresult(ptr*);" & _
+	"AppendPrivatePath hresult();" & _
+	"ClearPrivatePath ) = 0; hresult();" & _
+	"SetShadowCopyPath hresult();" & _
+	"ClearShadowCopyPath ) = 0; hresult();" & _
+	"SetCachePath hresult();" & _
+	"SetData hresult();" & _
+	"GetData hresult();" & _
+	"SetAppDomainPolicy hresult();" & _
+	"SetThreadPrincipal hresult();" & _
+	"SetPrincipalPolicy hresult();" & _
+	"DoCallBack hresult();" & _
+	"get_DynamicDirectory hresult();"
+
+Global Const $sIID__Type = "{BCA8B44D-AAD6-3A86-8AB7-03349F4F2DA2}"
+Global Const $sTag__Type = _
+	$sTag_IDispatch & _
+	"get_ToString hresult(bstr*);" & _
+	"Equals hresult(variant;short*);" & _
+	"GetHashCode hresult(int*);" & _
+	"GetType hresult(ptr);" & _
+	"get_MemberType hresult(ptr);" & _
+	"get_name hresult(bstr*);" & _
+	"get_DeclaringType hresult(ptr);" & _
+	"get_ReflectedType hresult(ptr);" & _
+	"GetCustomAttributes hresult(ptr;short;ptr);" & _
+	"GetCustomAttributes_2 hresult(short;ptr);" & _
+	"IsDefined hresult(ptr;short;short*);" & _
+	"get_Guid hresult(ptr);" & _
+	"get_Module hresult(ptr);" & _
+	"get_Assembly hresult(ptr*);" & _
+	"get_TypeHandle hresult(ptr);" & _
+	"get_FullName hresult(bstr*);" & _
+	"get_Namespace hresult(bstr*);" & _
+	"get_AssemblyQualifiedName hresult(bstr*);" & _
+	"GetArrayRank hresult(int*);" & _
+	"get_BaseType hresult(ptr);" & _
+	"GetConstructors hresult(ptr;ptr);" & _
+	"GetInterface hresult(bstr;short;ptr);" & _
+	"GetInterfaces hresult(ptr);" & _
+	"FindInterfaces hresult(ptr;variant;ptr);" & _
+	"GetEvent hresult(bstr;ptr;ptr);" & _
+	"GetEvents hresult(ptr);" & _
+	"GetEvents_2 hresult(int;ptr);" & _
+	"GetNestedTypes hresult(int;ptr);" & _
+	"GetNestedType hresult(bstr;ptr;ptr);" & _
+	"GetMember hresult(bstr;ptr;ptr;ptr);" & _
+	"GetDefaultMembers hresult(ptr);" & _
+	"FindMembers hresult(ptr;ptr;ptr;variant;ptr);" & _
+	"GetElementType hresult(ptr);" & _
+	"IsSubclassOf hresult(ptr;short*);" & _
+	"IsInstanceOfType hresult(variant;short*);" & _
+	"IsAssignableFrom hresult(ptr;short*);" & _
+	"GetInterfaceMap hresult(ptr;ptr);" & _
+	"GetMethod hresult(bstr;ptr;ptr;ptr;ptr;ptr);" & _
+	"GetMethod_2 hresult(bstr;ptr;ptr);" & _
+	"GetMethods hresult(int;ptr);" & _
+	"GetField hresult(bstr;ptr;ptr);" & _
+	"GetFields hresult(int;ptr);" & _
+	"GetProperty hresult(bstr;ptr;ptr);" & _
+	"GetProperty_2 hresult(bstr;ptr;ptr;ptr;ptr;ptr;ptr);" & _
+	"GetProperties hresult(ptr;ptr);" & _
+	"GetMember_2 hresult(bstr;ptr;ptr);" & _
+	"GetMembers hresult(int;ptr*);" & _
+	"InvokeMember hresult(bstr;ptr;ptr;variant;ptr;ptr;ptr;ptr;variant*);" & _
+	"get_UnderlyingSystemType hresult(ptr);" & _
+	"InvokeMember_2 hresult(bstr;int;ptr;variant;ptr;ptr;variant*);" & _
+	"InvokeMember_3 hresult(bstr;int;ptr;variant;ptr;variant*);" & _
+	"GetConstructor hresult(ptr;ptr;ptr;ptr;ptr;ptr);" & _
+	"GetConstructor_2 hresult(ptr;ptr;ptr;ptr;ptr);" & _
+	"GetConstructor_3 hresult(ptr;ptr);" & _
+	"GetConstructors_2 hresult(ptr);" & _
+	"get_TypeInitializer hresult(ptr);" & _
+	"GetMethod_3 hresult(bstr;ptr;ptr;ptr;ptr;ptr;ptr);" & _
+	"GetMethod_4 hresult(bstr;ptr;ptr;ptr);" & _
+	"GetMethod_5 hresult(bstr;ptr;ptr);" & _
+	"GetMethod_6 hresult(bstr;ptr);" & _
+	"GetMethods_2 hresult(ptr);" & _
+	"GetField_2 hresult(bstr;ptr);" & _
+	"GetFields_2 hresult(ptr);" & _
+	"GetInterface_2 hresult(bstr;ptr);" & _
+	"GetEvent_2 hresult(bstr;ptr);" & _
+	"GetProperty_3 hresult(bstr;ptr;ptr;ptr;ptr);" & _
+	"GetProperty_4 hresult(bstr;ptr;ptr;ptr);" & _
+	"GetProperty_5 hresult(bstr;ptr;ptr);" & _
+	"GetProperty_6 hresult(bstr;ptr;ptr);" & _
+	"GetProperty_7 hresult(bstr;ptr);" & _
+	"GetProperties_2 hresult(ptr);" & _
+	"GetNestedTypes_2 hresult(ptr);" & _
+	"GetNestedType_2 hresult(bstr;ptr);" & _
+	"GetMember_3 hresult(bstr;ptr);" & _
+	"GetMembers_2 hresult(ptr);" & _
+	"get_Attributes hresult(ptr);" & _
+	"get_IsNotPublic hresult(short*);" & _
+	"get_IsPublic hresult(short*);" & _
+	"get_IsNestedPublic hresult(short*);" & _
+	"get_IsNestedPrivate hresult(short*);" & _
+	"get_IsNestedFamily hresult(short*);" & _
+	"get_IsNestedAssembly hresult(short*);" & _
+	"get_IsNestedFamANDAssem hresult(short*);" & _
+	"get_IsNestedFamORAssem hresult(short*);" & _
+	"get_IsAutoLayout hresult(short*);" & _
+	"get_IsLayoutSequential hresult(short*);" & _
+	"get_IsExplicitLayout hresult(short*);" & _
+	"get_IsClass hresult(short*);" & _
+	"get_IsInterface hresult(short*);" & _
+	"get_IsValueType hresult(short*);" & _
+	"get_IsAbstract hresult(short*);" & _
+	"get_IsSealed hresult(short*);" & _
+	"get_IsEnum hresult(short*);" & _
+	"get_IsSpecialName hresult(short*);" & _
+	"get_IsImport hresult(short*);" & _
+	"get_IsSerializable hresult(short*);" & _
+	"get_IsAnsiClass hresult(short*);" & _
+	"get_IsUnicodeClass hresult(short*);" & _
+	"get_IsAutoClass hresult(short*);" & _
+	"get_IsArray hresult(short*);" & _
+	"get_IsByRef hresult(short*);" & _
+	"get_IsPointer hresult(short*);" & _
+	"get_IsPrimitive hresult(short*);" & _
+	"get_IsCOMObject hresult(short*);" & _
+	"get_HasElementType hresult(short*);" & _
+	"get_IsContextful hresult(short*);" & _
+	"get_IsMarshalByRef hresult(short*);" & _
+	"Equals_2 hresult(ptr;short*);"
+
+; Binding flags for InvokeMember, InvokeMember_2
+; and InvokeMember_3 methods of _Type interface.
+Global Const $BindingFlags_Default = 0x0000
+Global Const $BindingFlags_IgnoreCase = 0x0001
+Global Const $BindingFlags_DeclaredOnly = 0x0002
+Global Const $BindingFlags_Instance = 0x0004
+Global Const $BindingFlags_Static = 0x0008
+Global Const $BindingFlags_Public = 0x0010
+Global Const $BindingFlags_NonPublic = 0x0020
+Global Const $BindingFlags_FlattenHierarchy = 0x0040
+Global Const $BindingFlags_InvokeMethod = 0x0100
+Global Const $BindingFlags_CreateInstance = 0x0200
+Global Const $BindingFlags_GetField = 0x0400
+Global Const $BindingFlags_SetField = 0x0800
+Global Const $BindingFlags_GetProperty = 0x1000
+Global Const $BindingFlags_SetProperty = 0x2000
+Global Const $BindingFlags_PutDispProperty = 0x4000
+Global Const $BindingFlags_PutRefDispProperty = 0x8000
+Global Const $BindingFlags_ExactBinding = 0x00010000
+Global Const $BindingFlags_SuppressChangeType = 0x00020000
+Global Const $BindingFlags_OptionalParamBinding = 0x00040000
+Global Const $BindingFlags_IgnoreReturn = 0x01000000
+Global Const $BindingFlags_DefaultValue = $BindingFlags_Static + $BindingFlags_Public + $BindingFlags_FlattenHierarchy + $BindingFlags_InvokeMethod
+
+Global Const $sIID__Assembly = "{17156360-2F1A-384A-BC52-FDE93C215C5B}"
+Global Const $sTag__Assembly = _
+	$sTag_IDispatch & _
+	"get_ToString hresult(bstr*);" & _
+	"Equals hresult();" & _
+	"GetHashCode hresult();" & _
+	"GetType hresult(ptr*);" & _
+	"get_CodeBase hresult();" & _
+	"get_EscapedCodeBase hresult();" & _
+	"GetName hresult();" & _
+	"GetName_2 hresult();" & _
+	"get_FullName hresult(bstr*);" & _
+	"get_EntryPoint hresult();" & _
+	"GetType_2 hresult(bstr;ptr*);" & _
+	"GetType_3 hresult();" & _
+	"GetExportedTypes hresult();" & _
+	"GetTypes hresult(ptr*);" & _
+	"GetManifestResourceStream hresult();" & _
+	"GetManifestResourceStream_2 hresult();" & _
+	"GetFile hresult();" & _
+	"GetFiles hresult();" & _
+	"GetFiles_2 hresult();" & _
+	"GetManifestResourceNames hresult();" & _
+	"GetManifestResourceInfo hresult();" & _
+	"get_Location hresult(bstr*);" & _
+	"get_Evidence hresult();" & _
+	"GetCustomAttributes hresult();" & _
+	"GetCustomAttributes_2 hresult();" & _
+	"IsDefined hresult();" & _
+	"GetObjectData hresult();" & _
+	"add_ModuleResolve hresult();" & _
+	"remove_ModuleResolve hresult();" & _
+	"GetType_4 hresult();" & _
+	"GetSatelliteAssembly hresult();" & _
+	"GetSatelliteAssembly_2 hresult();" & _
+	"LoadModule hresult();" & _
+	"LoadModule_2 hresult();" & _
+	"CreateInstance hresult(bstr;variant*);" & _
+	"CreateInstance_2 hresult(bstr;bool;variant*);" & _
+	"CreateInstance_3 hresult(bstr;bool;int;ptr;ptr;ptr;ptr;variant*);" & _
+	"GetLoadedModules hresult();" & _
+	"GetLoadedModules_2 hresult();" & _
+	"GetModules hresult();" & _
+	"GetModules_2 hresult();" & _
+	"GetModule hresult();" & _
+	"GetReferencedAssemblies hresult();" & _
+	"get_GlobalAssemblyCache hresult(bool*);"
+
+Func CLSIDFromString( $sGUID )
+	Static $hOle32Dll = "ole32.dll", $tGUID = DllStructCreate( "ulong Data1;ushort Data2;ushort Data3;byte Data4[8]" ), $pGUID = DllStructGetPtr( $tGUID )
+	DllCall( $hOle32Dll, "uint", "CLSIDFromString", "wstr", $sGUID, "ptr", $pGUID )
+	Return $tGUID
+EndFunc
+
+Func GUIDFromStringEx( $sGUID, $tGUID )
+	Static $hOle32Dll = "ole32.dll"
+	DllCall( $hOle32Dll, "long", "CLSIDFromString", "wstr", $sGUID, "struct*", $tGUID )
+EndFunc
+
+
+; ####################################################################################################
+; ###                                                                                              ###
+; ###                                          DotNet.au3                                          ###
+; ###                                                                                              ###
+; ####################################################################################################
+
+Func DotNet_Start( $sVersion = "" )
+	Static $pRuntimeHost = 0, $oRuntimeHost
+	If $pRuntimeHost Then Return $oRuntimeHost
+
+	If $sVersion = "" Then
+		Local $sPath = @WindowsDir & "\Microsoft.NET\Framework" & ( @AutoItX64 ? "64" : "" ) & "\"
+		Local $hSearch = FileFindFirstFile( $sPath & "v?.*" ), $sFolder
+		If $hSearch <> -1 Then
+			While 1
+				$sFolder = FileFindNextFile( $hSearch )
+				Local $iError = @error, $iExtended = @extended
+				If $iExtended = 1 And FileExists( $sPath & $sFolder & "\mscorlib.dll" ) And $sVersion < $sFolder Then $sVersion = $sFolder
+				If $iError Then ExitLoop
+			WEnd
+		EndIf
+	ElseIf Not FileExists( @WindowsDir & "\Microsoft.NET\Framework" & ( @AutoItX64 ? "64" : "" ) & "\" & $sVersion ) Then
+		Return SetError( 1,0,0 )
+	EndIf
+
+	Local Const $tagGUID = "struct; ulong Data1;ushort Data2;ushort Data3;byte Data4[8]; endstruct"
+
+	Local $tCLSID_CorRuntimeHost = DllStructCreate( $tagGUID )
+	GUIDFromStringEx( $sCLSID_CorRuntimeHost, $tCLSID_CorRuntimeHost )
+
+	Local $tIID_ICorRuntimeHost = DllStructCreate( $tagGUID )
+	GUIDFromStringEx( $sIID_ICorRuntimeHost, $tIID_ICorRuntimeHost )
+
+	Local $aRet = DllCall( "MSCorEE.dll", "long", "CorBindToRuntimeEx", "wstr", $sVersion, "ptr", NULL, "dword", 0, _
+	                       "struct*", $tCLSID_CorRuntimeHost, "struct*", $tIID_ICorRuntimeHost, "ptr*", 0 )
+	If Not ( @error = 0 And $aRet[0] = 0 And $aRet[6] ) Then Return SetError( 1,0,0 )
+
+	$pRuntimeHost = $aRet[6]
+	$oRuntimeHost = ObjCreateInterface( $pRuntimeHost, $sIID_ICorRuntimeHost, $sTag_ICorRuntimeHost )
+	Return $oRuntimeHost
+EndFunc
+
+Func DotNet_StartDomain( ByRef $oAppDomain, $sFriendlyName = "", $sBaseDirectory = "" )
+	Local $oDefDomain = DotNet_GetDefaultDomain()
+
+	Local $pType, $oType
+	$oDefDomain.GetType( $pType )
+	$oType = ObjCreateInterface( $pType, $sIID__Type, $sTag__Type )
+
+	Local $psaEmpty = SafeArrayCreateEmpty( $VT_VARIANT )
+	Local $aArguments[5], $pSafeArray
+	$aArguments[0] = $sFriendlyName
+	$aArguments[2] = $sBaseDirectory
+	$aArguments[4] = False
+	AccVars_ArrayToSafeArray( $aArguments, $pSafeArray )
+
+	$oType.InvokeMember_3( "CreateDomain", $BindingFlags_DefaultValue, $psaEmpty, $psaEmpty, $pSafeArray, $oAppDomain )
+EndFunc
+
+Func DotNet_StopDomain( ByRef $oAppDomain )
+	Local $oRuntimeHost = DotNet_Start()
+	$oRuntimeHost.UnloadDomain( Ptr( $oAppDomain ) )
+	$oAppDomain = 0
+EndFunc
+
+; Internal function
+Func DotNet_GetDefaultDomain()
+	Static $pDefDomain = 0, $oDefDomain
+	If $pDefDomain Then Return $oDefDomain
+
+	Local $oRuntimeHost = DotNet_Start()
+	$oRuntimeHost.Start()
+
+	$oRuntimeHost.GetDefaultDomain( $pDefDomain )
+	$oDefDomain = ObjCreateInterface( $pDefDomain, $sIID__AppDomain, $sTag__AppDomain )
+	Return $oDefDomain
+EndFunc
+
+Func DotNet_LoadAssembly( $sAssemblyName, $oAppDomain = 0 )
+	If Not $oAppDomain Then $oAppDomain = DotNet_GetDefaultDomain()
+
+	Local $pType, $oType
+	$oAppDomain.GetType( $pType )
+	$oType = ObjCreateInterface( $pType, $sIID__Type, $sTag__Type )
+
+	Local $pAssembly, $oAssembly
+	$oType.get_Assembly( $pAssembly )
+	$oAssembly = ObjCreateInterface( $pAssembly, $sIID__Assembly, $sTag__Assembly )
+
+	Local $pAssemblyType, $oAssemblyType
+	$oAssembly.GetType( $pAssemblyType )
+	$oAssemblyType = ObjCreateInterface( $pAssemblyType, $sIID__Type, $sTag__Type )
+
+	Local $aAssemblyName = [ $sAssemblyName ], $pSafeArray
+	AccVars_ArrayToSafeArray( $aAssemblyName, $pSafeArray )
+
+	Local $pNetCode
+	$oAssemblyType.InvokeMember_3( "LoadFrom", $BindingFlags_DefaultValue, 0, 0, $pSafeArray, $pNetCode )
+	; We first try to load the .NET assembly with the LoadFrom method
+
+	; If LoadFrom method fails, we try to load the .NET assembly using the LoadWithPartialName method
+	If Not Ptr( $pNetCode ) Then
+		Local $iPos = StringInStr( $sAssemblyName, ".", Default, -1 )
+		If StringRight( $sAssemblyName, StringLen( $sAssemblyName ) - $iPos ) = "dll" Then _ ; Use name of .NET assembly without DLL-
+			$sAssemblyName = StringLeft( $sAssemblyName, $iPos - 1 )                           ; extension in LoadWithPartialName method.
+		$aAssemblyName[0] = $sAssemblyName
+		AccVars_ArrayToSafeArray( $aAssemblyName, $pSafeArray )
+		$oAssemblyType.InvokeMember_3( "LoadWithPartialName", $BindingFlags_DefaultValue, 0, 0, $pSafeArray, $pNetCode )
+		; LoadWithPartialName searches for the .NET assembly in the path given by $sBaseDirectory in DotNet_StartDomain
+	EndIf
+
+	If Not Ptr( $pNetCode ) Then Return SetError( 2,0,0 )
+	Return ObjCreateInterface( $pNetCode, $sIID__Assembly, $sTag__Assembly )
+EndFunc
+
+Func DotNet_LoadCScode( $sCode, $sReferences = "", $oAppDomain = 0, $sFileName = "", $sCompilerOptions = "" )
+	Local $oNetCode = DotNet_LoadCode( $sCode, $sReferences, "System", "Microsoft.CSharp.CSharpCodeProvider", $oAppDomain, $sFileName, $sCompilerOptions )
+	If @error Then Return SetError( @error,0,0 )
+	Return $oNetCode
+EndFunc
+
+Func DotNet_LoadVBcode( $sCode, $sReferences = "", $oAppDomain = 0, $sFileName = "", $sCompilerOptions = "" )
+	Local $oNetCode = DotNet_LoadCode( $sCode, $sReferences, "System", "Microsoft.VisualBasic.VBCodeProvider", $oAppDomain, $sFileName, $sCompilerOptions )
+	If @error Then Return SetError( @error,0,0 )
+	Return $oNetCode
+EndFunc
+
+; Internal function
+Func DotNet_LoadCode( $sCode, $sReferences, $sProviderAssembly, $sProviderType, $oAppDomain = 0, $sFileName = "", $sCompilerOptions = "" )
+	If Not $oAppDomain Then $oAppDomain = DotNet_GetDefaultDomain()
+
+	Local $oAsmProvider, $oCodeProvider, $oCodeCompiler, $oAsmSystem, $oPrms
+	If IsObj( $oAppDomain ) Then $oAsmProvider = DotNet_LoadAssembly( $sProviderAssembly, $oAppDomain )
+	If IsObj( $oAsmProvider ) Then $oAsmProvider.CreateInstance( $sProviderType, $oCodeProvider )
+	If IsObj( $oCodeProvider ) Then $oCodeCompiler = $oCodeProvider.CreateCompiler()
+	If IsObj( $oCodeCompiler ) Then $oAsmSystem = $sProviderAssembly = "System" ? $oAsmProvider : DotNet_LoadAssembly( "System", $oAppDomain )
+	If Not IsObj( $oAsmSystem ) Then Return SetError( 3,0,0 )
+
+	Local $aReferences = StringSplit( StringStripWS( StringRegExpReplace( $sReferences, "\s*\|\s*", "|" ), 3 ), "|", 2 ) ; 3 = $STR_STRIPLEADING + $STR_STRIPTRAILING, 2 = $STR_NOCOUNT
+	Local $pSafeArray = AccVars_ArrayToSafeArrayOfVartype( $aReferences, $VT_BSTR )
+	Local $psaVariant = AccVars_SafeArrayToSafeArrayOfVariant( $pSafeArray )
+	Local $psaEmpty = SafeArrayCreateEmpty( $VT_VARIANT )
+
+	; Create $oPrms object
+	$oAsmSystem.CreateInstance_3( "System.CodeDom.Compiler.CompilerParameters", True, 0, 0, $psaVariant, 0, $psaEmpty, $oPrms )
+	If Not IsObj( $oPrms ) Then Return SetError( 4,0,0 )
+
+	; Set parameters for compiler
+	$oPrms.OutputAssembly = $sFileName
+	$oPrms.GenerateInMemory = ( $sFileName = "" )
+	$oPrms.GenerateExecutable = ( StringRight( $sFileName, 4 ) = ".exe" )
+	$oPrms.CompilerOptions = $sCompilerOptions
+	$oPrms.IncludeDebugInformation = True
+
+	; Compile code
+	Local $oCompilerRes = $oCodeCompiler.CompileAssemblyFromSource( $oPrms, $sCode )
+
+	; Compiler errors?
+	If $oCompilerRes.Errors.Count() Then
+		Local $b = False
+		For $err In $oCompilerRes.Errors
+			If $b Then ConsoleWrite( @CRLF )
+			ConsoleWrite( "Line: " & $err.Line & @CRLF & "Column: " & $err.Column & @CRLF & $err.ErrorNumber & ": " & $err.ErrorText & @CRLF )
+			$b = True
+		Next
+		Return SetError( 5,0,0 )
+	EndIf
+
+	If $sFileName Then
+		Return $oCompilerRes.PathToAssembly()
+	Else
+		Local $pNetCode = $oCompilerRes.CompiledAssembly()
+		Return ObjCreateInterface( $pNetCode, $sIID__Assembly, $sTag__Assembly )
+	EndIf
+EndFunc
+
+Func DotNet_CreateObject( ByRef $oNetCode, $sClassName, $v3 = Default, $v4 = Default, $v5 = Default, $v6 = Default, $v7 = Default, $v8 = Default, $v9 = Default )
+	Local $aParams = [ $v3, $v4, $v5, $v6, $v7, $v8, $v9 ], $oObject = 0
+
+	If @NumParams = 2 Then
+		$oNetCode.CreateInstance_2( $sClassName, True, $oObject )
+		Return $oObject
+	EndIf
+
+	Local $iArgs = @NumParams - 2, $aArgs[$iArgs], $pSafeArray
+	For $i = 0 To $iArgs - 1
+		$aArgs[$i] = $aParams[$i]
+	Next
+	AccVars_ArrayToSafeArray( $aArgs, $pSafeArray )
+
+	Local $psaEmpty = SafeArrayCreateEmpty( $VT_VARIANT )
+
+	$oNetCode.CreateInstance_3( $sClassName, True, 0, 0, $pSafeArray, 0, $psaEmpty, $oObject )
+	Return $oObject
+EndFunc
+
+
+; ####################################################################################################
+; ###                                                                                              ###
+; ###                                       DotNetUtils.au3                                        ###
+; ###                                                                                              ###
+; ####################################################################################################
+
+#include <Array.au3>
+
+Func DotNet_ListDomains()
+	Local $pEnum, $pDomain, $oDomain
+	Local $aDomains[100][2], $iDomains = 0
+	Local $oRuntimeHost = DotNet_Start()
+	$oRuntimeHost.EnumDomains( $pEnum )
+	While Not $oRuntimeHost.NextDomain( $pEnum, $pDomain )
+		$oDomain = ObjCreateInterface( $pDomain, $sIID__AppDomain, $sTag__AppDomain )
+		$oDomain.get_FriendlyName( $aDomains[$iDomains][0] )
+		$oDomain.get_BaseDirectory( $aDomains[$iDomains][1] )
+		$iDomains += 1
+	WEnd
+	ReDim $aDomains[$iDomains][2]
+	Return $aDomains
+EndFunc
+
+Func DotNet_ListDomainsEx()
+	Local $aDomains = DotNet_ListDomains()
+	_ArrayDisplay( $aDomains, ".NET Framework Domains", "", 0, Default, "Friendly Name|Base Directory to load assemblies" )
+EndFunc
+
+Func DotNet_ListAssemblies( $oAppDomain = 0 )
+	Local $pAssemblies, $aAssemblies
+	If Not $oAppDomain Then _
+		$oAppDomain = DotNet_GetDefaultDomain()
+	$oAppDomain.getAssemblies( $pAssemblies )
+	AccVars_SafeArrayToArray( $pAssemblies, $aAssemblies )
+	Local $nAsms = UBound( $aAssemblies ), $aAsmInfo[$nAsms][3], $oAssembly
+	For $i = 0 To $nAsms - 1
+		$oAssembly = ObjCreateInterface( $aAssemblies[$i], $sIID__Assembly, $sTag__Assembly )
+		$oAssembly.get_GlobalAssemblyCache( $aAsmInfo[$i][0] )
+		$oAssembly.get_FullName( $aAsmInfo[$i][1] )
+		$oAssembly.get_Location( $aAsmInfo[$i][2] )
+	Next
+	Return $aAsmInfo
+EndFunc
+
+Func DotNet_ListAssembliesEx( $oAppDomain = 0 )
+	Local $aAssemblies = DotNet_ListAssemblies( $oAppDomain )
+	_ArrayDisplay( $aAssemblies, "Loaded Assemblies in Domain", "", 0, Default, "GAC|Assembly Full Name|Assembly Location" )
+EndFunc

+ 44 - 0
DotNet/Includes/DotNetUtils.au3

@@ -0,0 +1,44 @@
+#include-once
+#include <Array.au3>
+#include "DotNet.au3"
+
+Func DotNet_ListDomains()
+	Local $pEnum, $pDomain, $oDomain
+	Local $aDomains[100][2], $iDomains = 0
+	Local $oRuntimeHost = DotNet_Start()
+	$oRuntimeHost.EnumDomains( $pEnum )
+	While Not $oRuntimeHost.NextDomain( $pEnum, $pDomain )
+		$oDomain = ObjCreateInterface( $pDomain, $sIID__AppDomain, $sTag__AppDomain )
+		$oDomain.get_FriendlyName( $aDomains[$iDomains][0] )
+		$oDomain.get_BaseDirectory( $aDomains[$iDomains][1] )
+		$iDomains += 1
+	WEnd
+	ReDim $aDomains[$iDomains][2]
+	Return $aDomains
+EndFunc
+
+Func DotNet_ListDomainsEx()
+	Local $aDomains = DotNet_ListDomains()
+	_ArrayDisplay( $aDomains, ".NET Framework Domains", "", 0, Default, "Friendly Name|Base Directory to load assemblies" )
+EndFunc
+
+Func DotNet_ListAssemblies( $oAppDomain = 0 )
+	Local $pAssemblies, $aAssemblies
+	If Not $oAppDomain Then _
+		$oAppDomain = DotNet_GetDefaultDomain()
+	$oAppDomain.getAssemblies( $pAssemblies )
+	AccVars_SafeArrayToArray( $pAssemblies, $aAssemblies )
+	Local $nAsms = UBound( $aAssemblies ), $aAsmInfo[$nAsms][3], $oAssembly
+	For $i = 0 To $nAsms - 1
+		$oAssembly = ObjCreateInterface( $aAssemblies[$i], $sIID__Assembly, $sTag__Assembly )
+		$oAssembly.get_GlobalAssemblyCache( $aAsmInfo[$i][0] )
+		$oAssembly.get_FullName( $aAsmInfo[$i][1] )
+		$oAssembly.get_Location( $aAsmInfo[$i][2] )
+	Next
+	Return $aAsmInfo
+EndFunc
+
+Func DotNet_ListAssembliesEx( $oAppDomain = 0 )
+	Local $aAssemblies = DotNet_ListAssemblies( $oAppDomain )
+	_ArrayDisplay( $aAssemblies, "Loaded Assemblies in Domain", "", 0, Default, "GAC|Assembly Full Name|Assembly Location" )
+EndFunc

+ 298 - 0
DotNet/Includes/Interfaces.au3

@@ -0,0 +1,298 @@
+#include-once
+
+Global Const $sCLSID_CorRuntimeHost = "{CB2F6723-AB3A-11D2-9C40-00C04FA30A3E}"
+Global Const $tCLSID_CorRuntimeHost = CLSIDFromString( $sCLSID_CorRuntimeHost )
+Global Const $sIID_ICorRuntimeHost = "{CB2F6722-AB3A-11D2-9C40-00C04FA30A3E}"
+Global Const $tIID_ICorRuntimeHost = CLSIDFromString( $sIID_ICorRuntimeHost )
+Global Const $sTag_ICorRuntimeHost = _
+	"CreateLogicalThreadState hresult();" & _
+	"DeleteLogicalThreadState hresult();" & _
+	"SwitchInLogicalThreadState hresult();" & _
+	"SwitchOutLogicalThreadState hresult();" & _
+	"LocksHeldByLogicalThread hresult();" & _
+	"MapFile hresult();" & _
+	"GetConfiguration hresult();" & _
+	"Start hresult();" & _
+	"Stop hresult();" & _
+	"CreateDomain hresult();" & _
+	"GetDefaultDomain hresult(ptr*);" & _
+	"EnumDomains hresult(ptr*);" & _
+	"NextDomain hresult(ptr;ptr*);" & _
+	"CloseEnum hresult();" & _
+	"CreateDomainEx hresult();" & _
+	"CreateDomainSetup hresult();" & _
+	"CreateEvidence hresult();" & _
+	"UnloadDomain hresult(ptr);" & _
+	"CurrentDomain hresult();"
+
+Global Const $sIID_IDispatch = "{00020400-0000-0000-C000-000000000046}"
+Global Const $sTag_IDispatch = _
+	"GetTypeInfoCount hresult(dword*);" & _
+	"GetTypeInfo hresult(dword;dword;ptr*);" & _
+	"GetIDsOfNames hresult(ptr;ptr;dword;dword;ptr);" & _
+	"Invoke hresult(dword;ptr;dword;word;ptr;ptr;ptr;ptr);"
+
+; The interfaces _AppDomain, _Type and _Assembly below that starts with
+; an underscore are the interfaces that can be used from unmanaged code.
+
+Global Const $sIID__AppDomain = "{05F696DC-2B29-3663-AD8B-C4389CF2A713}"
+Global Const $sTag__AppDomain = _
+	$sTag_IDispatch & _
+	"get_ToString hresult();" & _
+	"Equals hresult();" & _
+	"GetHashCode hresult();" & _
+	"GetType hresult(ptr*);" & _
+	"InitializeLifetimeService hresult();" & _
+	"GetLifetimeService hresult();" & _
+	"get_Evidence hresult();" & _
+	"add_DomainUnload hresult();" & _
+	"remove_DomainUnload hresult();" & _
+	"add_AssemblyLoad hresult();" & _
+	"remove_AssemblyLoad hresult();" & _
+	"add_ProcessExit hresult();" & _
+	"remove_ProcessExit hresult();" & _
+	"add_TypeResolve hresult();" & _
+	"remove_TypeResolve hresult();" & _
+	"add_ResourceResolve hresult();" & _
+	"remove_ResourceResolve hresult();" & _
+	"add_AssemblyResolve hresult();" & _
+	"remove_AssemblyResolve hresult();" & _
+	"add_UnhandledException hresult();" & _
+	"remove_UnhandledException hresult();" & _
+	"DefineDynamicAssembly hresult();" & _
+	"DefineDynamicAssembly_2 hresult();" & _
+	"DefineDynamicAssembly_3 hresult();" & _
+	"DefineDynamicAssembly_4 hresult();" & _
+	"DefineDynamicAssembly_5 hresult();" & _
+	"DefineDynamicAssembly_6 hresult();" & _
+	"DefineDynamicAssembly_7 hresult();" & _
+	"DefineDynamicAssembly_8 hresult();" & _
+	"DefineDynamicAssembly_9 hresult();" & _
+	"CreateInstance hresult(bstr;bstr;object*);" & _
+	"CreateInstanceFrom hresult();" & _
+	"CreateInstance_2 hresult();" & _
+	"CreateInstanceFrom_2 hresult();" & _
+	"CreateInstance_3 hresult(bstr;bstr;bool;int;ptr;ptr;ptr;ptr;ptr;ptr*);" & _
+	"CreateInstanceFrom_3 hresult();" & _
+	"Load hresult();" & _
+	"Load_2 hresult();" & _
+	"Load_3 hresult();" & _
+	"Load_4 hresult();" & _
+	"Load_5 hresult();" & _
+	"Load_6 hresult();" & _
+	"Load_7 hresult();" & _
+	"ExecuteAssembly hresult();" & _
+	"ExecuteAssembly_2 hresult();" & _
+	"ExecuteAssembly_3 hresult();" & _
+	"get_FriendlyName hresult(bstr*);" & _
+	"get_BaseDirectory hresult(bstr*);" & _
+	"get_RelativeSearchPath hresult();" & _
+	"get_ShadowCopyFiles hresult();" & _
+	"GetAssemblies hresult(ptr*);" & _
+	"AppendPrivatePath hresult();" & _
+	"ClearPrivatePath ) = 0; hresult();" & _
+	"SetShadowCopyPath hresult();" & _
+	"ClearShadowCopyPath ) = 0; hresult();" & _
+	"SetCachePath hresult();" & _
+	"SetData hresult();" & _
+	"GetData hresult();" & _
+	"SetAppDomainPolicy hresult();" & _
+	"SetThreadPrincipal hresult();" & _
+	"SetPrincipalPolicy hresult();" & _
+	"DoCallBack hresult();" & _
+	"get_DynamicDirectory hresult();"
+
+Global Const $sIID__Type = "{BCA8B44D-AAD6-3A86-8AB7-03349F4F2DA2}"
+Global Const $sTag__Type = _
+	$sTag_IDispatch & _
+	"get_ToString hresult(bstr*);" & _
+	"Equals hresult(variant;short*);" & _
+	"GetHashCode hresult(int*);" & _
+	"GetType hresult(ptr);" & _
+	"get_MemberType hresult(ptr);" & _
+	"get_name hresult(bstr*);" & _
+	"get_DeclaringType hresult(ptr);" & _
+	"get_ReflectedType hresult(ptr);" & _
+	"GetCustomAttributes hresult(ptr;short;ptr);" & _
+	"GetCustomAttributes_2 hresult(short;ptr);" & _
+	"IsDefined hresult(ptr;short;short*);" & _
+	"get_Guid hresult(ptr);" & _
+	"get_Module hresult(ptr);" & _
+	"get_Assembly hresult(ptr*);" & _
+	"get_TypeHandle hresult(ptr);" & _
+	"get_FullName hresult(bstr*);" & _
+	"get_Namespace hresult(bstr*);" & _
+	"get_AssemblyQualifiedName hresult(bstr*);" & _
+	"GetArrayRank hresult(int*);" & _
+	"get_BaseType hresult(ptr);" & _
+	"GetConstructors hresult(ptr;ptr);" & _
+	"GetInterface hresult(bstr;short;ptr);" & _
+	"GetInterfaces hresult(ptr);" & _
+	"FindInterfaces hresult(ptr;variant;ptr);" & _
+	"GetEvent hresult(bstr;ptr;ptr);" & _
+	"GetEvents hresult(ptr);" & _
+	"GetEvents_2 hresult(int;ptr);" & _
+	"GetNestedTypes hresult(int;ptr);" & _
+	"GetNestedType hresult(bstr;ptr;ptr);" & _
+	"GetMember hresult(bstr;ptr;ptr;ptr);" & _
+	"GetDefaultMembers hresult(ptr);" & _
+	"FindMembers hresult(ptr;ptr;ptr;variant;ptr);" & _
+	"GetElementType hresult(ptr);" & _
+	"IsSubclassOf hresult(ptr;short*);" & _
+	"IsInstanceOfType hresult(variant;short*);" & _
+	"IsAssignableFrom hresult(ptr;short*);" & _
+	"GetInterfaceMap hresult(ptr;ptr);" & _
+	"GetMethod hresult(bstr;ptr;ptr;ptr;ptr;ptr);" & _
+	"GetMethod_2 hresult(bstr;ptr;ptr);" & _
+	"GetMethods hresult(int;ptr);" & _
+	"GetField hresult(bstr;ptr;ptr);" & _
+	"GetFields hresult(int;ptr);" & _
+	"GetProperty hresult(bstr;ptr;ptr);" & _
+	"GetProperty_2 hresult(bstr;ptr;ptr;ptr;ptr;ptr;ptr);" & _
+	"GetProperties hresult(ptr;ptr);" & _
+	"GetMember_2 hresult(bstr;ptr;ptr);" & _
+	"GetMembers hresult(int;ptr*);" & _
+	"InvokeMember hresult(bstr;ptr;ptr;variant;ptr;ptr;ptr;ptr;variant*);" & _
+	"get_UnderlyingSystemType hresult(ptr);" & _
+	"InvokeMember_2 hresult(bstr;int;ptr;variant;ptr;ptr;variant*);" & _
+	"InvokeMember_3 hresult(bstr;int;ptr;variant;ptr;variant*);" & _
+	"GetConstructor hresult(ptr;ptr;ptr;ptr;ptr;ptr);" & _
+	"GetConstructor_2 hresult(ptr;ptr;ptr;ptr;ptr);" & _
+	"GetConstructor_3 hresult(ptr;ptr);" & _
+	"GetConstructors_2 hresult(ptr);" & _
+	"get_TypeInitializer hresult(ptr);" & _
+	"GetMethod_3 hresult(bstr;ptr;ptr;ptr;ptr;ptr;ptr);" & _
+	"GetMethod_4 hresult(bstr;ptr;ptr;ptr);" & _
+	"GetMethod_5 hresult(bstr;ptr;ptr);" & _
+	"GetMethod_6 hresult(bstr;ptr);" & _
+	"GetMethods_2 hresult(ptr);" & _
+	"GetField_2 hresult(bstr;ptr);" & _
+	"GetFields_2 hresult(ptr);" & _
+	"GetInterface_2 hresult(bstr;ptr);" & _
+	"GetEvent_2 hresult(bstr;ptr);" & _
+	"GetProperty_3 hresult(bstr;ptr;ptr;ptr;ptr);" & _
+	"GetProperty_4 hresult(bstr;ptr;ptr;ptr);" & _
+	"GetProperty_5 hresult(bstr;ptr;ptr);" & _
+	"GetProperty_6 hresult(bstr;ptr;ptr);" & _
+	"GetProperty_7 hresult(bstr;ptr);" & _
+	"GetProperties_2 hresult(ptr);" & _
+	"GetNestedTypes_2 hresult(ptr);" & _
+	"GetNestedType_2 hresult(bstr;ptr);" & _
+	"GetMember_3 hresult(bstr;ptr);" & _
+	"GetMembers_2 hresult(ptr);" & _
+	"get_Attributes hresult(ptr);" & _
+	"get_IsNotPublic hresult(short*);" & _
+	"get_IsPublic hresult(short*);" & _
+	"get_IsNestedPublic hresult(short*);" & _
+	"get_IsNestedPrivate hresult(short*);" & _
+	"get_IsNestedFamily hresult(short*);" & _
+	"get_IsNestedAssembly hresult(short*);" & _
+	"get_IsNestedFamANDAssem hresult(short*);" & _
+	"get_IsNestedFamORAssem hresult(short*);" & _
+	"get_IsAutoLayout hresult(short*);" & _
+	"get_IsLayoutSequential hresult(short*);" & _
+	"get_IsExplicitLayout hresult(short*);" & _
+	"get_IsClass hresult(short*);" & _
+	"get_IsInterface hresult(short*);" & _
+	"get_IsValueType hresult(short*);" & _
+	"get_IsAbstract hresult(short*);" & _
+	"get_IsSealed hresult(short*);" & _
+	"get_IsEnum hresult(short*);" & _
+	"get_IsSpecialName hresult(short*);" & _
+	"get_IsImport hresult(short*);" & _
+	"get_IsSerializable hresult(short*);" & _
+	"get_IsAnsiClass hresult(short*);" & _
+	"get_IsUnicodeClass hresult(short*);" & _
+	"get_IsAutoClass hresult(short*);" & _
+	"get_IsArray hresult(short*);" & _
+	"get_IsByRef hresult(short*);" & _
+	"get_IsPointer hresult(short*);" & _
+	"get_IsPrimitive hresult(short*);" & _
+	"get_IsCOMObject hresult(short*);" & _
+	"get_HasElementType hresult(short*);" & _
+	"get_IsContextful hresult(short*);" & _
+	"get_IsMarshalByRef hresult(short*);" & _
+	"Equals_2 hresult(ptr;short*);"
+
+; Binding flags for InvokeMember, InvokeMember_2
+; and InvokeMember_3 methods of _Type interface.
+Global Const $BindingFlags_Default = 0x0000
+Global Const $BindingFlags_IgnoreCase = 0x0001
+Global Const $BindingFlags_DeclaredOnly = 0x0002
+Global Const $BindingFlags_Instance = 0x0004
+Global Const $BindingFlags_Static = 0x0008
+Global Const $BindingFlags_Public = 0x0010
+Global Const $BindingFlags_NonPublic = 0x0020
+Global Const $BindingFlags_FlattenHierarchy = 0x0040
+Global Const $BindingFlags_InvokeMethod = 0x0100
+Global Const $BindingFlags_CreateInstance = 0x0200
+Global Const $BindingFlags_GetField = 0x0400
+Global Const $BindingFlags_SetField = 0x0800
+Global Const $BindingFlags_GetProperty = 0x1000
+Global Const $BindingFlags_SetProperty = 0x2000
+Global Const $BindingFlags_PutDispProperty = 0x4000
+Global Const $BindingFlags_PutRefDispProperty = 0x8000
+Global Const $BindingFlags_ExactBinding = 0x00010000
+Global Const $BindingFlags_SuppressChangeType = 0x00020000
+Global Const $BindingFlags_OptionalParamBinding = 0x00040000
+Global Const $BindingFlags_IgnoreReturn = 0x01000000
+Global Const $BindingFlags_DefaultValue = $BindingFlags_Static + $BindingFlags_Public + $BindingFlags_FlattenHierarchy + $BindingFlags_InvokeMethod
+
+Global Const $sIID__Assembly = "{17156360-2F1A-384A-BC52-FDE93C215C5B}"
+Global Const $sTag__Assembly = _
+	$sTag_IDispatch & _
+	"get_ToString hresult(bstr*);" & _
+	"Equals hresult();" & _
+	"GetHashCode hresult();" & _
+	"GetType hresult(ptr*);" & _
+	"get_CodeBase hresult();" & _
+	"get_EscapedCodeBase hresult();" & _
+	"GetName hresult();" & _
+	"GetName_2 hresult();" & _
+	"get_FullName hresult(bstr*);" & _
+	"get_EntryPoint hresult();" & _
+	"GetType_2 hresult(bstr;ptr*);" & _
+	"GetType_3 hresult();" & _
+	"GetExportedTypes hresult();" & _
+	"GetTypes hresult(ptr*);" & _
+	"GetManifestResourceStream hresult();" & _
+	"GetManifestResourceStream_2 hresult();" & _
+	"GetFile hresult();" & _
+	"GetFiles hresult();" & _
+	"GetFiles_2 hresult();" & _
+	"GetManifestResourceNames hresult();" & _
+	"GetManifestResourceInfo hresult();" & _
+	"get_Location hresult(bstr*);" & _
+	"get_Evidence hresult();" & _
+	"GetCustomAttributes hresult();" & _
+	"GetCustomAttributes_2 hresult();" & _
+	"IsDefined hresult();" & _
+	"GetObjectData hresult();" & _
+	"add_ModuleResolve hresult();" & _
+	"remove_ModuleResolve hresult();" & _
+	"GetType_4 hresult();" & _
+	"GetSatelliteAssembly hresult();" & _
+	"GetSatelliteAssembly_2 hresult();" & _
+	"LoadModule hresult();" & _
+	"LoadModule_2 hresult();" & _
+	"CreateInstance hresult(bstr;variant*);" & _
+	"CreateInstance_2 hresult(bstr;bool;variant*);" & _
+	"CreateInstance_3 hresult(bstr;bool;int;ptr;ptr;ptr;ptr;variant*);" & _
+	"GetLoadedModules hresult();" & _
+	"GetLoadedModules_2 hresult();" & _
+	"GetModules hresult();" & _
+	"GetModules_2 hresult();" & _
+	"GetModule hresult();" & _
+	"GetReferencedAssemblies hresult();" & _
+	"get_GlobalAssemblyCache hresult(bool*);"
+
+Func CLSIDFromString( $sGUID )
+	Static $hOle32Dll = "ole32.dll", $tGUID = DllStructCreate( "ulong Data1;ushort Data2;ushort Data3;byte Data4[8]" ), $pGUID = DllStructGetPtr( $tGUID )
+	DllCall( $hOle32Dll, "uint", "CLSIDFromString", "wstr", $sGUID, "ptr", $pGUID )
+	Return $tGUID
+EndFunc
+
+Func GUIDFromStringEx( $sGUID, $tGUID )
+	Static $hOle32Dll = "ole32.dll"
+	DllCall( $hOle32Dll, "long", "CLSIDFromString", "wstr", $sGUID, "struct*", $tGUID )
+EndFunc

+ 117 - 0
DotNet/Includes/SafeArray.au3

@@ -0,0 +1,117 @@
+#include-once
+
+Global Const $tagSAFEARRAYBOUND = _
+	"ulong  cElements;"  & _ ; The number of elements in the dimension.
+	"long   lLbound;"        ; The lower bound of the dimension.
+
+Global Const $tagSAFEARRAY = _
+	"ushort cDims;"      & _ ; The number of dimensions.
+	"ushort fFeatures;"  & _ ; Flags, see below.
+	"ulong  cbElements;" & _ ; The size of an array element.
+	"ulong  cLocks;"     & _ ; The number of times the array has been locked without a corresponding unlock.
+	"ptr    pvData;"     & _ ; The data.
+	$tagSAFEARRAYBOUND       ; One $tagSAFEARRAYBOUND for each dimension.
+
+; fFeatures flags
+Global Const $FADF_AUTO        = 0x0001 ; An array that is allocated on the stack.
+Global Const $FADF_STATIC      = 0x0002 ; An array that is statically allocated.
+Global Const $FADF_EMBEDDED    = 0x0004 ; An array that is embedded in a structure.
+Global Const $FADF_FIXEDSIZE   = 0x0010 ; An array that may not be resized or reallocated.
+Global Const $FADF_RECORD      = 0x0020 ; An array that contains records. When set, there will be a pointer to the IRecordInfo interface at negative offset 4 in the array descriptor.
+Global Const $FADF_HAVEIID     = 0x0040 ; An array that has an IID identifying interface. When set, there will be a GUID at negative offset 16 in the safearray descriptor. Flag is set only when FADF_DISPATCH or FADF_UNKNOWN is also set.
+Global Const $FADF_HAVEVARTYPE = 0x0080 ; An array that has a variant type. The variant type can be retrieved with SafeArrayGetVartype.
+Global Const $FADF_BSTR        = 0x0100 ; An array of BSTRs.
+Global Const $FADF_UNKNOWN     = 0x0200 ; An array of IUnknown*.
+Global Const $FADF_DISPATCH    = 0x0400 ; An array of IDispatch*.
+Global Const $FADF_VARIANT     = 0x0800 ; An array of VARIANTs.
+Global Const $FADF_RESERVED    = 0xF008 ; Bits reserved for future use.
+
+
+
+; >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+
+; Safearray functions
+; Copied from AutoItObject.au3 by the AutoItObject-Team: monoceres, trancexx, Kip, ProgAndy
+; https://www.autoitscript.com/forum/index.php?showtopic=110379
+
+Func SafeArrayCreate($vType, $cDims, $rgsabound)
+	; Author: Prog@ndy
+	Local $aCall = DllCall("OleAut32.dll", "ptr", "SafeArrayCreate", "dword", $vType, "uint", $cDims, 'struct*', $rgsabound)
+	If @error Then Return SetError(1, 0, 0)
+	Return $aCall[0]
+EndFunc
+
+Func SafeArrayDestroy($pSafeArray)
+	; Author: Prog@ndy
+	Local $aCall = DllCall("OleAut32.dll", "int", "SafeArrayDestroy", "ptr", $pSafeArray)
+	If @error Then Return SetError(1, 0, 1)
+	Return $aCall[0]
+EndFunc
+
+Func SafeArrayAccessData($pSafeArray, ByRef $pArrayData)
+	; Author: Prog@ndy
+	Local $aCall = DllCall("OleAut32.dll", "int", "SafeArrayAccessData", "ptr", $pSafeArray, 'ptr*', 0)
+	If @error Then Return SetError(1, 0, 1)
+	$pArrayData = $aCall[2]
+	Return $aCall[0]
+EndFunc
+
+Func SafeArrayUnaccessData($pSafeArray)
+	; Author: Prog@ndy
+	Local $aCall = DllCall("OleAut32.dll", "int", "SafeArrayUnaccessData", "ptr", $pSafeArray)
+	If @error Then Return SetError(1, 0, 1)
+	Return $aCall[0]
+EndFunc
+
+Func SafeArrayGetUBound($pSafeArray, $iDim, ByRef $iBound)
+	; Author: Prog@ndy
+	Local $aCall = DllCall("OleAut32.dll", "int", "SafeArrayGetUBound", "ptr", $pSafeArray, 'uint', $iDim, 'long*', 0)
+	If @error Then Return SetError(1, 0, 1)
+	$iBound = $aCall[3]
+	Return $aCall[0]
+EndFunc
+
+Func SafeArrayGetLBound($pSafeArray, $iDim, ByRef $iBound)
+	; Author: Prog@ndy
+	Local $aCall = DllCall("OleAut32.dll", "int", "SafeArrayGetLBound", "ptr", $pSafeArray, 'uint', $iDim, 'long*', 0)
+	If @error Then Return SetError(1, 0, 1)
+	$iBound = $aCall[3]
+	Return $aCall[0]
+EndFunc
+
+Func SafeArrayGetDim($pSafeArray)
+	Local $aResult = DllCall("OleAut32.dll", "uint", "SafeArrayGetDim", "ptr", $pSafeArray)
+	If @error Then Return SetError(1, 0, 0)
+	Return $aResult[0]
+EndFunc
+
+; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
+
+
+
+Func SafeArrayCopy( $pSafeArrayIn, ByRef $pSafeArrayOut )
+	Local $aRet = DllCall( "OleAut32.dll", "int", "SafeArrayCopy", "ptr", $pSafeArrayIn, "ptr*", 0 )
+	If @error Then Return SetError(1,0,1)
+	$pSafeArrayOut = $aRet[2]
+	Return $aRet[0]
+EndFunc
+
+Func SafeArrayCreateEmpty( $vType )
+	Local $tsaBound = DllStructCreate( $tagSAFEARRAYBOUND )
+	DllStructSetData( $tsaBound, "cElements", 0 )
+	DllStructSetData( $tsaBound, "lLbound", 0 )
+	Return SafeArrayCreate( $vType, 0, $tsaBound )
+EndFunc
+
+Func SafeArrayDestroyData( $pSafeArray )
+	Local $aRet = DllCall( "OleAut32.dll", "int", "SafeArrayDestroyData", "ptr", $pSafeArray )
+	If @error Then Return SetError(1,0,1)
+	Return $aRet[0]
+EndFunc
+
+Func SafeArrayGetVartype( $pSafeArray, ByRef $vt )
+	Local $aRet = DllCall( "OleAut32.dll", "int", "SafeArrayGetVartype", "ptr", $pSafeArray, "ptr*", 0 )
+	If @error Then Return SetError(1,0,1)
+	$vt = $aRet[2]
+	Return $aRet[0]
+EndFunc

+ 237 - 0
DotNet/Includes/Variant.au3

@@ -0,0 +1,237 @@
+#include-once
+
+; >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+
+; Copied from AutoItObject.au3 by the AutoItObject-Team: monoceres, trancexx, Kip, ProgAndy
+; https://www.autoitscript.com/forum/index.php?showtopic=110379
+
+Global Const $tagVARIANT = "word vt;word r1;word r2;word r3;ptr data; ptr"
+; The structure takes up 16/24 bytes when running 32/64 bit
+; Space for the data element at the end represents 2 pointers
+; This is 8 bytes running 32 bit and 16 bytes running 64 bit
+
+Global Const $VT_EMPTY            = 0  ; 0x0000
+Global Const $VT_NULL             = 1  ; 0x0001
+Global Const $VT_I2               = 2  ; 0x0002
+Global Const $VT_I4               = 3  ; 0x0003
+Global Const $VT_R4               = 4  ; 0x0004
+Global Const $VT_R8               = 5  ; 0x0005
+Global Const $VT_CY               = 6  ; 0x0006
+Global Const $VT_DATE             = 7  ; 0x0007
+Global Const $VT_BSTR             = 8  ; 0x0008
+Global Const $VT_DISPATCH         = 9  ; 0x0009
+Global Const $VT_ERROR            = 10 ; 0x000A
+Global Const $VT_BOOL             = 11 ; 0x000B
+Global Const $VT_VARIANT          = 12 ; 0x000C
+Global Const $VT_UNKNOWN          = 13 ; 0x000D
+Global Const $VT_DECIMAL          = 14 ; 0x000E
+Global Const $VT_I1               = 16 ; 0x0010
+Global Const $VT_UI1              = 17 ; 0x0011
+Global Const $VT_UI2              = 18 ; 0x0012
+Global Const $VT_UI4              = 19 ; 0x0013
+Global Const $VT_I8               = 20 ; 0x0014
+Global Const $VT_UI8              = 21 ; 0x0015
+Global Const $VT_INT              = 22 ; 0x0016
+Global Const $VT_UINT             = 23 ; 0x0017
+Global Const $VT_VOID             = 24 ; 0x0018
+Global Const $VT_HRESULT          = 25 ; 0x0019
+Global Const $VT_PTR              = 26 ; 0x001A
+Global Const $VT_SAFEARRAY        = 27 ; 0x001B
+Global Const $VT_CARRAY           = 28 ; 0x001C
+Global Const $VT_USERDEFINED      = 29 ; 0x001D
+Global Const $VT_LPSTR            = 30 ; 0x001E
+Global Const $VT_LPWSTR           = 31 ; 0x001F
+Global Const $VT_RECORD           = 36 ; 0x0024
+Global Const $VT_INT_PTR          = 37 ; 0x0025
+Global Const $VT_UINT_PTR         = 38 ; 0x0026
+Global Const $VT_FILETIME         = 64 ; 0x0040
+Global Const $VT_BLOB             = 65 ; 0x0041
+Global Const $VT_STREAM           = 66 ; 0x0042
+Global Const $VT_STORAGE          = 67 ; 0x0043
+Global Const $VT_STREAMED_OBJECT  = 68 ; 0x0044
+Global Const $VT_STORED_OBJECT    = 69 ; 0x0045
+Global Const $VT_BLOB_OBJECT      = 70 ; 0x0046
+Global Const $VT_CF               = 71 ; 0x0047
+Global Const $VT_CLSID            = 72 ; 0x0048
+Global Const $VT_VERSIONED_STREAM = 73 ; 0x0049
+Global Const $VT_BSTR_BLOB        = 0xFFF
+Global Const $VT_VECTOR           = 0x1000
+Global Const $VT_ARRAY            = 0x2000
+Global Const $VT_BYREF            = 0x4000
+Global Const $VT_RESERVED         = 0x8000
+Global Const $VT_ILLEGAL          = 0xFFFF
+Global Const $VT_ILLEGALMASKED    = 0xFFF
+Global Const $VT_TYPEMASK         = 0xFFF
+
+; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
+
+
+;Global Const $tagVARIANT = "word vt;word r1;word r2;word r3;ptr data; ptr"
+; The structure takes up 16/24 bytes when running 32/64 bit
+; Space for the data element at the end represents 2 pointers
+; This is 8 bytes running 32 bit and 16 bytes running 64 bit
+
+#cs
+DECIMAL structure
+https://msdn.microsoft.com/en-us/library/windows/desktop/ms221061(v=vs.85).aspx
+
+From oledb.h:
+typedef struct tagDEC {
+    USHORT wReserved;			; vt,     2 bytes
+    union {								; r1,     2 bytes
+        struct {
+            BYTE scale;
+            BYTE sign;
+        };
+        USHORT signscale;
+    };
+    ULONG Hi32;						; r2, r3, 4 bytes
+    union {								; data,   8 bytes
+        struct {
+#ifdef _MAC
+            ULONG Mid32;
+            ULONG Lo32;
+#else
+            ULONG Lo32;
+            ULONG Mid32;
+#endif
+        };
+        ULONGLONG Lo64;
+    };
+} DECIMAL;
+#ce
+
+Global Const $tagDEC = "word wReserved;byte scale;byte sign;uint Hi32;uint Lo32;uint Mid32"
+
+
+; >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+
+; Variant functions
+; Copied from AutoItObject.au3 by the AutoItObject-Team: monoceres, trancexx, Kip, ProgAndy
+; https://www.autoitscript.com/forum/index.php?showtopic=110379
+
+; #FUNCTION# ====================================================================================================================
+; Name...........: VariantClear
+; Description ...: Clears the value of a variant
+; Syntax.........: VariantClear($pvarg)
+; Parameters ....: $pvarg       - the VARIANT to clear
+; Return values .: Success      - 0
+;                  Failure      - nonzero
+; Author ........: Prog@ndy
+; Modified.......:
+; Remarks .......:
+; Related .......: VariantFree
+; Link ..........: http://msdn.microsoft.com/en-us/library/ms221165.aspx
+; Example .......:
+; ===============================================================================================================================
+Func VariantClear($pvarg)
+	; Author: Prog@ndy
+	Local $aCall = DllCall("OleAut32.dll", "long", "VariantClear", "ptr", $pvarg)
+	If @error Then Return SetError(1, 0, 1)
+	Return $aCall[0]
+EndFunc
+
+; #FUNCTION# ====================================================================================================================
+; Name...........: VariantCopy
+; Description ...: Copies a VARIANT to another
+; Syntax.........: VariantCopy($pvargDest, $pvargSrc)
+; Parameters ....: $pvargDest   - Destionation variant
+;                  $pvargSrc    - Source variant
+; Return values .: Success      - 0
+;                  Failure      - nonzero
+; Author ........: Prog@ndy
+; Modified.......:
+; Remarks .......:
+; Related .......: VariantRead
+; Link ..........: http://msdn.microsoft.com/en-us/library/ms221697.aspx
+; Example .......:
+; ===============================================================================================================================
+Func VariantCopy($pvargDest, $pvargSrc)
+	; Author: Prog@ndy
+	Local $aCall = DllCall("OleAut32.dll", "long", "VariantCopy", "ptr", $pvargDest, 'ptr', $pvargSrc)
+	If @error Then Return SetError(1, 0, 1)
+	Return $aCall[0]
+EndFunc
+
+; #FUNCTION# ====================================================================================================================
+; Name...........: VariantInit
+; Description ...: Initializes a variant.
+; Syntax.........: VariantInit($pvarg)
+; Parameters ....: $pvarg       - the VARIANT to initialize
+; Return values .: Success      - 0
+;                  Failure      - nonzero
+; Author ........: Prog@ndy
+; Modified.......:
+; Remarks .......:
+; Related .......: VariantClear
+; Link ..........: http://msdn.microsoft.com/en-us/library/ms221402.aspx
+; Example .......:
+; ===============================================================================================================================
+Func VariantInit($pvarg)
+	; Author: Prog@ndy
+	Local $aCall = DllCall("OleAut32.dll", "long", "VariantInit", "ptr", $pvarg)
+	If @error Then Return SetError(1, 0, 1)
+	Return $aCall[0]
+EndFunc
+
+; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
+
+
+Func VariantChangeType( $pVarDest, $pVarSrc, $wFlags, $vt )
+	Local $aRet = DllCall( "OleAut32.dll", "long", "VariantChangeType", "ptr", $pVarDest, "ptr", $pVarSrc, "word", $wFlags, "word", $vt )
+	If @error Then Return SetError(1,0,1)
+	Return $aRet[0]
+EndFunc
+
+Func VariantChangeTypeEx( $pVarDest, $pVarSrc, $lcid, $wFlags, $vt )
+	Local $aRet = DllCall( "OleAut32.dll", "long", "VariantChangeTypeEx", "ptr", $pVarDest, "ptr", $pVarSrc, "word", $lcid, "word", $wFlags, "word", $vt )
+	If @error Then Return SetError(1,0,1)
+	Return $aRet[0]
+EndFunc
+
+Func VarAdd( $pVarLeft, $pVarRight, $pVarResult )
+	Local $aRet = DllCall( "OleAut32.dll", "long", "VarAdd", "ptr", $pVarLeft, "ptr", $pVarRight, "ptr", $pVarResult )
+	If @error Then Return SetError(1,0,1)
+	Return $aRet[0]
+EndFunc
+
+Func VarSub( $pVarLeft, $pVarRight, $pVarResult )
+	Local $aRet = DllCall( "OleAut32.dll", "long", "VarSub", "ptr", $pVarLeft, "ptr", $pVarRight, "ptr", $pVarResult )
+	If @error Then Return SetError(1,0,1)
+	Return $aRet[0]
+EndFunc
+
+
+; >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+
+; BSTR (basic string) functions
+; Copied from AutoItObject.au3 by the AutoItObject-Team: monoceres, trancexx, Kip, ProgAndy
+; https://www.autoitscript.com/forum/index.php?showtopic=110379
+
+Func SysAllocString( $str )
+	Local $aRet = DllCall( "OleAut32.dll", "ptr", "SysAllocString", "wstr", $str )
+	If @error Then Return SetError(1, 0, 0)
+	Return $aRet[0]
+EndFunc
+
+Func SysFreeString( $pBSTR )
+	If Not $pBSTR Then Return SetError(1, 0, 0)
+	DllCall( "OleAut32.dll", "none", "SysFreeString", "ptr", $pBSTR )
+	If @error Then Return SetError(2, 0, 0)
+EndFunc
+
+Func SysReadString( $pBSTR, $iLen = -1 )
+	If Not $pBSTR Then Return SetError(1, 0, "")
+	If $iLen < 1 Then $iLen = SysStringLen( $pBSTR )
+	If $iLen < 1 Then Return SetError(2, 0, "")
+	Return DllStructGetData( DllStructCreate( "wchar[" & $iLen & "]", $pBSTR ), 1 )
+EndFunc
+
+Func SysStringLen( $pBSTR )
+	If Not $pBSTR Then Return SetError(1, 0, 0)
+	Local $aRet = DllCall( "OleAut32.dll", "uint", "SysStringLen", "ptr", $pBSTR )
+	If @error Then Return SetError(2, 0, 0)
+	Return $aRet[0]
+EndFunc
+
+; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

+ 914 - 0
VA-2.3/VA.ahk

@@ -0,0 +1,914 @@
+; VA v2.3
+
+;
+; MASTER CONTROLS
+;
+
+VA_GetMasterVolume(channel="", device_desc="playback")
+{
+    if ! aev := VA_GetAudioEndpointVolume(device_desc)
+        return
+    if channel =
+        VA_IAudioEndpointVolume_GetMasterVolumeLevelScalar(aev, vol)
+    else
+        VA_IAudioEndpointVolume_GetChannelVolumeLevelScalar(aev, channel-1, vol)
+    ObjRelease(aev)
+    return Round(vol*100,3)
+}
+
+VA_SetMasterVolume(vol, channel="", device_desc="playback")
+{
+    vol := vol>100 ? 100 : vol<0 ? 0 : vol
+    if ! aev := VA_GetAudioEndpointVolume(device_desc)
+        return
+    if channel =
+        VA_IAudioEndpointVolume_SetMasterVolumeLevelScalar(aev, vol/100)
+    else
+        VA_IAudioEndpointVolume_SetChannelVolumeLevelScalar(aev, channel-1, vol/100)
+    ObjRelease(aev)
+}
+
+VA_GetMasterChannelCount(device_desc="playback")
+{
+    if ! aev := VA_GetAudioEndpointVolume(device_desc)
+        return
+    VA_IAudioEndpointVolume_GetChannelCount(aev, count)
+    ObjRelease(aev)
+    return count
+}
+
+VA_SetMasterMute(mute, device_desc="playback")
+{
+    if ! aev := VA_GetAudioEndpointVolume(device_desc)
+        return
+    VA_IAudioEndpointVolume_SetMute(aev, mute)
+    ObjRelease(aev)
+}
+
+VA_GetMasterMute(device_desc="playback")
+{
+    if ! aev := VA_GetAudioEndpointVolume(device_desc)
+        return
+    VA_IAudioEndpointVolume_GetMute(aev, mute)
+    ObjRelease(aev)
+    return mute
+}
+
+;
+; SUBUNIT CONTROLS
+;
+
+VA_GetVolume(subunit_desc="1", channel="", device_desc="playback")
+{
+    if ! avl := VA_GetDeviceSubunit(device_desc, subunit_desc, "{7FB7B48F-531D-44A2-BCB3-5AD5A134B3DC}")
+        return
+    VA_IPerChannelDbLevel_GetChannelCount(avl, channel_count)
+    if channel =
+    {
+        vol = 0
+        
+        Loop, %channel_count%
+        {
+            VA_IPerChannelDbLevel_GetLevelRange(avl, A_Index-1, min_dB, max_dB, step_dB)
+            VA_IPerChannelDbLevel_GetLevel(avl, A_Index-1, this_vol)
+            this_vol := VA_dB2Scalar(this_vol, min_dB, max_dB)
+            
+            ; "Speakers Properties" reports the highest channel as the volume.
+            if (this_vol > vol)
+                vol := this_vol
+        }
+    }
+    else if channel between 1 and channel_count
+    {
+        channel -= 1
+        VA_IPerChannelDbLevel_GetLevelRange(avl, channel, min_dB, max_dB, step_dB)
+        VA_IPerChannelDbLevel_GetLevel(avl, channel, vol)
+        vol := VA_dB2Scalar(vol, min_dB, max_dB)
+    }
+    ObjRelease(avl)
+    return vol
+}
+
+VA_SetVolume(vol, subunit_desc="1", channel="", device_desc="playback")
+{
+    if ! avl := VA_GetDeviceSubunit(device_desc, subunit_desc, "{7FB7B48F-531D-44A2-BCB3-5AD5A134B3DC}")
+        return
+    
+    vol := vol<0 ? 0 : vol>100 ? 100 : vol
+    
+    VA_IPerChannelDbLevel_GetChannelCount(avl, channel_count)
+    
+    if channel =
+    {
+        ; Simple method -- resets balance to "center":
+        ;VA_IPerChannelDbLevel_SetLevelUniform(avl, vol)
+        
+        vol_max = 0
+        
+        Loop, %channel_count%
+        {
+            VA_IPerChannelDbLevel_GetLevelRange(avl, A_Index-1, min_dB, max_dB, step_dB)
+            VA_IPerChannelDbLevel_GetLevel(avl, A_Index-1, this_vol)
+            this_vol := VA_dB2Scalar(this_vol, min_dB, max_dB)
+            
+            channel%A_Index%vol := this_vol
+            channel%A_Index%min := min_dB
+            channel%A_Index%max := max_dB
+            
+            ; Scale all channels relative to the loudest channel.
+            ; (This is how Vista's "Speakers Properties" dialog seems to work.)
+            if (this_vol > vol_max)
+                vol_max := this_vol
+        }
+        
+        Loop, %channel_count%
+        {
+            this_vol := vol_max ? channel%A_Index%vol / vol_max * vol : vol
+            this_vol := VA_Scalar2dB(this_vol/100, channel%A_Index%min, channel%A_Index%max)            
+            VA_IPerChannelDbLevel_SetLevel(avl, A_Index-1, this_vol)
+        }
+    }
+    else if channel between 1 and %channel_count%
+    {
+        channel -= 1
+        VA_IPerChannelDbLevel_GetLevelRange(avl, channel, min_dB, max_dB, step_dB)
+        VA_IPerChannelDbLevel_SetLevel(avl, channel, VA_Scalar2dB(vol/100, min_dB, max_dB))
+    }
+    ObjRelease(avl)
+}
+
+VA_GetChannelCount(subunit_desc="1", device_desc="playback")
+{
+    if ! avl := VA_GetDeviceSubunit(device_desc, subunit_desc, "{7FB7B48F-531D-44A2-BCB3-5AD5A134B3DC}")
+        return
+    VA_IPerChannelDbLevel_GetChannelCount(avl, channel_count)
+    ObjRelease(avl)
+    return channel_count
+}
+
+VA_SetMute(mute, subunit_desc="1", device_desc="playback")
+{
+    if ! amute := VA_GetDeviceSubunit(device_desc, subunit_desc, "{DF45AEEA-B74A-4B6B-AFAD-2366B6AA012E}")
+        return
+    VA_IAudioMute_SetMute(amute, mute)
+    ObjRelease(amute)
+}
+
+VA_GetMute(subunit_desc="1", device_desc="playback")
+{
+    if ! amute := VA_GetDeviceSubunit(device_desc, subunit_desc, "{DF45AEEA-B74A-4B6B-AFAD-2366B6AA012E}")
+        return
+    VA_IAudioMute_GetMute(amute, muted)
+    ObjRelease(amute)
+    return muted
+}
+
+;
+; AUDIO METERING
+;
+
+VA_GetAudioMeter(device_desc="playback")
+{
+    if ! device := VA_GetDevice(device_desc)
+        return 0
+    VA_IMMDevice_Activate(device, "{C02216F6-8C67-4B5B-9D00-D008E73E0064}", 7, 0, audioMeter)
+    ObjRelease(device)
+    return audioMeter
+}
+
+VA_GetDevicePeriod(device_desc, ByRef default_period, ByRef minimum_period="")
+{
+    defaultPeriod := minimumPeriod := 0
+    if ! device := VA_GetDevice(device_desc)
+        return false
+    VA_IMMDevice_Activate(device, "{1CB9AD4C-DBFA-4c32-B178-C2F568A703B2}", 7, 0, audioClient)
+    ObjRelease(device)
+    ; IAudioClient::GetDevicePeriod
+    DllCall(NumGet(NumGet(audioClient+0)+9*A_PtrSize), "ptr",audioClient, "int64*",default_period, "int64*",minimum_period)
+    ; Convert 100-nanosecond units to milliseconds.
+    default_period /= 10000
+    minimum_period /= 10000    
+    ObjRelease(audioClient)
+    return true
+}
+
+VA_GetAudioEndpointVolume(device_desc="playback")
+{
+    if ! device := VA_GetDevice(device_desc)
+        return 0
+    VA_IMMDevice_Activate(device, "{5CDF2C82-841E-4546-9722-0CF74078229A}", 7, 0, endpointVolume)
+    ObjRelease(device)
+    return endpointVolume
+}
+
+VA_GetDeviceSubunit(device_desc, subunit_desc, subunit_iid)
+{
+    if ! device := VA_GetDevice(device_desc)
+        return 0
+    subunit := VA_FindSubunit(device, subunit_desc, subunit_iid)
+    ObjRelease(device)
+    return subunit
+}
+
+VA_FindSubunit(device, target_desc, target_iid)
+{
+    if target_desc is integer
+        target_index := target_desc
+    else
+        RegExMatch(target_desc, "(?<_name>.*?)(?::(?<_index>\d+))?$", target)
+    ; v2.01: Since target_name is now a regular expression, default to case-insensitive mode if no options are specified.
+    if !RegExMatch(target_name,"^[^\(]+\)")
+        target_name := "i)" target_name
+    r := VA_EnumSubunits(device, "VA_FindSubunitCallback", target_name, target_iid
+            , Object(0, target_index ? target_index : 1, 1, 0))
+    return r
+}
+
+VA_FindSubunitCallback(part, interface, index)
+{
+    index[1] := index[1] + 1 ; current += 1
+    if (index[0] == index[1]) ; target == current ?
+    {
+        ObjAddRef(interface)
+        return interface
+    }
+}
+
+VA_EnumSubunits(device, callback, target_name="", target_iid="", callback_param="")
+{
+    VA_IMMDevice_Activate(device, "{2A07407E-6497-4A18-9787-32F79BD0D98F}", 7, 0, deviceTopology)
+    VA_IDeviceTopology_GetConnector(deviceTopology, 0, conn)
+    ObjRelease(deviceTopology)
+    VA_IConnector_GetConnectedTo(conn, conn_to)
+    VA_IConnector_GetDataFlow(conn, data_flow)
+    ObjRelease(conn)
+    if !conn_to
+        return ; blank to indicate error
+    part := ComObjQuery(conn_to, "{AE2DE0E4-5BCA-4F2D-AA46-5D13F8FDB3A9}") ; IID_IPart
+    ObjRelease(conn_to)
+    if !part
+        return
+    r := VA_EnumSubunitsEx(part, data_flow, callback, target_name, target_iid, callback_param)
+    ObjRelease(part)
+    return r ; value returned by callback, or zero.
+}
+
+VA_EnumSubunitsEx(part, data_flow, callback, target_name="", target_iid="", callback_param="")
+{
+    r := 0
+    
+    VA_IPart_GetPartType(part, type)
+   
+    if type = 1 ; Subunit
+    {
+        VA_IPart_GetName(part, name)
+        
+        ; v2.01: target_name is now a regular expression.
+        if RegExMatch(name, target_name)
+        {
+            if target_iid =
+                r := %callback%(part, 0, callback_param)
+            else
+                if VA_IPart_Activate(part, 7, target_iid, interface) = 0
+                {
+                    r := %callback%(part, interface, callback_param)
+                    ; The callback is responsible for calling ObjAddRef()
+                    ; if it intends to keep the interface pointer.
+                    ObjRelease(interface)
+                }
+
+            if r
+                return r ; early termination
+        }
+    }
+    
+    if data_flow = 0
+        VA_IPart_EnumPartsIncoming(part, parts)
+    else
+        VA_IPart_EnumPartsOutgoing(part, parts)
+    
+    VA_IPartsList_GetCount(parts, count)
+    Loop %count%
+    {
+        VA_IPartsList_GetPart(parts, A_Index-1, subpart)        
+        r := VA_EnumSubunitsEx(subpart, data_flow, callback, target_name, target_iid, callback_param)
+        ObjRelease(subpart)
+        if r
+            break ; early termination
+    }
+    ObjRelease(parts)
+    return r ; continue/finished enumeration
+}
+
+; device_desc = device_id
+;               | ( friendly_name | 'playback' | 'capture' ) [ ':' index ]
+VA_GetDevice(device_desc="playback")
+{
+    static CLSID_MMDeviceEnumerator := "{BCDE0395-E52F-467C-8E3D-C4579291692E}"
+        , IID_IMMDeviceEnumerator := "{A95664D2-9614-4F35-A746-DE8DB63617E6}"
+    if !(deviceEnumerator := ComObjCreate(CLSID_MMDeviceEnumerator, IID_IMMDeviceEnumerator))
+        return 0
+    
+    device := 0
+    
+    if VA_IMMDeviceEnumerator_GetDevice(deviceEnumerator, device_desc, device) = 0
+        goto VA_GetDevice_Return
+    
+    if device_desc is integer
+    {
+        m2 := device_desc
+        if m2 >= 4096 ; Probably a device pointer, passed here indirectly via VA_GetAudioMeter or such.
+        {
+            ObjAddRef(device := m2)
+            goto VA_GetDevice_Return
+        }
+    }
+    else
+        RegExMatch(device_desc, "(.*?)\s*(?::(\d+))?$", m)
+    
+    if m1 in playback,p
+        m1 := "", flow := 0 ; eRender
+    else if m1 in capture,c
+        m1 := "", flow := 1 ; eCapture
+    else if (m1 . m2) = ""  ; no name or number specified
+        m1 := "", flow := 0 ; eRender (default)
+    else
+        flow := 2 ; eAll
+    
+    if (m1 . m2) = ""   ; no name or number (maybe "playback" or "capture")
+    {
+        VA_IMMDeviceEnumerator_GetDefaultAudioEndpoint(deviceEnumerator, flow, 0, device)
+        goto VA_GetDevice_Return
+    }
+
+    VA_IMMDeviceEnumerator_EnumAudioEndpoints(deviceEnumerator, flow, 1, devices)
+    
+    if m1 =
+    {
+        VA_IMMDeviceCollection_Item(devices, m2-1, device)
+        goto VA_GetDevice_Return
+    }
+    
+    VA_IMMDeviceCollection_GetCount(devices, count)
+    index := 0
+    Loop % count
+        if VA_IMMDeviceCollection_Item(devices, A_Index-1, device) = 0
+            if InStr(VA_GetDeviceName(device), m1) && (m2 = "" || ++index = m2)
+                goto VA_GetDevice_Return
+            else
+                ObjRelease(device), device:=0
+
+VA_GetDevice_Return:
+    ObjRelease(deviceEnumerator)
+    if devices
+        ObjRelease(devices)
+    
+    return device ; may be 0
+}
+
+VA_GetDeviceName(device)
+{
+    static PKEY_Device_FriendlyName
+    if !VarSetCapacity(PKEY_Device_FriendlyName)
+        VarSetCapacity(PKEY_Device_FriendlyName, 20)
+        ,VA_GUID(PKEY_Device_FriendlyName :="{A45C254E-DF1C-4EFD-8020-67D146A850E0}")
+        ,NumPut(14, PKEY_Device_FriendlyName, 16)
+    VarSetCapacity(prop, 16)
+    VA_IMMDevice_OpenPropertyStore(device, 0, store)
+    ; store->GetValue(.., [out] prop)
+    DllCall(NumGet(NumGet(store+0)+5*A_PtrSize), "ptr", store, "ptr", &PKEY_Device_FriendlyName, "ptr", &prop)
+    ObjRelease(store)
+    VA_WStrOut(deviceName := NumGet(prop,8))
+    return deviceName
+}
+
+VA_SetDefaultEndpoint(device_desc, role)
+{
+    /* Roles:
+         eConsole        = 0  ; Default Device
+         eMultimedia     = 1
+         eCommunications = 2  ; Default Communications Device
+    */
+    if ! device := VA_GetDevice(device_desc)
+        return 0
+    if VA_IMMDevice_GetId(device, id) = 0
+    {
+        cfg := ComObjCreate("{294935CE-F637-4E7C-A41B-AB255460B862}"
+                          , "{568b9108-44bf-40b4-9006-86afe5b5a620}")
+        hr := VA_xIPolicyConfigVista_SetDefaultEndpoint(cfg, id, role)
+        ObjRelease(cfg)
+    }
+    ObjRelease(device)
+    return hr = 0
+}
+
+
+;
+; HELPERS
+;
+
+; Convert string to binary GUID structure.
+VA_GUID(ByRef guid_out, guid_in="%guid_out%") {
+    if (guid_in == "%guid_out%")
+        guid_in :=   guid_out
+    if  guid_in is integer
+        return guid_in
+    VarSetCapacity(guid_out, 16, 0)
+	DllCall("ole32\CLSIDFromString", "wstr", guid_in, "ptr", &guid_out)
+	return &guid_out
+}
+
+; Convert binary GUID structure to string.
+VA_GUIDOut(ByRef guid) {
+    VarSetCapacity(buf, 78)
+    DllCall("ole32\StringFromGUID2", "ptr", &guid, "ptr", &buf, "int", 39)
+    guid := StrGet(&buf, "UTF-16")
+}
+
+; Convert COM-allocated wide char string pointer to usable string.
+VA_WStrOut(ByRef str) {
+    str := StrGet(ptr := str, "UTF-16")
+    DllCall("ole32\CoTaskMemFree", "ptr", ptr)  ; FREES THE STRING.
+}
+
+VA_dB2Scalar(dB, min_dB, max_dB) {
+    min_s := 10**(min_dB/20), max_s := 10**(max_dB/20)
+    return ((10**(dB/20))-min_s)/(max_s-min_s)*100
+}
+
+VA_Scalar2dB(s, min_dB, max_dB) {
+    min_s := 10**(min_dB/20), max_s := 10**(max_dB/20)
+    return log((max_s-min_s)*s+min_s)*20
+}
+
+
+;
+; INTERFACE WRAPPERS
+;   Reference: Core Audio APIs in Windows Vista -- Programming Reference
+;       http://msdn2.microsoft.com/en-us/library/ms679156(VS.85).aspx
+;
+
+;
+; IMMDevice : {D666063F-1587-4E43-81F1-B948E807363F}
+;
+VA_IMMDevice_Activate(this, iid, ClsCtx, ActivationParams, ByRef Interface) {
+    return DllCall(NumGet(NumGet(this+0)+3*A_PtrSize), "ptr", this, "ptr", VA_GUID(iid), "uint", ClsCtx, "uint", ActivationParams, "ptr*", Interface)
+}
+VA_IMMDevice_OpenPropertyStore(this, Access, ByRef Properties) {
+    return DllCall(NumGet(NumGet(this+0)+4*A_PtrSize), "ptr", this, "uint", Access, "ptr*", Properties)
+}
+VA_IMMDevice_GetId(this, ByRef Id) {
+    hr := DllCall(NumGet(NumGet(this+0)+5*A_PtrSize), "ptr", this, "uint*", Id)
+    VA_WStrOut(Id)
+    return hr
+}
+VA_IMMDevice_GetState(this, ByRef State) {
+    return DllCall(NumGet(NumGet(this+0)+6*A_PtrSize), "ptr", this, "uint*", State)
+}
+
+;
+; IDeviceTopology : {2A07407E-6497-4A18-9787-32F79BD0D98F}
+;
+VA_IDeviceTopology_GetConnectorCount(this, ByRef Count) {
+    return DllCall(NumGet(NumGet(this+0)+3*A_PtrSize), "ptr", this, "uint*", Count)
+}
+VA_IDeviceTopology_GetConnector(this, Index, ByRef Connector) {
+    return DllCall(NumGet(NumGet(this+0)+4*A_PtrSize), "ptr", this, "uint", Index, "ptr*", Connector)
+}
+VA_IDeviceTopology_GetSubunitCount(this, ByRef Count) {
+    return DllCall(NumGet(NumGet(this+0)+5*A_PtrSize), "ptr", this, "uint*", Count)
+}
+VA_IDeviceTopology_GetSubunit(this, Index, ByRef Subunit) {
+    return DllCall(NumGet(NumGet(this+0)+6*A_PtrSize), "ptr", this, "uint", Index, "ptr*", Subunit)
+}
+VA_IDeviceTopology_GetPartById(this, Id, ByRef Part) {
+    return DllCall(NumGet(NumGet(this+0)+7*A_PtrSize), "ptr", this, "uint", Id, "ptr*", Part)
+}
+VA_IDeviceTopology_GetDeviceId(this, ByRef DeviceId) {
+    hr := DllCall(NumGet(NumGet(this+0)+8*A_PtrSize), "ptr", this, "uint*", DeviceId)
+    VA_WStrOut(DeviceId)
+    return hr
+}
+VA_IDeviceTopology_GetSignalPath(this, PartFrom, PartTo, RejectMixedPaths, ByRef Parts) {
+    return DllCall(NumGet(NumGet(this+0)+9*A_PtrSize), "ptr", this, "ptr", PartFrom, "ptr", PartTo, "int", RejectMixedPaths, "ptr*", Parts)
+}
+
+;
+; IConnector : {9c2c4058-23f5-41de-877a-df3af236a09e}
+;
+VA_IConnector_GetType(this, ByRef Type) {
+    return DllCall(NumGet(NumGet(this+0)+3*A_PtrSize), "ptr", this, "int*", Type)
+}
+VA_IConnector_GetDataFlow(this, ByRef Flow) {
+    return DllCall(NumGet(NumGet(this+0)+4*A_PtrSize), "ptr", this, "int*", Flow)
+}
+VA_IConnector_ConnectTo(this, ConnectTo) {
+    return DllCall(NumGet(NumGet(this+0)+5*A_PtrSize), "ptr", this, "ptr", ConnectTo)
+}
+VA_IConnector_Disconnect(this) {
+    return DllCall(NumGet(NumGet(this+0)+6*A_PtrSize), "ptr", this)
+}
+VA_IConnector_IsConnected(this, ByRef Connected) {
+    return DllCall(NumGet(NumGet(this+0)+7*A_PtrSize), "ptr", this, "int*", Connected)
+}
+VA_IConnector_GetConnectedTo(this, ByRef ConTo) {
+    return DllCall(NumGet(NumGet(this+0)+8*A_PtrSize), "ptr", this, "ptr*", ConTo)
+}
+VA_IConnector_GetConnectorIdConnectedTo(this, ByRef ConnectorId) {
+    hr := DllCall(NumGet(NumGet(this+0)+9*A_PtrSize), "ptr", this, "ptr*", ConnectorId)
+    VA_WStrOut(ConnectorId)
+    return hr
+}
+VA_IConnector_GetDeviceIdConnectedTo(this, ByRef DeviceId) {
+    hr := DllCall(NumGet(NumGet(this+0)+10*A_PtrSize), "ptr", this, "ptr*", DeviceId)
+    VA_WStrOut(DeviceId)
+    return hr
+}
+
+;
+; IPart : {AE2DE0E4-5BCA-4F2D-AA46-5D13F8FDB3A9}
+;
+VA_IPart_GetName(this, ByRef Name) {
+    hr := DllCall(NumGet(NumGet(this+0)+3*A_PtrSize), "ptr", this, "ptr*", Name)
+    VA_WStrOut(Name)
+    return hr
+}
+VA_IPart_GetLocalId(this, ByRef Id) {
+    return DllCall(NumGet(NumGet(this+0)+4*A_PtrSize), "ptr", this, "uint*", Id)
+}
+VA_IPart_GetGlobalId(this, ByRef GlobalId) {
+    hr := DllCall(NumGet(NumGet(this+0)+5*A_PtrSize), "ptr", this, "ptr*", GlobalId)
+    VA_WStrOut(GlobalId)
+    return hr
+}
+VA_IPart_GetPartType(this, ByRef PartType) {
+    return DllCall(NumGet(NumGet(this+0)+6*A_PtrSize), "ptr", this, "int*", PartType)
+}
+VA_IPart_GetSubType(this, ByRef SubType) {
+    VarSetCapacity(SubType,16,0)
+    hr := DllCall(NumGet(NumGet(this+0)+7*A_PtrSize), "ptr", this, "ptr", &SubType)
+    VA_GUIDOut(SubType)
+    return hr
+}
+VA_IPart_GetControlInterfaceCount(this, ByRef Count) {
+    return DllCall(NumGet(NumGet(this+0)+8*A_PtrSize), "ptr", this, "uint*", Count)
+}
+VA_IPart_GetControlInterface(this, Index, ByRef InterfaceDesc) {
+    return DllCall(NumGet(NumGet(this+0)+9*A_PtrSize), "ptr", this, "uint", Index, "ptr*", InterfaceDesc)
+}
+VA_IPart_EnumPartsIncoming(this, ByRef Parts) {
+    return DllCall(NumGet(NumGet(this+0)+10*A_PtrSize), "ptr", this, "ptr*", Parts)
+}
+VA_IPart_EnumPartsOutgoing(this, ByRef Parts) {
+    return DllCall(NumGet(NumGet(this+0)+11*A_PtrSize), "ptr", this, "ptr*", Parts)
+}
+VA_IPart_GetTopologyObject(this, ByRef Topology) {
+    return DllCall(NumGet(NumGet(this+0)+12*A_PtrSize), "ptr", this, "ptr*", Topology)
+}
+VA_IPart_Activate(this, ClsContext, iid, ByRef Object) {
+    return DllCall(NumGet(NumGet(this+0)+13*A_PtrSize), "ptr", this, "uint", ClsContext, "ptr", VA_GUID(iid), "ptr*", Object)
+}
+VA_IPart_RegisterControlChangeCallback(this, iid, Notify) {
+    return DllCall(NumGet(NumGet(this+0)+14*A_PtrSize), "ptr", this, "ptr", VA_GUID(iid), "ptr", Notify)
+}
+VA_IPart_UnregisterControlChangeCallback(this, Notify) {
+    return DllCall(NumGet(NumGet(this+0)+15*A_PtrSize), "ptr", this, "ptr", Notify)
+}
+
+;
+; IPartsList : {6DAA848C-5EB0-45CC-AEA5-998A2CDA1FFB}
+;
+VA_IPartsList_GetCount(this, ByRef Count) {
+    return DllCall(NumGet(NumGet(this+0)+3*A_PtrSize), "ptr", this, "uint*", Count)
+}
+VA_IPartsList_GetPart(this, INdex, ByRef Part) {
+    return DllCall(NumGet(NumGet(this+0)+4*A_PtrSize), "ptr", this, "uint", Index, "ptr*", Part)
+}
+
+;
+; IAudioEndpointVolume : {5CDF2C82-841E-4546-9722-0CF74078229A}
+;
+VA_IAudioEndpointVolume_RegisterControlChangeNotify(this, Notify) {
+    return DllCall(NumGet(NumGet(this+0)+3*A_PtrSize), "ptr", this, "ptr", Notify)
+}
+VA_IAudioEndpointVolume_UnregisterControlChangeNotify(this, Notify) {
+    return DllCall(NumGet(NumGet(this+0)+4*A_PtrSize), "ptr", this, "ptr", Notify)
+}
+VA_IAudioEndpointVolume_GetChannelCount(this, ByRef ChannelCount) {
+    return DllCall(NumGet(NumGet(this+0)+5*A_PtrSize), "ptr", this, "uint*", ChannelCount)
+}
+VA_IAudioEndpointVolume_SetMasterVolumeLevel(this, LevelDB, GuidEventContext="") {
+    return DllCall(NumGet(NumGet(this+0)+6*A_PtrSize), "ptr", this, "float", LevelDB, "ptr", VA_GUID(GuidEventContext))
+}
+VA_IAudioEndpointVolume_SetMasterVolumeLevelScalar(this, Level, GuidEventContext="") {
+    return DllCall(NumGet(NumGet(this+0)+7*A_PtrSize), "ptr", this, "float", Level, "ptr", VA_GUID(GuidEventContext))
+}
+VA_IAudioEndpointVolume_GetMasterVolumeLevel(this, ByRef LevelDB) {
+    return DllCall(NumGet(NumGet(this+0)+8*A_PtrSize), "ptr", this, "float*", LevelDB)
+}
+VA_IAudioEndpointVolume_GetMasterVolumeLevelScalar(this, ByRef Level) {
+    return DllCall(NumGet(NumGet(this+0)+9*A_PtrSize), "ptr", this, "float*", Level)
+}
+VA_IAudioEndpointVolume_SetChannelVolumeLevel(this, Channel, LevelDB, GuidEventContext="") {
+    return DllCall(NumGet(NumGet(this+0)+10*A_PtrSize), "ptr", this, "uint", Channel, "float", LevelDB, "ptr", VA_GUID(GuidEventContext))
+}
+VA_IAudioEndpointVolume_SetChannelVolumeLevelScalar(this, Channel, Level, GuidEventContext="") {
+    return DllCall(NumGet(NumGet(this+0)+11*A_PtrSize), "ptr", this, "uint", Channel, "float", Level, "ptr", VA_GUID(GuidEventContext))
+}
+VA_IAudioEndpointVolume_GetChannelVolumeLevel(this, Channel, ByRef LevelDB) {
+    return DllCall(NumGet(NumGet(this+0)+12*A_PtrSize), "ptr", this, "uint", Channel, "float*", LevelDB)
+}
+VA_IAudioEndpointVolume_GetChannelVolumeLevelScalar(this, Channel, ByRef Level) {
+    return DllCall(NumGet(NumGet(this+0)+13*A_PtrSize), "ptr", this, "uint", Channel, "float*", Level)
+}
+VA_IAudioEndpointVolume_SetMute(this, Mute, GuidEventContext="") {
+    return DllCall(NumGet(NumGet(this+0)+14*A_PtrSize), "ptr", this, "int", Mute, "ptr", VA_GUID(GuidEventContext))
+}
+VA_IAudioEndpointVolume_GetMute(this, ByRef Mute) {
+    return DllCall(NumGet(NumGet(this+0)+15*A_PtrSize), "ptr", this, "int*", Mute)
+}
+VA_IAudioEndpointVolume_GetVolumeStepInfo(this, ByRef Step, ByRef StepCount) {
+    return DllCall(NumGet(NumGet(this+0)+16*A_PtrSize), "ptr", this, "uint*", Step, "uint*", StepCount)
+}
+VA_IAudioEndpointVolume_VolumeStepUp(this, GuidEventContext="") {
+    return DllCall(NumGet(NumGet(this+0)+17*A_PtrSize), "ptr", this, "ptr", VA_GUID(GuidEventContext))
+}
+VA_IAudioEndpointVolume_VolumeStepDown(this, GuidEventContext="") {
+    return DllCall(NumGet(NumGet(this+0)+18*A_PtrSize), "ptr", this, "ptr", VA_GUID(GuidEventContext))
+}
+VA_IAudioEndpointVolume_QueryHardwareSupport(this, ByRef HardwareSupportMask) {
+    return DllCall(NumGet(NumGet(this+0)+19*A_PtrSize), "ptr", this, "uint*", HardwareSupportMask)
+}
+VA_IAudioEndpointVolume_GetVolumeRange(this, ByRef MinDB, ByRef MaxDB, ByRef IncrementDB) {
+    return DllCall(NumGet(NumGet(this+0)+20*A_PtrSize), "ptr", this, "float*", MinDB, "float*", MaxDB, "float*", IncrementDB)
+}
+
+;
+; IPerChannelDbLevel  : {C2F8E001-F205-4BC9-99BC-C13B1E048CCB}
+;   IAudioVolumeLevel : {7FB7B48F-531D-44A2-BCB3-5AD5A134B3DC}
+;   IAudioBass        : {A2B1A1D9-4DB3-425D-A2B2-BD335CB3E2E5}
+;   IAudioMidrange    : {5E54B6D7-B44B-40D9-9A9E-E691D9CE6EDF}
+;   IAudioTreble      : {0A717812-694E-4907-B74B-BAFA5CFDCA7B}
+;
+VA_IPerChannelDbLevel_GetChannelCount(this, ByRef Channels) {
+    return DllCall(NumGet(NumGet(this+0)+3*A_PtrSize), "ptr", this, "uint*", Channels)
+}
+VA_IPerChannelDbLevel_GetLevelRange(this, Channel, ByRef MinLevelDB, ByRef MaxLevelDB, ByRef Stepping) {
+    return DllCall(NumGet(NumGet(this+0)+4*A_PtrSize), "ptr", this, "uint", Channel, "float*", MinLevelDB, "float*", MaxLevelDB, "float*", Stepping)
+}
+VA_IPerChannelDbLevel_GetLevel(this, Channel, ByRef LevelDB) {
+    return DllCall(NumGet(NumGet(this+0)+5*A_PtrSize), "ptr", this, "uint", Channel, "float*", LevelDB)
+}
+VA_IPerChannelDbLevel_SetLevel(this, Channel, LevelDB, GuidEventContext="") {
+    return DllCall(NumGet(NumGet(this+0)+6*A_PtrSize), "ptr", this, "uint", Channel, "float", LevelDB, "ptr", VA_GUID(GuidEventContext))
+}
+VA_IPerChannelDbLevel_SetLevelUniform(this, LevelDB, GuidEventContext="") {
+    return DllCall(NumGet(NumGet(this+0)+7*A_PtrSize), "ptr", this, "float", LevelDB, "ptr", VA_GUID(GuidEventContext))
+}
+VA_IPerChannelDbLevel_SetLevelAllChannels(this, LevelsDB, ChannelCount, GuidEventContext="") {
+    return DllCall(NumGet(NumGet(this+0)+8*A_PtrSize), "ptr", this, "uint", LevelsDB, "uint", ChannelCount, "ptr", VA_GUID(GuidEventContext))
+}
+
+;
+; IAudioMute : {DF45AEEA-B74A-4B6B-AFAD-2366B6AA012E}
+;
+VA_IAudioMute_SetMute(this, Muted, GuidEventContext="") {
+    return DllCall(NumGet(NumGet(this+0)+3*A_PtrSize), "ptr", this, "int", Muted, "ptr", VA_GUID(GuidEventContext))
+}
+VA_IAudioMute_GetMute(this, ByRef Muted) {
+    return DllCall(NumGet(NumGet(this+0)+4*A_PtrSize), "ptr", this, "int*", Muted)
+}
+
+;
+; IAudioAutoGainControl : {85401FD4-6DE4-4b9d-9869-2D6753A82F3C}
+;
+VA_IAudioAutoGainControl_GetEnabled(this, ByRef Enabled) {
+    return DllCall(NumGet(NumGet(this+0)+3*A_PtrSize), "ptr", this, "int*", Enabled)
+}
+VA_IAudioAutoGainControl_SetEnabled(this, Enable, GuidEventContext="") {
+    return DllCall(NumGet(NumGet(this+0)+4*A_PtrSize), "ptr", this, "int", Enable, "ptr", VA_GUID(GuidEventContext))
+}
+
+;
+; IAudioMeterInformation : {C02216F6-8C67-4B5B-9D00-D008E73E0064}
+;
+VA_IAudioMeterInformation_GetPeakValue(this, ByRef Peak) {
+    return DllCall(NumGet(NumGet(this+0)+3*A_PtrSize), "ptr", this, "float*", Peak)
+}
+VA_IAudioMeterInformation_GetMeteringChannelCount(this, ByRef ChannelCount) {
+    return DllCall(NumGet(NumGet(this+0)+4*A_PtrSize), "ptr", this, "uint*", ChannelCount)
+}
+VA_IAudioMeterInformation_GetChannelsPeakValues(this, ChannelCount, PeakValues) {
+    return DllCall(NumGet(NumGet(this+0)+5*A_PtrSize), "ptr", this, "uint", ChannelCount, "ptr", PeakValues)
+}
+VA_IAudioMeterInformation_QueryHardwareSupport(this, ByRef HardwareSupportMask) {
+    return DllCall(NumGet(NumGet(this+0)+6*A_PtrSize), "ptr", this, "uint*", HardwareSupportMask)
+}
+
+;
+; IAudioClient : {1CB9AD4C-DBFA-4c32-B178-C2F568A703B2}
+;
+VA_IAudioClient_Initialize(this, ShareMode, StreamFlags, BufferDuration, Periodicity, Format, AudioSessionGuid) {
+    return DllCall(NumGet(NumGet(this+0)+3*A_PtrSize), "ptr", this, "int", ShareMode, "uint", StreamFlags, "int64", BufferDuration, "int64", Periodicity, "ptr", Format, "ptr", VA_GUID(AudioSessionGuid))
+}
+VA_IAudioClient_GetBufferSize(this, ByRef NumBufferFrames) {
+    return DllCall(NumGet(NumGet(this+0)+4*A_PtrSize), "ptr", this, "uint*", NumBufferFrames)
+}
+VA_IAudioClient_GetStreamLatency(this, ByRef Latency) {
+    return DllCall(NumGet(NumGet(this+0)+5*A_PtrSize), "ptr", this, "int64*", Latency)
+}
+VA_IAudioClient_GetCurrentPadding(this, ByRef NumPaddingFrames) {
+    return DllCall(NumGet(NumGet(this+0)+6*A_PtrSize), "ptr", this, "uint*", NumPaddingFrames)
+}
+VA_IAudioClient_IsFormatSupported(this, ShareMode, Format, ByRef ClosestMatch) {
+    return DllCall(NumGet(NumGet(this+0)+7*A_PtrSize), "ptr", this, "int", ShareMode, "ptr", Format, "ptr*", ClosestMatch)
+}
+VA_IAudioClient_GetMixFormat(this, ByRef Format) {
+    return DllCall(NumGet(NumGet(this+0)+8*A_PtrSize), "ptr", this, "uint*", Format)
+}
+VA_IAudioClient_GetDevicePeriod(this, ByRef DefaultDevicePeriod, ByRef MinimumDevicePeriod) {
+    return DllCall(NumGet(NumGet(this+0)+9*A_PtrSize), "ptr", this, "int64*", DefaultDevicePeriod, "int64*", MinimumDevicePeriod)
+}
+VA_IAudioClient_Start(this) {
+    return DllCall(NumGet(NumGet(this+0)+10*A_PtrSize), "ptr", this)
+}
+VA_IAudioClient_Stop(this) {
+    return DllCall(NumGet(NumGet(this+0)+11*A_PtrSize), "ptr", this)
+}
+VA_IAudioClient_Reset(this) {
+    return DllCall(NumGet(NumGet(this+0)+12*A_PtrSize), "ptr", this)
+}
+VA_IAudioClient_SetEventHandle(this, eventHandle) {
+    return DllCall(NumGet(NumGet(this+0)+13*A_PtrSize), "ptr", this, "ptr", eventHandle)
+}
+VA_IAudioClient_GetService(this, iid, ByRef Service) {
+    return DllCall(NumGet(NumGet(this+0)+14*A_PtrSize), "ptr", this, "ptr", VA_GUID(iid), "ptr*", Service)
+}
+
+;
+; IAudioSessionControl : {F4B1A599-7266-4319-A8CA-E70ACB11E8CD}
+;
+/*
+AudioSessionStateInactive = 0
+AudioSessionStateActive = 1
+AudioSessionStateExpired = 2
+*/
+VA_IAudioSessionControl_GetState(this, ByRef State) {
+    return DllCall(NumGet(NumGet(this+0)+3*A_PtrSize), "ptr", this, "int*", State)
+}
+VA_IAudioSessionControl_GetDisplayName(this, ByRef DisplayName) {
+    hr := DllCall(NumGet(NumGet(this+0)+4*A_PtrSize), "ptr", this, "ptr*", DisplayName)
+    VA_WStrOut(DisplayName)
+    return hr
+}
+VA_IAudioSessionControl_SetDisplayName(this, DisplayName, EventContext) {
+    return DllCall(NumGet(NumGet(this+0)+5*A_PtrSize), "ptr", this, "wstr", DisplayName, "ptr", VA_GUID(EventContext))
+}
+VA_IAudioSessionControl_GetIconPath(this, ByRef IconPath) {
+    hr := DllCall(NumGet(NumGet(this+0)+6*A_PtrSize), "ptr", this, "ptr*", IconPath)
+    VA_WStrOut(IconPath)
+    return hr
+}
+VA_IAudioSessionControl_SetIconPath(this, IconPath) {
+    return DllCall(NumGet(NumGet(this+0)+7*A_PtrSize), "ptr", this, "wstr", IconPath)
+}
+VA_IAudioSessionControl_GetGroupingParam(this, ByRef Param) {
+    VarSetCapacity(Param,16,0)
+    hr := DllCall(NumGet(NumGet(this+0)+8*A_PtrSize), "ptr", this, "ptr", &Param)
+    VA_GUIDOut(Param)
+    return hr
+}
+VA_IAudioSessionControl_SetGroupingParam(this, Param, EventContext) {
+    return DllCall(NumGet(NumGet(this+0)+9*A_PtrSize), "ptr", this, "ptr", VA_GUID(Param), "ptr", VA_GUID(EventContext))
+}
+VA_IAudioSessionControl_RegisterAudioSessionNotification(this, NewNotifications) {
+    return DllCall(NumGet(NumGet(this+0)+10*A_PtrSize), "ptr", this, "ptr", NewNotifications)
+}
+VA_IAudioSessionControl_UnregisterAudioSessionNotification(this, NewNotifications) {
+    return DllCall(NumGet(NumGet(this+0)+11*A_PtrSize), "ptr", this, "ptr", NewNotifications)
+}
+
+;
+; IAudioSessionManager : {BFA971F1-4D5E-40BB-935E-967039BFBEE4}
+;
+VA_IAudioSessionManager_GetAudioSessionControl(this, AudioSessionGuid) {
+    return DllCall(NumGet(NumGet(this+0)+3*A_PtrSize), "ptr", this, "ptr", VA_GUID(AudioSessionGuid))
+}
+VA_IAudioSessionManager_GetSimpleAudioVolume(this, AudioSessionGuid, StreamFlags, ByRef AudioVolume) {
+    return DllCall(NumGet(NumGet(this+0)+4*A_PtrSize), "ptr", this, "ptr", VA_GUID(AudioSessionGuid), "uint", StreamFlags, "uint*", AudioVolume)
+}
+
+;
+; IMMDeviceEnumerator
+;
+VA_IMMDeviceEnumerator_EnumAudioEndpoints(this, DataFlow, StateMask, ByRef Devices) {
+    return DllCall(NumGet(NumGet(this+0)+3*A_PtrSize), "ptr", this, "int", DataFlow, "uint", StateMask, "ptr*", Devices)
+}
+VA_IMMDeviceEnumerator_GetDefaultAudioEndpoint(this, DataFlow, Role, ByRef Endpoint) {
+    return DllCall(NumGet(NumGet(this+0)+4*A_PtrSize), "ptr", this, "int", DataFlow, "int", Role, "ptr*", Endpoint)
+}
+VA_IMMDeviceEnumerator_GetDevice(this, id, ByRef Device) {
+    return DllCall(NumGet(NumGet(this+0)+5*A_PtrSize), "ptr", this, "wstr", id, "ptr*", Device)
+}
+VA_IMMDeviceEnumerator_RegisterEndpointNotificationCallback(this, Client) {
+    return DllCall(NumGet(NumGet(this+0)+6*A_PtrSize), "ptr", this, "ptr", Client)
+}
+VA_IMMDeviceEnumerator_UnregisterEndpointNotificationCallback(this, Client) {
+    return DllCall(NumGet(NumGet(this+0)+7*A_PtrSize), "ptr", this, "ptr", Client)
+}
+
+;
+; IMMDeviceCollection
+;
+VA_IMMDeviceCollection_GetCount(this, ByRef Count) {
+    return DllCall(NumGet(NumGet(this+0)+3*A_PtrSize), "ptr", this, "uint*", Count)
+}
+VA_IMMDeviceCollection_Item(this, Index, ByRef Device) {
+    return DllCall(NumGet(NumGet(this+0)+4*A_PtrSize), "ptr", this, "uint", Index, "ptr*", Device)
+}
+
+;
+; IControlInterface
+;
+VA_IControlInterface_GetName(this, ByRef Name) {
+    hr := DllCall(NumGet(NumGet(this+0)+3*A_PtrSize), "ptr", this, "ptr*", Name)
+    VA_WStrOut(Name)
+    return hr
+}
+VA_IControlInterface_GetIID(this, ByRef IID) {
+    VarSetCapacity(IID,16,0)
+    hr := DllCall(NumGet(NumGet(this+0)+4*A_PtrSize), "ptr", this, "ptr", &IID)
+    VA_GUIDOut(IID)
+    return hr
+}
+
+
+/*
+    INTERFACES REQUIRING WINDOWS 7 / SERVER 2008 R2
+*/
+
+;
+; IAudioSessionControl2 : {bfb7ff88-7239-4fc9-8fa2-07c950be9c6d}
+;   extends IAudioSessionControl
+;
+VA_IAudioSessionControl2_GetSessionIdentifier(this, ByRef id) {
+    hr := DllCall(NumGet(NumGet(this+0)+12*A_PtrSize), "ptr", this, "ptr*", id)
+    VA_WStrOut(id)
+    return hr
+}
+VA_IAudioSessionControl2_GetSessionInstanceIdentifier(this, ByRef id) {
+    hr := DllCall(NumGet(NumGet(this+0)+13*A_PtrSize), "ptr", this, "ptr*", id)
+    VA_WStrOut(id)
+    return hr
+}
+VA_IAudioSessionControl2_GetProcessId(this, ByRef pid) {
+    return DllCall(NumGet(NumGet(this+0)+14*A_PtrSize), "ptr", this, "uint*", pid)
+}
+VA_IAudioSessionControl2_IsSystemSoundsSession(this) {
+    return DllCall(NumGet(NumGet(this+0)+15*A_PtrSize), "ptr", this)
+}
+VA_IAudioSessionControl2_SetDuckingPreference(this, OptOut) {
+    return DllCall(NumGet(NumGet(this+0)+16*A_PtrSize), "ptr", this, "int", OptOut)
+}
+
+;
+; IAudioSessionManager2 : {77AA99A0-1BD6-484F-8BC7-2C654C9A9B6F}
+;   extends IAudioSessionManager
+;
+VA_IAudioSessionManager2_GetSessionEnumerator(this, ByRef SessionEnum) {
+    return DllCall(NumGet(NumGet(this+0)+5*A_PtrSize), "ptr", this, "ptr*", SessionEnum)
+}
+VA_IAudioSessionManager2_RegisterSessionNotification(this, SessionNotification) {
+    return DllCall(NumGet(NumGet(this+0)+6*A_PtrSize), "ptr", this, "ptr", SessionNotification)
+}
+VA_IAudioSessionManager2_UnregisterSessionNotification(this, SessionNotification) {
+    return DllCall(NumGet(NumGet(this+0)+7*A_PtrSize), "ptr", this, "ptr", SessionNotification)
+}
+VA_IAudioSessionManager2_RegisterDuckNotification(this, SessionNotification) {
+    return DllCall(NumGet(NumGet(this+0)+8*A_PtrSize), "ptr", this, "ptr", SessionNotification)
+}
+VA_IAudioSessionManager2_UnregisterDuckNotification(this, SessionNotification) {
+    return DllCall(NumGet(NumGet(this+0)+9*A_PtrSize), "ptr", this, "ptr", SessionNotification)
+}
+
+;
+; IAudioSessionEnumerator : {E2F5BB11-0570-40CA-ACDD-3AA01277DEE8}
+;
+VA_IAudioSessionEnumerator_GetCount(this, ByRef SessionCount) {
+    return DllCall(NumGet(NumGet(this+0)+3*A_PtrSize), "ptr", this, "int*", SessionCount)
+}
+VA_IAudioSessionEnumerator_GetSession(this, SessionCount, ByRef Session) {
+    return DllCall(NumGet(NumGet(this+0)+4*A_PtrSize), "ptr", this, "int", SessionCount, "ptr*", Session)
+}
+
+
+/*
+    UNDOCUMENTED INTERFACES
+*/
+
+; Thanks to Dave Amenta for publishing this interface - http://goo.gl/6L93L
+; IID := "{568b9108-44bf-40b4-9006-86afe5b5a620}"
+; CLSID := "{294935CE-F637-4E7C-A41B-AB255460B862}"
+VA_xIPolicyConfigVista_SetDefaultEndpoint(this, DeviceId, Role) {
+    return DllCall(NumGet(NumGet(this+0)+12*A_PtrSize), "ptr", this, "wstr", DeviceId, "int", Role)
+}

+ 914 - 0
VA-2.3/VA.ahk.bak

@@ -0,0 +1,914 @@
+; VA v2.3
+
+;
+; MASTER CONTROLS
+;
+SplashTextOn 100, 100, "apad", "anyád"
+VA_GetMasterVolume(channel="", device_desc="playback")
+{
+    if ! aev := VA_GetAudioEndpointVolume(device_desc)
+        return
+    if channel =
+        VA_IAudioEndpointVolume_GetMasterVolumeLevelScalar(aev, vol)
+    else
+        VA_IAudioEndpointVolume_GetChannelVolumeLevelScalar(aev, channel-1, vol)
+    ObjRelease(aev)
+    return Round(vol*100,3)
+}
+
+VA_SetMasterVolume(vol, channel="", device_desc="playback")
+{
+    vol := vol>100 ? 100 : vol<0 ? 0 : vol
+    if ! aev := VA_GetAudioEndpointVolume(device_desc)
+        return
+    if channel =
+        VA_IAudioEndpointVolume_SetMasterVolumeLevelScalar(aev, vol/100)
+    else
+        VA_IAudioEndpointVolume_SetChannelVolumeLevelScalar(aev, channel-1, vol/100)
+    ObjRelease(aev)
+}
+
+VA_GetMasterChannelCount(device_desc="playback")
+{
+    if ! aev := VA_GetAudioEndpointVolume(device_desc)
+        return
+    VA_IAudioEndpointVolume_GetChannelCount(aev, count)
+    ObjRelease(aev)
+    return count
+}
+
+VA_SetMasterMute(mute, device_desc="playback")
+{
+    if ! aev := VA_GetAudioEndpointVolume(device_desc)
+        return
+    VA_IAudioEndpointVolume_SetMute(aev, mute)
+    ObjRelease(aev)
+}
+
+VA_GetMasterMute(device_desc="playback")
+{
+    if ! aev := VA_GetAudioEndpointVolume(device_desc)
+        return
+    VA_IAudioEndpointVolume_GetMute(aev, mute)
+    ObjRelease(aev)
+    return mute
+}
+
+;
+; SUBUNIT CONTROLS
+;
+
+VA_GetVolume(subunit_desc="1", channel="", device_desc="playback")
+{
+    if ! avl := VA_GetDeviceSubunit(device_desc, subunit_desc, "{7FB7B48F-531D-44A2-BCB3-5AD5A134B3DC}")
+        return
+    VA_IPerChannelDbLevel_GetChannelCount(avl, channel_count)
+    if channel =
+    {
+        vol = 0
+        
+        Loop, %channel_count%
+        {
+            VA_IPerChannelDbLevel_GetLevelRange(avl, A_Index-1, min_dB, max_dB, step_dB)
+            VA_IPerChannelDbLevel_GetLevel(avl, A_Index-1, this_vol)
+            this_vol := VA_dB2Scalar(this_vol, min_dB, max_dB)
+            
+            ; "Speakers Properties" reports the highest channel as the volume.
+            if (this_vol > vol)
+                vol := this_vol
+        }
+    }
+    else if channel between 1 and channel_count
+    {
+        channel -= 1
+        VA_IPerChannelDbLevel_GetLevelRange(avl, channel, min_dB, max_dB, step_dB)
+        VA_IPerChannelDbLevel_GetLevel(avl, channel, vol)
+        vol := VA_dB2Scalar(vol, min_dB, max_dB)
+    }
+    ObjRelease(avl)
+    return vol
+}
+
+VA_SetVolume(vol, subunit_desc="1", channel="", device_desc="playback")
+{
+    if ! avl := VA_GetDeviceSubunit(device_desc, subunit_desc, "{7FB7B48F-531D-44A2-BCB3-5AD5A134B3DC}")
+        return
+    
+    vol := vol<0 ? 0 : vol>100 ? 100 : vol
+    
+    VA_IPerChannelDbLevel_GetChannelCount(avl, channel_count)
+    
+    if channel =
+    {
+        ; Simple method -- resets balance to "center":
+        ;VA_IPerChannelDbLevel_SetLevelUniform(avl, vol)
+        
+        vol_max = 0
+        
+        Loop, %channel_count%
+        {
+            VA_IPerChannelDbLevel_GetLevelRange(avl, A_Index-1, min_dB, max_dB, step_dB)
+            VA_IPerChannelDbLevel_GetLevel(avl, A_Index-1, this_vol)
+            this_vol := VA_dB2Scalar(this_vol, min_dB, max_dB)
+            
+            channel%A_Index%vol := this_vol
+            channel%A_Index%min := min_dB
+            channel%A_Index%max := max_dB
+            
+            ; Scale all channels relative to the loudest channel.
+            ; (This is how Vista's "Speakers Properties" dialog seems to work.)
+            if (this_vol > vol_max)
+                vol_max := this_vol
+        }
+        
+        Loop, %channel_count%
+        {
+            this_vol := vol_max ? channel%A_Index%vol / vol_max * vol : vol
+            this_vol := VA_Scalar2dB(this_vol/100, channel%A_Index%min, channel%A_Index%max)            
+            VA_IPerChannelDbLevel_SetLevel(avl, A_Index-1, this_vol)
+        }
+    }
+    else if channel between 1 and %channel_count%
+    {
+        channel -= 1
+        VA_IPerChannelDbLevel_GetLevelRange(avl, channel, min_dB, max_dB, step_dB)
+        VA_IPerChannelDbLevel_SetLevel(avl, channel, VA_Scalar2dB(vol/100, min_dB, max_dB))
+    }
+    ObjRelease(avl)
+}
+
+VA_GetChannelCount(subunit_desc="1", device_desc="playback")
+{
+    if ! avl := VA_GetDeviceSubunit(device_desc, subunit_desc, "{7FB7B48F-531D-44A2-BCB3-5AD5A134B3DC}")
+        return
+    VA_IPerChannelDbLevel_GetChannelCount(avl, channel_count)
+    ObjRelease(avl)
+    return channel_count
+}
+
+VA_SetMute(mute, subunit_desc="1", device_desc="playback")
+{
+    if ! amute := VA_GetDeviceSubunit(device_desc, subunit_desc, "{DF45AEEA-B74A-4B6B-AFAD-2366B6AA012E}")
+        return
+    VA_IAudioMute_SetMute(amute, mute)
+    ObjRelease(amute)
+}
+
+VA_GetMute(subunit_desc="1", device_desc="playback")
+{
+    if ! amute := VA_GetDeviceSubunit(device_desc, subunit_desc, "{DF45AEEA-B74A-4B6B-AFAD-2366B6AA012E}")
+        return
+    VA_IAudioMute_GetMute(amute, muted)
+    ObjRelease(amute)
+    return muted
+}
+
+;
+; AUDIO METERING
+;
+
+VA_GetAudioMeter(device_desc="playback")
+{
+    if ! device := VA_GetDevice(device_desc)
+        return 0
+    VA_IMMDevice_Activate(device, "{C02216F6-8C67-4B5B-9D00-D008E73E0064}", 7, 0, audioMeter)
+    ObjRelease(device)
+    return audioMeter
+}
+
+VA_GetDevicePeriod(device_desc, ByRef default_period, ByRef minimum_period="")
+{
+    defaultPeriod := minimumPeriod := 0
+    if ! device := VA_GetDevice(device_desc)
+        return false
+    VA_IMMDevice_Activate(device, "{1CB9AD4C-DBFA-4c32-B178-C2F568A703B2}", 7, 0, audioClient)
+    ObjRelease(device)
+    ; IAudioClient::GetDevicePeriod
+    DllCall(NumGet(NumGet(audioClient+0)+9*A_PtrSize), "ptr",audioClient, "int64*",default_period, "int64*",minimum_period)
+    ; Convert 100-nanosecond units to milliseconds.
+    default_period /= 10000
+    minimum_period /= 10000    
+    ObjRelease(audioClient)
+    return true
+}
+
+VA_GetAudioEndpointVolume(device_desc="playback")
+{
+    if ! device := VA_GetDevice(device_desc)
+        return 0
+    VA_IMMDevice_Activate(device, "{5CDF2C82-841E-4546-9722-0CF74078229A}", 7, 0, endpointVolume)
+    ObjRelease(device)
+    return endpointVolume
+}
+
+VA_GetDeviceSubunit(device_desc, subunit_desc, subunit_iid)
+{
+    if ! device := VA_GetDevice(device_desc)
+        return 0
+    subunit := VA_FindSubunit(device, subunit_desc, subunit_iid)
+    ObjRelease(device)
+    return subunit
+}
+
+VA_FindSubunit(device, target_desc, target_iid)
+{
+    if target_desc is integer
+        target_index := target_desc
+    else
+        RegExMatch(target_desc, "(?<_name>.*?)(?::(?<_index>\d+))?$", target)
+    ; v2.01: Since target_name is now a regular expression, default to case-insensitive mode if no options are specified.
+    if !RegExMatch(target_name,"^[^\(]+\)")
+        target_name := "i)" target_name
+    r := VA_EnumSubunits(device, "VA_FindSubunitCallback", target_name, target_iid
+            , Object(0, target_index ? target_index : 1, 1, 0))
+    return r
+}
+
+VA_FindSubunitCallback(part, interface, index)
+{
+    index[1] := index[1] + 1 ; current += 1
+    if (index[0] == index[1]) ; target == current ?
+    {
+        ObjAddRef(interface)
+        return interface
+    }
+}
+
+VA_EnumSubunits(device, callback, target_name="", target_iid="", callback_param="")
+{
+    VA_IMMDevice_Activate(device, "{2A07407E-6497-4A18-9787-32F79BD0D98F}", 7, 0, deviceTopology)
+    VA_IDeviceTopology_GetConnector(deviceTopology, 0, conn)
+    ObjRelease(deviceTopology)
+    VA_IConnector_GetConnectedTo(conn, conn_to)
+    VA_IConnector_GetDataFlow(conn, data_flow)
+    ObjRelease(conn)
+    if !conn_to
+        return ; blank to indicate error
+    part := ComObjQuery(conn_to, "{AE2DE0E4-5BCA-4F2D-AA46-5D13F8FDB3A9}") ; IID_IPart
+    ObjRelease(conn_to)
+    if !part
+        return
+    r := VA_EnumSubunitsEx(part, data_flow, callback, target_name, target_iid, callback_param)
+    ObjRelease(part)
+    return r ; value returned by callback, or zero.
+}
+
+VA_EnumSubunitsEx(part, data_flow, callback, target_name="", target_iid="", callback_param="")
+{
+    r := 0
+    
+    VA_IPart_GetPartType(part, type)
+   
+    if type = 1 ; Subunit
+    {
+        VA_IPart_GetName(part, name)
+        
+        ; v2.01: target_name is now a regular expression.
+        if RegExMatch(name, target_name)
+        {
+            if target_iid =
+                r := %callback%(part, 0, callback_param)
+            else
+                if VA_IPart_Activate(part, 7, target_iid, interface) = 0
+                {
+                    r := %callback%(part, interface, callback_param)
+                    ; The callback is responsible for calling ObjAddRef()
+                    ; if it intends to keep the interface pointer.
+                    ObjRelease(interface)
+                }
+
+            if r
+                return r ; early termination
+        }
+    }
+    
+    if data_flow = 0
+        VA_IPart_EnumPartsIncoming(part, parts)
+    else
+        VA_IPart_EnumPartsOutgoing(part, parts)
+    
+    VA_IPartsList_GetCount(parts, count)
+    Loop %count%
+    {
+        VA_IPartsList_GetPart(parts, A_Index-1, subpart)        
+        r := VA_EnumSubunitsEx(subpart, data_flow, callback, target_name, target_iid, callback_param)
+        ObjRelease(subpart)
+        if r
+            break ; early termination
+    }
+    ObjRelease(parts)
+    return r ; continue/finished enumeration
+}
+
+; device_desc = device_id
+;               | ( friendly_name | 'playback' | 'capture' ) [ ':' index ]
+VA_GetDevice(device_desc="playback")
+{
+    static CLSID_MMDeviceEnumerator := "{BCDE0395-E52F-467C-8E3D-C4579291692E}"
+        , IID_IMMDeviceEnumerator := "{A95664D2-9614-4F35-A746-DE8DB63617E6}"
+    if !(deviceEnumerator := ComObjCreate(CLSID_MMDeviceEnumerator, IID_IMMDeviceEnumerator))
+        return 0
+    
+    device := 0
+    
+    if VA_IMMDeviceEnumerator_GetDevice(deviceEnumerator, device_desc, device) = 0
+        goto VA_GetDevice_Return
+    
+    if device_desc is integer
+    {
+        m2 := device_desc
+        if m2 >= 4096 ; Probably a device pointer, passed here indirectly via VA_GetAudioMeter or such.
+        {
+            ObjAddRef(device := m2)
+            goto VA_GetDevice_Return
+        }
+    }
+    else
+        RegExMatch(device_desc, "(.*?)\s*(?::(\d+))?$", m)
+    
+    if m1 in playback,p
+        m1 := "", flow := 0 ; eRender
+    else if m1 in capture,c
+        m1 := "", flow := 1 ; eCapture
+    else if (m1 . m2) = ""  ; no name or number specified
+        m1 := "", flow := 0 ; eRender (default)
+    else
+        flow := 2 ; eAll
+    
+    if (m1 . m2) = ""   ; no name or number (maybe "playback" or "capture")
+    {
+        VA_IMMDeviceEnumerator_GetDefaultAudioEndpoint(deviceEnumerator, flow, 0, device)
+        goto VA_GetDevice_Return
+    }
+
+    VA_IMMDeviceEnumerator_EnumAudioEndpoints(deviceEnumerator, flow, 1, devices)
+    
+    if m1 =
+    {
+        VA_IMMDeviceCollection_Item(devices, m2-1, device)
+        goto VA_GetDevice_Return
+    }
+    
+    VA_IMMDeviceCollection_GetCount(devices, count)
+    index := 0
+    Loop % count
+        if VA_IMMDeviceCollection_Item(devices, A_Index-1, device) = 0
+            if InStr(VA_GetDeviceName(device), m1) && (m2 = "" || ++index = m2)
+                goto VA_GetDevice_Return
+            else
+                ObjRelease(device), device:=0
+
+VA_GetDevice_Return:
+    ObjRelease(deviceEnumerator)
+    if devices
+        ObjRelease(devices)
+    
+    return device ; may be 0
+}
+
+VA_GetDeviceName(device)
+{
+    static PKEY_Device_FriendlyName
+    if !VarSetCapacity(PKEY_Device_FriendlyName)
+        VarSetCapacity(PKEY_Device_FriendlyName, 20)
+        ,VA_GUID(PKEY_Device_FriendlyName :="{A45C254E-DF1C-4EFD-8020-67D146A850E0}")
+        ,NumPut(14, PKEY_Device_FriendlyName, 16)
+    VarSetCapacity(prop, 16)
+    VA_IMMDevice_OpenPropertyStore(device, 0, store)
+    ; store->GetValue(.., [out] prop)
+    DllCall(NumGet(NumGet(store+0)+5*A_PtrSize), "ptr", store, "ptr", &PKEY_Device_FriendlyName, "ptr", &prop)
+    ObjRelease(store)
+    VA_WStrOut(deviceName := NumGet(prop,8))
+    return deviceName
+}
+
+VA_SetDefaultEndpoint(device_desc, role)
+{
+    /* Roles:
+         eConsole        = 0  ; Default Device
+         eMultimedia     = 1
+         eCommunications = 2  ; Default Communications Device
+    */
+    if ! device := VA_GetDevice(device_desc)
+        return 0
+    if VA_IMMDevice_GetId(device, id) = 0
+    {
+        cfg := ComObjCreate("{294935CE-F637-4E7C-A41B-AB255460B862}"
+                          , "{568b9108-44bf-40b4-9006-86afe5b5a620}")
+        hr := VA_xIPolicyConfigVista_SetDefaultEndpoint(cfg, id, role)
+        ObjRelease(cfg)
+    }
+    ObjRelease(device)
+    return hr = 0
+}
+
+
+;
+; HELPERS
+;
+
+; Convert string to binary GUID structure.
+VA_GUID(ByRef guid_out, guid_in="%guid_out%") {
+    if (guid_in == "%guid_out%")
+        guid_in :=   guid_out
+    if  guid_in is integer
+        return guid_in
+    VarSetCapacity(guid_out, 16, 0)
+	DllCall("ole32\CLSIDFromString", "wstr", guid_in, "ptr", &guid_out)
+	return &guid_out
+}
+
+; Convert binary GUID structure to string.
+VA_GUIDOut(ByRef guid) {
+    VarSetCapacity(buf, 78)
+    DllCall("ole32\StringFromGUID2", "ptr", &guid, "ptr", &buf, "int", 39)
+    guid := StrGet(&buf, "UTF-16")
+}
+
+; Convert COM-allocated wide char string pointer to usable string.
+VA_WStrOut(ByRef str) {
+    str := StrGet(ptr := str, "UTF-16")
+    DllCall("ole32\CoTaskMemFree", "ptr", ptr)  ; FREES THE STRING.
+}
+
+VA_dB2Scalar(dB, min_dB, max_dB) {
+    min_s := 10**(min_dB/20), max_s := 10**(max_dB/20)
+    return ((10**(dB/20))-min_s)/(max_s-min_s)*100
+}
+
+VA_Scalar2dB(s, min_dB, max_dB) {
+    min_s := 10**(min_dB/20), max_s := 10**(max_dB/20)
+    return log((max_s-min_s)*s+min_s)*20
+}
+
+
+;
+; INTERFACE WRAPPERS
+;   Reference: Core Audio APIs in Windows Vista -- Programming Reference
+;       http://msdn2.microsoft.com/en-us/library/ms679156(VS.85).aspx
+;
+
+;
+; IMMDevice : {D666063F-1587-4E43-81F1-B948E807363F}
+;
+VA_IMMDevice_Activate(this, iid, ClsCtx, ActivationParams, ByRef Interface) {
+    return DllCall(NumGet(NumGet(this+0)+3*A_PtrSize), "ptr", this, "ptr", VA_GUID(iid), "uint", ClsCtx, "uint", ActivationParams, "ptr*", Interface)
+}
+VA_IMMDevice_OpenPropertyStore(this, Access, ByRef Properties) {
+    return DllCall(NumGet(NumGet(this+0)+4*A_PtrSize), "ptr", this, "uint", Access, "ptr*", Properties)
+}
+VA_IMMDevice_GetId(this, ByRef Id) {
+    hr := DllCall(NumGet(NumGet(this+0)+5*A_PtrSize), "ptr", this, "uint*", Id)
+    VA_WStrOut(Id)
+    return hr
+}
+VA_IMMDevice_GetState(this, ByRef State) {
+    return DllCall(NumGet(NumGet(this+0)+6*A_PtrSize), "ptr", this, "uint*", State)
+}
+
+;
+; IDeviceTopology : {2A07407E-6497-4A18-9787-32F79BD0D98F}
+;
+VA_IDeviceTopology_GetConnectorCount(this, ByRef Count) {
+    return DllCall(NumGet(NumGet(this+0)+3*A_PtrSize), "ptr", this, "uint*", Count)
+}
+VA_IDeviceTopology_GetConnector(this, Index, ByRef Connector) {
+    return DllCall(NumGet(NumGet(this+0)+4*A_PtrSize), "ptr", this, "uint", Index, "ptr*", Connector)
+}
+VA_IDeviceTopology_GetSubunitCount(this, ByRef Count) {
+    return DllCall(NumGet(NumGet(this+0)+5*A_PtrSize), "ptr", this, "uint*", Count)
+}
+VA_IDeviceTopology_GetSubunit(this, Index, ByRef Subunit) {
+    return DllCall(NumGet(NumGet(this+0)+6*A_PtrSize), "ptr", this, "uint", Index, "ptr*", Subunit)
+}
+VA_IDeviceTopology_GetPartById(this, Id, ByRef Part) {
+    return DllCall(NumGet(NumGet(this+0)+7*A_PtrSize), "ptr", this, "uint", Id, "ptr*", Part)
+}
+VA_IDeviceTopology_GetDeviceId(this, ByRef DeviceId) {
+    hr := DllCall(NumGet(NumGet(this+0)+8*A_PtrSize), "ptr", this, "uint*", DeviceId)
+    VA_WStrOut(DeviceId)
+    return hr
+}
+VA_IDeviceTopology_GetSignalPath(this, PartFrom, PartTo, RejectMixedPaths, ByRef Parts) {
+    return DllCall(NumGet(NumGet(this+0)+9*A_PtrSize), "ptr", this, "ptr", PartFrom, "ptr", PartTo, "int", RejectMixedPaths, "ptr*", Parts)
+}
+
+;
+; IConnector : {9c2c4058-23f5-41de-877a-df3af236a09e}
+;
+VA_IConnector_GetType(this, ByRef Type) {
+    return DllCall(NumGet(NumGet(this+0)+3*A_PtrSize), "ptr", this, "int*", Type)
+}
+VA_IConnector_GetDataFlow(this, ByRef Flow) {
+    return DllCall(NumGet(NumGet(this+0)+4*A_PtrSize), "ptr", this, "int*", Flow)
+}
+VA_IConnector_ConnectTo(this, ConnectTo) {
+    return DllCall(NumGet(NumGet(this+0)+5*A_PtrSize), "ptr", this, "ptr", ConnectTo)
+}
+VA_IConnector_Disconnect(this) {
+    return DllCall(NumGet(NumGet(this+0)+6*A_PtrSize), "ptr", this)
+}
+VA_IConnector_IsConnected(this, ByRef Connected) {
+    return DllCall(NumGet(NumGet(this+0)+7*A_PtrSize), "ptr", this, "int*", Connected)
+}
+VA_IConnector_GetConnectedTo(this, ByRef ConTo) {
+    return DllCall(NumGet(NumGet(this+0)+8*A_PtrSize), "ptr", this, "ptr*", ConTo)
+}
+VA_IConnector_GetConnectorIdConnectedTo(this, ByRef ConnectorId) {
+    hr := DllCall(NumGet(NumGet(this+0)+9*A_PtrSize), "ptr", this, "ptr*", ConnectorId)
+    VA_WStrOut(ConnectorId)
+    return hr
+}
+VA_IConnector_GetDeviceIdConnectedTo(this, ByRef DeviceId) {
+    hr := DllCall(NumGet(NumGet(this+0)+10*A_PtrSize), "ptr", this, "ptr*", DeviceId)
+    VA_WStrOut(DeviceId)
+    return hr
+}
+
+;
+; IPart : {AE2DE0E4-5BCA-4F2D-AA46-5D13F8FDB3A9}
+;
+VA_IPart_GetName(this, ByRef Name) {
+    hr := DllCall(NumGet(NumGet(this+0)+3*A_PtrSize), "ptr", this, "ptr*", Name)
+    VA_WStrOut(Name)
+    return hr
+}
+VA_IPart_GetLocalId(this, ByRef Id) {
+    return DllCall(NumGet(NumGet(this+0)+4*A_PtrSize), "ptr", this, "uint*", Id)
+}
+VA_IPart_GetGlobalId(this, ByRef GlobalId) {
+    hr := DllCall(NumGet(NumGet(this+0)+5*A_PtrSize), "ptr", this, "ptr*", GlobalId)
+    VA_WStrOut(GlobalId)
+    return hr
+}
+VA_IPart_GetPartType(this, ByRef PartType) {
+    return DllCall(NumGet(NumGet(this+0)+6*A_PtrSize), "ptr", this, "int*", PartType)
+}
+VA_IPart_GetSubType(this, ByRef SubType) {
+    VarSetCapacity(SubType,16,0)
+    hr := DllCall(NumGet(NumGet(this+0)+7*A_PtrSize), "ptr", this, "ptr", &SubType)
+    VA_GUIDOut(SubType)
+    return hr
+}
+VA_IPart_GetControlInterfaceCount(this, ByRef Count) {
+    return DllCall(NumGet(NumGet(this+0)+8*A_PtrSize), "ptr", this, "uint*", Count)
+}
+VA_IPart_GetControlInterface(this, Index, ByRef InterfaceDesc) {
+    return DllCall(NumGet(NumGet(this+0)+9*A_PtrSize), "ptr", this, "uint", Index, "ptr*", InterfaceDesc)
+}
+VA_IPart_EnumPartsIncoming(this, ByRef Parts) {
+    return DllCall(NumGet(NumGet(this+0)+10*A_PtrSize), "ptr", this, "ptr*", Parts)
+}
+VA_IPart_EnumPartsOutgoing(this, ByRef Parts) {
+    return DllCall(NumGet(NumGet(this+0)+11*A_PtrSize), "ptr", this, "ptr*", Parts)
+}
+VA_IPart_GetTopologyObject(this, ByRef Topology) {
+    return DllCall(NumGet(NumGet(this+0)+12*A_PtrSize), "ptr", this, "ptr*", Topology)
+}
+VA_IPart_Activate(this, ClsContext, iid, ByRef Object) {
+    return DllCall(NumGet(NumGet(this+0)+13*A_PtrSize), "ptr", this, "uint", ClsContext, "ptr", VA_GUID(iid), "ptr*", Object)
+}
+VA_IPart_RegisterControlChangeCallback(this, iid, Notify) {
+    return DllCall(NumGet(NumGet(this+0)+14*A_PtrSize), "ptr", this, "ptr", VA_GUID(iid), "ptr", Notify)
+}
+VA_IPart_UnregisterControlChangeCallback(this, Notify) {
+    return DllCall(NumGet(NumGet(this+0)+15*A_PtrSize), "ptr", this, "ptr", Notify)
+}
+
+;
+; IPartsList : {6DAA848C-5EB0-45CC-AEA5-998A2CDA1FFB}
+;
+VA_IPartsList_GetCount(this, ByRef Count) {
+    return DllCall(NumGet(NumGet(this+0)+3*A_PtrSize), "ptr", this, "uint*", Count)
+}
+VA_IPartsList_GetPart(this, INdex, ByRef Part) {
+    return DllCall(NumGet(NumGet(this+0)+4*A_PtrSize), "ptr", this, "uint", Index, "ptr*", Part)
+}
+
+;
+; IAudioEndpointVolume : {5CDF2C82-841E-4546-9722-0CF74078229A}
+;
+VA_IAudioEndpointVolume_RegisterControlChangeNotify(this, Notify) {
+    return DllCall(NumGet(NumGet(this+0)+3*A_PtrSize), "ptr", this, "ptr", Notify)
+}
+VA_IAudioEndpointVolume_UnregisterControlChangeNotify(this, Notify) {
+    return DllCall(NumGet(NumGet(this+0)+4*A_PtrSize), "ptr", this, "ptr", Notify)
+}
+VA_IAudioEndpointVolume_GetChannelCount(this, ByRef ChannelCount) {
+    return DllCall(NumGet(NumGet(this+0)+5*A_PtrSize), "ptr", this, "uint*", ChannelCount)
+}
+VA_IAudioEndpointVolume_SetMasterVolumeLevel(this, LevelDB, GuidEventContext="") {
+    return DllCall(NumGet(NumGet(this+0)+6*A_PtrSize), "ptr", this, "float", LevelDB, "ptr", VA_GUID(GuidEventContext))
+}
+VA_IAudioEndpointVolume_SetMasterVolumeLevelScalar(this, Level, GuidEventContext="") {
+    return DllCall(NumGet(NumGet(this+0)+7*A_PtrSize), "ptr", this, "float", Level, "ptr", VA_GUID(GuidEventContext))
+}
+VA_IAudioEndpointVolume_GetMasterVolumeLevel(this, ByRef LevelDB) {
+    return DllCall(NumGet(NumGet(this+0)+8*A_PtrSize), "ptr", this, "float*", LevelDB)
+}
+VA_IAudioEndpointVolume_GetMasterVolumeLevelScalar(this, ByRef Level) {
+    return DllCall(NumGet(NumGet(this+0)+9*A_PtrSize), "ptr", this, "float*", Level)
+}
+VA_IAudioEndpointVolume_SetChannelVolumeLevel(this, Channel, LevelDB, GuidEventContext="") {
+    return DllCall(NumGet(NumGet(this+0)+10*A_PtrSize), "ptr", this, "uint", Channel, "float", LevelDB, "ptr", VA_GUID(GuidEventContext))
+}
+VA_IAudioEndpointVolume_SetChannelVolumeLevelScalar(this, Channel, Level, GuidEventContext="") {
+    return DllCall(NumGet(NumGet(this+0)+11*A_PtrSize), "ptr", this, "uint", Channel, "float", Level, "ptr", VA_GUID(GuidEventContext))
+}
+VA_IAudioEndpointVolume_GetChannelVolumeLevel(this, Channel, ByRef LevelDB) {
+    return DllCall(NumGet(NumGet(this+0)+12*A_PtrSize), "ptr", this, "uint", Channel, "float*", LevelDB)
+}
+VA_IAudioEndpointVolume_GetChannelVolumeLevelScalar(this, Channel, ByRef Level) {
+    return DllCall(NumGet(NumGet(this+0)+13*A_PtrSize), "ptr", this, "uint", Channel, "float*", Level)
+}
+VA_IAudioEndpointVolume_SetMute(this, Mute, GuidEventContext="") {
+    return DllCall(NumGet(NumGet(this+0)+14*A_PtrSize), "ptr", this, "int", Mute, "ptr", VA_GUID(GuidEventContext))
+}
+VA_IAudioEndpointVolume_GetMute(this, ByRef Mute) {
+    return DllCall(NumGet(NumGet(this+0)+15*A_PtrSize), "ptr", this, "int*", Mute)
+}
+VA_IAudioEndpointVolume_GetVolumeStepInfo(this, ByRef Step, ByRef StepCount) {
+    return DllCall(NumGet(NumGet(this+0)+16*A_PtrSize), "ptr", this, "uint*", Step, "uint*", StepCount)
+}
+VA_IAudioEndpointVolume_VolumeStepUp(this, GuidEventContext="") {
+    return DllCall(NumGet(NumGet(this+0)+17*A_PtrSize), "ptr", this, "ptr", VA_GUID(GuidEventContext))
+}
+VA_IAudioEndpointVolume_VolumeStepDown(this, GuidEventContext="") {
+    return DllCall(NumGet(NumGet(this+0)+18*A_PtrSize), "ptr", this, "ptr", VA_GUID(GuidEventContext))
+}
+VA_IAudioEndpointVolume_QueryHardwareSupport(this, ByRef HardwareSupportMask) {
+    return DllCall(NumGet(NumGet(this+0)+19*A_PtrSize), "ptr", this, "uint*", HardwareSupportMask)
+}
+VA_IAudioEndpointVolume_GetVolumeRange(this, ByRef MinDB, ByRef MaxDB, ByRef IncrementDB) {
+    return DllCall(NumGet(NumGet(this+0)+20*A_PtrSize), "ptr", this, "float*", MinDB, "float*", MaxDB, "float*", IncrementDB)
+}
+
+;
+; IPerChannelDbLevel  : {C2F8E001-F205-4BC9-99BC-C13B1E048CCB}
+;   IAudioVolumeLevel : {7FB7B48F-531D-44A2-BCB3-5AD5A134B3DC}
+;   IAudioBass        : {A2B1A1D9-4DB3-425D-A2B2-BD335CB3E2E5}
+;   IAudioMidrange    : {5E54B6D7-B44B-40D9-9A9E-E691D9CE6EDF}
+;   IAudioTreble      : {0A717812-694E-4907-B74B-BAFA5CFDCA7B}
+;
+VA_IPerChannelDbLevel_GetChannelCount(this, ByRef Channels) {
+    return DllCall(NumGet(NumGet(this+0)+3*A_PtrSize), "ptr", this, "uint*", Channels)
+}
+VA_IPerChannelDbLevel_GetLevelRange(this, Channel, ByRef MinLevelDB, ByRef MaxLevelDB, ByRef Stepping) {
+    return DllCall(NumGet(NumGet(this+0)+4*A_PtrSize), "ptr", this, "uint", Channel, "float*", MinLevelDB, "float*", MaxLevelDB, "float*", Stepping)
+}
+VA_IPerChannelDbLevel_GetLevel(this, Channel, ByRef LevelDB) {
+    return DllCall(NumGet(NumGet(this+0)+5*A_PtrSize), "ptr", this, "uint", Channel, "float*", LevelDB)
+}
+VA_IPerChannelDbLevel_SetLevel(this, Channel, LevelDB, GuidEventContext="") {
+    return DllCall(NumGet(NumGet(this+0)+6*A_PtrSize), "ptr", this, "uint", Channel, "float", LevelDB, "ptr", VA_GUID(GuidEventContext))
+}
+VA_IPerChannelDbLevel_SetLevelUniform(this, LevelDB, GuidEventContext="") {
+    return DllCall(NumGet(NumGet(this+0)+7*A_PtrSize), "ptr", this, "float", LevelDB, "ptr", VA_GUID(GuidEventContext))
+}
+VA_IPerChannelDbLevel_SetLevelAllChannels(this, LevelsDB, ChannelCount, GuidEventContext="") {
+    return DllCall(NumGet(NumGet(this+0)+8*A_PtrSize), "ptr", this, "uint", LevelsDB, "uint", ChannelCount, "ptr", VA_GUID(GuidEventContext))
+}
+
+;
+; IAudioMute : {DF45AEEA-B74A-4B6B-AFAD-2366B6AA012E}
+;
+VA_IAudioMute_SetMute(this, Muted, GuidEventContext="") {
+    return DllCall(NumGet(NumGet(this+0)+3*A_PtrSize), "ptr", this, "int", Muted, "ptr", VA_GUID(GuidEventContext))
+}
+VA_IAudioMute_GetMute(this, ByRef Muted) {
+    return DllCall(NumGet(NumGet(this+0)+4*A_PtrSize), "ptr", this, "int*", Muted)
+}
+
+;
+; IAudioAutoGainControl : {85401FD4-6DE4-4b9d-9869-2D6753A82F3C}
+;
+VA_IAudioAutoGainControl_GetEnabled(this, ByRef Enabled) {
+    return DllCall(NumGet(NumGet(this+0)+3*A_PtrSize), "ptr", this, "int*", Enabled)
+}
+VA_IAudioAutoGainControl_SetEnabled(this, Enable, GuidEventContext="") {
+    return DllCall(NumGet(NumGet(this+0)+4*A_PtrSize), "ptr", this, "int", Enable, "ptr", VA_GUID(GuidEventContext))
+}
+
+;
+; IAudioMeterInformation : {C02216F6-8C67-4B5B-9D00-D008E73E0064}
+;
+VA_IAudioMeterInformation_GetPeakValue(this, ByRef Peak) {
+    return DllCall(NumGet(NumGet(this+0)+3*A_PtrSize), "ptr", this, "float*", Peak)
+}
+VA_IAudioMeterInformation_GetMeteringChannelCount(this, ByRef ChannelCount) {
+    return DllCall(NumGet(NumGet(this+0)+4*A_PtrSize), "ptr", this, "uint*", ChannelCount)
+}
+VA_IAudioMeterInformation_GetChannelsPeakValues(this, ChannelCount, PeakValues) {
+    return DllCall(NumGet(NumGet(this+0)+5*A_PtrSize), "ptr", this, "uint", ChannelCount, "ptr", PeakValues)
+}
+VA_IAudioMeterInformation_QueryHardwareSupport(this, ByRef HardwareSupportMask) {
+    return DllCall(NumGet(NumGet(this+0)+6*A_PtrSize), "ptr", this, "uint*", HardwareSupportMask)
+}
+
+;
+; IAudioClient : {1CB9AD4C-DBFA-4c32-B178-C2F568A703B2}
+;
+VA_IAudioClient_Initialize(this, ShareMode, StreamFlags, BufferDuration, Periodicity, Format, AudioSessionGuid) {
+    return DllCall(NumGet(NumGet(this+0)+3*A_PtrSize), "ptr", this, "int", ShareMode, "uint", StreamFlags, "int64", BufferDuration, "int64", Periodicity, "ptr", Format, "ptr", VA_GUID(AudioSessionGuid))
+}
+VA_IAudioClient_GetBufferSize(this, ByRef NumBufferFrames) {
+    return DllCall(NumGet(NumGet(this+0)+4*A_PtrSize), "ptr", this, "uint*", NumBufferFrames)
+}
+VA_IAudioClient_GetStreamLatency(this, ByRef Latency) {
+    return DllCall(NumGet(NumGet(this+0)+5*A_PtrSize), "ptr", this, "int64*", Latency)
+}
+VA_IAudioClient_GetCurrentPadding(this, ByRef NumPaddingFrames) {
+    return DllCall(NumGet(NumGet(this+0)+6*A_PtrSize), "ptr", this, "uint*", NumPaddingFrames)
+}
+VA_IAudioClient_IsFormatSupported(this, ShareMode, Format, ByRef ClosestMatch) {
+    return DllCall(NumGet(NumGet(this+0)+7*A_PtrSize), "ptr", this, "int", ShareMode, "ptr", Format, "ptr*", ClosestMatch)
+}
+VA_IAudioClient_GetMixFormat(this, ByRef Format) {
+    return DllCall(NumGet(NumGet(this+0)+8*A_PtrSize), "ptr", this, "uint*", Format)
+}
+VA_IAudioClient_GetDevicePeriod(this, ByRef DefaultDevicePeriod, ByRef MinimumDevicePeriod) {
+    return DllCall(NumGet(NumGet(this+0)+9*A_PtrSize), "ptr", this, "int64*", DefaultDevicePeriod, "int64*", MinimumDevicePeriod)
+}
+VA_IAudioClient_Start(this) {
+    return DllCall(NumGet(NumGet(this+0)+10*A_PtrSize), "ptr", this)
+}
+VA_IAudioClient_Stop(this) {
+    return DllCall(NumGet(NumGet(this+0)+11*A_PtrSize), "ptr", this)
+}
+VA_IAudioClient_Reset(this) {
+    return DllCall(NumGet(NumGet(this+0)+12*A_PtrSize), "ptr", this)
+}
+VA_IAudioClient_SetEventHandle(this, eventHandle) {
+    return DllCall(NumGet(NumGet(this+0)+13*A_PtrSize), "ptr", this, "ptr", eventHandle)
+}
+VA_IAudioClient_GetService(this, iid, ByRef Service) {
+    return DllCall(NumGet(NumGet(this+0)+14*A_PtrSize), "ptr", this, "ptr", VA_GUID(iid), "ptr*", Service)
+}
+
+;
+; IAudioSessionControl : {F4B1A599-7266-4319-A8CA-E70ACB11E8CD}
+;
+/*
+AudioSessionStateInactive = 0
+AudioSessionStateActive = 1
+AudioSessionStateExpired = 2
+*/
+VA_IAudioSessionControl_GetState(this, ByRef State) {
+    return DllCall(NumGet(NumGet(this+0)+3*A_PtrSize), "ptr", this, "int*", State)
+}
+VA_IAudioSessionControl_GetDisplayName(this, ByRef DisplayName) {
+    hr := DllCall(NumGet(NumGet(this+0)+4*A_PtrSize), "ptr", this, "ptr*", DisplayName)
+    VA_WStrOut(DisplayName)
+    return hr
+}
+VA_IAudioSessionControl_SetDisplayName(this, DisplayName, EventContext) {
+    return DllCall(NumGet(NumGet(this+0)+5*A_PtrSize), "ptr", this, "wstr", DisplayName, "ptr", VA_GUID(EventContext))
+}
+VA_IAudioSessionControl_GetIconPath(this, ByRef IconPath) {
+    hr := DllCall(NumGet(NumGet(this+0)+6*A_PtrSize), "ptr", this, "ptr*", IconPath)
+    VA_WStrOut(IconPath)
+    return hr
+}
+VA_IAudioSessionControl_SetIconPath(this, IconPath) {
+    return DllCall(NumGet(NumGet(this+0)+7*A_PtrSize), "ptr", this, "wstr", IconPath)
+}
+VA_IAudioSessionControl_GetGroupingParam(this, ByRef Param) {
+    VarSetCapacity(Param,16,0)
+    hr := DllCall(NumGet(NumGet(this+0)+8*A_PtrSize), "ptr", this, "ptr", &Param)
+    VA_GUIDOut(Param)
+    return hr
+}
+VA_IAudioSessionControl_SetGroupingParam(this, Param, EventContext) {
+    return DllCall(NumGet(NumGet(this+0)+9*A_PtrSize), "ptr", this, "ptr", VA_GUID(Param), "ptr", VA_GUID(EventContext))
+}
+VA_IAudioSessionControl_RegisterAudioSessionNotification(this, NewNotifications) {
+    return DllCall(NumGet(NumGet(this+0)+10*A_PtrSize), "ptr", this, "ptr", NewNotifications)
+}
+VA_IAudioSessionControl_UnregisterAudioSessionNotification(this, NewNotifications) {
+    return DllCall(NumGet(NumGet(this+0)+11*A_PtrSize), "ptr", this, "ptr", NewNotifications)
+}
+
+;
+; IAudioSessionManager : {BFA971F1-4D5E-40BB-935E-967039BFBEE4}
+;
+VA_IAudioSessionManager_GetAudioSessionControl(this, AudioSessionGuid) {
+    return DllCall(NumGet(NumGet(this+0)+3*A_PtrSize), "ptr", this, "ptr", VA_GUID(AudioSessionGuid))
+}
+VA_IAudioSessionManager_GetSimpleAudioVolume(this, AudioSessionGuid, StreamFlags, ByRef AudioVolume) {
+    return DllCall(NumGet(NumGet(this+0)+4*A_PtrSize), "ptr", this, "ptr", VA_GUID(AudioSessionGuid), "uint", StreamFlags, "uint*", AudioVolume)
+}
+
+;
+; IMMDeviceEnumerator
+;
+VA_IMMDeviceEnumerator_EnumAudioEndpoints(this, DataFlow, StateMask, ByRef Devices) {
+    return DllCall(NumGet(NumGet(this+0)+3*A_PtrSize), "ptr", this, "int", DataFlow, "uint", StateMask, "ptr*", Devices)
+}
+VA_IMMDeviceEnumerator_GetDefaultAudioEndpoint(this, DataFlow, Role, ByRef Endpoint) {
+    return DllCall(NumGet(NumGet(this+0)+4*A_PtrSize), "ptr", this, "int", DataFlow, "int", Role, "ptr*", Endpoint)
+}
+VA_IMMDeviceEnumerator_GetDevice(this, id, ByRef Device) {
+    return DllCall(NumGet(NumGet(this+0)+5*A_PtrSize), "ptr", this, "wstr", id, "ptr*", Device)
+}
+VA_IMMDeviceEnumerator_RegisterEndpointNotificationCallback(this, Client) {
+    return DllCall(NumGet(NumGet(this+0)+6*A_PtrSize), "ptr", this, "ptr", Client)
+}
+VA_IMMDeviceEnumerator_UnregisterEndpointNotificationCallback(this, Client) {
+    return DllCall(NumGet(NumGet(this+0)+7*A_PtrSize), "ptr", this, "ptr", Client)
+}
+
+;
+; IMMDeviceCollection
+;
+VA_IMMDeviceCollection_GetCount(this, ByRef Count) {
+    return DllCall(NumGet(NumGet(this+0)+3*A_PtrSize), "ptr", this, "uint*", Count)
+}
+VA_IMMDeviceCollection_Item(this, Index, ByRef Device) {
+    return DllCall(NumGet(NumGet(this+0)+4*A_PtrSize), "ptr", this, "uint", Index, "ptr*", Device)
+}
+
+;
+; IControlInterface
+;
+VA_IControlInterface_GetName(this, ByRef Name) {
+    hr := DllCall(NumGet(NumGet(this+0)+3*A_PtrSize), "ptr", this, "ptr*", Name)
+    VA_WStrOut(Name)
+    return hr
+}
+VA_IControlInterface_GetIID(this, ByRef IID) {
+    VarSetCapacity(IID,16,0)
+    hr := DllCall(NumGet(NumGet(this+0)+4*A_PtrSize), "ptr", this, "ptr", &IID)
+    VA_GUIDOut(IID)
+    return hr
+}
+
+
+/*
+    INTERFACES REQUIRING WINDOWS 7 / SERVER 2008 R2
+*/
+
+;
+; IAudioSessionControl2 : {bfb7ff88-7239-4fc9-8fa2-07c950be9c6d}
+;   extends IAudioSessionControl
+;
+VA_IAudioSessionControl2_GetSessionIdentifier(this, ByRef id) {
+    hr := DllCall(NumGet(NumGet(this+0)+12*A_PtrSize), "ptr", this, "ptr*", id)
+    VA_WStrOut(id)
+    return hr
+}
+VA_IAudioSessionControl2_GetSessionInstanceIdentifier(this, ByRef id) {
+    hr := DllCall(NumGet(NumGet(this+0)+13*A_PtrSize), "ptr", this, "ptr*", id)
+    VA_WStrOut(id)
+    return hr
+}
+VA_IAudioSessionControl2_GetProcessId(this, ByRef pid) {
+    return DllCall(NumGet(NumGet(this+0)+14*A_PtrSize), "ptr", this, "uint*", pid)
+}
+VA_IAudioSessionControl2_IsSystemSoundsSession(this) {
+    return DllCall(NumGet(NumGet(this+0)+15*A_PtrSize), "ptr", this)
+}
+VA_IAudioSessionControl2_SetDuckingPreference(this, OptOut) {
+    return DllCall(NumGet(NumGet(this+0)+16*A_PtrSize), "ptr", this, "int", OptOut)
+}
+
+;
+; IAudioSessionManager2 : {77AA99A0-1BD6-484F-8BC7-2C654C9A9B6F}
+;   extends IAudioSessionManager
+;
+VA_IAudioSessionManager2_GetSessionEnumerator(this, ByRef SessionEnum) {
+    return DllCall(NumGet(NumGet(this+0)+5*A_PtrSize), "ptr", this, "ptr*", SessionEnum)
+}
+VA_IAudioSessionManager2_RegisterSessionNotification(this, SessionNotification) {
+    return DllCall(NumGet(NumGet(this+0)+6*A_PtrSize), "ptr", this, "ptr", SessionNotification)
+}
+VA_IAudioSessionManager2_UnregisterSessionNotification(this, SessionNotification) {
+    return DllCall(NumGet(NumGet(this+0)+7*A_PtrSize), "ptr", this, "ptr", SessionNotification)
+}
+VA_IAudioSessionManager2_RegisterDuckNotification(this, SessionNotification) {
+    return DllCall(NumGet(NumGet(this+0)+8*A_PtrSize), "ptr", this, "ptr", SessionNotification)
+}
+VA_IAudioSessionManager2_UnregisterDuckNotification(this, SessionNotification) {
+    return DllCall(NumGet(NumGet(this+0)+9*A_PtrSize), "ptr", this, "ptr", SessionNotification)
+}
+
+;
+; IAudioSessionEnumerator : {E2F5BB11-0570-40CA-ACDD-3AA01277DEE8}
+;
+VA_IAudioSessionEnumerator_GetCount(this, ByRef SessionCount) {
+    return DllCall(NumGet(NumGet(this+0)+3*A_PtrSize), "ptr", this, "int*", SessionCount)
+}
+VA_IAudioSessionEnumerator_GetSession(this, SessionCount, ByRef Session) {
+    return DllCall(NumGet(NumGet(this+0)+4*A_PtrSize), "ptr", this, "int", SessionCount, "ptr*", Session)
+}
+
+
+/*
+    UNDOCUMENTED INTERFACES
+*/
+
+; Thanks to Dave Amenta for publishing this interface - http://goo.gl/6L93L
+; IID := "{568b9108-44bf-40b4-9006-86afe5b5a620}"
+; CLSID := "{294935CE-F637-4E7C-A41B-AB255460B862}"
+VA_xIPolicyConfigVista_SetDefaultEndpoint(this, DeviceId, Role) {
+    return DllCall(NumGet(NumGet(this+0)+12*A_PtrSize), "ptr", this, "wstr", DeviceId, "int", Role)
+}

+ 890 - 0
VA-2.3/VA.html

@@ -0,0 +1,890 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
+  <head>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+    <meta name="Generator" content="XN-Docs v2.03 (http://ccgi.inspiration3.plus.com/ahk/xn-docs/)" />
+    <title>Vista Audio Control Function Reference</title>
+    <style type="text/css" media="all">
+/*<![CDATA[*/
+html {
+	color: #333;
+	background: #fff;
+	font: .9em Calibri, Arial, Helvetica, sans-serif;
+}
+body { margin: 0em;  min-width: 600px; }
+h1 {
+	margin: 0em;
+	color: #fff;
+	background: #333;
+	padding: .2em .5em;
+	border-bottom: 1px solid #000;
+}
+h1 a {
+	color: #fff !important;
+	background: inherit;
+	text-decoration: none;
+}
+h2 { border-bottom: 1px solid #ddd; }
+h3.command {
+	background: #09c;
+	padding: .7em;
+	color: #fff;
+	cursor: help;
+	letter-spacing: .1em;
+	font: bold 1.2em "Courier New", Courier, monospace;
+}
+a { color: #06c; }
+a:hover { color: #936; }
+table { font-size: 1em; }
+p.descr {
+	margin: 1.5em;
+	line-height: 1.5;
+}
+span.sub {
+	color: #666;
+	background: inherit;
+}
+p.descr span.sub:before { content: ">> "; }
+table.params span.sub {
+	font-size: .75em;
+	margin-right: .5em;
+}
+div#contents {
+	width: 200px;
+	float: right;
+	border-left: 1px dashed #ddd;
+	margin-top: 2em;
+	overflow: auto;
+	padding: 10px;
+}
+div#contents div { margin-left: 1em; }
+div#contents ul {
+	list-style: square;
+	padding-left: 1em;
+}
+div#contents *:first-child { margin-top: 0em; }
+div#page {
+  position: relative;
+  margin-left: 0px;
+  margin-right: 230px;
+	width: auto;
+}
+div#page > div:not(:target) { display: none; }
+div#page > div:target { display: block; }
+div.method {
+	background: #fefefe;
+	border: 1px solid #eee;
+	margin-bottom: 2em;
+	margin-left: 0.5em;
+	padding: 1em;
+}
+div.method *:first-child { margin-top: 0em; }
+div#end {
+	font-size: .9em;
+	margin-top: 1em;
+	border-top: 1px solid #000;
+	padding: 1em;
+	color: #fff;
+	background: #666;
+}
+div#end a { color: #fff; }
+span.vers {
+	font-size: .6em;
+	color: #ccc;
+	padding-left: .3em;
+}
+table.params {
+	font-size: 1em;
+	margin-left: 3em;
+}
+table.params th {
+	text-align: left;
+	background: #eee;
+	padding: .2em;
+}
+table.params td {
+	vertical-align: top;
+	padding: .2em 1em .2em .5em;
+	background: #fff;
+	border: 1px solid #f3f3f3;
+}
+table.params td:first-child { background: #f3f3f3 !important; }
+table.params tr.returns td { background: #f3f3f3; }
+table.params tr.returns td:first-child { background: #fff !important; }
+table.dataset { margin-left: 3em; }
+table.dataset th {
+	background: #eee;
+	text-align: left;
+	padding: .2em;
+}
+table.dataset td {
+	vertical-align: top;
+	padding: .2em 1em .2em .5em;
+}
+pre.code {
+	padding: 1em;
+	font-size: 1em;
+	border: 1px dotted #999;
+	background: #fff;
+	margin-left: 2em;
+	overflow: auto;
+}
+kbd { font: 1em "Courier New", Courier, monospace; }
+code, pre.code { font: .9em "Courier New", Courier, monospace; }
+pre.code em, code em {
+	color: #060;
+	font-style: normal;
+	font-weight: bold;
+}
+pre.code kbd, code kbd {
+	color: #c00;
+	font-weight: normal;
+}
+pre.code var, code var {
+	font-style: normal;
+	font-weight: bold;
+	color: #f80;
+}
+pre.code var.prc, code var.prc {
+	font-weight: normal;
+	color: #f00;
+	font-style: italic;
+}
+pre.code strong, code strong { color: #039; }
+pre.code strong.res, code strong.res { color: #800000; }
+@media print {
+	* {
+		background: none !important;
+		color: #000 !important;
+	}
+	p.descr span.sub, div#contents { display: none; }
+	div#page { width: 100%; }
+	div#page > div:not(:target) { display: block; }
+	table.params, pre.code { margin: 0em; }
+	div.method {
+		border: none;
+		margin: 1em 0em;
+		padding: 0em;
+	}
+	pre.code { overflow: visible; }
+}
+/*]]>*/
+    </style>
+    <script type="text/javascript">
+/*<![CDATA[*/
+function tabsetup() {
+var a = document.getElementById('contents').getElementsByTagName('a'), i;
+	tabswitch(window.location.hash);
+	for (i in a) { a[i].onclick = tabswitch; }
+}
+function tabswitch(e) {
+	var d = document.getElementById('page').getElementsByTagName('div'),
+		h = typeof(e) == 'string' ? e : this.hash, id = h ? h.slice(1) : '', i;
+	for (i = 0; i < d.length; i++) { if (d[i].className == 'method') { d[i].style.display = 'none'; } }
+	if (id) { document.getElementById(id).style.display = 'block'; }
+}
+if (window.attachEvent) { window.attachEvent('onload', tabsetup); }
+/*]]>*/
+    </script>
+  </head>
+  <body>
+    <h1>
+      <a href="http://www.autohotkey.com/forum/topic23792.html">Vista Audio Control Function Reference</a><span class="vers"> (version 2.3)</span>
+    </h1>
+    <div id="contents">
+      <div>
+        <h4>Master Controls</h4>
+        <ul>
+          <li>
+            <a href="#VA_GetMasterVolume">VA_GetMasterVolume</a>
+          </li>
+          <li>
+            <a href="#VA_SetMasterVolume">VA_SetMasterVolume</a>
+          </li>
+          <li>
+            <a href="#VA_GetMasterChannelCount">VA_GetMasterChannelCount</a>
+          </li>
+          <li>
+            <a href="#VA_GetMasterMute">VA_GetMasterMute</a>
+          </li>
+          <li>
+            <a href="#VA_SetMasterMute">VA_SetMasterMute</a>
+          </li>
+        </ul>
+        <h4>Subunit Controls</h4>
+        <ul>
+          <li>
+            <a href="#VA_GetVolume">VA_GetVolume</a>
+          </li>
+          <li>
+            <a href="#VA_SetVolume">VA_SetVolume</a>
+          </li>
+          <li>
+            <a href="#VA_GetChannelCount">VA_GetChannelCount</a>
+          </li>
+          <li>
+            <a href="#VA_GetMute">VA_GetMute</a>
+          </li>
+          <li>
+            <a href="#VA_SetMute">VA_SetMute</a>
+          </li>
+        </ul>
+        <h4>Advanced</h4>
+        <ul>
+          <li>
+            <a href="#VA_GetAudioEndpointVolume">VA_GetAudioEndpointVolume</a>
+          </li>
+          <li>
+            <a href="#VA_GetAudioMeter">VA_GetAudioMeter</a>
+          </li>
+          <li>
+            <a href="#VA_GetDevice">VA_GetDevice</a>
+          </li>
+          <li>
+            <a href="#VA_GetDeviceName">VA_GetDeviceName</a>
+          </li>
+          <li>
+            <a href="#VA_GetDevicePeriod">VA_GetDevicePeriod</a>
+          </li>
+          <li>
+            <a href="#VA_GetDeviceSubunit">VA_GetDeviceSubunit</a>
+          </li>
+          <li>
+            <a href="#VA_EnumSubunits">VA_EnumSubunits</a>
+          </li>
+          <li>
+            <a href="#VA_EnumSubunitsEx">VA_EnumSubunitsEx</a>
+          </li>
+          <li>
+            <a href="#VA_FindSubunit">VA_FindSubunit</a>
+          </li>
+          <li>
+            <a href="#VA_SetDefaultEndpoint">VA_SetDefaultEndpoint</a>
+          </li>
+          <li>
+            <a href="#VA_dB2Scalar">VA_dB2Scalar</a>
+          </li>
+          <li>
+            <a href="#VA_Scalar2dB">VA_Scalar2dB</a>
+          </li>
+        </ul>
+        <h4>Other</h4>
+        <ul>
+          <li>
+            <a href="#Interface%20Functions">Interface Functions</a>
+          </li>
+        </ul>
+      </div>
+    </div>
+    <p class="descr"><br /><span class="sub">Browse through the topics in the contents list to the right.</span></p>
+    <div id="page">
+      <div class="method" id="VA_GetMasterVolume">
+        <h2>VA_GetMasterVolume</h2>
+        <p>Gets the master volume level of an audio endpoint device.</p>
+        <h3 class="command">VA_GetMasterVolume(channel, device_desc)</h3>
+        <h4>Parameters</h4>
+        <table class="params">
+          <tr class="returns">
+            <td>
+              <em>Returns</em>
+            </td>
+            <td>A value between 0.0 and 100.0, inclusive.</td>
+          </tr>
+          <tr>
+            <td>channel</td>
+            <td><span class="sub">(optional)</span>The one-based index of the channel to retrieve.</td>
+          </tr>
+          <tr>
+            <td>device_desc</td>
+            <td><span class="sub">(optional)</span>See <a href="#VA_GetDevice">VA_GetDevice</a>. Defaults to "playback".</td>
+          </tr>
+        </table>
+        <h4>Remarks</h4>
+        <p>Volume levels returned by this function follow the same curve as the Windows Vista Sound Mixer.</p>
+        <h4>Example</h4>
+        <pre class="code"><em>; Get the master volume of the default playback device.</em>
+volume := <strong>VA_GetMasterVolume</strong>()
+
+<em>; Get the volume of the first and second channels.</em>
+volume1 := <strong>VA_GetMasterVolume</strong>(1)
+volume2 := <strong>VA_GetMasterVolume</strong>(2)
+
+<em>; Get the master volume of a device by name.</em>
+lineout_volume := <strong>VA_GetMasterVolume</strong>(<kbd>""</kbd>, <kbd>"Line Out"</kbd>)
+
+<em>; Get the master volume of the default recording device.</em>
+recording_volume := <strong>VA_GetMasterVolume</strong>(<kbd>""</kbd>, <kbd>"capture"</kbd>)
+
+<strong>MsgBox</strong>, % <kbd>"Playback volume:`t"</kbd> volume
+        . <kbd>"`n  Channel 1:`t"</kbd> volume1
+        . <kbd>"`n  Channel 2:`t"</kbd> volume2
+        . <kbd>"`nLine Out volume:`t"</kbd> lineout_volume
+        . <kbd>"`nRecording volume:`t"</kbd> recording_volume
+        </pre>
+      </div>
+      <div class="method" id="VA_SetMasterVolume">
+        <h2>VA_SetMasterVolume</h2>
+        <p>Sets the master volume level of an audio endpoint device.</p>
+        <h3 class="command">VA_SetMasterVolume(vol, channel, device_desc)</h3>
+        <h4>Parameters</h4>
+        <table class="params">
+          <tr>
+            <td>vol</td>
+            <td>A value between 0.0 and 100.0, inclusive.</td>
+          </tr>
+          <tr>
+            <td>channel</td>
+            <td><span class="sub">(optional)</span>The one-based index of the channel to adjust.</td>
+          </tr>
+          <tr>
+            <td>device_desc</td>
+            <td><span class="sub">(optional)</span>See <a href="#VA_GetDevice">VA_GetDevice</a>. Defaults to "playback".</td>
+          </tr>
+        </table>
+        <h4>Remarks</h4>
+        <p>Volume levels set by this function follow the same curve as the Windows Vista Sound Mixer.</p>
+      </div>
+      <div class="method" id="VA_GetMasterChannelCount">
+        <h2>VA_GetMasterChannelCount</h2>
+        <p>Gets the number of channels an audio endpoint device has.</p>
+        <h3 class="command">VA_GetMasterChannelCount(device_desc)</h3>
+        <h4>Parameters</h4>
+        <table class="params">
+          <tr>
+            <td>device_desc</td>
+            <td><span class="sub">(optional)</span>See <a href="#VA_GetDevice">VA_GetDevice</a>. Defaults to "playback".</td>
+          </tr>
+        </table>
+        <h4>Example</h4>
+        <pre class="code"><strong>Loop</strong> % <strong>VA_GetMasterChannelCount</strong>()
+    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>
+<strong>MsgBox</strong> %Message%</pre>
+      </div>
+      <div class="method" id="VA_GetMasterMute">
+        <h2>VA_GetMasterMute</h2>
+        <p>Gets the mute status of an audio endpoint device.</p>
+        <h3 class="command">VA_GetMasterMute(device_desc)</h3>
+        <h4>Parameters</h4>
+        <table class="params">
+          <tr class="returns">
+            <td>
+              <em>Returns</em>
+            </td>
+            <td>True if the audio endpoint device is muted, otherwise false.</td>
+          </tr>
+          <tr>
+            <td>device_desc</td>
+            <td><span class="sub">(optional)</span>See <a href="#VA_GetDevice">VA_GetDevice</a>. Defaults to "playback".</td>
+          </tr>
+        </table>
+      </div>
+      <div class="method" id="VA_SetMasterMute">
+        <h2>VA_SetMasterMute</h2>
+        <p>Mutes or un-mutes an audio endpoint device.</p>
+        <h3 class="command">VA_SetMasterMute(mute, device_desc)</h3>
+        <h4>Parameters</h4>
+        <table class="params">
+          <tr>
+            <td>mute</td>
+            <td>True to mute; false to un-mute.</td>
+          </tr>
+          <tr>
+            <td>device_desc</td>
+            <td><span class="sub">(optional)</span>See <a href="#VA_GetDevice">VA_GetDevice</a>. Defaults to "playback".</td>
+          </tr>
+        </table>
+      </div>
+      <div class="method" id="VA_GetVolume">
+        <h2>VA_GetVolume</h2>
+        <p>Gets the volume level of a subunit.</p>
+        <h3 class="command">VA_GetVolume(subunit_desc, channel, device_desc)</h3>
+        <h4>Parameters</h4>
+        <table class="params">
+          <tr class="returns">
+            <td>
+              <em>Returns</em>
+            </td>
+            <td>A value between 0.0 and 100.0, inclusive.</td>
+          </tr>
+          <tr>
+            <td>subunit_desc</td>
+            <td><span class="sub">(optional)</span>See <a href="#VA_FindSubunit">VA_FindSubunit</a>. Defaults to "1".</td>
+          </tr>
+          <tr>
+            <td>channel</td>
+            <td><span class="sub">(optional)</span>The one-based index of the channel to retrieve.</td>
+          </tr>
+          <tr>
+            <td>device_desc</td>
+            <td><span class="sub">(optional)</span>See <a href="#VA_GetDevice">VA_GetDevice</a>. Defaults to "playback".</td>
+          </tr>
+        </table>
+        <h4>Remarks</h4>
+        <p>Volume levels returned by this function follow the same curve as the Sound applet in Control Panel, not the Sound Mixer.</p>
+        <h4>Example</h4>
+        <pre class="code"><em>; Note that subunit names are audio driver-specific.</em>
+<em>; The following will match "Line", "Line In", "Line Volume", etc.</em>
+linein_feedback := <strong>VA_GetVolume</strong>(<kbd>"Line"</kbd>)
+mic_feedback := <strong>VA_GetVolume</strong>(<kbd>"Mic"</kbd>, <kbd>""</kbd>, <kbd>"Line Out"</kbd>)
+<strong>MsgBox</strong>, % <kbd>"Line In feedback through default playback device: "</kbd> linein_feedback
+        . <kbd>"`nMicrophone feedback through Line Out: "</kbd> mic_feedback
+        . <kbd>"`n(Note: these may be muted.)"</kbd></pre>
+      </div>
+      <div class="method" id="VA_SetVolume">
+        <h2>VA_SetVolume</h2>
+        <p>Sets the volume level of a subunit.</p>
+        <h3 class="command">VA_SetVolume(vol, subunit_desc, channel, device_desc)</h3>
+        <h4>Parameters</h4>
+        <table class="params">
+          <tr>
+            <td>vol</td>
+            <td>A value between 0.0 and 100.0, inclusive.</td>
+          </tr>
+          <tr>
+            <td>subunit_desc</td>
+            <td><span class="sub">(optional)</span>See <a href="#VA_FindSubunit">VA_FindSubunit</a>. Defaults to "1".</td>
+          </tr>
+          <tr>
+            <td>channel</td>
+            <td><span class="sub">(optional)</span>The one-based index of the channel to retrieve.</td>
+          </tr>
+          <tr>
+            <td>device_desc</td>
+            <td><span class="sub">(optional)</span>See <a href="#VA_GetDevice">VA_GetDevice</a>. Defaults to "playback".</td>
+          </tr>
+        </table>
+        <h4>Remarks</h4>
+        <p>Volume levels set by this function follow the same curve as the Sound applet in Control Panel, not the Sound Mixer.</p>
+      </div>
+      <div class="method" id="VA_GetChannelCount">
+        <h2>VA_GetChannelCount</h2>
+        <p>Gets the number of channels a subunit has.</p>
+        <h3 class="command">VA_GetChannelCount(subunit_desc, device_desc)</h3>
+        <h4>Parameters</h4>
+        <table class="params">
+          <tr>
+            <td>subunit_desc</td>
+            <td><span class="sub">(optional)</span>See <a href="#VA_FindSubunit">VA_FindSubunit</a>. Defaults to "1".</td>
+          </tr>
+          <tr>
+            <td>device_desc</td>
+            <td><span class="sub">(optional)</span>See <a href="#VA_GetDevice">VA_GetDevice</a>. Defaults to "playback".</td>
+          </tr>
+        </table>
+      </div>
+      <div class="method" id="VA_GetMute">
+        <h2>VA_GetMute</h2>
+        <p>Gets the mute status of a subunit.</p>
+        <h3 class="command">VA_GetMute(subunit_desc, device_desc)</h3>
+        <h4>Parameters</h4>
+        <table class="params">
+          <tr class="returns">
+            <td>
+              <em>Returns</em>
+            </td>
+            <td>True if the subunit is muted, otherwise false.</td>
+          </tr>
+          <tr>
+            <td>subunit_desc</td>
+            <td><span class="sub">(optional)</span>See <a href="#VA_FindSubunit">VA_FindSubunit</a>. Defaults to "1".</td>
+          </tr>
+          <tr>
+            <td>device_desc</td>
+            <td><span class="sub">(optional)</span>See <a href="#VA_GetDevice">VA_GetDevice</a>. Defaults to "playback".</td>
+          </tr>
+        </table>
+      </div>
+      <div class="method" id="VA_SetMute">
+        <h2>VA_SetMute</h2>
+        <p>Mutes or un-mutes a subunit.</p>
+        <h3 class="command">VA_SetMute(mute, subunit_desc, device_desc)</h3>
+        <h4>Parameters</h4>
+        <table class="params">
+          <tr>
+            <td>mute</td>
+            <td>True to mute; false to un-mute.</td>
+          </tr>
+          <tr>
+            <td>subunit_desc</td>
+            <td><span class="sub">(optional)</span>See <a href="#VA_FindSubunit">VA_FindSubunit</a>. Defaults to "1".</td>
+          </tr>
+          <tr>
+            <td>device_desc</td>
+            <td><span class="sub">(optional)</span>See <a href="#VA_GetDevice">VA_GetDevice</a>. Defaults to "playback".</td>
+          </tr>
+        </table>
+      </div>
+      <div class="method" id="VA_GetAudioEndpointVolume">
+        <h2>VA_GetAudioEndpointVolume</h2>
+        <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>
+        <h3 class="command">VA_GetAudioEndpointVolume(device_desc)</h3>
+        <h4>Parameters</h4>
+        <table class="params">
+          <tr>
+            <td>device_desc</td>
+            <td><span class="sub">(optional)</span>See <a href="#VA_GetDevice">VA_GetDevice</a>. Defaults to "playback".</td>
+          </tr>
+        </table>
+        <h4>Remarks</h4>
+        <p>Use <code><strong>ObjRelease</strong>(pointer)</code> to release the interface pointer when it is no longer needed.</p>
+      </div>
+      <div class="method" id="VA_GetAudioMeter">
+        <h2>VA_GetAudioMeter</h2>
+        <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>
+        <h3 class="command">VA_GetAudioMeter(device_desc)</h3>
+        <h4>Parameters</h4>
+        <table class="params">
+          <tr>
+            <td>device_desc</td>
+            <td><span class="sub">(optional)</span>See <a href="#VA_GetDevice">VA_GetDevice</a>. Defaults to "playback".</td>
+          </tr>
+        </table>
+        <h4>Remarks</h4>
+        <p>Use <code><strong>ObjRelease</strong>(pointer)</code> to release the interface pointer when it is no longer needed.</p>
+        <h4>Example</h4>
+        <pre class="code"><var class="prc">#SingleInstance</var>, Force
+MeterLength =<kbd> 30</kbd>
+
+audioMeter := <strong>VA_GetAudioMeter</strong>()
+
+<strong>VA_IAudioMeterInformation_GetMeteringChannelCount</strong>(audioMeter, channelCount)
+
+<em>; "The peak value for each channel is recorded over one device</em>
+<em>;  period and made available during the subsequent device period."</em>
+<strong>VA_GetDevicePeriod</strong>(<kbd>"capture"</kbd>, devicePeriod)
+
+<strong>Loop</strong>
+{
+    <em>; Get the peak value across all channels.</em>
+    <strong>VA_IAudioMeterInformation_GetPeakValue</strong>(audioMeter, peakValue)    
+    meter := <strong>MakeMeter</strong>(peakValue, MeterLength)
+    
+    <em>; Get the peak values of all channels.</em>
+    <strong>VarSetCapacity</strong>(peakValues, channelCount*4)
+    <strong>VA_IAudioMeterInformation_GetChannelsPeakValues</strong>(audioMeter, channelCount, &peakValues)
+    <strong>Loop</strong> %channelCount%
+        meter .= <kbd>"`n"</kbd> <strong>MakeMeter</strong>(<strong>NumGet</strong>(peakValues, <strong class="res">A_Index</strong>*4-4, <kbd>"float"</kbd>), MeterLength)
+
+    <strong>ToolTip</strong>, %meter%
+    <strong>Sleep</strong>, %devicePeriod%
+}
+
+<strong>MakeMeter</strong>(fraction, size)
+{
+    <strong>global</strong> MeterLength
+    <strong>Loop</strong> % fraction*size
+        meter .= <kbd>"|"</kbd>
+    <strong>Loop</strong> % (1-fraction)*size
+        meter .= <kbd>"."</kbd>
+    meter .= <kbd>"  "</kbd> fraction
+    <strong>return</strong> meter
+}</pre>
+      </div>
+      <div class="method" id="VA_GetDevice">
+        <h2>VA_GetDevice</h2>
+        <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>
+        <h3 class="command">VA_GetDevice(device_desc)</h3>
+        <h4>Parameters</h4>
+        <table class="params">
+          <tr>
+            <td>device_desc</td>
+            <td>device_id | device_number | ( friendly_name | 'playback' | 'capture' ) [ ':' index ]</td>
+          </tr>
+        </table>
+        <h4>Remarks</h4>
+        <p>Use <code><strong>ObjRelease</strong>(device)</code> to release the interface pointer when it is no longer needed.</p>
+        <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>
+        <h4>Examples</h4>
+        <pre class="code">device := <strong>VA_GetDevice</strong>(<kbd>"playback"</kbd>)      <em>; default playback device</em>
+device := <strong>VA_GetDevice</strong>(<kbd>"playback:1"</kbd>)    <em>; first playback device</em>
+device := <strong>VA_GetDevice</strong>(<kbd>"nvidia:2"</kbd>)      <em>; second device whose name contains "nvidia"</em>
+device := <strong>VA_GetDevice</strong>(3)               <em>; third device</em></pre>
+        <pre class="code"><strong>VA_IMMDevice_GetId</strong>(device, device_id)   <em>; get a device id from a device pointer</em>
+<em>;...</em>
+device := <strong>VA_GetDevice</strong>(device_id)       <em>; get a device pointer from an id</em></pre>
+      </div>
+      <div class="method" id="VA_GetDeviceName">
+        <h2>VA_GetDeviceName</h2>
+        <p>Gets the friendly name of an audio endpoint device.</p>
+        <h3 class="command">VA_GetDeviceName(device)</h3>
+        <h4>Parameters</h4>
+        <table class="params">
+          <tr>
+            <td>device</td>
+            <td>A pointer to an <a href="http://msdn2.microsoft.com/en-us/library/ms679028(VS.85).aspx">IMMDevice</a> interface.</td>
+          </tr>
+        </table>
+      </div>
+      <div class="method" id="VA_GetDevicePeriod">
+        <h2>VA_GetDevicePeriod</h2>
+        <p>Retrieves the length of the periodic interval separating successive processing passes by the audio engine.</p>
+        <h3 class="command">VA_GetDevicePeriod(device_desc, default_period, minimum_period)</h3>
+        <h4>Parameters</h4>
+        <table class="params">
+          <tr class="returns">
+            <td>
+              <em>Returns</em>
+            </td>
+            <td>True on success, otherwise false.</td>
+          </tr>
+          <tr>
+            <td>device_desc</td>
+            <td>See <a href="#VA_GetDevice">VA_GetDevice</a>.</td>
+          </tr>
+          <tr>
+            <td>default_period</td>
+            <td><span class="sub">(out)</span> The default interval, in milliseconds.</td>
+          </tr>
+          <tr>
+            <td>minimum_period</td>
+            <td><span class="sub">(out)</span> The minimum interval, in milliseconds.</td>
+          </tr>
+        </table>
+      </div>
+      <div class="method" id="VA_GetDeviceSubunit">
+        <h2>VA_GetDeviceSubunit</h2>
+        <p>Finds a subunit of a device, given a device description.</p>
+        <h3 class="command">VA_GetDeviceSubunit(device_desc, subunit_desc, subunit_iid)</h3>
+        <h4>Parameters</h4>
+        <table class="params">
+          <tr class="returns">
+            <td>
+              <em>Returns</em>
+            </td>
+            <td>A pointer to the requested interface of a matching subunit, or 0 if none were found.</td>
+          </tr>
+          <tr>
+            <td>device_desc</td>
+            <td>See <a href="#VA_GetDevice">VA_GetDevice</a>.</td>
+          </tr>
+          <tr>
+            <td>subunit_desc</td>
+            <td>See <a href="#VA_FindSubunit">VA_FindSubunit</a> (target_desc).</td>
+          </tr>
+          <tr>
+            <td>subunit_iid</td>
+            <td>See <a href="#VA_FindSubunit">VA_FindSubunit</a> (target_iid).</td>
+          </tr>
+        </table>
+        <h4>Remarks</h4>
+        <p>See <a href="#VA_FindSubunit">VA_FindSubunit</a>.</p>
+      </div>
+      <div class="method" id="VA_EnumSubunits">
+        <h2>VA_EnumSubunits</h2>
+        <p>Enumerates matching subunits of a device.</p>
+        <h3 class="command">VA_EnumSubunits(device, callback, target_name, target_iid)</h3>
+        <h4>Parameters</h4>
+        <table class="params">
+          <tr class="returns">
+            <td>
+              <em>Returns</em>
+            </td>
+            <td>See <a href="#VA_EnumSubunitsEx">VA_EnumSubunitsEx</a>.</td>
+          </tr>
+          <tr>
+            <td>device</td>
+            <td>A pointer to an <a href="http://msdn2.microsoft.com/en-us/library/ms679028(VS.85).aspx">IMMDevice</a> interface.</td>
+          </tr>
+          <tr>
+            <td>callback</td>
+            <td>A callback accepting two parameters: part, interface.</td>
+          </tr>
+          <tr>
+            <td>target_name</td>
+            <td><span class="sub">(optional)</span>The full or partial friendly name of a subunit or subunits.</td>
+          </tr>
+          <tr>
+            <td>target_iid</td>
+            <td><span class="sub">(optional)</span>The ID of an interface which matching subunits must support.</td>
+          </tr>
+        </table>
+        <h4>Remarks</h4>
+        <p>See <a href="#VA_EnumSubunitsEx">VA_EnumSubunitsEx</a>.</p>
+      </div>
+      <div class="method" id="VA_EnumSubunitsEx">
+        <h2>VA_EnumSubunitsEx</h2>
+        <p>Enumerates matching subunits of a part (subunit or connector).</p>
+        <h3 class="command">VA_EnumSubunitsEx(part, data_flow, callback, target_name, target_iid)</h3>
+        <h4>Parameters</h4>
+        <table class="params">
+          <tr class="returns">
+            <td>
+              <em>Returns</em>
+            </td>
+            <td>See Remarks.</td>
+          </tr>
+          <tr>
+            <td>part</td>
+            <td>A pointer to an <a href="http://msdn2.microsoft.com/en-us/library/ms679050(VS.85).aspx">IPart</a> interface.</td>
+          </tr>
+          <tr>
+            <td>data_flow</td>
+            <td>0 to enumerate incoming parts; 1 to enumerate outgoing parts.</td>
+          </tr>
+          <tr>
+            <td>callback</td>
+            <td>A callback accepting two parameters: part, interface.</td>
+          </tr>
+          <tr>
+            <td>target_name</td>
+            <td><span class="sub">(optional)</span>The full or partial friendly name of a subunit or subunits.</td>
+          </tr>
+          <tr>
+            <td>target_iid</td>
+            <td><span class="sub">(optional)</span>The ID of an interface which matching subunits must support.</td>
+          </tr>
+        </table>
+        <h4>Remarks</h4>
+        <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>
+      </div>
+      <div class="method" id="VA_FindSubunit">
+        <h2>VA_FindSubunit</h2>
+        <p>Finds a subunit of a device, given a device pointer.</p>
+        <h3 class="command">VA_FindSubunit(device, target_desc, target_iid)</h3>
+        <h4>Parameters</h4>
+        <table class="params">
+          <tr class="returns">
+            <td>
+              <em>Returns</em>
+            </td>
+            <td>If a matching subunit is found, the return value is a pointer to the requested interface. Otherwise, the return value is 0.</td>
+          </tr>
+          <tr>
+            <td>device</td>
+            <td>A pointer to an <a href="http://msdn2.microsoft.com/en-us/library/ms679028(VS.85).aspx">IMMDevice</a> interface.</td>
+          </tr>
+          <tr>
+            <td>target_desc</td>
+            <td>friendly_name | index | friendly_name:index</td>
+          </tr>
+          <tr>
+            <td>target_iid</td>
+            <td>An interface ID.</td>
+          </tr>
+        </table>
+        <h4>Remarks</h4>
+        <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>
+      </div>
+      <div class="method" id="VA_SetDefaultEndpoint">
+        <p>Sets the default audio endpoint for a given role.  Requires v2.3 or later.</p>
+        <h3 class="command">VA_SetDefaultEndpoint(device_desc, role)</h3>
+        <h4>Parameters</h4>
+        <table class="params">
+          <tr class="returns">
+            <td>
+              <em>Returns</em>
+            </td>
+            <td></td>
+          </tr>
+          <tr>
+            <td>device_desc</td>
+            <td>See <a href="#VA_GetDevice">VA_GetDevice</a>.</td>
+          </tr>
+          <tr>
+            <td>role</td>
+            <td>One of the following integer values:<br>
+            <strong>0</strong>: eConsole - what Windows calls the "Default Device".<br>
+            <strong>1</strong>: eMultimedia<br>
+            <strong>2</strong>: eCommunications - what Windows calls the "Default Communication Device".</td>
+          </tr>
+        </table>
+        <h4>Remarks</h4>
+        <p>This function relies on undocumented interfaces and therefore isn't guaranteed to work.</p>
+      </div>
+      <div class="method" id="VA_dB2Scalar">
+        <h2>VA_dB2Scalar</h2>
+        <p>Converts a decibel value to a scalar value.</p>
+        <h3 class="command">VA_dB2Scalar(dB, min_dB, max_dB)</h3>
+        <h4>Parameters</h4>
+        <table class="params">
+          <tr class="returns">
+            <td>
+              <em>Returns</em>
+            </td>
+            <td>A value between 0.0 and 1.0.</td>
+          </tr>
+          <tr>
+            <td>dB</td>
+            <td>A decibel value.</td>
+          </tr>
+          <tr>
+            <td>min_dB</td>
+            <td>Minimum decibel value.</td>
+          </tr>
+          <tr>
+            <td>max_dB</td>
+            <td>Maximum decibel value.</td>
+          </tr>
+        </table>
+        <h4>Remarks</h4>
+        <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>
+      </div>
+      <div class="method" id="VA_Scalar2dB">
+        <h2>VA_Scalar2dB</h2>
+        <p>Converts a scalar value to a decibel value.</p>
+        <h3 class="command">VA_Scalar2dB(s, min_dB, max_dB)</h3>
+        <h4>Parameters</h4>
+        <table class="params">
+          <tr class="returns">
+            <td>
+              <em>Returns</em>
+            </td>
+            <td>A decibel value.</td>
+          </tr>
+          <tr>
+            <td>s</td>
+            <td>A value between 0.0 and 1.0.</td>
+          </tr>
+          <tr>
+            <td>min_dB</td>
+            <td>Minimum decibel value.</td>
+          </tr>
+          <tr>
+            <td>max_dB</td>
+            <td>Maximum decibel value.</td>
+          </tr>
+        </table>
+      </div>
+      <div class="method" id="Interface Functions">
+        <h2>Interface Functions</h2>
+        <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
+    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>
+        <h3 class="command">VA_I<em>Interface</em>_<em>Function</em></h3>
+        <h4>Remarks</h4>
+        <p>As of v2.0, interface wrappers for the following interfaces are included:</p>
+        <ul>
+          <li><a href="http://msdn.microsoft.com/en-us/library/ms679028">IMMDevice</a></li>
+          <li><a href="http://msdn.microsoft.com/en-us/library/ms678970">IDeviceTopology</a></li>
+          <li><a href="http://msdn.microsoft.com/en-us/library/ms678851">IConnector</a></li>
+          <li><a href="http://msdn.microsoft.com/en-us/library/ms679050">IPart</a></li>
+          <li><a href="http://msdn.microsoft.com/en-us/library/ms679063">IPartsList</a></li>
+          <li><a href="http://msdn.microsoft.com/en-us/library/aa964574">IAudioEndpointVolume</a></li>
+          <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>
+          <li><a href="http://msdn.microsoft.com/en-us/library/ms678773">IAudioMute</a></li>
+          <li><a href="http://msdn.microsoft.com/en-us/library/ms678718">IAudioAutoGainControl</a></li>
+          <li><a href="http://msdn.microsoft.com/en-us/library/aa964578">IAudioMeterInformation</a></li>
+        </ul>
+        <p>v2.1:</p>
+        <ul>
+          <li><a href="http://msdn.microsoft.com/en-us/library/dd370865">IAudioClient</a></li>
+          <li><a href="http://msdn.microsoft.com/en-us/library/dd368246">IAudioSessionControl</a></li>
+          <li><a href="http://msdn.microsoft.com/en-us/library/dd370948">IAudioSessionManager</a></li>
+        </ul>
+        <p>v2.1 on Windows 7 or later:</p>
+        <ul>
+          <li><a href="http://msdn.microsoft.com/en-us/library/dd368248">IAudioSessionControl2</a></li>
+          <li><a href="http://msdn.microsoft.com/en-us/library/dd370950">IAudioSessionManager2</a></li>
+          <li><a href="http://msdn.microsoft.com/en-us/library/dd368281">IAudioSessionEnumerator</a></li>
+        </ul>
+        <p>v2.2:</p>
+        <ul>
+          <li><a href="http://msdn.microsoft.com/en-us/library/dd371399">IMMDeviceEnumerator</a></li>
+          <li><a href="http://msdn.microsoft.com/en-us/library/dd371396">IMMDeviceCollection</a></li>
+          <li><a href="http://msdn.microsoft.com/en-us/library/dd371098">IControlInterface</a></li>
+        </ul>
+      </div>
+    </div>
+    <div style="clear: both;"></div>
+    <div id="end">Copyright © Lexikos</div>
+  </body>
+</html>

+ 65 - 0
sandbox.au3

@@ -0,0 +1,65 @@
+#include <WinAPICOM.au3>
+
+
+Global Const $sCLSID_MMDeviceEnumerator = "{BCDE0395-E52F-467C-8E3D-C4579291692E}"
+Global Const $sIID_IMMDeviceEnumerator = "{A95664D2-9614-4F35-A746-DE8DB63617E6}"
+Global Const $tagIMMDeviceEnumerator = "EnumAudioEndpoints hresult(int;int;ptr*);" & _
+        "GetDefaultAudioEndpoint hresult(int;int;ptr*);" & _
+        "GetDevice hresult(wstr;ptr*);" & _
+        "RegisterEndpointNotificationCallback hresult(ptr);" & _
+        "UnregisterEndpointNotificationCallback hresult(ptr);"
+
+Global Const $IID_IMMDevice = "{D666063F-1587-4E43-81F1-B948E807363F}"
+Global Const $tagIMMDevice = "Activate hresult(ptr;dword;variant*;ptr*);" & _
+        "OpenPropertyStore hresult(dword;ptr*);" & _
+        "GetId hresult(ptr*);" & _
+        "GetState hresult(dword*);"
+
+Global Const $IID_IPropertyStore = "{886d8eeb-8cf2-4446-8d02-cdba1dbdcf99}"
+Global Const $tagIPropertyStore = "GetCount hresult(dword*);" & _
+        "GetAt hresult(dword;ptr*);" & _
+        "GetValue hresult(struct*;variant*);" & _
+        "SetValue hresult(struct*;variant);" & _
+        "Commit hresult();"
+
+Global Const $sPKEY_Device_FriendlyName = "{a45c254e-df1c-4efd-8020-67d146a850e0} 14"
+
+Global Const $STGM_READ = 0
+Global Const $DEVICE_STATE_ACTIVE = 0x00000001
+
+Global Const $eRender = 0
+Global Const $eCapture = 1
+Global Const $eAll = 2
+Global Const $EDataFlow_enum_count = 3
+
+Global Const $eConsole = 0
+Global Const $eMultimedia = 1
+Global Const $eCommunications = 2
+Global Const $ERole_enum_count = 3
+
+Func _WinAPI_PKEYFromString($sPKEY, $pID = Default)
+    Local $tPKEY = DllStructCreate("byte GUID[16]; dword PID;")
+    DllCall("propsys.dll", "long", "PSPropertyKeyFromString", "wstr", $sPKEY, "struct*", $tPKEY)
+    If $pID <> Default Then DllStructSetData($tPKEY, "PID", $pID)
+    Return $tPKEY
+EndFunc
+;==========================================================
+
+Local $oEnumerator = ObjCreateInterface($sCLSID_MMDeviceEnumerator, $sIID_IMMDeviceEnumerator, $tagIMMDeviceEnumerator)
+
+Local $pDefaultEndpoint
+$oEnumerator.GetDefaultAudioEndpoint($eRender, $DEVICE_STATE_ACTIVE, $pDefaultEndpoint)
+
+Local $oEndpoint = ObjCreateInterface($pDefaultEndpoint, $IID_IMMDevice, $tagIMMDevice)
+
+; PropertyStore stores properties
+Local $pProps
+$oEndpoint.OpenPropertyStore($STGM_READ, $pProps)
+$oProps = ObjCreateInterface($pProps, $IID_IPropertyStore, $tagIPropertyStore)
+
+; Collect FriendlyName property
+Local $tPKEY_Device_FriendlyName = _WinAPI_PKEYFromString($sPKEY_Device_FriendlyName)
+Local $sName
+$oProps.GetValue($tPKEY_Device_FriendlyName, $sName)
+
+ConsoleWrite($sName & @CRLF)

+ 193 - 0
soundDetect.au3

@@ -0,0 +1,193 @@
+#include <WinAPICom.au3>
+#include <Process.au3>
+#include <Array.au3>
+
+Opt("MustDeclareVars", 1)
+
+Global Const $CLSCTX_INPROC_SERVER = 0x01 + 0x02 + 0x04 + 0x10
+Global Enum $eRender, $eCapture, $eAll, $EDataFlow_enum_count
+Global Enum $AudioSessionStateInactive, $AudioSessionStateActive, $AudioSessionStateExpired
+Global Const $eMultimedia = 1
+
+
+Global Const $sCLSID_MMDeviceEnumerator = "{BCDE0395-E52F-467C-8E3D-C4579291692E}"
+Global Const $sIID_IMMDeviceEnumerator = "{A95664D2-9614-4F35-A746-DE8DB63617E6}"
+Global Const $sTagIMMDeviceEnumerator = _
+        "EnumAudioEndpoints hresult(int;dword;ptr*);" & _
+        "GetDefaultAudioEndpoint hresult(int;int;ptr*);" & _
+        "GetDevice hresult(wstr;ptr*);" & _
+        "RegisterEndpointNotificationCallback hresult(ptr);" & _
+        "UnregisterEndpointNotificationCallback hresult(ptr)"
+
+
+Global Const $sIID_IAudioMeterInformation = "{C02216F6-8C67-4B5B-9D00-D008E73E0064}"
+Global Const $sTagIAudioMeterInformation = "GetPeakValue hresult(float*);" & _
+        "GetMeteringChannelCount hresult(dword*);" & _
+        "GetChannelsPeakValues hresult(dword;float*);" & _
+        "QueryHardwareSupport hresult(dword*);"
+
+
+Global Const $sIID_IMMDevice = "{D666063F-1587-4E43-81F1-B948E807363F}"
+Global Const $sTagIMMDevice = _
+        "Activate hresult(clsid;dword;ptr;ptr*);" & _
+        "OpenPropertyStore hresult(dword;ptr*);" & _
+        "GetId hresult(wstr*);" & _
+        "GetState hresult(dword*)"
+
+
+Global Const $sIID_IAudioSessionManager2 = "{77aa99a0-1bd6-484f-8bc7-2c654c9a9b6f}"
+Global Const $sTagIAudioSessionManager = "GetAudioSessionControl hresult(ptr;dword;ptr*);" & _
+        "GetSimpleAudioVolume hresult(ptr;dword;ptr*);"
+Global Const $sTagIAudioSessionManager2 = $sTagIAudioSessionManager & "GetSessionEnumerator hresult(ptr*);" & _
+        "RegisterSessionNotification hresult(ptr);" & _
+        "UnregisterSessionNotification hresult(ptr);" & _
+        "RegisterDuckNotification hresult(wstr;ptr);" & _
+        "UnregisterDuckNotification hresult(ptr)"
+
+
+Global Const $sIID_IAudioSessionEnumerator = "{e2f5bb11-0570-40ca-acdd-3aa01277dee8}"
+Global Const $sTagIAudioSessionEnumerator = "GetCount hresult(int*);GetSession hresult(int;ptr*)"
+
+Global Const $sIID_IAudioSessionControl = "{f4b1a599-7266-4319-a8ca-e70acb11e8cd}"
+Global Const $sTagIAudioSessionControl = "GetState hresult(int*);GetDisplayName hresult(wstr*);" & _
+        "SetDisplayName hresult(wstr);GetIconPath hresult(wstr*);" & _
+        "SetIconPath hresult(wstr;ptr);GetGroupingParam hresult(ptr*);" & _
+        "SetGroupingParam hresult(ptr;ptr);RegisterAudioSessionNotification hresult(ptr);" & _
+        "UnregisterAudioSessionNotification hresult(ptr);"
+
+
+Global Const $sIID_IAudioSessionControl2 = "{bfb7ff88-7239-4fc9-8fa2-07c950be9c6d}"
+Global Const $sTagIAudioSessionControl2 = $sTagIAudioSessionControl & "GetSessionIdentifier hresult(wstr*);" & _
+        "GetSessionInstanceIdentifier hresult(wstr*);" & _
+        "GetProcessId hresult(dword*);IsSystemSoundsSession hresult();" & _
+        "SetDuckingPreferences hresult(bool);"
+
+Global $bExit= not False
+
+HotKeySet("{F5}","_Exit")
+
+_WinAPI_CoInitialize()
+
+Local $aApp =0
+
+While $bExit
+$aApp = _GetAppsPlayingSound()
+If (UBound($aApp)>1) then
+For $i= 0 to UBound($aApp)-1
+ConsoleWrite(Int($aApp[$i][1]*100) & " - " & $aApp[$i][0] & @CRLF)
+ControlSetText('', '', 'Scintilla2', '')
+Next
+EndIf
+Sleep(100)
+WEnd
+
+
+_WinAPI_CoUninitialize()
+
+Func _Exit()
+$bExit=False
+EndFunc
+
+
+
+
+Func _GetAppsPlayingSound()
+
+    Local $pIMMDevice = 0
+    Local $oMMDevice = 0
+    Local $pIAudioSessionManager2 = 0
+    Local $oIAudioSessionManager2 = 0
+    Local $pIAudioSessionEnumerator = 0
+    Local $oIAudioSessionEnumerator = 0
+    Local $nSessions = 0
+    Local $oMMDeviceEnumerator = 0
+    Local $aApp[1][1]
+    Local $pIAudioSessionControl2 = 0
+    Local $oIAudioSessionControl2 = 0
+    Local $oIAudioMeterInformation = 0
+    Local $ProcessID = 0
+    Local $fPeakValue = 0
+    Local $iState = 0
+    Local $iVolume = 10
+    Local $oErrorHandler = 0
+
+    $oErrorHandler = ObjEvent("AutoIt.Error", "_ErrFunc")
+
+
+    $oMMDeviceEnumerator = ObjCreateInterface($sCLSID_MMDeviceEnumerator, $sIID_IMMDeviceEnumerator, $sTagIMMDeviceEnumerator)
+
+    If @error Then Return $aApp
+
+    If SUCCEEDED($oMMDeviceEnumerator.GetDefaultAudioEndpoint($eRender, $eMultimedia, $pIMMDevice)) Then ;eRender
+
+
+        $oMMDevice = ObjCreateInterface($pIMMDevice, $sIID_IMMDevice, $sTagIMMDevice)
+
+        $oMMDevice.Activate($sIID_IAudioSessionManager2, $CLSCTX_INPROC_SERVER, 0, $pIAudioSessionManager2)
+
+        $oIAudioSessionManager2 = ObjCreateInterface($pIAudioSessionManager2, $sIID_IAudioSessionManager2, $sTagIAudioSessionManager2)
+
+        $oIAudioSessionManager2.GetSessionEnumerator($pIAudioSessionEnumerator)
+
+        $oIAudioSessionEnumerator = ObjCreateInterface($pIAudioSessionEnumerator, $sIID_IAudioSessionEnumerator, $sTagIAudioSessionEnumerator)
+
+        $oIAudioSessionEnumerator.GetCount($nSessions)
+
+
+        For $i = 0 To $nSessions - 1
+            $oIAudioSessionEnumerator.GetSession($i, $pIAudioSessionControl2)
+            $oIAudioSessionControl2 = ObjCreateInterface($pIAudioSessionControl2, $sIID_IAudioSessionControl2, $sTagIAudioSessionControl2)
+            $oIAudioSessionControl2.GetState($iState)
+            If $iState = $AudioSessionStateActive Then
+                $oIAudioSessionControl2.GetProcessId($ProcessID)
+                $oIAudioMeterInformation = ObjCreateInterface($pIAudioSessionControl2, $sIID_IAudioMeterInformation, $sTagIAudioMeterInformation)
+                $oIAudioSessionControl2.AddRef
+                $oIAudioMeterInformation.GetPeakValue($fPeakValue)
+                If $fPeakValue > 0 Then
+                    ReDim $aApp[UBound($aApp) + 1][2]
+                    $aApp[UBound($aApp) - 1][0] = _ProcessGetName($ProcessID)
+                    $aApp[UBound($aApp) - 1][1] = $fPeakValue
+                EndIf
+
+            EndIf
+            $fPeakValue = 0
+            $iState = 0
+            $ProcessID = 0
+            $oIAudioMeterInformation = 0
+            $oIAudioSessionControl2 = 0
+
+        Next
+        $oIAudioSessionEnumerator = 0
+        $oIAudioSessionManager2 = 0
+        $oMMDevice = 0
+        $oMMDeviceEnumerator = 0
+
+        If UBound($aApp) = 0 Then $aApp = 0
+        Return $aApp
+    Else
+        Return 0
+    EndIf
+
+
+EndFunc   ;==>_GetAppsPlayingSound
+
+
+
+Func SUCCEEDED($hr)
+    Return ($hr >= 0)
+EndFunc   ;==>SUCCEEDED
+
+; User's COM error function. Will be called if COM error occurs
+Func _ErrFunc($oError)
+    ; Do anything here.
+    ConsoleWrite(@ScriptName & " (" & $oError.scriptline & ") : ==> COM Error intercepted !" & @CRLF & _
+            @TAB & "err.number is: " & @TAB & @TAB & "0x" & Hex($oError.number) & @CRLF & _
+            @TAB & "err.windescription:" & @TAB & $oError.windescription & @CRLF & _
+            @TAB & "err.description is: " & @TAB & $oError.description & @CRLF & _
+            @TAB & "err.source is: " & @TAB & @TAB & $oError.source & @CRLF & _
+            @TAB & "err.helpfile is: " & @TAB & $oError.helpfile & @CRLF & _
+            @TAB & "err.helpcontext is: " & @TAB & $oError.helpcontext & @CRLF & _
+            @TAB & "err.lastdllerror is: " & @TAB & $oError.lastdllerror & @CRLF & _
+            @TAB & "err.scriptline is: " & @TAB & $oError.scriptline & @CRLF & _
+            @TAB & "err.retcode is: " & @TAB & "0x" & Hex($oError.retcode) & @CRLF & @CRLF)
+EndFunc   ;==>_ErrFunc

+ 35 - 0
soundDetect2.au3

@@ -0,0 +1,35 @@
+Local $ui = GUICreate('Level', 110, 160, -1, -1, Default, 0x00000008)
+Local $ProgressBar = GUICtrlCreateProgress(50, 20, 10, 120, 0x04)
+GUISetState(@SW_SHOW, $ui)
+;
+Local $mciLevel, $lpszReturnString
+
+
+
+
+
+
+
+Local $mciInit = DllCall('winmm.dll', 'long', 'mciSendStringA', 'str', 'open Hangszórók (Realtek High Definition Audio) type waveaudio alias mywave', 'str', $lpszReturnString, 'long', 64, 'long', 0)
+;Local $mciInit = DllCall('winmm.dll', 'long', 'mciSendStringA', 'str', 'open new type waveaudio alias mywave4  ', 'str', $lpszReturnString, 'long', 64, 'long', 0)
+Local $mciInit = DllCall('winmm.dll', 'long', 'mciSendStringA', 'str', 'status mywave level', 'str', $lpszReturnString, 'long', 64, 'long', 0)
+ConsoleWrite($mciInit[0]&@CRLF)
+ConsoleWrite($mciInit[1]&@CRLF)
+ConsoleWrite($mciInit[2]&@CRLF)
+Exit
+
+
+Local $mciInit = DllCall('winmm.dll', 'long', 'mciSendStringA', 'str', 'open new type waveaudio alias mywave', 'str', $lpszReturnString, 'long', 64, 'long', 0)
+			   ;DllCall ( "dll",     "return type", "function" [, type1, param1 [, type n, param n]] )
+If $mciInit[0] <> 0 Then Exit
+;
+Do
+    $mciLevel = DllCall('winmm.dll', 'long', 'mciSendStringA', 'str', 'status mywave level', 'str', $lpszReturnString, 'long', 64, 'long', 0)
+    If $mciLevel[0] <> 0 Then Exit
+    ; If $mciLevel[2] > 60 Then MsgBox(64, 'Levels', 'Peaked > 60')
+	ConsoleWrite($mciLevel[2] & @CRLF)
+    GUICtrlSetData($ProgressBar, $mciLevel[2]); <-- here is the numeric audio level
+Until GUIGetMsg() = -3
+;
+GUIDelete($ui)
+Exit

+ 153 - 0
soundDetect3.au3

@@ -0,0 +1,153 @@
+#Include <string.au3>		; for _StringRepeat function
+#Include <GUIConstants.au3>	; GUI !
+
+Dim $lpszDevice		; Identifier of an MCI device or device driver.
+Dim $lpszDeviceID	; Identifier of an MCI device.
+			; This identifier or alias is assigned when the device is opened.
+Dim $lpszOpenFlags	; Flag that identifies what to initialize.
+Dim $lpszRequest	; Flag for requesting status information. See table on the web page mentioned above.
+
+; Source: http://msdn.microsoft.com/library/en-us/multimed/htm/_win32_the_wait_notify_and_test_flags.asp
+
+Dim $lpszFlags		; Can be "wait", "notify", or both.
+			; For digital-video and VCR devices, "test" can also be specified.
+Dim $lpszCommand	; mciCommand string to send.
+Dim $lpszReturnString	; information will be returned into this string. Reserve enough space!
+Dim $cchReturn		; Length of returnstring
+Dim $mciError		; mci error code
+
+; STEP 1: Open the device we want to monitor
+
+; Source: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/multimed/htm/_win32_open.asp
+
+;$lpszDevice = "waveaudio"
+
+$lpszDevice = "new type waveaudio"
+
+$lpszOpenFlags = "alias mywave"	; For all possible flags, see table on web page mentioned above.
+
+$lpszFlags = ""
+
+$lpszCommand = StringFormat( "open %s %s %s", $lpszDevice, $lpszOpenFlags, $lpszFlags );
+
+$lpszReturnString = _StringRepeat( " ", 100 )	; Information will return in this string
+
+$cchReturn = StringLen($lpszReturnString)
+				; Size, in characters, of the return buffer specified
+				; by the lpszReturnString parameter.
+
+
+$mciError = _mciSendString( $lpszCommand, $lpszReturnString, $cchReturn, 0);
+
+
+if $mciError[0] <> 0 then _mciShowError($mcierror[0])
+
+
+; STEP 2: Obtain the audio levels
+
+; Source: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/multimed/htm/_win32_status_mm.asp
+
+$lpszDeviceID = "mywave"
+
+$lpszRequest = "level"  ; Returns the current PCM audio sample value.
+			; See table on web page mentioned above.
+
+$lpszFlags = ""
+$lpszCommand= StringFormat( "status %s %s %s", $lpszDeviceID, $lpszRequest, $lpszFlags );
+
+
+; Before we collect the information, first create a nice GUI.
+
+GUICreate("MCI wave level test",200,130)  ; This will create a centered dialog box
+
+$VolumeLabel=GUICtrlCreateLabel ("Initializing..." , 14, 8, 200, 20)
+$ProgressBar = GUICtrlCreateProgress (14,25,180,20)
+
+$ExitButton =GUICtrlCreateButton (" Exit ",80,60)
+
+GUISetState ()		; Display the dialog
+
+; Run the GUI until the dialog is closed
+While 1
+
+	$mciError = _mciSendString( $lpszCommand,  $lpszReturnString,  $cchReturn, 0);
+
+	if $mciError[0] <> 0 then _mciShowError($mcierror[0])
+
+	; The average input signal level is returned.
+	; The left-channel value is in the high-order word and the right-
+	; or mono-channel value is in the low-order word.
+
+	; The input level is represented as an unsigned value.
+	; For 8-bit samples, this value is in the range 0 through 127 (0x7F).
+	; For 16-bit samples, it is in the range 0 through 32,767 (0x7FFF).
+
+	GUICtrlSetData ($VolumeLabel, $mcierror[2])
+	GUICtrlSetData ($ProgressBar,$mcierror[2])
+
+	$msg = GUIGetMsg()
+
+	Select
+		case $msg = $Exitbutton
+    			Exit
+
+		case $msg = $GUI_EVENT_CLOSE
+			Exit
+	EndSelect
+Wend
+
+GUIDelete()
+
+exit
+
+
+; USER DEFINED FUNCTIONS
+
+Func _mciSendString( $lpszCommand, $lpszReturnString, $cchReturn, $hwndCallback)
+
+;VB-style declaration:
+;
+;Declare Function mciSendString
+;	Lib "winmm.dll"
+;	Alias "mciSendStringA"
+;	(ByVal lpstrCommand As String,
+;	ByVal lpstrReturnString As String,
+;	ByVal uReturnLength As Long,
+;	ByVal hwndCallback As Long)
+;	As Long
+
+
+; mciSendString returns information in the lpszReturnString parameter of mciSendString.
+; The information is dependent on the request type.
+
+
+Return DllCall("winmm.dll", "long", "mciSendStringA", "str", $lpszCommand, "str", $lpszReturnString, "long", $cchReturn, "long", 0)
+
+EndFunc
+
+
+Func _mciShowError($mcierror)
+
+; To show a "readable" mci error.
+;
+;VB-style declaration:
+;
+;Declare Function mciGetErrorString
+;	Lib "winmm.dll"
+;	Alias "mciGetErrorStringA"
+;	(ByVal dwError As Long,
+;	ByVal lpstrBuffer As String,
+;	ByVal uLength As Long)
+;	As Long
+
+ Dim $errStr	; Error message
+
+
+ $errStr=_StringRepeat( " ", 100 )	; Reserve some space for the error message
+
+
+ $Result=DllCall("winmm.dll","long", "mciGetErrorStringA", "long", $mcierror, "string", $errStr, "long", StringLen($errStr))
+
+ MsgBox (0,"MCI test", "MCI Error Number " & $mcierror & ":" & $Result[2] )
+
+EndFunc

+ 14 - 0
soundDetect4-sandbox.au3

@@ -0,0 +1,14 @@
+Local $mciLevel, $lpszReturnString
+ ;DllCall ( "dll",     "return type", "function" [, type1, param1 [, type n, param n]] )
+
+;Local $mciInit = DllCall('winmm.dll', 'long', 'mciSendStringA', 'str', 'open new type waveaudio alias mywave', 'str', $lpszReturnString, 'long', 64, 'long', 0)
+;Local $mciInit = DllCall('winmm.dll', 'long', 'mciSendStringA', 'str', 'status mywave level', 'str', $lpszReturnString, 'long', 64, 'long', 0)
+Local $mciInit = DllCall('winmm.dll', 'long', 'mciGetDeviceID', 'str', 'NVIDIA High Definition Audio')
+;Local $mciInit = DllCall('winmm.dll', 'long', 'waveOutGetVolume', 'HWAVEOUT', '0', 'str', '0xFFFF')
+
+ConsoleWrite($lpszReturnString)
+ConsoleWrite($mciInit)
+ConsoleWrite($mciInit[0])
+ConsoleWrite($mciInit[1])
+
+Exit

+ 543 - 0
sourceCode/BuildProcessTemplates/DefaultTemplate.11.1.xaml

@@ -0,0 +1,543 @@
+<Activity mc:Ignorable="sad" x:Class="TfsBuild.Process" xmlns="http://schemas.microsoft.com/netfx/2009/xaml/activities" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mt="clr-namespace:Microsoft.TeamFoundation;assembly=Microsoft.TeamFoundation.Common" xmlns:mtbc="clr-namespace:Microsoft.TeamFoundation.Build.Client;assembly=Microsoft.TeamFoundation.Build.Client" xmlns:mtbw="clr-namespace:Microsoft.TeamFoundation.Build.Workflow;assembly=Microsoft.TeamFoundation.Build.Workflow" xmlns:mtbwa="clr-namespace:Microsoft.TeamFoundation.Build.Workflow.Activities;assembly=Microsoft.TeamFoundation.Build.Workflow" xmlns:mtbwt="clr-namespace:Microsoft.TeamFoundation.Build.Workflow.Tracking;assembly=Microsoft.TeamFoundation.Build.Workflow" xmlns:mttbb="clr-namespace:Microsoft.TeamFoundation.TestImpact.BuildIntegration.BuildActivities;assembly=Microsoft.TeamFoundation.TestImpact.BuildIntegration" xmlns:mtvc="clr-namespace:Microsoft.TeamFoundation.VersionControl.Client;assembly=Microsoft.TeamFoundation.VersionControl.Client" xmlns:mtvco="clr-namespace:Microsoft.TeamFoundation.VersionControl.Common;assembly=Microsoft.TeamFoundation.VersionControl.Common" xmlns:mva="clr-namespace:Microsoft.VisualBasic.Activities;assembly=System.Activities" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:sad="http://schemas.microsoft.com/netfx/2009/xaml/activities/presentation" xmlns:sad1="clr-namespace:System.Activities.Debugger;assembly=System.Activities" xmlns:scg="clr-namespace:System.Collections.Generic;assembly=mscorlib" xmlns:sl="clr-namespace:System.Linq;assembly=System.Core" xmlns:this="clr-namespace:TfsBuild;" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
+  <x:Members>
+    <x:Property Name="BuildSettings" Type="InArgument(mtbwa:BuildSettings)" />
+    <x:Property Name="TestSpecs" Type="InArgument(mtbwa:TestSpecList)" />
+    <x:Property Name="BuildNumberFormat" Type="InArgument(x:String)" />
+    <x:Property Name="SolutionSpecificBuildOutputs" Type="InArgument(x:Boolean)" />
+    <x:Property Name="CleanWorkspace" Type="InArgument(mtbwa:CleanWorkspaceOption)" />
+    <x:Property Name="RunCodeAnalysis" Type="InArgument(mtbwa:CodeAnalysisOption)" />
+    <x:Property Name="SourceAndSymbolServerSettings" Type="InArgument(mtbwa:SourceAndSymbolServerSettings)" />
+    <x:Property Name="AgentSettings" Type="InArgument(mtbwa:AgentSettings)" />
+    <x:Property Name="AssociateChangesetsAndWorkItems" Type="InArgument(x:Boolean)" />
+    <x:Property Name="CreateWorkItem" Type="InArgument(x:Boolean)" />
+    <x:Property Name="MSBuildArguments" Type="InArgument(x:String)" />
+    <x:Property Name="MSBuildPlatform" Type="InArgument(mtbwa:ToolPlatform)" />
+    <x:Property Name="MSBuildMultiProc" Type="InArgument(x:Boolean)" />
+    <x:Property Name="PerformTestImpactAnalysis" Type="InArgument(x:Boolean)" />
+    <x:Property Name="CreateLabel" Type="InArgument(x:Boolean)" />
+    <x:Property Name="DisableTests" Type="InArgument(x:Boolean)" />
+    <x:Property Name="GetVersion" Type="InArgument(x:String)" />
+    <x:Property Name="PrivateDropLocation" Type="InArgument(x:String)" />
+    <x:Property Name="Verbosity" Type="InArgument(mtbw:BuildVerbosity)" />
+    <x:Property Name="Metadata" Type="mtbw:ProcessParameterMetadataCollection" />
+    <x:Property Name="SupportedReasons" Type="mtbc:BuildReason" />
+    <x:Property Name="BuildProcessVersion" Type="x:String" />
+  </x:Members>
+  <this:Process.BuildSettings>[New Microsoft.TeamFoundation.Build.Workflow.Activities.BuildSettings()]</this:Process.BuildSettings>
+  <this:Process.DisableTests>[False]</this:Process.DisableTests>
+  <this:Process.TestSpecs>[New Microsoft.TeamFoundation.Build.Workflow.Activities.TestSpecList(New Microsoft.TeamFoundation.Build.Workflow.Activities.AgileTestPlatformSpec("**\*test*.dll"))]</this:Process.TestSpecs>
+  <this:Process.BuildNumberFormat>["$(BuildDefinitionName)_$(Date:yyyyMMdd)$(Rev:.r)"]</this:Process.BuildNumberFormat>
+  <this:Process.SolutionSpecificBuildOutputs>[False]</this:Process.SolutionSpecificBuildOutputs>
+  <this:Process.AssociateChangesetsAndWorkItems>[True]</this:Process.AssociateChangesetsAndWorkItems>
+  <this:Process.CreateWorkItem>[True]</this:Process.CreateWorkItem>
+  <this:Process.CleanWorkspace>[Microsoft.TeamFoundation.Build.Workflow.Activities.CleanWorkspaceOption.All]</this:Process.CleanWorkspace>
+  <this:Process.MSBuildArguments>
+    <InArgument x:TypeArguments="x:String" />
+  </this:Process.MSBuildArguments>
+  <this:Process.RunCodeAnalysis>[Microsoft.TeamFoundation.Build.Workflow.Activities.CodeAnalysisOption.AsConfigured]</this:Process.RunCodeAnalysis>
+  <this:Process.MSBuildMultiProc>[True]</this:Process.MSBuildMultiProc>
+  <this:Process.MSBuildPlatform>[Microsoft.TeamFoundation.Build.Workflow.Activities.ToolPlatform.Auto]</this:Process.MSBuildPlatform>
+  <this:Process.PerformTestImpactAnalysis>[True]</this:Process.PerformTestImpactAnalysis>
+  <this:Process.SourceAndSymbolServerSettings>[New Microsoft.TeamFoundation.Build.Workflow.Activities.SourceAndSymbolServerSettings(True, Nothing)]</this:Process.SourceAndSymbolServerSettings>
+  <this:Process.CreateLabel>[True]</this:Process.CreateLabel>
+  <this:Process.GetVersion>
+    <InArgument x:TypeArguments="x:String" />
+  </this:Process.GetVersion>
+  <this:Process.AgentSettings>[New Microsoft.TeamFoundation.Build.Workflow.Activities.AgentSettings() With {.MaxWaitTime = New System.TimeSpan(4, 0, 0), .MaxExecutionTime = New System.TimeSpan(0, 0, 0), .TagComparison = Microsoft.TeamFoundation.Build.Workflow.Activities.TagComparison.MatchExactly }]</this:Process.AgentSettings>
+  <this:Process.Verbosity>[Microsoft.TeamFoundation.Build.Workflow.BuildVerbosity.Normal]</this:Process.Verbosity>
+  <this:Process.Metadata>
+    <mtbw:ProcessParameterMetadataCollection>
+      <mtbw:ProcessParameterMetadata BrowsableWhen="EditingDefinition" Category="#300 Advanced" DisplayName="MSBuild Multi-Proc" Description="Enable MSBuid Multi-proc to build your solutions' projects in parallel, when possible, using all available processors on the build server." ParameterName="MSBuildMultiProc" />
+      <mtbw:ProcessParameterMetadata BrowsableWhen="EditingDefinition" Category="#300 Advanced" DisplayName="Solution Specific Build Outputs" Description="True will put build outputs into folders based on the solution name. False will put all build outputs into the same folder." ParameterName="SolutionSpecificBuildOutputs" />
+    </mtbw:ProcessParameterMetadataCollection>
+  </this:Process.Metadata>
+  <this:Process.SupportedReasons>All</this:Process.SupportedReasons>
+  <this:Process.BuildProcessVersion>11.0</this:Process.BuildProcessVersion>  
+  <mva:VisualBasic.Settings>Assembly references and imported namespaces serialized as XML namespaces</mva:VisualBasic.Settings>
+  <Sequence mtbwt:BuildTrackingParticipant.Importance="None">
+    <Sequence.Variables>
+      <Variable x:TypeArguments="mtbc:IBuildDetail" Name="BuildDetail" />
+      <Variable x:TypeArguments="x:String"  Name="DropLocation" />
+    </Sequence.Variables>
+    <mtbwa:GetBuildDetail DisplayName="Get the Build" Result="[BuildDetail]" mtbwt:BuildTrackingParticipant.Importance="Low" />
+    <Sequence DisplayName="Update Drop Location" mtbwt:BuildTrackingParticipant.Importance="Low">
+      <mtbwa:InvokeForReason DisplayName="Update Build Number for Triggered Builds" Reason="Triggered">
+        <mtbwa:UpdateBuildNumber BuildNumberFormat="[BuildNumberFormat]" DisplayName="Update Build Number" />
+      </mtbwa:InvokeForReason>
+      <If Condition="[(Not String.IsNullOrEmpty(BuildDetail.DropLocationRoot)) AndAlso (BuildDetail.Reason And Microsoft.TeamFoundation.Build.Client.BuildReason.Triggered) = BuildDetail.Reason]" DisplayName="If Build Reason is Triggered" mtbwt:BuildTrackingParticipant.Importance="Low">
+        <If.Then>
+          <Sequence mtbwt:BuildTrackingParticipant.Importance="None">
+            <Assign x:TypeArguments="x:String" mtbwt:BuildTrackingParticipant.Importance="None" Value="[BuildDropProvider.CombinePaths(BuildDetail.DropLocationRoot, BuildDetail.BuildDefinition.Name, BuildDetail.BuildNumber)]" To="[DropLocation]" />
+            <mtbwa:SetBuildProperties DisplayName="Set Drop Location" DropLocation="[DropLocation]" PropertiesToSet="DropLocation" mtbwt:BuildTrackingParticipant.Importance="Low" />
+          </Sequence>
+        </If.Then>
+      </If>
+      <If Condition="[(Not String.IsNullOrEmpty(PrivateDropLocation)) AndAlso BuildDetail.Reason = Microsoft.TeamFoundation.Build.Client.BuildReason.ValidateShelveset]" DisplayName="If Build Reason is ValidateShelveset" mtbwt:BuildTrackingParticipant.Importance="Low">
+        <If.Then>
+          <Sequence mtbwt:BuildTrackingParticipant.Importance="None">
+            <Assign x:TypeArguments="x:String" Value="[BuildDropProvider.CombinePaths(PrivateDropLocation, BuildDetail.BuildDefinition.Name, BuildDetail.BuildNumber)]" To="[DropLocation]" mtbwt:BuildTrackingParticipant.Importance="None" />
+            <mtbwa:SetBuildProperties DisplayName="Set Drop Location for Private Build" DropLocation="[DropLocation]" PropertiesToSet="DropLocation" mtbwt:BuildTrackingParticipant.Importance="Low" />
+          </Sequence>
+        </If.Then>
+      </If>
+    </Sequence>
+    <mtbwa:AgentScope DisplayName="Run On Agent" MaxExecutionTime="[AgentSettings.MaxExecutionTime]" MaxWaitTime="[AgentSettings.MaxWaitTime]" ReservationSpec="[AgentSettings.GetAgentReservationSpec()]">
+      <mtbwa:AgentScope.Variables>
+        <Variable x:TypeArguments="mtbc:IBuildAgent" Name="BuildAgent" />
+        <Variable x:TypeArguments="mtvc:Workspace" Name="Workspace" />
+        <Variable x:TypeArguments="x:String" Name="BuildDirectory" />
+        <Variable x:TypeArguments="x:String" Default="[BuildDetail.BuildNumber]" Name="LabelName" />
+        <Variable x:TypeArguments="x:String" Name="WorkspaceName" />
+        <Variable x:TypeArguments="x:String" Name="SourcesDirectory" />
+        <Variable x:TypeArguments="x:String" Name="BinariesDirectory" />
+        <Variable x:TypeArguments="x:String" Name="TestResultsDirectory" />
+      </mtbwa:AgentScope.Variables>
+      <Sequence DisplayName="Initialize Variables" mtbwt:BuildTrackingParticipant.Importance="Low">
+        <mtbwa:GetBuildAgent DisplayName="Get the Agent" Result="[BuildAgent]" mtbwt:BuildTrackingParticipant.Importance="Low" />
+        <mtbwa:GetBuildDirectory DisplayName="Get the Build Directory" Result="[BuildDirectory]" mtbwt:BuildTrackingParticipant.Importance="Low" />
+        <Assign x:TypeArguments="x:String" DisplayName="Initialize Workspace Name" To="[WorkspaceName]" Value="[String.Format(&quot;{0}_{1}_{2}&quot;, BuildDetail.BuildDefinition.Id, Microsoft.TeamFoundation.LinkingUtilities.DecodeUri(BuildAgent.Uri.AbsoluteUri).ToolSpecificId, BuildAgent.ServiceHost.Name)]" mtbwt:BuildTrackingParticipant.Importance="Low" />
+        <Assign x:TypeArguments="x:String" DisplayName="Initialize Sources Directory" To="[SourcesDirectory]" Value="[String.Format(&quot;{0}\Sources&quot;, BuildDirectory)]" mtbwt:BuildTrackingParticipant.Importance="Low" />
+        <Assign x:TypeArguments="x:String" DisplayName="Initialize Binaries Directory" To="[BinariesDirectory]" Value="[String.Format(&quot;{0}\Binaries&quot;, BuildDirectory)]" mtbwt:BuildTrackingParticipant.Importance="Low" />
+        <Assign x:TypeArguments="x:String" DisplayName="Initialize TestResults Directory" To="[TestResultsDirectory]" Value="[String.Format(&quot;{0}\TestResults&quot;, BuildDirectory)]" mtbwt:BuildTrackingParticipant.Importance="Low" />
+        <If Condition="[Not BuildSettings.HasPlatformConfigurations]" DisplayName="If Not BuildSettings.HasPlatformConfigurations" mtbwt:BuildTrackingParticipant.Importance="Low">
+          <If.Then>
+            <AddToCollection x:TypeArguments="mtbwa:PlatformConfiguration" DisplayName="Use Default Platform Configuration" Collection="[BuildSettings.PlatformConfigurations]" Item="[Microsoft.TeamFoundation.Build.Workflow.Activities.PlatformConfiguration.Default]" mtbwt:BuildTrackingParticipant.Importance="Low" />
+          </If.Then>
+        </If>
+        <If Condition="[WorkspaceName.Length &gt; Microsoft.TeamFoundation.VersionControl.Common.RepositoryConstants.MaxWorkspaceNameSize]" DisplayName="If WorkspaceName &gt; MaxSize" mtbwt:BuildTrackingParticipant.Importance="Low">
+          <If.Then>
+            <Sequence mtbwt:BuildTrackingParticipant.Importance="None">
+              <mtbwa:WriteBuildWarning DisplayName="Write Workspace Size Warning" Message="[String.Format(&quot;The workspace name '{0}' exceeds the maximum allowed limit of '{1}' characters. Truncating it to match the maximum limit.&quot;, WorkspaceName, Microsoft.TeamFoundation.VersionControl.Common.RepositoryConstants.MaxWorkspaceNameSize)]" />
+              <Assign x:TypeArguments="x:String" DisplayName="Truncate WorkspaceName to MaxSize" To="[WorkspaceName]" Value="[WorkspaceName.Substring(0, Microsoft.TeamFoundation.VersionControl.Common.RepositoryConstants.MaxWorkspaceNameSize).TrimEnd()]" mtbwt:BuildTrackingParticipant.Importance="Low" />
+            </Sequence>
+          </If.Then>
+        </If>
+      </Sequence>
+      <Sequence DisplayName="Initialize Workspace" mtbwt:BuildTrackingParticipant.Importance="Low">
+        <mtbwa:DeleteDirectory Directory="[TestResultsDirectory]" DisplayName="Delete Test Results Directory" Recursive="[True]" mtbwt:BuildTrackingParticipant.Importance="Low" />
+        <If Condition="[Not CleanWorkspace = Microsoft.TeamFoundation.Build.Workflow.Activities.CleanWorkspaceOption.None]" DisplayName="If Not CleanWorkspace = CleanWorkspaceOption.None" mtbwt:BuildTrackingParticipant.Importance="Low">
+          <If.Then>
+            <mtbwa:DeleteDirectory Directory="[BinariesDirectory]" DisplayName="Delete Binaries Directory" mtbwt:BuildTrackingParticipant.Importance="Low" />
+          </If.Then>
+        </If>
+        <If Condition="[CleanWorkspace = Microsoft.TeamFoundation.Build.Workflow.Activities.CleanWorkspaceOption.All]" DisplayName="If CleanWorkspace = CleanWorkspaceOption.All" mtbwt:BuildTrackingParticipant.Importance="Low">
+          <If.Then>
+            <Sequence DisplayName="Delete Workspace and Sources Directory" mtbwt:BuildTrackingParticipant.Importance="Low">
+              <mtbwa:DeleteWorkspace DeleteLocalItems="[True]" DisplayName="Delete Workspace" Name="[WorkspaceName]" mtbwt:BuildTrackingParticipant.Importance="Low" />
+              <mtbwa:DeleteDirectory Directory="[SourcesDirectory]" DisplayName="Delete Sources Directory" mtbwt:BuildTrackingParticipant.Importance="Low" />
+            </Sequence>
+          </If.Then>
+        </If>
+        <mtbwa:CreateWorkspace BuildDirectory="[BuildDirectory]" Comment="[&quot;Workspace Created by Team Build&quot;]" DisplayName="Create Workspace" Name="[WorkspaceName]" Result="[Workspace]" SourcesDirectory="[SourcesDirectory]" />
+        <If Condition="[CleanWorkspace = Microsoft.TeamFoundation.Build.Workflow.Activities.CleanWorkspaceOption.Outputs]" DisplayName="If CleanWorkspace = CleanWorkspaceOption.Outputs" mtbwt:BuildTrackingParticipant.Importance="Low">
+          <If.Then>
+            <ForEach x:TypeArguments="mtbwa:PlatformConfiguration" DisplayName="For Each Configuration in BuildSettings.PlatformConfigurations" Values="[BuildSettings.PlatformConfigurations]" mtbwt:BuildTrackingParticipant.Importance="Low">
+              <ActivityAction x:TypeArguments="mtbwa:PlatformConfiguration">
+                <ActivityAction.Argument>
+                  <DelegateInArgument x:TypeArguments="mtbwa:PlatformConfiguration" Name="platformConfiguration" />
+                </ActivityAction.Argument>
+                <Sequence DisplayName="Clean Configuration">
+                  <If Condition="[BuildSettings.HasProjectsToBuild]" DisplayName="If BuildSettings.HasProjectsToBuild" mtbwt:BuildTrackingParticipant.Importance="Low">
+                    <If.Then>
+                      <ForEach x:TypeArguments="x:String" DisplayName="For Each Project in BuildSettings.ProjectsToBuild" Values="[BuildSettings.ProjectsToBuild]" mtbwt:BuildTrackingParticipant.Importance="Low">
+                        <ActivityAction x:TypeArguments="x:String">
+                          <ActivityAction.Argument>
+                            <DelegateInArgument x:TypeArguments="x:String" Name="serverBuildProjectItem" />
+                          </ActivityAction.Argument>
+                          <Sequence DisplayName="Clean Project" mtbwt:BuildTrackingParticipant.Importance="Low">
+                            <Sequence.Variables>
+                              <Variable x:TypeArguments="x:String" Name="localBuildProjectItem" />
+                            </Sequence.Variables>
+                            <mtbwa:ConvertWorkspaceItem DisplayName="Convert Server Paths to Local Paths" Input="[serverBuildProjectItem]" Result="[localBuildProjectItem]" Workspace="[Workspace]" mtbwt:BuildTrackingParticipant.Importance="Low" />
+                            <If Condition="[System.IO.File.Exists(localBuildProjectItem)]" DisplayName="If File.Exists(Project)" mtbwt:BuildTrackingParticipant.Importance="Low">
+                              <If.Then>
+                                <mtbwa:MSBuild CommandLineArguments="[String.Format(&quot;/p:SkipInvalidConfigurations=true {0}&quot;, MSBuildArguments)]" Configuration="[platformConfiguration.Configuration]" DisplayName="Run MSBuild for Project" GenerateVSPropsFile="[True]" MaxProcesses="[If (MSBuildMultiProc, 0, 1)]" OutDir="[BinariesDirectory]" Platform="[platformConfiguration.Platform]" Project="[localBuildProjectItem]" Targets="[New String() { &quot;Clean&quot; }]" TargetsNotLogged="[New String() {&quot;GetNativeManifest&quot;, &quot;GetCopyToOutputDirectoryItems&quot;, &quot;GetTargetPath&quot;}]" ToolPlatform="[MSBuildPlatform]" Verbosity="[Verbosity]" />
+                              </If.Then>
+                            </If>
+                          </Sequence>
+                        </ActivityAction>
+                      </ForEach>
+                    </If.Then>
+                  </If>
+                </Sequence>
+              </ActivityAction>
+            </ForEach>
+          </If.Then>
+        </If>
+        <mtbwa:SyncWorkspace DisplayName="Get Workspace" VersionOverride="[GetVersion]" Workspace="[Workspace]">
+          <mtbwa:SyncWorkspace.RequestsFailed>
+            <ActivityAction x:TypeArguments="scg:ICollection(mtbc:IQueuedBuild)">
+              <ActivityAction.Argument>
+                <DelegateInArgument x:TypeArguments="scg:ICollection(mtbc:IQueuedBuild)" Name="failedRequests" />
+              </ActivityAction.Argument>
+              <mtbwa:RetryRequests Behavior="[Microsoft.TeamFoundation.Build.Workflow.Activities.RetryBehavior.DoNotBatch]" DisplayName="Mark Requests for Retry" Requests="[failedRequests]" mtbwt:BuildTrackingParticipant.Importance="Low" />
+            </ActivityAction>
+          </mtbwa:SyncWorkspace.RequestsFailed>
+        </mtbwa:SyncWorkspace>
+      </Sequence>
+      <If Condition="[CreateLabel]" DisplayName="If CreateLabel" mtbwt:BuildTrackingParticipant.Importance="Low">
+        <If.Then>
+          <mtbwa:InvokeForReason DisplayName="Create and Set Label for non-Shelveset Builds" Reason="Manual, IndividualCI, BatchedCI, Schedule, ScheduleForced, UserCreated">
+            <mtbwa:LabelWorkspace Comment="[&quot;Label Created by Team Build&quot;]" DisplayName="Create Label" Name="[LabelName]" Scope="[String.Format(&quot;$/{0}&quot;, BuildDetail.BuildDefinition.TeamProject)]" Workspace="[Workspace]" />
+            <mtbwa:SetBuildProperties DisplayName="Set Label on BuildDetail" LabelName="[String.Format(&quot;{0}@$/{1}&quot;, LabelName, BuildDetail.BuildDefinition.TeamProject)]" PropertiesToSet="LabelName" mtbwt:BuildTrackingParticipant.Importance="Low" />
+          </mtbwa:InvokeForReason>
+        </If.Then>
+        <If.Else>
+          <mtbwa:WriteBuildMessage DisplayName="Write Message" Message="Not Labeling sources" Importance="[Microsoft.TeamFoundation.Build.Client.BuildMessageImportance.High]" />
+        </If.Else>
+      </If>
+      <TryCatch DisplayName="Try Compile, Test, and Associate Changesets and Work Items" mtbwt:BuildTrackingParticipant.Importance="Low">
+        <TryCatch.Finally>
+          <Sequence DisplayName="Revert Workspace and Copy Files to Drop Location" mtbwt:BuildTrackingParticipant.Importance="Low">
+            <mtbwa:InvokeForReason DisplayName="Revert Workspace for Shelveset Builds" Reason="CheckInShelveset, ValidateShelveset">
+              <mtbwa:RevertWorkspace DisplayName="Revert Workspace" Workspace="[Workspace]" />
+            </mtbwa:InvokeForReason>
+            <If  Condition="[Not String.IsNullOrEmpty(DropLocation)]" DisplayName="If DropLocation is Set" mtbwt:BuildTrackingParticipant.Importance="Low">
+              <If.Then>
+                <mtbwa:CopyDirectory DisplayName="Drop Files to Drop Location" Source="[BinariesDirectory]" Destination="[DropLocation]" />
+              </If.Then>
+            </If>
+          </Sequence>
+        </TryCatch.Finally>
+        <TryCatch.Try>
+          <Sequence mtbwt:BuildTrackingParticipant.Importance="None">
+            <Sequence.Variables>
+              <Variable x:TypeArguments="s:Exception" Name="compilationException" />
+              <Variable x:TypeArguments="scg:IList(mtvc:Changeset)" Name="associatedChangesets" />
+              <Variable x:TypeArguments="s:Boolean" Name="treatTestFailureAsBuildFailure" />
+            </Sequence.Variables>
+            <Parallel DisplayName="Compile, Test, and Associate Changesets and Work Items">
+              <TryCatch DisplayName="Try Compile and Test" mtbwt:BuildTrackingParticipant.Importance="Low">
+                <TryCatch.Try>
+                  <Sequence DisplayName="Compile and Test">
+                    <ForEach x:TypeArguments="mtbwa:PlatformConfiguration" DisplayName="For Each Configuration in BuildSettings.PlatformConfigurations" Values="[BuildSettings.PlatformConfigurations]" mtbwt:BuildTrackingParticipant.Importance="Low">
+                      <ActivityAction x:TypeArguments="mtbwa:PlatformConfiguration">
+                        <ActivityAction.Argument>
+                          <DelegateInArgument x:TypeArguments="mtbwa:PlatformConfiguration" Name="platformConfiguration" />
+                        </ActivityAction.Argument>
+                        <Sequence DisplayName="Compile and Test for Configuration" mtbwt:BuildTrackingParticipant.Importance="Low">
+                          <Sequence.Variables>
+                            <Variable x:TypeArguments="x:String" Name="outputDirectory" />
+                            <Variable x:TypeArguments="x:String" Name="logFileDropLocation" />
+                          </Sequence.Variables>
+                          <Sequence DisplayName="Initialize Variables" mtbwt:BuildTrackingParticipant.Importance="Low">
+                            <Assign x:TypeArguments="x:String" DisplayName="Create OutputDirectory Per Platform and Configuration" To="[outputDirectory]" Value="[If (platformConfiguration.IsEmpty Or BuildSettings.PlatformConfigurations.Count = 1, BinariesDirectory, If (platformConfiguration.IsPlatformEmptyOrAnyCpu, BinariesDirectory + &quot;\&quot; + platformConfiguration.Configuration, BinariesDirectory + &quot;\&quot; + platformConfiguration.Platform + &quot;\&quot; + platformConfiguration.Configuration))]" mtbwt:BuildTrackingParticipant.Importance="Low" />
+                            <If Condition="[Not String.IsNullOrEmpty(DropLocation)]" DisplayName="If DropLocation is Set" mtbwt:BuildTrackingParticipant.Importance="Low">
+                              <If.Then>
+                                <Assign x:TypeArguments="x:String" DisplayName="Initialize LogFile Drop Location" To="[logFileDropLocation]" Value="[If (platformConfiguration.IsEmpty Or BuildSettings.PlatformConfigurations.Count = 1, BuildDropProvider.CombinePaths(DropLocation, &quot;logs&quot;), If (platformConfiguration.IsPlatformEmptyOrAnyCpu, BuildDropProvider.CombinePaths(DropLocation, &quot;logs&quot;, platformConfiguration.Configuration), BuildDropProvider.CombinePaths(DropLocation, &quot;logs&quot;, platformConfiguration.Platform, platformConfiguration.Configuration)))]" mtbwt:BuildTrackingParticipant.Importance="Low" />
+                              </If.Then>
+                            </If>
+                          </Sequence>
+                          <If Condition="[BuildSettings.HasProjectsToBuild]" DisplayName="If BuildSettings.HasProjectsToBuild" mtbwt:BuildTrackingParticipant.Importance="Low">
+                            <If.Then>
+                              <ForEach x:TypeArguments="x:String" DisplayName="For Each Project in BuildSettings.ProjectsToBuild" Values="[BuildSettings.ProjectsToBuild]" mtbwt:BuildTrackingParticipant.Importance="Low">
+                                <ActivityAction x:TypeArguments="x:String">
+                                  <ActivityAction.Argument>
+                                    <DelegateInArgument x:TypeArguments="x:String" Name="serverBuildProjectItem" />
+                                  </ActivityAction.Argument>
+                                  <TryCatch DisplayName="Try to Compile the Project" mtbwt:BuildTrackingParticipant.Importance="Low">
+                                    <TryCatch.Try>
+                                      <Sequence DisplayName="Compile the Project" mtbwt:BuildTrackingParticipant.Importance="Low">
+                                        <Sequence.Variables>
+                                          <Variable x:TypeArguments="x:String" Name="localProject" />
+                                          <Variable x:TypeArguments="x:String" Name="outputDirectoryPerProject" Default="[outputDirectory]" />
+                                        </Sequence.Variables>
+                                        <mtbwa:ConvertWorkspaceItem DisplayName="Convert Server Path to Local Path" Input="[serverBuildProjectItem]" Result="[localProject]" Workspace="[Workspace]" mtbwt:BuildTrackingParticipant.Importance="Low" />
+                                        <If Condition="[SolutionSpecificBuildOutputs]" DisplayName="If Build Outputs are Solution-Specific" mtbwt:BuildTrackingParticipant.Importance="Low">
+                                          <If.Then>
+                                            <Sequence DisplayName="Update Output Directory" mtbwt:BuildTrackingParticipant.Importance="Low">
+                                              <Assign x:TypeArguments="x:String" DisplayName="Set Solution-Specific Output Directory" To="[outputDirectoryPerProject]" Value="[System.IO.Path.Combine(outputDirectory, System.IO.Path.GetFileNameWithoutExtension(localProject))]" mtbwt:BuildTrackingParticipant.Importance="Low" />
+                                              <If DisplayName="If Output Directory Exists" Condition="[System.IO.Directory.Exists(outputDirectoryPerProject)]" mtbwt:BuildTrackingParticipant.Importance="Low">
+                                                <If.Then>
+                                                  <mtbwa:WriteBuildWarning DisplayName="Write Duplicate Project Names Warning" Message="[String.Format(&quot;{0} conflicts with another solution/project. Build outputs for solutions/projects with the same name will be copied to the same directory. To separate the build outputs, change the name of one of the solutions/projects.&quot;, System.IO.Path.GetFileNameWithoutExtension(localProject))]" />
+                                                </If.Then>
+                                              </If>
+                                            </Sequence>
+                                          </If.Then>
+                                        </If>
+                                        <mtbwa:MSBuild CommandLineArguments="[String.Format(&quot;/p:SkipInvalidConfigurations=true {0}&quot;, MSBuildArguments)]" Configuration="[platformConfiguration.Configuration]" DisplayName="Run MSBuild for Project" GenerateVSPropsFile="[True]" LogFileDropLocation="[logFileDropLocation]" MaxProcesses="[If (MSBuildMultiProc, 0, 1)]" OutDir="[outputDirectoryPerProject]" Platform="[platformConfiguration.Platform]" Project="[localProject]" RunCodeAnalysis="[RunCodeAnalysis]" TargetsNotLogged="[New String() {&quot;GetNativeManifest&quot;, &quot;GetCopyToOutputDirectoryItems&quot;, &quot;GetTargetPath&quot;}]" ToolPlatform="[MSBuildPlatform]" Verbosity="[Verbosity]" />
+                                      </Sequence>
+                                    </TryCatch.Try>
+                                    <TryCatch.Catches>
+                                      <Catch x:TypeArguments="s:Exception">
+                                        <ActivityAction x:TypeArguments="s:Exception">
+                                          <ActivityAction.Argument>
+                                            <DelegateInArgument x:TypeArguments="s:Exception" Name="ex" />
+                                          </ActivityAction.Argument>
+                                          <Sequence DisplayName="Handle Exception">
+                                            <Sequence.Variables>
+                                              <Variable x:TypeArguments="scg:ICollection(mtbc:IQueuedBuild)" Name="failedRequests" />
+                                            </Sequence.Variables>
+                                            <mtbwa:SetBuildProperties CompilationStatus="[Microsoft.TeamFoundation.Build.Client.BuildPhaseStatus.Failed]" DisplayName="Set CompilationStatus to Failed" PropertiesToSet="CompilationStatus" mtbwt:BuildTrackingParticipant.Importance="Low" />
+                                            <If Condition="[CreateWorkItem]" DisplayName="If CreateWorkItem" mtbwt:BuildTrackingParticipant.Importance="Low">
+                                              <If.Then>
+                                                <mtbwa:InvokeForReason DisplayName="Create Work Item for non-Shelveset Builds" Reason="Manual, IndividualCI, BatchedCI, Schedule, ScheduleForced, UserCreated">
+                                                  <mtbwa:OpenWorkItem AssignedTo="[BuildDetail.RequestedFor]" Comment="[&quot;This work item was created by TFS Build on a build failure.&quot;]" CustomFields="[New Dictionary(Of String, String) From { {&quot;System.Reason&quot;, &quot;Build Failure&quot;}, {&quot;Microsoft.VSTS.TCM.ReproSteps&quot;, &quot;Start the build using TFS Build&quot;}, {&quot;Priority&quot;, &quot;1&quot;}, {&quot;Severity&quot;, &quot;1 - Critical&quot;} }]" DisplayName="Create Work Item" Title="[String.Format(&quot;Build Failure in Build: {0}&quot;, BuildDetail.BuildNumber)]" Type="[&quot;Bug&quot;]" />
+                                                </mtbwa:InvokeForReason>
+                                              </If.Then>
+                                            </If>
+                                            <mtbwa:GetApprovedRequests DisplayName="Get Requests Approved for Check In" Result="[failedRequests]" mtbwt:BuildTrackingParticipant.Importance="None" />
+                                            <mtbwa:RetryRequests Behavior="[Microsoft.TeamFoundation.Build.Workflow.Activities.RetryBehavior.DoNotBatch]" DisplayName="Mark Requests for Retry" Requests="[failedRequests]" mtbwt:BuildTrackingParticipant.Importance="Low" />
+                                            <Rethrow DisplayName="Rethrow the exception so the build will stop" mtbwt:BuildTrackingParticipant.Importance="Low" />
+                                          </Sequence>
+                                        </ActivityAction>
+                                      </Catch>
+                                    </TryCatch.Catches>
+                                  </TryCatch>
+                                </ActivityAction>
+                              </ForEach>
+                            </If.Then>
+                          </If>
+                          <If Condition="[Not DisableTests]" DisplayName="If Not DisableTests" mtbwt:BuildTrackingParticipant.Importance="Low">
+                            <If.Then>
+                              <Sequence DisplayName="Run Tests" mtbwt:BuildTrackingParticipant.Importance="Low">
+                                <If Condition="[Not TestSpecs Is Nothing]" DisplayName="If Not TestSpecs Is Nothing" mtbwt:BuildTrackingParticipant.Importance="Low">
+                                  <If.Then>
+                                    <ForEach x:TypeArguments="mtbwa:TestSpec" DisplayName="For Each TestSpec in TestSpecs" Values="[TestSpecs]" mtbwt:BuildTrackingParticipant.Importance="Low">
+                                      <ActivityAction x:TypeArguments="mtbwa:TestSpec">
+                                        <ActivityAction.Argument>
+                                          <DelegateInArgument x:TypeArguments="mtbwa:TestSpec" Name="spec" />
+                                        </ActivityAction.Argument>
+                                        <TryCatch DisplayName="Try Run Tests" mtbwt:BuildTrackingParticipant.Importance="Low">
+                                          <TryCatch.Try>
+                                            <If Condition="[TypeOf spec Is Microsoft.TeamFoundation.Build.Workflow.Activities.AgileTestPlatformSpec]" DisplayName="If spec Is AgileTestPlatformSpec" mtbwt:BuildTrackingParticipant.Importance="None">
+                                              <If.Then>
+                                                <Sequence DisplayName="Run Visual Studio Test Runner for Test Sources" mtbwt:BuildTrackingParticipant.Importance="Low">
+                                                  <Sequence.Variables>
+                                                    <Variable x:TypeArguments="mtbwa:AgileTestPlatformSpec" Name="agileTestPlatformAssembly" />
+                                                    <Variable x:TypeArguments="scg:IEnumerable(x:String)" Name="agileTestPlatformAssemblies" />
+                                                  </Sequence.Variables>
+                                                  <Assign x:TypeArguments="mtbwa:AgileTestPlatformSpec" DisplayName="Assign spec to agileTestPlatformAssembly" To="[agileTestPlatformAssembly]" Value="[DirectCast(spec, Microsoft.TeamFoundation.Build.Workflow.Activities.AgileTestPlatformSpec)]" mtbwt:BuildTrackingParticipant.Importance="Low" />
+                                                  <mtbwa:FindMatchingFiles DisplayName="Find Visual Studio Test Platform Test Assemblies" MatchPattern="[String.Format(&quot;{0}\{1}&quot;, outputDirectory, agileTestPlatformAssembly.AssemblyFileSpec)]" Result="[agileTestPlatformAssemblies]" mtbwt:BuildTrackingParticipant.Importance="Low" />
+                                                  <If Condition="[agileTestPlatformAssemblies.Count() &gt; 0]" DisplayName="If Visual Studio Test Platform Test Assemblies Found" mtbwt:BuildTrackingParticipant.Importance="Low">
+                                                    <If.Then>
+                                                      <If Condition="[agileTestPlatformAssembly.HasRunSettingsFile]" DisplayName="If agileTestPlatformAssembly.HasRunSettingsFile" mtbwt:BuildTrackingParticipant.Importance="Low">
+                                                        <If.Then>
+                                                          <Sequence DisplayName="Find Run Settings File And Run Visual Studio Test Runner" mtbwt:BuildTrackingParticipant.Importance="Low">
+                                                            <Sequence.Variables>
+                                                              <Variable x:TypeArguments="x:String" Name="localRunSettings" />
+                                                            </Sequence.Variables>
+                                                            <mtbwa:GenerateRunSettings DisplayName="Generate Run Settings File" RunSettingsForTestRun="[agileTestPlatformAssembly.RunSettingsForTestRun]" Result="[localRunSettings]" Workspace="[Workspace]" mtbwt:BuildTrackingParticipant.Importance="Low" />
+                                                            <mtbwa:RunTests DisplayName="Run Visual Studio Test Runner for Test Sources" RunName="[agileTestPlatformAssembly.RunName]" Flavor="[platformConfiguration.Configuration]" Platform="[platformConfiguration.Platform]" TestSources="[agileTestPlatformAssemblies]" RunSettings="[localRunSettings]" TestCaseFilter="[agileTestPlatformAssembly.TestCaseFilter]" ExecutionPlatform="[agileTestPlatformAssembly.ExecutionPlatform]" />
+                                                          </Sequence>
+                                                        </If.Then>
+                                                        <If.Else>
+                                                          <mtbwa:RunTests DisplayName="Run Visual Studio Test Runner for Test Sources" RunName="[agileTestPlatformAssembly.RunName]" Flavor="[platformConfiguration.Configuration]" Platform="[platformConfiguration.Platform]" TestSources="[agileTestPlatformAssemblies]" TestCaseFilter="[agileTestPlatformAssembly.TestCaseFilter]" ExecutionPlatform="[agileTestPlatformAssembly.ExecutionPlatform]" />
+                                                        </If.Else>
+                                                      </If>
+                                                    </If.Then>
+                                                  </If>
+                                                </Sequence>
+                                              </If.Then>
+                                              <If.Else>
+                                                <If Condition="[TypeOf spec Is Microsoft.TeamFoundation.Build.Workflow.Activities.TestMetadataFileSpec]" DisplayName="If spec Is TestMetadataFileSpec" mtbwt:BuildTrackingParticipant.Importance="None">
+                                                  <If.Then>
+                                                    <Sequence DisplayName="Run MSTest for Metadata File">
+                                                      <Sequence.Variables>
+                                                        <Variable x:TypeArguments="mtbwa:TestMetadataFileSpec" Name="testMetadataFile" />
+                                                        <Variable x:TypeArguments="x:String" Name="localTestMetadata" />
+                                                      </Sequence.Variables>
+                                                      <Assign x:TypeArguments="mtbwa:TestMetadataFileSpec" DisplayName="Assign spec to testMetadataFile" To="[testMetadataFile]" Value="[DirectCast(spec, Microsoft.TeamFoundation.Build.Workflow.Activities.TestMetadataFileSpec)]" mtbwt:BuildTrackingParticipant.Importance="Low" />
+                                                      <mtbwa:ConvertWorkspaceItem DisplayName="Convert Server Path to Local Path" Input="[testMetadataFile.MetadataFileName]" Result="[localTestMetadata]" Workspace="[Workspace]" mtbwt:BuildTrackingParticipant.Importance="Low" />
+                                                      <mtbwa:MSTest RunTitle="[testMetadataFile.RunName]" Category="[testMetadataFile.CategoryFilter]" DisplayName="Run MSTest for Metadata File" Flavor="[platformConfiguration.Configuration]" MaxPriority="[testMetadataFile.MaximumPriority]" MinPriority="[testMetadataFile.MinimumPriority]" PathToResultsFilesRoot="[TestResultsDirectory]" Platform="[platformConfiguration.Platform]" SearchPathRoot="[outputDirectory]" TestLists="[testMetadataFile.TestLists]" TestMetadata="[localTestMetadata]" TestSettings="[String.Empty]" CommandLineArguments="[testMetadataFile.MSTestCommandLineArgs]" />
+                                                    </Sequence>
+                                                  </If.Then>
+                                                  <If.Else>
+                                                    <Sequence DisplayName="Run MSTest for Test Assemblies" mtbwt:BuildTrackingParticipant.Importance="Low">
+                                                      <Sequence.Variables>
+                                                        <Variable x:TypeArguments="mtbwa:TestAssemblySpec" Name="testAssembly" />
+                                                        <Variable x:TypeArguments="scg:IEnumerable(x:String)" Name="testAssemblies" />
+                                                        <Variable x:TypeArguments="x:String" Default="[String.Empty]" Name="testFlavor" />
+                                                        <Variable x:TypeArguments="x:String" Default="[String.Empty]" Name="testPlatform" />
+                                                      </Sequence.Variables>
+                                                      <Assign x:TypeArguments="mtbwa:TestAssemblySpec" DisplayName="Assign spec to testAssembly" To="[testAssembly]" Value="[DirectCast(spec, Microsoft.TeamFoundation.Build.Workflow.Activities.TestAssemblySpec)]" mtbwt:BuildTrackingParticipant.Importance="Low" />
+                                                      <mtbwa:FindMatchingFiles DisplayName="Find Test Assemblies" MatchPattern="[String.Format(&quot;{0}\{1}&quot;, outputDirectory, testAssembly.AssemblyFileSpec)]" Result="[testAssemblies]" mtbwt:BuildTrackingParticipant.Importance="Low" />
+                                                      <If Condition="[testAssemblies.Count() &gt; 0]" DisplayName="If Test Assemblies Found" mtbwt:BuildTrackingParticipant.Importance="Low">
+                                                        <If.Then>
+                                                          <If Condition="[testAssembly.HasTestSettingsFile]" DisplayName="If testAssembly.HasTestSettingsFile" mtbwt:BuildTrackingParticipant.Importance="Low">
+                                                            <If.Then>
+                                                              <Sequence DisplayName="Find Test Settings File And Run MSTest" mtbwt:BuildTrackingParticipant.Importance="Low">
+                                                                <Sequence.Variables>
+                                                                  <Variable x:TypeArguments="x:String" Name="localTestSettings" />
+                                                                </Sequence.Variables>
+                                                                <mtbwa:ConvertWorkspaceItem DisplayName="Convert Server Path to Local Path" Input="[testAssembly.TestSettingsFileName]" Result="[localTestSettings]" Workspace="[Workspace]" mtbwt:BuildTrackingParticipant.Importance="Low" />
+                                                                <mtbwa:MSTest RunTitle="[testAssembly.RunName]" Category="[testAssembly.CategoryFilter]" DisplayName="Run MSTest for Test Assemblies" Flavor="[platformConfiguration.Configuration]" MaxPriority="[testAssembly.MaximumPriority]" MinPriority="[testAssembly.MinimumPriority]" PathToResultsFilesRoot="[TestResultsDirectory]" Platform="[platformConfiguration.Platform]" SearchPathRoot="[outputDirectory]" TestContainers="[testAssemblies]" TestSettings="[localTestSettings]" CommandLineArguments="[testAssembly.MSTestCommandLineArgs]" />
+                                                              </Sequence>
+                                                            </If.Then>
+                                                            <If.Else>
+                                                              <mtbwa:MSTest RunTitle="[testAssembly.RunName]" Category="[testAssembly.CategoryFilter]" DisplayName="Run MSTest for Test Assemblies" Flavor="[platformConfiguration.Configuration]" MaxPriority="[testAssembly.MaximumPriority]" MinPriority="[testAssembly.MinimumPriority]" PathToResultsFilesRoot="[TestResultsDirectory]" Platform="[platformConfiguration.Platform]" SearchPathRoot="[outputDirectory]" TestContainers="[testAssemblies]" CommandLineArguments="[testAssembly.MSTestCommandLineArgs]" />
+                                                            </If.Else>
+                                                          </If>
+                                                        </If.Then>
+                                                      </If>
+                                                    </Sequence>
+                                                  </If.Else>
+                                                </If>
+                                              </If.Else>
+                                            </If>
+                                          </TryCatch.Try>
+                                          <TryCatch.Catches>
+                                            <Catch x:TypeArguments="s:Exception">
+                                              <ActivityAction x:TypeArguments="s:Exception">
+                                                <ActivityAction.Argument>
+                                                  <DelegateInArgument x:TypeArguments="s:Exception" Name="testException" />
+                                                </ActivityAction.Argument>
+                                                <Sequence DisplayName="Handle Test Run Exception">
+                                                  <Sequence.Variables>
+                                                    <Variable x:TypeArguments="scg:ICollection(mtbc:IQueuedBuild)" Name="failedRequests" />
+                                                  </Sequence.Variables>
+                                                  <If Condition="[Not (TypeOf testException Is Microsoft.TeamFoundation.Build.Workflow.Activities.TestFailureException)]" DisplayName="If testException is NOT TestFailureException" mtbwt:BuildTrackingParticipant.Importance="Low">
+                                                    <If.Then>
+                                                      <mtbwa:WriteBuildError DisplayName="Write Test Failure Message" Message="[testException.Message]" />
+                                                    </If.Then>
+                                                  </If>
+                                                  <mtbwa:SetBuildProperties DisplayName="Set TestStatus to Failed" PropertiesToSet="TestStatus" TestStatus="[Microsoft.TeamFoundation.Build.Client.BuildPhaseStatus.Failed]" mtbwt:BuildTrackingParticipant.Importance="Low" />
+                                                  <If Condition="[spec.FailBuildOnFailure]" DisplayName="If spec.FailBuildOnFailure" mtbwt:BuildTrackingParticipant.Importance="Low">
+                                                    <If.Then>
+                                                      <Assign x:TypeArguments="s:Boolean" DisplayName="Set treatTestFailureAsBuildFailure to True" To="[treatTestFailureAsBuildFailure]" Value="[True]" mtbwt:BuildTrackingParticipant.Importance="Low" />
+                                                    </If.Then>
+                                                  </If>
+                                                  <mtbwa:GetApprovedRequests DisplayName="Get Requests Approved for Check In" Result="[failedRequests]" mtbwt:BuildTrackingParticipant.Importance="None" />
+                                                  <mtbwa:RetryRequests Behavior="[Microsoft.TeamFoundation.Build.Workflow.Activities.RetryBehavior.DoNotBatch]" DisplayName="Mark Requests for Retry" Requests="[failedRequests]" mtbwt:BuildTrackingParticipant.Importance="Low" />
+                                                </Sequence>
+                                              </ActivityAction>
+                                            </Catch>
+                                          </TryCatch.Catches>
+                                        </TryCatch>
+                                      </ActivityAction>
+                                    </ForEach>
+                                  </If.Then>
+                                </If>
+                              </Sequence>
+                            </If.Then>
+                            <If.Else>
+                              <If Condition="[(Not TestSpecs Is Nothing) And (TestSpecs.Count > 0)]" DisplayName="If TestSpecs Is Not Nothing or Empty" mtbwt:BuildTrackingParticipant.Importance="Low">
+                                <If.Then>
+                                  <mtbwa:WriteBuildWarning DisplayName="Write Warning" Message="No automated tests will be run for this build because tests have been disabled for this build definition. To enable these tests, edit this build definition and set the Disable Tests process parameter to false." />
+                                </If.Then>
+                              </If>
+                            </If.Else>
+                          </If>
+                        </Sequence>
+                      </ActivityAction>
+                    </ForEach>
+                    <If Condition="[BuildDetail.CompilationStatus = Microsoft.TeamFoundation.Build.Client.BuildPhaseStatus.Unknown]" DisplayName="If CompilationStatus = Unknown" mtbwt:BuildTrackingParticipant.Importance="Low">
+                      <If.Then>
+                        <mtbwa:SetBuildProperties CompilationStatus="[Microsoft.TeamFoundation.Build.Client.BuildPhaseStatus.Succeeded]" DisplayName="Set CompilationStatus to Succeeded" PropertiesToSet="CompilationStatus" mtbwt:BuildTrackingParticipant.Importance="Low" />
+                      </If.Then>
+                    </If>
+                    <If Condition="[BuildDetail.TestStatus = Microsoft.TeamFoundation.Build.Client.BuildPhaseStatus.Unknown]" DisplayName="If TestStatus = Unknown" mtbwt:BuildTrackingParticipant.Importance="Low">
+                      <If.Then>
+                        <mtbwa:SetBuildProperties DisplayName="Set TestStatus to Succeeded" PropertiesToSet="TestStatus" TestStatus="[Microsoft.TeamFoundation.Build.Client.BuildPhaseStatus.Succeeded]" mtbwt:BuildTrackingParticipant.Importance="Low" />
+                      </If.Then>
+                    </If>
+                    <If Condition="[treatTestFailureAsBuildFailure And (BuildDetail.TestStatus = Microsoft.TeamFoundation.Build.Client.BuildPhaseStatus.Failed)]" DisplayName="If TreatTestFailureAsBuildFailure And (TestStatus = Failed)" mtbwt:BuildTrackingParticipant.Importance="Low">
+                      <If.Then>
+                        <mtbwa:SetBuildProperties DisplayName="Set Status to Failed" PropertiesToSet="Status" Status="[Microsoft.TeamFoundation.Build.Client.BuildStatus.Failed]" mtbwt:BuildTrackingParticipant.Importance="Low" />
+                      </If.Then>
+                    </If>
+                  </Sequence>
+                </TryCatch.Try>
+                <TryCatch.Catches>
+                  <Catch x:TypeArguments="s:Exception">
+                    <ActivityAction x:TypeArguments="s:Exception">
+                      <ActivityAction.Argument>
+                        <DelegateInArgument x:TypeArguments="s:Exception" Name="compilationExceptionArgument" />
+                      </ActivityAction.Argument>
+                      <Assign x:TypeArguments="s:Exception" DisplayName="Save the Compilation Exception" To="[compilationException]" Value="[compilationExceptionArgument]" mtbwt:BuildTrackingParticipant.Importance="None" />
+                    </ActivityAction>
+                  </Catch>
+                </TryCatch.Catches>
+              </TryCatch>
+              <If Condition="[AssociateChangesetsAndWorkItems]" DisplayName="If AssociateChangesetsAndWorkItems" mtbwt:BuildTrackingParticipant.Importance="Low">
+                <If.Then>
+                  <If Condition="[CreateLabel]" DisplayName="If CreateLabel and AssociateChangesetsAndWorkItems" mtbwt:BuildTrackingParticipant.Importance="Low">
+                    <If.Then>
+                      <mtbwa:InvokeForReason DisplayName="Associate Changesets and Work Items for non-Shelveset Builds" Reason="Manual, IndividualCI, BatchedCI, Schedule, ScheduleForced, UserCreated">
+                        <mtbwa:AssociateChangesetsAndWorkItems DisplayName="Associate Changesets and Work Items" Result="[associatedChangesets]" />
+                      </mtbwa:InvokeForReason>
+                    </If.Then>
+                    <If.Else>
+                      <mtbwa:WriteBuildWarning DisplayName="Write Associate Changesets and Work Items Warning" Message="Cannot Associate Changesets and Work Items because the Label Sources option is set to False." />
+                    </If.Else>
+                  </If>
+                </If.Then>
+              </If>
+            </Parallel>
+            <If Condition="[Not compilationException Is Nothing]" DisplayName="If a Compilation Exception Occurred" mtbwt:BuildTrackingParticipant.Importance="Low">
+              <If.Then>
+                <Throw DisplayName="Rethrow Compilation Exception" Exception="[compilationException]" mtbwt:BuildTrackingParticipant.Importance="Low" />
+              </If.Then>
+            </If>
+            <Parallel DisplayName="Get Impacted Tests, Index Sources and Publish Symbols">
+              <If Condition="[PerformTestImpactAnalysis]" DisplayName="If PerformTestImpactAnalysis" mtbwt:BuildTrackingParticipant.Importance="Low">
+                <If.Then>
+                  <Sequence DisplayName="Get Impacted Tests" mtbwt:BuildTrackingParticipant.Importance="Low">
+                    <Sequence.Variables>
+                      <Variable x:TypeArguments="scg:IEnumerable(x:String)" Name="assemblies" />
+                    </Sequence.Variables>
+                    <mtbwa:FindMatchingFiles DisplayName="Find Build Outputs" MatchPattern="[String.Format(&quot;{0}\**\*.dll;{0}\**\*.exe&quot;, BinariesDirectory)]" Result="[assemblies]" mtbwt:BuildTrackingParticipant.Importance="Low" />
+                    <mttbb:GetImpactedTests Assemblies="[assemblies]" AssociatedChangesets="[associatedChangesets]" BinariesRoot="[BinariesDirectory]" Build="[BuildDetail]" CodeChanges="{x:Null}" DisplayName="Get Impacted Tests" ImpactedTests="{x:Null}" Workspace="[Workspace]" />
+                  </Sequence>
+                </If.Then>
+              </If>
+              <If Condition="[SourceAndSymbolServerSettings.IndexSources Or SourceAndSymbolServerSettings.HasSymbolStorePath]" DisplayName="If SourceAndSymbolServerSettings.IndexSources Or SourceAndSymbolServerSettings.HasSymbolStorePath" mtbwt:BuildTrackingParticipant.Importance="Low">
+                <If.Then>
+                  <mtbwa:InvokeForReason DisplayName="Index Sources and Publish Symbols for Triggered Builds" Reason="Triggered">
+                    <mtbwa:InvokeForReason.Variables>
+                      <Variable x:TypeArguments="scg:IEnumerable(x:String)" Name="symbolFiles" />
+                    </mtbwa:InvokeForReason.Variables>
+                    <mtbwa:FindMatchingFiles DisplayName="Find Symbol Files" MatchPattern="[String.Format(&quot;{0}\**\*.pdb&quot;, BinariesDirectory)]" Result="[symbolFiles]" mtbwt:BuildTrackingParticipant.Importance="Low" />
+                    <If Condition="[SourceAndSymbolServerSettings.IndexSources]" DisplayName="If SourceAndSymbolServerSettings.IndexSources" mtbwt:BuildTrackingParticipant.Importance="Low">
+                      <If.Then>
+                        <TryCatch DisplayName="Try Index Sources" mtbwt:BuildTrackingParticipant.Importance="Low">
+                          <TryCatch.Try>
+                            <mtbwa:IndexSources DisplayName="Index Sources" FileList="[symbolFiles]" />
+                          </TryCatch.Try>
+                          <TryCatch.Catches>
+                            <Catch x:TypeArguments="s:Exception">
+                              <ActivityAction x:TypeArguments="s:Exception">
+                                <ActivityAction.Argument>
+                                  <DelegateInArgument x:TypeArguments="s:Exception" Name="exception" />
+                                </ActivityAction.Argument>
+                                <mtbwa:WriteBuildError DisplayName="Write Indexing Sources Error" Message="[exception.Message]" />
+                              </ActivityAction>
+                            </Catch>
+                          </TryCatch.Catches>
+                        </TryCatch>
+                      </If.Then>
+                    </If>
+                    <If Condition="[SourceAndSymbolServerSettings.HasSymbolStorePath]" DisplayName="If SourceAndSymbolServerSettings.HasSymbolStorePath" mtbwt:BuildTrackingParticipant.Importance="Low">
+                      <If.Then>
+                        <TryCatch DisplayName="Try Publish Symbols" mtbwt:BuildTrackingParticipant.Importance="Low">
+                          <TryCatch.Try>
+                            <mtbwa:SharedResourceScope DisplayName="Synchronize Access to Symbol Store" MaxExecutionTime="[TimeSpan.Zero]" MaxWaitTime="[New TimeSpan(1, 0, 0)]" ResourceName="[SourceAndSymbolServerSettings.SymbolStorePath]" mtbwt:BuildTrackingParticipant.Importance="Low">
+                              <mtbwa:PublishSymbols DisplayName="Publish Symbols" FileList="[symbolFiles]" ProductName="[BuildDetail.BuildDefinition.Name]" StorePath="[SourceAndSymbolServerSettings.SymbolStorePath]" Version="[BuildDetail.BuildNumber]" />
+                            </mtbwa:SharedResourceScope>
+                          </TryCatch.Try>
+                          <TryCatch.Catches>
+                            <Catch x:TypeArguments="s:Exception">
+                              <ActivityAction x:TypeArguments="s:Exception">
+                                <ActivityAction.Argument>
+                                  <DelegateInArgument x:TypeArguments="s:Exception" Name="exception" />
+                                </ActivityAction.Argument>
+                                <mtbwa:WriteBuildError DisplayName="Write Publishing Symbols Error" Message="[exception.Message]" />
+                              </ActivityAction>
+                            </Catch>
+                          </TryCatch.Catches>
+                        </TryCatch>
+                      </If.Then>
+                    </If>
+                  </mtbwa:InvokeForReason>
+                </If.Then>
+              </If>
+            </Parallel>
+          </Sequence>
+        </TryCatch.Try>
+      </TryCatch>
+    </mtbwa:AgentScope>
+    <mtbwa:InvokeForReason DisplayName="Check In Gated Changes for CheckInShelveset Builds" Reason="CheckInShelveset">
+      <mtbwa:CheckInGatedChanges DisplayName="Check In Gated Changes" />
+    </mtbwa:InvokeForReason>
+  </Sequence>
+</Activity>

File diff suppressed because it is too large
+ 0 - 0
sourceCode/BuildProcessTemplates/LabDefaultTemplate.11.xaml


+ 76 - 0
sourceCode/BuildProcessTemplates/UpgradeTemplate.xaml

@@ -0,0 +1,76 @@
+<Activity mc:Ignorable="sad" x:Class="TfsBuild.Process" xmlns="http://schemas.microsoft.com/netfx/2009/xaml/activities" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mtbc="clr-namespace:Microsoft.TeamFoundation.Build.Client;assembly=Microsoft.TeamFoundation.Build.Client" xmlns:mtbw="clr-namespace:Microsoft.TeamFoundation.Build.Workflow;assembly=Microsoft.TeamFoundation.Build.Workflow" xmlns:mtbwa="clr-namespace:Microsoft.TeamFoundation.Build.Workflow.Activities;assembly=Microsoft.TeamFoundation.Build.Workflow" xmlns:mtbwt="clr-namespace:Microsoft.TeamFoundation.Build.Workflow.Tracking;assembly=Microsoft.TeamFoundation.Build.Workflow" xmlns:mtvc="clr-namespace:Microsoft.TeamFoundation.VersionControl.Client;assembly=Microsoft.TeamFoundation.VersionControl.Client" xmlns:mva="clr-namespace:Microsoft.VisualBasic.Activities;assembly=System.Activities" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:sad="http://schemas.microsoft.com/netfx/2009/xaml/activities/presentation" xmlns:sad1="clr-namespace:System.Activities.Debugger;assembly=System.Activities" xmlns:scg="clr-namespace:System.Collections.Generic;assembly=mscorlib" xmlns:this="clr-namespace:TfsBuild;" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
+  <x:Members>
+    <x:Property Name="ConfigurationFolderPath" Type="InArgument(x:String)" />
+    <x:Property Name="AgentSettings" Type="InArgument(mtbwa:AgentSettings)" />
+    <x:Property Name="MSBuildArguments" Type="InArgument(x:String)" />
+    <x:Property Name="MSBuildPlatform" Type="InArgument(mtbwa:ToolPlatform)" />
+    <x:Property Name="DoNotDownloadBuildType" Type="InArgument(x:Boolean)" />
+    <x:Property Name="LogFilePerProject" Type="InArgument(x:Boolean)" />
+    <x:Property Name="SourcesSubdirectory" Type="InArgument(x:String)" />
+    <x:Property Name="BinariesSubdirectory" Type="InArgument(x:String)" />
+    <x:Property Name="TestResultsSubdirectory" Type="InArgument(x:String)" />
+    <x:Property Name="RecursionType" Type="InArgument(mtvc:RecursionType)" />
+    <x:Property Name="Verbosity" Type="InArgument(mtbw:BuildVerbosity)" />
+    <x:Property Name="Metadata" Type="mtbw:ProcessParameterMetadataCollection" />
+    <x:Property Name="SupportedReasons" Type="mtbc:BuildReason" />
+  </x:Members>
+  <this:Process.ConfigurationFolderPath>
+    <InArgument x:TypeArguments="x:String" />
+  </this:Process.ConfigurationFolderPath>
+  <this:Process.AgentSettings>[New Microsoft.TeamFoundation.Build.Workflow.Activities.AgentSettings() With {.MaxWaitTime = New System.TimeSpan(4, 0, 0), .MaxExecutionTime = New System.TimeSpan(0, 0, 0), .TagComparison = Microsoft.TeamFoundation.Build.Workflow.Activities.TagComparison.MatchExactly }]</this:Process.AgentSettings>
+  <this:Process.MSBuildArguments>
+    <InArgument x:TypeArguments="x:String" />
+  </this:Process.MSBuildArguments>
+  <this:Process.MSBuildPlatform>[Microsoft.TeamFoundation.Build.Workflow.Activities.ToolPlatform.Auto]</this:Process.MSBuildPlatform>
+  <this:Process.DoNotDownloadBuildType>[False]</this:Process.DoNotDownloadBuildType>
+  <this:Process.LogFilePerProject>[False]</this:Process.LogFilePerProject>
+  <this:Process.SourcesSubdirectory>
+    <InArgument x:TypeArguments="x:String" />
+  </this:Process.SourcesSubdirectory>
+  <this:Process.BinariesSubdirectory>
+    <InArgument x:TypeArguments="x:String" />
+  </this:Process.BinariesSubdirectory>
+  <this:Process.TestResultsSubdirectory>
+    <InArgument x:TypeArguments="x:String" />
+  </this:Process.TestResultsSubdirectory>
+  <this:Process.RecursionType>[Microsoft.TeamFoundation.VersionControl.Client.RecursionType.OneLevel]</this:Process.RecursionType>
+  <this:Process.Verbosity>[Microsoft.TeamFoundation.Build.Workflow.BuildVerbosity.Normal]</this:Process.Verbosity>
+  <this:Process.Metadata>
+    <mtbw:ProcessParameterMetadataCollection />
+  </this:Process.Metadata>
+  <this:Process.SupportedReasons>All</this:Process.SupportedReasons>
+  <mva:VisualBasic.Settings>Assembly references and imported namespaces serialized as XML namespaces</mva:VisualBasic.Settings>
+  <Sequence mtbwt:BuildTrackingParticipant.Importance="None">
+    <Sequence.Variables>
+      <Variable x:TypeArguments="mtbc:IBuildDetail" Name="BuildDetail" />
+    </Sequence.Variables>
+    <mtbwa:GetBuildDetail DisplayName="Get the Build" Result="[BuildDetail]" />
+    <mtbwa:InvokeForReason DisplayName="Update Build Number for Triggered Builds" Reason="Triggered">
+      <mtbwa:UpdateBuildNumber BuildNumberFormat="[&quot;$(BuildDefinitionName)_$(Date:yyyyMMdd)$(Rev:.r)&quot;]" DisplayName="Update Build Number" />
+    </mtbwa:InvokeForReason>
+    <mtbwa:AgentScope DisplayName="Run On Agent" MaxExecutionTime="[AgentSettings.MaxExecutionTime]" MaxWaitTime="[AgentSettings.MaxWaitTime]" ReservationSpec="[AgentSettings.GetAgentReservationSpec()]">
+      <mtbwa:AgentScope.Variables>
+        <Variable x:TypeArguments="x:String" Name="buildDirectory" />
+      </mtbwa:AgentScope.Variables>
+      <mtbwa:GetBuildDirectory DisplayName="Get the Build Directory" Result="[buildDirectory]" />
+      <If Condition="[Not String.IsNullOrEmpty(ConfigurationFolderPath)]" DisplayName="If Not String.IsNullOrEmpty(ConfigurationFolderPath)">
+        <If.Then>
+          <mtbwa:TfsBuild BinariesSubdirectory="[BinariesSubdirectory]" BuildDirectory="[buildDirectory]" CommandLineArguments="[MSBuildArguments]" ConfigurationFolderPath="[ConfigurationFolderPath]" DisplayName="Run TfsBuild for Configuration Folder" DoNotDownloadBuildType="[DoNotDownloadBuildType]" LogFilePerProject="[LogFilePerProject]" RecursionType="[RecursionType]" SourcesSubdirectory="[SourcesSubdirectory]" TargetsNotLogged="[New String() {&quot;GetNativeManifest&quot;, &quot;GetCopyToOutputDirectoryItems&quot;, &quot;GetTargetPath&quot;}]" TestResultsSubdirectory="[TestResultsSubdirectory]" ToolPlatform="[MSBuildPlatform]" Verbosity="[Verbosity]" />
+        </If.Then>
+      </If>
+      <If Condition="[BuildDetail.CompilationStatus = Microsoft.TeamFoundation.Build.Client.BuildPhaseStatus.Unknown]" DisplayName="If CompilationStatus = Unknown">
+        <If.Then>
+           <mtbwa:SetBuildProperties CompilationStatus="[Microsoft.TeamFoundation.Build.Client.BuildPhaseStatus.Succeeded]" DisplayName="Set CompilationStatus to Succeeded" PropertiesToSet="CompilationStatus" />
+        </If.Then>
+      </If>
+      <If Condition="[BuildDetail.TestStatus = Microsoft.TeamFoundation.Build.Client.BuildPhaseStatus.Unknown]" DisplayName="If TestStatus = Unknown">
+        <If.Then>
+          <mtbwa:SetBuildProperties DisplayName="Set TestStatus to Succeeded" PropertiesToSet="TestStatus" TestStatus="[Microsoft.TeamFoundation.Build.Client.BuildPhaseStatus.Succeeded]" />
+        </If.Then>
+      </If>
+    </mtbwa:AgentScope>
+    <mtbwa:InvokeForReason Reason="CheckInShelveset">
+      <mtbwa:CheckInGatedChanges DisplayName="Check In Gated Changes" />
+    </mtbwa:InvokeForReason>
+  </Sequence>
+</Activity>

+ 34 - 0
sourceCode/trunk/Code/CoreAudio.sln

@@ -0,0 +1,34 @@
+
+Microsoft Visual Studio Solution File, Format Version 11.00
+# Visual Studio 2010
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CoreAudio", "CoreAudio\CoreAudio.csproj", "{2222E8D7-6130-4B46-9749-474E3FE2891B}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CoreAudioTests", "CoreAudioTests\CoreAudioTests.csproj", "{40A8F7EA-C45A-487B-B6E0-BC151827E8C4}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{93C71651-B113-4672-A9B2-862A8F7AF5D4}"
+	ProjectSection(SolutionItems) = preProject
+		CoreAudio.vsmdi = CoreAudio.vsmdi
+	EndProjectSection
+EndProject
+Global
+	GlobalSection(TestCaseManagementSettings) = postSolution
+		CategoryFile = CoreAudio.vsmdi
+	EndGlobalSection
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|Any CPU = Debug|Any CPU
+		Release|Any CPU = Release|Any CPU
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{2222E8D7-6130-4B46-9749-474E3FE2891B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{2222E8D7-6130-4B46-9749-474E3FE2891B}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{2222E8D7-6130-4B46-9749-474E3FE2891B}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{2222E8D7-6130-4B46-9749-474E3FE2891B}.Release|Any CPU.Build.0 = Release|Any CPU
+		{40A8F7EA-C45A-487B-B6E0-BC151827E8C4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{40A8F7EA-C45A-487B-B6E0-BC151827E8C4}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{40A8F7EA-C45A-487B-B6E0-BC151827E8C4}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{40A8F7EA-C45A-487B-B6E0-BC151827E8C4}.Release|Any CPU.Build.0 = Release|Any CPU
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+EndGlobal

+ 209 - 0
sourceCode/trunk/Code/CoreAudio.vsmdi

@@ -0,0 +1,209 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<TestLists xmlns="http://microsoft.com/schemas/VisualStudio/TeamTest/2010">
+  <TestList name="MMDevice API Tests" id="07977958-bdc6-4656-a234-e47c2795ad43" parentListId="8c43106b-9dc1-4907-a29f-aa66a61bf5b6">
+    <TestLinks>
+      <TestLink id="127beaab-3c92-c9d5-9cab-80f842b8f21d" name="IMMDevice_GetId" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="68e5f266-e04b-466a-9ad1-6ec3896b501a" name="IMMDevice_OpenPropertyStore" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="8ce2b994-8a97-4f20-287c-4adc4d46d8ae" name="IMMDevice_GetState" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="0f320da8-2eb7-fa34-72be-8a16377f6e65" name="IMMDevice_Activate" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="05d13369-acf7-988f-7ab6-57b4de4e09b7" name="IMMDeviceCollection_Item" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="7c8aebaf-bc84-c5fb-a444-a2a2679ac4f4" name="IMMDeviceEnumerator_GetDevice" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="c57ebb75-e0fb-f2d3-2728-bc85e092235e" name="IMMDeviceEnumerator_EnumAudioEndpoints" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="29190c98-aa93-6fe1-4497-24dd2ab2d074" name="IMMDeviceCollection_GetCount" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="91bb2cbd-5d4c-aba5-2e34-866a260404fe" name="IMMEndpoint_GetDataFlow" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="9c33a68e-71bd-43ba-eb1a-030ffd8e93e4" name="IMMDeviceEnumerator_GetDefaultAudioEndpoint" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="72866c83-8052-7043-a174-cd10d2ff8bd0" name="IMMDeviceEnumerator_RegisterEndpointNotificationCallback" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="8e10c2aa-c81e-1c03-a060-f3a4e4a6e061" name="IMMDeviceEnumerator_UnregisterEndpointNotificationCallback" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+    </TestLinks>
+  </TestList>
+  <TestList name="WASAPI Tests" id="24d595d1-c0ed-4e10-9aab-a2104b018a55" parentListId="8c43106b-9dc1-4907-a29f-aa66a61bf5b6">
+    <TestLinks>
+      <TestLink id="76f42efc-f7ac-5327-d2f4-0d0f18599959" name="IAudioSessionEvents_OnGroupingParamChanged" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="5352cfcf-151f-e4be-3744-0823a4845631" name="IAudioStreamVolume_GetChannelVolume" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="a1d4adc5-7bd6-46ec-2bd0-f19168f5f52e" name="IAudioClient_GetBufferSize" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="fe6e9377-2d2a-0975-5a7c-2289a31b1fd7" name="IAudioCaptureClient_GetBuffer" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="4d2b8c61-1bc1-366e-58f7-e429420b1bbe" name="IAudioSessionControl2_GetSessionIdentifier" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="c7ea7370-4eaa-e8c0-2f4a-c634e5e98218" name="IAudioSessionControl_GetDisplayName" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="dbc3f41a-23fd-7c02-bfec-76ec27f79ba9" name="IAudioSessionControl_SetDisplayName" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="715eff51-5c98-29c2-1785-97ddc0c80ac9" name="IAudioSessionEvents_OnSessionDisconnected" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="29176110-e3d1-7258-f157-e6706832c7aa" name="IAudioSessionControl_UnregisterAudioSessionNotification" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="323aa34d-4b1c-fba1-beb6-acc11eef8a21" name="IAudioSessionManager2_UnregisterSessionNotification" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="dce81b74-5a2e-52e5-3bbd-0a2a6e0d56e0" name="ISimpleAudioVolume_SetMute" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="d07d5605-b661-cf04-6e0b-f7a0ea1ae814" name="IAudioSessionEnumerator_GetSession" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="7191ece3-945e-0e20-b171-c84b9138b3a7" name="IAudioSessionControl2_GetSessionInstanceIdentifier" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="6702289d-3209-f50a-e240-95fe4039116e" name="IAudioSessionControl_GetState" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="4756eb13-e48e-d078-d9a5-37f48bbccf4c" name="IAudioSessionEvents_OnSimpleVolumeChanged" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="0ed62a65-3112-99d3-3323-83ede03e1475" name="IAudioClient_GetStreamLatency" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="3873fdab-7e70-ce68-1aaa-7586fbb5e5d8" name="IAudioSessionControl2_IsSystemSoundsSession" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="0e3f92fa-4b8c-e017-100d-2cd90df00cbe" name="IAudioStreamVolume_GetChannelCount" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="d884cd70-7225-dba4-c93a-0921d9336943" name="IAudioClient_IsFormatSupported" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="d468661e-58de-bb23-c120-b1252e1741c3" name="IAudioClient_SetEventHandle" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="330490b6-e50e-661f-d3b4-2022a409571f" name="IAudioSessionManager2_UnregisterDuckNotification" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="f41a3d8f-c2b0-7207-bbfa-7ed17143a2c6" name="IAudioCaptureClient_ReleaseBuffer" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="181482a8-2051-cf01-f887-0498078c36bc" name="IAudioClient_Initialize" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="761fa241-acc7-f8bc-9d8d-6ce79a9c9fa0" name="IAudioSessionManager_GetAudioSessionControl" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="97a165e4-8252-990b-ff30-02fe1a56b997" name="IAudioSessionNotification_OnSessionCreated" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="68ca9a67-329f-e707-4759-5d81d924e2de" name="IAudioSessionControl_GetLastActivation" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="769d8672-8e25-44f6-515a-f0d250c9faf2" name="IAudioClock_GetPosition" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="90481f24-a189-d056-efdf-d3876037269f" name="IAudioStreamVolume_SetAllVolumes" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="1b5207d6-7791-b04c-23c1-7e551f66b0a1" name="IAudioClock_GetFrequency" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="f8818aeb-8cd3-7769-9fe7-cf2f47432cfa" name="IAudioSessionEvents_OnDisplayNameChanged" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="2aceda7e-3a28-f513-c38d-a00cbc5f383e" name="IAudioClient_Reset" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="325bda25-b2ab-76e9-6187-023684d80cc2" name="IAudioClockAdjustment_SetSampleRate" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="fec205b3-6e10-2aee-e1e2-a0ed404eaaac" name="IAudioSessionManager_GetSimpleAudioVolume" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="8508f32b-18ae-8e8f-d9b5-5be46b23cc76" name="IAudioSessionEvents_OnChannelVolumeChanged" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="caff822b-9424-eca0-6ec4-eca0e8adc500" name="IAudioSessionControl_SetGroupingParam" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="b849cb67-c56f-7bec-2cd9-203968ce79cd" name="IAudioSessionEvents_OnStateChanged" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="78a40a0e-75a3-c2a9-2d7a-18d049cf828a" name="IAudioSessionControl_GetLastInactivation" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="5008504e-7339-f95c-b017-9b233e299f97" name="IAudioSessionControl_GetGroupingParam" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="5fe39011-ead5-17ee-ac98-dd626d638668" name="IAudioSessionControl2_SetDuckingPreference" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="859dc102-a504-40cd-550d-7d7a877203dd" name="IAudioSessionManager2_RegisterDuckNotification" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="3f0950c5-a616-19de-d066-9f36ca46b9ce" name="IAudioSessionControl2_GetProcessId" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="e2e817f7-4586-158f-075d-a77ce56dad9c" name="IAudioClient_GetMixFormat" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="0562729c-4e73-5eb1-a982-04b96faace85" name="IAudioRenderClient_ReleaseBuffer" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="5ebdab91-60d6-0f89-7362-6a2fb908b637" name="IAudioSessionManager2_GetSessionEnumerator" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="71b5fb90-fecb-1158-19d7-d90dfdd07702" name="IAudioCaptureClient_GetNextPacketSize" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="d804ffd1-1317-2f2a-5c33-e67e0833db9e" name="IAudioClient_GetDevicePeriod" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="3bae1753-7f1b-df42-7045-99c04ff962d6" name="ISimpleAudioVolume_GetMasterVolume" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="3a3f0f9b-3e33-2bf6-01f8-03c255cd40f0" name="IAudioClient_GetService" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="23061fe6-f56a-6874-cac6-a3883a682e73" name="IAudioStreamVolume_SetChannelVolume" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="2f272991-a37b-58c1-9017-6baffd022d0b" name="IAudioClock2_GetDevicePosition" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="7c4d555f-d247-90f0-6c59-2ba392315a29" name="ISimpleAudioVolume_SetMasterVolume" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="492079ab-d656-f47d-2c8e-30aa89e2decf" name="IAudioSessionControl_RegisterAudioSessionNotification" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="9d8bfc55-3600-c80f-afab-050a096ad61b" name="IAudioRenderClient_GetBuffer" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="c62c1195-ee03-644c-79b4-e2bdc6da7c48" name="IAudioSessionControl_GetIconPath" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="76a3a903-02cf-0f6b-a40b-dc0d1285d591" name="IAudioVolumeDuckNotification_OnVolumeDuckNotification" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="acd41257-f8d3-e73f-6217-b12798817cb7" name="IAudioClient_Stop" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="e6c2ec4a-30f5-60e0-0447-6fd6ef5f5e3a" name="IChannelAudioVolume_GetChannelCount" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="ac7fac6a-46da-8e02-d614-5aefb2a5e608" name="IAudioClient_Start" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="3f11f8ac-e1fe-ffa0-acb1-323777b3b657" name="IAudioVolumeDuckNotification_OnVolumeUnduckNotification" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="e68f8bba-1e3d-c87d-0f64-45df041c34bd" name="IChannelAudioVolume_GetChannelVolume" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="00d43586-f831-ea57-33ad-b8168497fff2" name="IAudioSessionManager2_RegisterSessionNotification" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="ddaed319-013c-3438-ea38-caba27dd2d64" name="IAudioSessionControl_SetIconPath" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="f83eb3d7-c59a-3434-79d7-b39402d38fa7" name="IChannelAudioVolume_SetAllVolumes" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="ed0532af-7f37-4b86-ee46-ba4837546ff4" name="IAudioClock_GetCharacteristics" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="9295bb2c-df8c-d674-f6b5-35976f3d5439" name="IAudioSessionEvents_OnIconPathChanged" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="641a1aca-87da-bc8f-2368-34bff1a055fb" name="IChannelAudioVolume_GetAllVolumes" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="5b0af39c-0be1-1c04-109f-1cfa3b30f325" name="IChannelAudioVolume_SetChannelVolume" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="a5129a8e-73c2-f556-8c80-82a827199981" name="IAudioStreamVolume_GetAllVolumes" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="9e867264-fdc5-bf2a-2514-bcbb3c7e58c0" name="ISimpleAudioVolume_GetMute" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="2bda45af-555f-23bc-b9fb-5ec189043e07" name="IAudioClient_GetCurrentPadding" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="a57a935b-46fc-8f34-e124-8b72c84678ee" name="IAudioSessionEnumerator_GetCount" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+    </TestLinks>
+  </TestList>
+  <TestList name="Device Topology API Tests" id="561d671d-23a7-4f7d-bcd8-21c3b859fdde" parentListId="8c43106b-9dc1-4907-a29f-aa66a61bf5b6">
+    <TestLinks>
+      <TestLink id="6b7335db-66ad-4a21-9358-9c346d399bfa" name="IKsFormatSupport_GetDevicePreferredFormat" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="76f7bd72-da69-5e0c-1859-a37ffb15c294" name="IDeviceSpecificProperty_GetType" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="4624e81c-81a3-d0b9-df88-835cef20fd6a" name="IPart_Activate" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="bae4acc6-ce30-0cda-43d2-e0ce38fd9d98" name="IPart_GetPartType" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="252cd4b4-24dd-c3fb-ccd1-2bb64ed12dc8" name="IPart_GetControlInterface" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="b6074cd2-7b75-3864-b2f7-27ad58a56cea" name="IAudioInputSelector_GetSelection" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="03a02266-4a06-f272-5ade-2167b5cd643e" name="IAudioBass_GetChannelCount" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="0ccef576-5330-a230-185b-330dcf9db4dd" name="IAudioOutputSelector_GetSelection" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="07a0fa8a-ef8a-f39e-81a3-34836b06a842" name="IAudioTreble_GetLevelRange" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="c8621f48-b073-cd0a-b411-9315864db6ea" name="IDeviceSpecificProperty_Get4BRange" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="df4714c9-0cf2-0173-e9b5-736aae0cc84d" name="IPartsList_GetPart" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="8fe0ee75-4465-00e3-9155-29798b5a46fb" name="IAudioPeakMeter_GetLevel" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="1d831b4c-2c41-68c9-876d-0b95a85ebbb8" name="IPart_UnregisterControlChangeCallback" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="1433d8f1-67ca-9f17-aa4f-ac3a539b2e30" name="IControlChangeNotify_OnNotify" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="ff0779bf-4604-4fb5-a3ec-1f97e8d9cb1b" name="IConnector_GetDataFlow" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="26b80a60-a767-819c-ee08-867363b9d393" name="IAudioBass_SetLevel" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="62a7bd24-2893-8d17-b441-1e08887a591f" name="IDeviceTopology_GetPartById" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="2abd27e5-b77a-870c-cc0c-ec46c3313a8a" name="IAudioLoudness_GetEnabled" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="0c30ec7a-1fba-75ef-a14a-ab59053ec28c" name="IDeviceTopology_GetSubunit" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="332e54e6-cb2f-a9a7-a563-08f066bc391e" name="IPart_GetTopologyObject" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="86f87390-38ff-bd47-5e31-8765f99b2cc6" name="IAudioVolumeLevel_GetChannelCount" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="3acb6d03-4917-96c0-a126-e33007cd9857" name="IAudioTreble_SetLevelAllChannels" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="4d22b4dc-76c5-84c8-0635-884a4419eed2" name="IControlInterface_GetIID" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="17ede916-a8fc-42cd-29e0-4dd6cc344b11" name="IAudioTreble_SetLevel" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="c2ba7bd4-06b6-a238-cbdf-e469c594ac71" name="IAudioMidrange_SetLevel" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="0a5001c7-198d-58dd-9f14-dc2847e0a9b2" name="IAudioTreble_GetChannelCount" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="f353225d-458c-b6ab-8bcc-5211a83cb67c" name="IKsFormatSupport_IsFormatSupported" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="79ea68eb-69c1-6511-e5db-e1facedaa11d" name="IKsJackDescription_GetJackDescription" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="7f579b0f-d498-b1e7-bb15-c1f8721a1229" name="IDeviceTopology_GetSubunitCount" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="2b1dccdf-5140-fb66-6d53-ff6f86adce4a" name="IDeviceTopology_GetConnectorCount" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="56448e5c-fcf5-5f7b-ffda-c7978adb2000" name="IAudioVolumeLevel_SetLevel" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="ab6ab8cf-ea69-65de-13f4-34a9849501e3" name="IAudioBass_SetLevelAllChannels" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="6ef7b015-d6ec-72c5-8e51-81f4099d4f5c" name="IConnector_GetConnectedTo" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="f2b2562a-8765-863a-86f5-fb05d8b76f01" name="IPart_GetLocalId" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="3c20637c-90ed-c62e-7fc1-2bfc5ad07fe0" name="IPart_EnumPartsIncoming" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="8b03784b-281c-fb37-be5c-cbfda90b54a6" name="IAudioVolumeLevel_SetLevelUniform" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="06016bae-8bef-d4e7-d812-0d627d7ee3b0" name="IAudioInputSelector_SetSelection" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="2520167f-d4ef-46d4-aaeb-9a30f395b24e" name="IAudioChannelConfig_SetChannelConfig" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="eb9d5247-fac6-fa07-21a0-5bb28d876df6" name="IAudioChannelConfig_GetChannelConfig" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="851f5147-4511-d629-0a9b-fc6376b6aa04" name="IAudioMute_GetMute" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="622bfcea-991c-5eee-39fe-2145bdb4930e" name="IAudioBass_GetLevelRange" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="5e0bc7aa-2dd5-3949-96c1-e1ee9ce9b00b" name="IAudioMidrange_SetLevelUniform" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="e4e320d1-b34d-1459-2003-b0a45510cbd9" name="IPart_GetGlobalId" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="30be180d-8f5f-0c20-7015-bafdec763b4b" name="IAudioMute_SetMute" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="5eb843b4-c99b-533a-2f8b-9c51d50dcd79" name="IKsJackDescription_GetJackCount" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="bc0f7c79-45ff-f36a-dd93-98fb88922f4f" name="IDeviceTopology_GetConnector" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="fd10eca8-5912-ecb9-60a8-d27de9c339ed" name="IConnector_GetType" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="62ba1320-3c42-e259-4a4a-820c671977fb" name="IAudioMidrange_GetLevelRange" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="1283f665-de92-414b-4436-6c4c14a4528d" name="IConnector_Disconnect" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="44ddf6d7-8a7f-486d-f8b0-60b428af101e" name="IConnector_GetConnectorIdConnectedTo" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="f07f548b-1fb3-bc56-0826-cabae8112022" name="IAudioLoudness_SetEnabled" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="9b0ef095-e342-c090-3bc6-4bc714e4ad60" name="IKsJackSinkInformation_GetJackSinkInformation" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="dd5ad827-f1c1-8916-eaa5-6c56761b97b2" name="IAudioVolumeLevel_SetLevelAllChannels" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="52bf9b0e-2801-ef39-8ea4-381cb6196891" name="IPart_GetSubType" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="4ce5f708-3f2d-7ed6-63c1-5bff8d7f250f" name="IDeviceTopology_GetSignalPath" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="d859da8d-367c-2a1b-e3d5-7ee333f7129d" name="IPart_RegisterControlChangeCallback" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="c5ed77ee-c2f2-ad39-b74b-6b2ceec431bb" name="IPart_GetControlInterfaceCount" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="3e2ac4d0-0592-5183-47b2-034370a45023" name="IAudioTreble_SetLevelUniform" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="c7004acc-ada4-3666-5d8c-2d1fb41cea57" name="IDeviceSpecificProperty_SetValue" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="cbbaf0b1-16ba-9c83-1aa9-b19f2d549311" name="IDeviceSpecificProperty_GetValue" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="251dab16-efa4-1cec-b1a8-4ed16e6f2b4e" name="IAudioOutputSelector_SetSelection" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="404c935e-3799-a637-f48a-4c1d608e6dd1" name="IAudioMidrange_SetLevelAllChannels" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="4a35d9e8-c669-af68-9963-8ef5875818d4" name="IPart_GetName" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="b87ecfd9-30a7-3124-eea6-7c81120e8f3c" name="IConnector_IsConnected" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="bb914f27-27d1-436f-56c9-b8aab1b85a0c" name="IAudioVolumeLevel_GetLevelRange" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="dc0cfd42-0c56-5039-21a6-e1d55debb6e1" name="IKsJackDescription2_GetJackDescription2" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="13a6f001-dbaf-1529-1ab2-19cf50ce134b" name="IPartsList_GetCount" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="6b180fba-3370-9aa4-015f-ca3e47f52a13" name="IAudioTreble_GetLevel" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="124d077a-3e17-f76e-cbfb-aedf783fe784" name="IConnector_GetDeviceIdConnectedTo" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="3075e859-fb95-8e6a-d41e-7be91e2a8e04" name="IAudioMidrange_GetLevel" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="75f28fac-566f-aab6-e787-74e9bb38f98d" name="IAudioPeakMeter_GetChannelCount" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="7db2edb7-41a3-4aa1-0932-2176589afeeb" name="IAudioAutoGainControl_GetEnabled" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="21f0e1c0-8bb4-2ff0-0364-600fea7ad0aa" name="IConnector_ConnectTo" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="7b0d64a7-28d5-a0d0-dc07-4707fe6064fe" name="IAudioBass_GetLevel" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="d68e12df-118b-b944-8de0-cc1c86337ecd" name="IDeviceTopology_GetDeviceId" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="92d924d3-3da9-c312-27c3-2c1bcbd30b89" name="IKsJackDescription2_GetJackCount" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="f7f6cbd1-9f97-ecfb-f8ca-f89cd8f4d563" name="IPart_EnumPartsOutgoing" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="65264406-de36-f773-7688-620d535cbf38" name="IAudioVolumeLevel_GetLevel" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="19860315-529b-2947-78e6-a6c8ef6669dd" name="IAudioAutoGainControl_SetEnabled" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="3f533ecb-f020-0d30-aba4-b9bea170e2d2" name="IControlInterface_GetName" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="3264be14-04f7-c88d-ab0c-8532f857bb97" name="IAudioBass_SetLevelUniform" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="9bbcd518-38eb-cdc1-3842-c85538cbb088" name="IAudioMidrange_GetChannelCount" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+    </TestLinks>
+  </TestList>
+  <TestList name="Endpoint Volume API Tests" id="67c3e92c-2152-4f12-bfff-2a1225f40441" parentListId="8c43106b-9dc1-4907-a29f-aa66a61bf5b6">
+    <TestLinks>
+      <TestLink id="e32e0b08-158f-177b-4bd3-337ad395307c" name="IAudioEndpointVolume_VolumeStepDown" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="8d761e47-353a-15ca-2b24-3196616858e6" name="IAudioEndpointVolume_SetMasterVolumeLevel" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="db96b03c-feb2-c83b-a7b3-206d6421e323" name="IAudioEndpointVolume_UnregisterControlChangeNotify" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="b96da34f-e8d0-975a-a64a-2739259e7a12" name="IAudioEndpointVolumeEx_GetVolumeRangeChannel" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="bf78aaa9-dff6-e80e-d332-6c2de798beda" name="IAudioEndpointVolume_GetMasterVolumeLevelScalar" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="a7e6ea50-9baf-69e6-8f1a-f295a68934e8" name="IAudioEndpointVolume_VolumeStepUp" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="16cbdd41-a567-0cf7-5c70-fe9fb939ebb7" name="IAudioEndpointVolume_GetChannelCount" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="ec4c167e-8f89-20e7-8d4a-e965fb20a43c" name="IAudioEndpointVolume_SetMasterVolumeLevelScalar" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="085e613b-7f15-3dcd-af9d-95a4a737e3c6" name="IAudioEndpointVolume_GetChannelVolumeLevel" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="a1a3a2bb-33d0-41fc-3c8a-32f9231f144b" name="IAudioEndpointVolume_RegisterControlChangeNotify" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="ca82982e-09c5-9619-7e24-2a26c40fd7b2" name="IAudioEndpointVolume_SetMute" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="e8cbcb83-5657-6bc4-7548-9327ea28ccc2" name="IAudioEndpointVolume_QueryHardwareSupport" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="065467d3-9bff-20cf-3748-3e315568e774" name="IAudioEndpointVolume_SetChannelVolumeLevelScalar" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="dd2a05de-5f49-da2d-e911-789fb9a9e0c5" name="IAudioEndpointVolumeCallback_OnNotify" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="87699302-9fc8-d61a-6c30-ae0cb5730211" name="IAudioEndpointVolume_GetMute" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="72094d66-f0c8-d31e-cb24-ef1e7da26f6b" name="IAudioEndpointVolume_GetVolumeRange" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="0b27a336-88eb-6a32-2d18-6f04ea4c648a" name="IAudioEndpointVolume_GetMasterVolumeLevel" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="db312817-c7e9-68ea-8705-a01eb1b1114f" name="IAudioEndpointVolume_GetVolumeStepInfo" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="79630673-cb97-ac98-6594-5c671224c0e1" name="IAudioEndpointVolume_SetChannelVolumeLevel" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="098d6fcf-4ee3-c157-3ae3-ff93344c2763" name="IAudioMeterInformation_GetChannelsPeakValues" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="0312f1be-0113-f358-d52e-7cc6d92ac5ee" name="IAudioMeterInformation_GetMeteringChannelCount" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="0024b7be-cdbc-3f84-6f63-eb75dc0cfeca" name="IAudioMeterInformation_GetPeakValue" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="bb1ac98b-71eb-df13-bedc-094fe77fb531" name="IAudioEndpointVolume_GetChannelVolumeLevelScalar" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+      <TestLink id="64cfd3dc-ec4f-35eb-7e8e-65b9e58e6c10" name="IAudioMeterInformation_QueryHardwareSupport" storage="coreaudiotests\bin\debug\coreaudiotests.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+    </TestLinks>
+  </TestList>
+  <TestList name="Lists of Tests" id="8c43106b-9dc1-4907-a29f-aa66a61bf5b6" />
+</TestLists>

+ 49 - 0
sourceCode/trunk/Code/CoreAudio/Constants/AUDCLNT_SESSIONFLAGS_XXX.cs

@@ -0,0 +1,49 @@
+// -----------------------------------------
+// SoundScribe (TM) and related software.
+// 
+// Copyright (C) 2007-2011 Vannatech
+// http://www.vannatech.com
+// All rights reserved.
+// 
+// This source code is subject to the MIT License.
+// http://www.opensource.org/licenses/mit-license.php
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+// -----------------------------------------
+
+
+
+using System;
+
+namespace Vannatech.CoreAudio.Constants
+{
+	/// <summary>
+	/// Indicate characteristics of an audio session associated with the stream.
+	/// </summary>
+	/// <remarks>
+	/// MSDN Reference: http://msdn.microsoft.com/en-us/library/dd370789.aspx
+	/// </remarks>
+	public class AUDCLNT_SESSIONFLAGS_XXX
+	{
+		/// <summary>
+		/// The session expires when there are no associated streams and owning session control objects holding references.
+		/// </summary>
+		public const int AUDCLNT_SESSIONFLAGS_EXPIREWHENUNOWNED = 0x10000000;
+
+		/// <summary>
+		/// The volume control is hidden in the volume mixer user interface when the audio session is created.
+		/// </summary>
+		public const int AUDCLNT_SESSIONFLAGS_DISPLAY_HIDE = 0x20000000;
+
+		/// <summary>
+		/// The volume control is hidden in the volume mixer user interface after the session expires.
+		/// </summary>
+		public const int AUDCLNT_SESSIONFLAGS_DISPLAY_HIDEWHENEXPIRED = 0x40000000;
+	}
+}

+ 57 - 0
sourceCode/trunk/Code/CoreAudio/Constants/AUDCLNT_STREAMFLAGS_XXX.cs

@@ -0,0 +1,57 @@
+// -----------------------------------------
+// SoundScribe (TM) and related software.
+// 
+// Copyright (C) 2007-2011 Vannatech
+// http://www.vannatech.com
+// All rights reserved.
+// 
+// This source code is subject to the MIT License.
+// http://www.opensource.org/licenses/mit-license.php
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+// -----------------------------------------
+
+using System;
+
+namespace Vannatech.CoreAudio.Constants
+{
+	/// <summary>
+	/// Indicate special characteristics that a client can assign to an audio stream during the initialization of the stream.
+	/// </summary>
+	/// <remarks>
+	/// MSDN Reference: http://msdn.microsoft.com/en-us/library/dd370791.aspx
+	/// </remarks>
+	public class AUDCLNT_STREAMFLAGS_XXX
+	{
+		/// <summary>
+		/// The audio stream will be a member of a cross-process audio session.
+		/// </summary>
+		public const UInt32 AUDCLNT_STREAMFLAGS_CROSSPROCESS = 0x00010000;
+
+		/// <summary>
+		/// The audio stream will operate in loopback mode.
+		/// </summary>
+        public const UInt32 AUDCLNT_STREAMFLAGS_LOOPBACK = 0x00020000;
+
+		/// <summary>
+		/// Processing of the audio buffer by the client will be event driven.
+		/// </summary>
+        public const UInt32 AUDCLNT_STREAMFLAGS_EVENTCALLBACK = 0x00040000;
+
+		/// <summary>
+		/// The volume and mute settings for an audio session will not persist across system restarts.
+		/// </summary>
+        public const UInt32 AUDCLNT_STREAMFLAGS_NOPERSIST = 0x00080000;
+
+		/// <summary>
+		/// The sample rate of the stream is adjusted to a rate specified by an application.
+		/// </summary>
+        public const UInt32 AUDCLNT_STREAMFLAGS_RATEADJUST = 0x00100000;
+	}
+}

+ 36 - 0
sourceCode/trunk/Code/CoreAudio/Constants/ComCLSIDs.cs

@@ -0,0 +1,36 @@
+// -----------------------------------------
+// SoundScribe (TM) and related software.
+// 
+// Copyright (C) 2007-2011 Vannatech
+// http://www.vannatech.com
+// All rights reserved.
+// 
+// This source code is subject to the MIT License.
+// http://www.opensource.org/licenses/mit-license.php
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+// -----------------------------------------
+
+
+// Turn off warning for XML comments
+// These constants are self documenting
+#pragma warning disable 1591
+
+namespace Vannatech.CoreAudio.Constants
+{
+    /// <summary>
+    /// Defines all COM CLSIDs applicable to CoreAudio API.
+    /// </summary>
+    public class ComCLSIDs
+    {
+        public const string MMDeviceEnumeratorCLSID = "BCDE0395-E52F-467C-8E3D-C4579291692E";
+    }
+}
+
+#pragma warning restore 1591

+ 91 - 0
sourceCode/trunk/Code/CoreAudio/Constants/ComIIDs.cs

@@ -0,0 +1,91 @@
+// -----------------------------------------
+// SoundScribe (TM) and related software.
+// 
+// Copyright (C) 2007-2011 Vannatech
+// http://www.vannatech.com
+// All rights reserved.
+// 
+// This source code is subject to the MIT License.
+// http://www.opensource.org/licenses/mit-license.php
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+// -----------------------------------------
+
+// Turn off warning for XML comments
+// These constants are self documenting
+#pragma warning disable 1591
+
+namespace Vannatech.CoreAudio.Constants
+{
+    /// <summary>
+    /// Defines all COM IIDs applicable to CoreAudio API.
+    /// </summary>
+    public class ComIIDs
+    {
+        // MMDevice ComIdentifiers
+        public const string IMMDeviceIID = "D666063F-1587-4E43-81F1-B948E807363F";
+        public const string IMMDeviceEnumeratorIID = "A95664D2-9614-4F35-A746-DE8DB63617E6";
+        public const string IMMDeviceCollectionIID = "0BD7A1BE-7A1A-44DB-8397-CC5392387B5E";
+        public const string IMMEndpointIID = "1BE09788-6894-4089-8586-9A2A6C265AC5";
+        public const string IMMNotificationClientIID = "7991EEC9-7E89-4D85-8390-6C703CEC60C0";
+
+        // WASAPI
+        public const string IAudioCaptureClientIID = "C8ADBD64-E71E-48a0-A4DE-185C395CD317";
+        public const string IAudioClientIID = "1CB9AD4C-DBFA-4c32-B178-C2F568A703B2";
+        public const string IAudioClockIID = "CD63314F-3FBA-4a1b-812C-EF96358728E7";
+        public const string IAudioClock2IID = "6f49ff73-6727-49ac-a008-d98cf5e70048";
+        public const string IAudioClockAdjustmentIID = "f6e4c0a0-46d9-4fb8-be21-57a3ef2b626c";
+        public const string IAudioRenderClientIID = "F294ACFC-3146-4483-A7BF-ADDCA7C260E2";
+        public const string IAudioSessionControlIID = "F4B1A599-7266-4319-A8CA-E70ACB11E8CD";
+        public const string IAudioSessionControl2IID = "bfb7ff88-7239-4fc9-8fa2-07c950be9c6d";
+        public const string IAudioSessionEnumeratorIID = "E2F5BB11-0570-40CA-ACDD-3AA01277DEE8";
+        public const string IAudioSessionEventsIID = "24918ACC-64B3-37C1-8CA9-74A66E9957A8";
+        public const string IAudioSessionManagerIID = "BFA971F1-4D5E-40BB-935E-967039BFBEE4";
+        public const string IAudioSessionManager2IID = "77AA99A0-1BD6-484F-8BC7-2C654C9A9B6F";
+        public const string IAudioSessionNotificationIID = "641DD20B-4D41-49CC-ABA3-174B9477BB08";
+        public const string IAudioStreamVolumeIID = "93014887-242D-4068-8A15-CF5E93B90FE3";
+        public const string IAudioVolumeDuckNotificationIID = "C3B284D4-6D39-4359-B3CF-B56DDB3BB39C";
+        public const string IChannelAudioVolumeIID = "1C158861-B533-4B30-B1CF-E853E51C59B8";
+        public const string ISimpleAudioVolumeIID = "87CE5498-68D6-44E5-9215-6DA47EF883D8";
+
+        // DeviceTopology
+        public const string IAudioAutoGainControlIID = "85401FD4-6DE4-4b9d-9869-2D6753A82F3C";
+        public const string IAudioBassIID = "A2B1A1D9-4DB3-425D-A2B2-BD335CB3E2E5";
+        public const string IAudioChannelConfigIID = "BB11C46F-EC28-493C-B88A-5DB88062CE98";
+        public const string IAudioInputSelectorIID = "4F03DC02-5E6E-4653-8F72-A030C123D598";
+        public const string IAudioLoudnessIID = "7D8B1437-DD53-4350-9C1B-1EE2890BD938";
+        public const string IAudioMidrangeIID = "5E54B6D7-B44B-40D9-9A9E-E691D9CE6EDF";
+        public const string IAudioMuteIID = "DF45AEEA-B74A-4B6B-AFAD-2366B6AA012E";
+        public const string IAudioOutputSelectorIID = "BB515F69-94A7-429e-8B9C-271B3F11A3AB";
+        public const string IAudioPeakMeterIID = "DD79923C-0599-45e0-B8B6-C8DF7DB6E796";
+        public const string IAudioTrebleIID = "0A717812-694E-4907-B74B-BAFA5CFDCA7B";
+        public const string IAudioVolumeLevelIID = "7FB7B48F-531D-44A2-BCB3-5AD5A134B3DC";
+        public const string IConnectorIID = "9c2c4058-23f5-41de-877a-df3af236a09e";
+        public const string IControlChangeNotifyIID = "A09513ED-C709-4d21-BD7B-5F34C47F3947";
+        public const string IControlInterfaceIID = "45d37c3f-5140-444a-ae24-400789f3cbf3";
+        public const string IDeviceSpecificPropertyIID = "3B22BCBF-2586-4af0-8583-205D391B807C";
+        public const string IDeviceTopologyIID = "2A07407E-6497-4A18-9787-32F79BD0D98F";
+        public const string IKsFormatSupportIID = "3CB4A69D-BB6F-4D2B-95B7-452D2C155DB5";
+        public const string IKsJackDescriptionIID = "4509F757-2D46-4637-8E62-CE7DB944F57B";
+        public const string IKsJackDescription2IID = "478F3A9B-E0C9-4827-9228-6F5505FFE76A";
+        public const string IKsJackSinkInformationIID = "D9BD72ED-290F-4581-9FF3-61027A8FE532";
+        public const string IPartIID = "AE2DE0E4-5BCA-4F2D-AA46-5D13F8FDB3A9";
+        public const string IPartsListIID = "6DAA848C-5EB0-45CC-AEA5-998A2CDA1FFB";
+        public const string IPerChannelDbLevelIID = "C2F8E001-F205-4BC9-99BC-C13B1E048CCB";
+        public const string ISubunitIID = "82149A85-DBA6-4487-86BB-EA8F7FEFCC71";
+
+        // EndpointVolume
+        public const string IAudioEndpointVolumeIID = "5CDF2C82-841E-4546-9722-0CF74078229A";
+        public const string IAudioEndpointVolumeExIID = "66E11784-F695-4F28-A505-A7080081A78F";
+        public const string IAudioMeterInformationIID = "C02216F6-8C67-4B5B-9D00-D008E73E0064";
+        public const string IAudioEndpointVolumeCallbackIID = "657804FA-D6AD-4496-8A60-352752AF4F89";
+    }
+}
+
+#pragma warning restore 1591

+ 57 - 0
sourceCode/trunk/Code/CoreAudio/Constants/DEVICE_STATE_XXX.cs

@@ -0,0 +1,57 @@
+// -----------------------------------------
+// SoundScribe (TM) and related software.
+// 
+// Copyright (C) 2007-2011 Vannatech
+// http://www.vannatech.com
+// All rights reserved.
+// 
+// This source code is subject to the MIT License.
+// http://www.opensource.org/licenses/mit-license.php
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+// -----------------------------------------
+
+using System;
+
+namespace Vannatech.CoreAudio.Constants
+{
+	/// <summary>
+	/// Indicate the current state of an audio endpoint device. 
+	/// </summary>
+	/// <remarks>
+	/// MSDN Reference: http://msdn.microsoft.com/en-us/library/dd370823.aspx
+	/// </remarks>
+	public class DEVICE_STATE_XXX
+	{
+		/// <summary>
+		/// The audio endpoint device is active.
+		/// </summary>
+		public const uint DEVICE_STATE_ACTIVE = 0x00000001;
+
+		/// <summary>
+		/// The audio endpoint device is disabled.
+		/// </summary>
+		public const uint DEVICE_STATE_DISABLED = 0x00000002;
+
+		/// <summary>
+		/// The audio endpoint device is not present because the audio adapter that connects to the endpoint device has been removed or disabled.
+		/// </summary>
+		public const uint DEVICE_STATE_NOTPRESENT = 0x00000004;
+
+		/// <summary>
+		/// The audio endpoint device is unplugged.
+		/// </summary>
+		public const uint DEVICE_STATE_UNPLUGGED = 0x00000008;
+
+		/// <summary>
+		/// Includes audio endpoint devices in all states.
+		/// </summary>
+		public const uint DEVICE_STATEMASK_ALL = 0x0000000F;
+	}
+}

+ 47 - 0
sourceCode/trunk/Code/CoreAudio/Constants/ENDPOINT_HARDWARE_SUPPORT_XXX.cs

@@ -0,0 +1,47 @@
+// -----------------------------------------
+// SoundScribe (TM) and related software.
+// 
+// Copyright (C) 2007-2011 Vannatech
+// http://www.vannatech.com
+// All rights reserved.
+// 
+// This source code is subject to the MIT License.
+// http://www.opensource.org/licenses/mit-license.php
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+// -----------------------------------------
+
+using System;
+
+namespace Vannatech.CoreAudio.Constants
+{
+	/// <summary>
+	/// Hardware support flags for an audio endpoint device.
+	/// </summary>
+	/// <remarks>
+	/// MSDN Reference: http://msdn.microsoft.com/en-us/library/dd370835.aspx
+	/// </remarks>
+	public class ENDPOINT_HARDWARE_SUPPORT_XXX
+	{
+		/// <summary>
+		/// The audio endpoint device supports a hardware volume control.
+		/// </summary>
+		public const int ENDPOINT_HARDWARE_SUPPORT_VOLUME = 0x00000001;
+
+		/// <summary>
+		/// The audio endpoint device supports a hardware mute control.
+		/// </summary>
+		public const int ENDPOINT_HARDWARE_SUPPORT_MUTE = 0x00000002;
+
+		/// <summary>
+		/// The audio endpoint device supports a hardware peak meter.
+		/// </summary>
+		public const int ENDPOINT_HARDWARE_SUPPORT_METER = 0x00000004;
+	}
+}

+ 96 - 0
sourceCode/trunk/Code/CoreAudio/Constants/PropertyKeys.cs

@@ -0,0 +1,96 @@
+// -----------------------------------------
+// SoundScribe (TM) and related software.
+// 
+// Copyright (C) 2007-2011 Vannatech
+// http://www.vannatech.com
+// All rights reserved.
+// 
+// This source code is subject to the MIT License.
+// http://www.opensource.org/licenses/mit-license.php
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+// -----------------------------------------
+
+using System;
+
+namespace Vannatech.CoreAudio.Constants
+{
+	/// <summary>
+	/// Defines all applicable property keys for CoreAudio API.
+	/// </summary>
+    public static class PropertyKeys
+    {
+		/* Defined by MMDevice API */
+		/* ----------------------- */
+
+		/// <summary>
+		/// Indicates the physical attributes of the audio endpoint device.
+		/// </summary>
+		public static readonly Guid PKEY_AudioEndpoint_FormFactor = new Guid(0x1da5d803, 0xd492, 0x4edd, 0x8c, 0x23, 0xe0, 0xc0, 0xff, 0xee, 0x7f, 0x0e);
+
+		/// <summary>
+		/// Specifies the CLSID of the registered provider of the device-properties extension for the audio endpoint device.
+		/// </summary>
+		public static readonly Guid PKEY_AudioEndpoint_ControlPanelPageProvider = new Guid(0x1da5d803, 0xd492, 0x4edd, 0x8c, 0x23, 0xe0, 0xc0, 0xff, 0xee, 0x7f, 0x0e);
+
+        /// <summary>
+		/// Associates a kernel-streaming (KS) pin category with an audio endpoint device.
+        /// </summary>
+        public static readonly Guid PKEY_AudioEndpoint_Association = new Guid(0x1da5d803, 0xd492, 0x4edd, 0x8c, 0x23, 0xe0, 0xc0, 0xff, 0xee, 0x7f, 0x0e);
+
+        /// <summary>
+		/// Defines the physical speaker configuration for the audio endpoint device.
+        /// </summary>
+        public static readonly Guid PKEY_AudioEndpoint_PhysicalSpeakers = new Guid(0x1da5d803, 0xd492, 0x4edd, 0x8c, 0x23, 0xe0, 0xc0, 0xff, 0xee, 0x7f, 0x0e);
+
+        /// <summary>
+		/// Supplies the DirectSound device identifier that corresponds to the audio endpoint device.
+        /// </summary>
+        public static readonly Guid PKEY_AudioEndpoint_GUID = new Guid(0x1da5d803, 0xd492, 0x4edd, 0x8c, 0x23, 0xe0, 0xc0, 0xff, 0xee, 0x7f, 0x0e);
+
+        /// <summary>
+		/// Specifies whether system effects are enabled in the shared-mode stream that flows to or from the audio endpoint device.
+        /// </summary>
+        public static readonly Guid PKEY_AudioEndpoint_Disable_SysFx = new Guid(0x1da5d803, 0xd492, 0x4edd, 0x8c, 0x23, 0xe0, 0xc0, 0xff, 0xee, 0x7f, 0x0e);
+
+        /// <summary>
+		/// Specifies the channel-configuration mask for the full-range speakers that are connected to the audio endpoint device.
+        /// </summary>
+        public static readonly Guid PKEY_AudioEndpoint_FullRangeSpeakers = new Guid(0x1da5d803, 0xd492, 0x4edd, 0x8c, 0x23, 0xe0, 0xc0, 0xff, 0xee, 0x7f, 0x0e);
+
+		/// <summary>
+		/// Indicates whether the endpoint supports the event-driven mode.
+		/// </summary>
+		public static readonly Guid PKEY_AudioEndpoint_Supports_EventDriven_Mode = new Guid(0x1da5d803, 0xd492, 0x4edd, 0x8c, 0x23, 0xe0, 0xc0, 0xff, 0xee, 0x7f, 0x0e);
+
+		/// <summary>
+		/// Contains an output category GUID for an audio endpoint device. 
+		/// </summary>
+		public static readonly Guid PKEY_AudioEndpoint_JackSubType = new Guid(0x1da5d803, 0xd492, 0x4edd, 0x8c, 0x23, 0xe0, 0xc0, 0xff, 0xee, 0x7f, 0x0e);
+        
+		/// <summary>
+		/// Specifies the device format, which is the format that the audio engine uses for the shared-mode stream that flows to or from the audio endpoint device.
+        /// </summary>
+        public static readonly Guid PKEY_AudioEngine_DeviceFormat = new Guid(0xf19f064d, 0x82c, 0x4e27, 0xbc, 0x73, 0x68, 0x82, 0xa1, 0xbb, 0x8e, 0x4c);
+
+		/// <summary>
+		/// Specifies the default format of the device that is used for rendering or capturing a stream.
+		/// </summary>
+		public static readonly Guid PKEY_AudioEngine_OEMFormat = new Guid(0xe4870e26, 0x3cc5, 0x4cd2, 0xba, 0x46, 0xca, 0xa, 0x9a, 0x70, 0xed, 0x4);
+
+		/* External to MMDevice API */
+		/* ------------------------ */
+
+		/// <summary>
+		/// Contains the friendly name of the endpoint device.
+		/// </summary>
+		public static readonly Guid PKEY_DeviceInterface_FriendlyName = new Guid(0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0);
+
+	}
+}

+ 157 - 0
sourceCode/trunk/Code/CoreAudio/CoreAudio.csproj

@@ -0,0 +1,157 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ProductVersion>8.0.30703</ProductVersion>
+    <SchemaVersion>2.0</SchemaVersion>
+    <ProjectGuid>{2222E8D7-6130-4B46-9749-474E3FE2891B}</ProjectGuid>
+    <OutputType>Library</OutputType>
+    <AppDesignerFolder>Properties</AppDesignerFolder>
+    <RootNamespace>Vannatech.CoreAudio</RootNamespace>
+    <AssemblyName>Vannatech.CoreAudio</AssemblyName>
+    <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
+    <FileAlignment>512</FileAlignment>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>bin\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+    <DocumentationFile>bin\Debug\Vannatech.CoreAudio.xml</DocumentationFile>
+    <TreatWarningsAsErrors>true</TreatWarningsAsErrors>
+    <RunCodeAnalysis>false</RunCodeAnalysis>
+    <PlatformTarget>AnyCPU</PlatformTarget>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <DebugType>pdbonly</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>bin\Release\</OutputPath>
+    <DefineConstants>
+    </DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+    <DocumentationFile>bin\Release\Vannatech.CoreAudio.xml</DocumentationFile>
+    <TreatWarningsAsErrors>true</TreatWarningsAsErrors>
+  </PropertyGroup>
+  <PropertyGroup>
+    <SignAssembly>true</SignAssembly>
+  </PropertyGroup>
+  <PropertyGroup>
+    <AssemblyOriginatorKeyFile>Properties\CoreAudioKey.snk</AssemblyOriginatorKeyFile>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="System" />
+    <Reference Include="System.Core" />
+    <Reference Include="System.Xml.Linq" />
+    <Reference Include="System.Data.DataSetExtensions" />
+    <Reference Include="Microsoft.CSharp" />
+    <Reference Include="System.Data" />
+    <Reference Include="System.Xml" />
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="Constants\AUDCLNT_SESSIONFLAGS_XXX.cs" />
+    <Compile Include="Constants\AUDCLNT_STREAMFLAGS_XXX.cs" />
+    <Compile Include="Constants\ComIIDs.cs" />
+    <Compile Include="Constants\PropertyKeys.cs" />
+    <Compile Include="Constants\ENDPOINT_HARDWARE_SUPPORT_XXX.cs" />
+    <Compile Include="Constants\DEVICE_STATE_XXX.cs" />
+    <Compile Include="Enumerations\AudioSessionDisconnectReason.cs" />
+    <Compile Include="Enumerations\PartType.cs" />
+    <Compile Include="Enumerations\AUDCLNT_BUFFERFLAGS.cs" />
+    <Compile Include="Enumerations\AUDCLNT_SHAREMODE.cs" />
+    <Compile Include="Enumerations\AudioSessionState.cs" />
+    <Compile Include="Enumerations\ConnectorType.cs" />
+    <Compile Include="Enumerations\DataFlow.cs" />
+    <Compile Include="Enumerations\EDataFlow.cs" />
+    <Compile Include="Enumerations\EndpointFormFactor.cs" />
+    <Compile Include="Enumerations\ERole.cs" />
+    <Compile Include="Enumerations\KSJACK_SINK_CONNECTIONTYPE.cs" />
+    <Compile Include="Externals\CLSCTX.cs" />
+    <Compile Include="Externals\STGM.cs" />
+    <Compile Include="Externals\PROPVARIANT.cs" />
+    <Compile Include="Externals\PROPERTYKEY.cs" />
+    <Compile Include="Constants\ComCLSIDs.cs" />
+    <Compile Include="Interfaces\IKsJackSinkInformation.cs" />
+    <Compile Include="Interfaces\IKsJackDescription2.cs" />
+    <Compile Include="Interfaces\IKsJackDescription.cs" />
+    <Compile Include="Interfaces\IKsFormatSupport.cs" />
+    <Compile Include="Interfaces\ISubunit.cs" />
+    <Compile Include="Interfaces\IPartsList.cs" />
+    <Compile Include="Interfaces\IPart.cs" />
+    <Compile Include="Interfaces\IDeviceTopology.cs" />
+    <Compile Include="Interfaces\IDeviceSpecificProperty.cs" />
+    <Compile Include="Interfaces\IControlInterface.cs" />
+    <Compile Include="Interfaces\IControlChangeNotify.cs" />
+    <Compile Include="Interfaces\IConnector.cs" />
+    <Compile Include="Interfaces\IChannelAudioVolume.cs" />
+    <Compile Include="Interfaces\IAudioVolumeLevel.cs" />
+    <Compile Include="Interfaces\IAudioTreble.cs" />
+    <Compile Include="Interfaces\IAudioStreamVolume.cs" />
+    <Compile Include="Interfaces\IAudioVolumeDuckNotification.cs" />
+    <Compile Include="Interfaces\IAudioSessionNotification.cs" />
+    <Compile Include="Interfaces\IAudioSessionManager2.cs" />
+    <Compile Include="Interfaces\ISimpleAudioVolume.cs" />
+    <Compile Include="Interfaces\IAudioSessionManager.cs" />
+    <Compile Include="Interfaces\IAudioSessionEnumerator.cs" />
+    <Compile Include="Interfaces\IAudioSessionControl2.cs" />
+    <Compile Include="Interfaces\IAudioSessionEvents.cs" />
+    <Compile Include="Interfaces\IAudioSessionControl.cs" />
+    <Compile Include="Interfaces\IAudioRenderClient.cs" />
+    <Compile Include="Interfaces\IAudioPeakMeter.cs" />
+    <Compile Include="Interfaces\IAudioOutputSelector.cs" />
+    <Compile Include="Interfaces\IAudioMute.cs" />
+    <Compile Include="Interfaces\IAudioMidrange.cs" />
+    <Compile Include="Interfaces\IAudioLoudness.cs" />
+    <Compile Include="Interfaces\IAudioInputSelector.cs" />
+    <Compile Include="Interfaces\IAudioClock2.cs" />
+    <Compile Include="Interfaces\IAudioClockAdjustment.cs" />
+    <Compile Include="Interfaces\IAudioClock.cs" />
+    <Compile Include="Interfaces\IAudioClient.cs" />
+    <Compile Include="Interfaces\IAudioChannelConfig.cs" />
+    <Compile Include="Interfaces\IAudioCaptureClient.cs" />
+    <Compile Include="Interfaces\IAudioBass.cs" />
+    <Compile Include="Interfaces\IPerChannelDbLevel.cs" />
+    <Compile Include="Interfaces\IAudioAutoGainControl.cs" />
+    <Compile Include="Interfaces\IAudioEndpointVolumeCallback.cs" />
+    <Compile Include="Interfaces\IAudioMeterInformation.cs" />
+    <Compile Include="Interfaces\IAudioEndpointVolumeEx.cs" />
+    <Compile Include="Interfaces\IAudioEndpointVolume.cs" />
+    <Compile Include="Interfaces\IMMNotificationClient.cs" />
+    <Compile Include="Structures\AUDIO_VOLUME_NOTIFICATION_DATA.cs" />
+    <Compile Include="Structures\KSJACK_SINK_INFORMATION.cs" />
+    <Compile Include="Structures\KSJACK_DESCRIPTION2.cs" />
+    <Compile Include="Structures\DIRECTX_AUDIO_ACTIVATION_PARAMS.cs" />
+    <Compile Include="Structures\KSJACK_DESCRIPTION.cs" />
+    <Compile Include="Structures\LUID.cs" />
+    <Compile Include="Externals\IPropertyStore.cs" />
+    <Compile Include="Interfaces\IMMEndpoint.cs" />
+    <Compile Include="Interfaces\IMMDeviceCollection.cs" />
+    <Compile Include="Interfaces\IMMDeviceEnumerator.cs" />
+    <Compile Include="Interfaces\IMMDevice.cs" />
+    <Compile Include="Interfaces\Definitions.cs" />
+    <Compile Include="Properties\AssemblyInfo.cs" />
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="Properties\CoreAudioKey.snk" />
+  </ItemGroup>
+  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+  <PropertyGroup>
+    <PostBuildEvent>
+    </PostBuildEvent>
+  </PropertyGroup>
+  <PropertyGroup>
+    <PreBuildEvent>
+    </PreBuildEvent>
+  </PropertyGroup>
+  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
+       Other similar extension points exist, see Microsoft.Common.targets.
+  <Target Name="BeforeBuild">
+  </Target>
+  <Target Name="AfterBuild">
+  </Target>
+  -->
+</Project>

+ 49 - 0
sourceCode/trunk/Code/CoreAudio/Enumerations/AUDCLNT_BUFFERFLAGS.cs

@@ -0,0 +1,49 @@
+// -----------------------------------------
+// SoundScribe (TM) and related software.
+// 
+// Copyright (C) 2007-2011 Vannatech
+// http://www.vannatech.com
+// All rights reserved.
+// 
+// This source code is subject to the MIT License.
+// http://www.opensource.org/licenses/mit-license.php
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+// -----------------------------------------
+
+using System;
+using System.Runtime.InteropServices;
+
+namespace Vannatech.CoreAudio.Enumerations
+{
+	/// <summary>
+	/// Defines flags that indicate the status of an audio endpoint buffer.
+	/// </summary>
+	/// <remarks>
+	/// MSDN Reference: http://msdn.microsoft.com/en-us/library/dd371458.aspx
+	/// </remarks>
+	[Flags]
+	public enum AUDCLNT_BUFFERFLAGS
+	{
+		/// <summary>
+		/// The data in the packet is not correlated with the previous packet's device position.
+		/// </summary>
+		AUDCLNT_BUFFERFLAGS_DATA_DISCONTINUITY = 0x1,
+
+		/// <summary>
+		/// Treat all of the data in the packet as silence and ignore the actual data values.
+		/// </summary>
+		AUDCLNT_BUFFERFLAGS_SILENT = 0x2,
+
+		/// <summary>
+		/// The time at which the device's stream position was recorded is uncertain.
+		/// </summary>
+		AUDCLNT_BUFFERFLAGS_TIMESTAMP_ERROR = 0x4
+	}
+}

+ 43 - 0
sourceCode/trunk/Code/CoreAudio/Enumerations/AUDCLNT_SHAREMODE.cs

@@ -0,0 +1,43 @@
+// -----------------------------------------
+// SoundScribe (TM) and related software.
+// 
+// Copyright (C) 2007-2011 Vannatech
+// http://www.vannatech.com
+// All rights reserved.
+// 
+// This source code is subject to the MIT License.
+// http://www.opensource.org/licenses/mit-license.php
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+// -----------------------------------------
+
+using System;
+using System.Runtime.InteropServices;
+
+namespace Vannatech.CoreAudio.Enumerations
+{
+	/// <summary>
+	/// Defines constants that indicate whether an audio stream will run in shared mode or in exclusive mode.
+	/// </summary>
+	/// <remarks>
+	/// MSDN Reference: http://msdn.microsoft.com/en-us/library/dd370790.aspx
+	/// </remarks>
+	public enum AUDCLNT_SHAREMODE
+	{
+		/// <summary>
+		/// The audio stream will run in shared mode.
+		/// </summary>
+		AUDCLNT_SHAREMODE_SHARED = 0,
+
+		/// <summary>
+		/// The audio stream will run in exclusive mode.
+		/// </summary>
+		AUDCLNT_SHAREMODE_EXCLUSIVE = 1
+	}
+}

+ 63 - 0
sourceCode/trunk/Code/CoreAudio/Enumerations/AudioSessionDisconnectReason.cs

@@ -0,0 +1,63 @@
+// -----------------------------------------
+// SoundScribe (TM) and related software.
+// 
+// Copyright (C) 2007-2011 Vannatech
+// http://www.vannatech.com
+// All rights reserved.
+// 
+// This source code is subject to the MIT License.
+// http://www.opensource.org/licenses/mit-license.php
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+// -----------------------------------------
+
+using System;
+using System.Runtime.InteropServices;
+
+namespace Vannatech.CoreAudio.Enumerations
+{
+	/// <summary>
+	/// Defines constants that indicate a reason for an audio session being disconnected.
+	/// </summary>
+	/// <remarks>
+	/// MSDN Reference: Unknown
+	/// </remarks>
+	public enum AudioSessionDisconnectReason
+	{
+		/// <summary>
+		/// The user removed the audio endpoint device.
+		/// </summary>
+		DisconnectReasonDeviceRemoval = 0,
+
+		/// <summary>
+		/// The Windows audio service has stopped.
+		/// </summary>
+		DisconnectReasonServerShutdown = 1,
+
+		/// <summary>
+		/// The stream format changed for the device that the audio session is connected to.
+		/// </summary>
+		DisconnectReasonFormatChanged = 2,
+
+		/// <summary>
+		/// The user logged off the WTS session that the audio session was running in.
+		/// </summary>
+		DisconnectReasonSessionLogoff = 3,
+
+		/// <summary>
+		/// The WTS session that the audio session was running in was disconnected.
+		/// </summary>
+		DisconnectReasonSessionDisconnected = 4,
+
+		/// <summary>
+		/// The (shared-mode) audio session was disconnected to make the audio endpoint device available for an exclusive-mode connection.
+		/// </summary>
+		DisconnectReasonExclusiveModeOverride = 5
+	}
+}

+ 48 - 0
sourceCode/trunk/Code/CoreAudio/Enumerations/AudioSessionState.cs

@@ -0,0 +1,48 @@
+// -----------------------------------------
+// SoundScribe (TM) and related software.
+// 
+// Copyright (C) 2007-2011 Vannatech
+// http://www.vannatech.com
+// All rights reserved.
+// 
+// This source code is subject to the MIT License.
+// http://www.opensource.org/licenses/mit-license.php
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+// -----------------------------------------
+
+using System;
+using System.Runtime.InteropServices;
+
+namespace Vannatech.CoreAudio.Enumerations
+{
+	/// <summary>
+	/// Defines constants that indicate the current state of an audio session.
+	/// </summary>
+	/// <remarks>
+	/// MSDN Reference: http://msdn.microsoft.com/en-us/library/dd370792.aspx
+	/// </remarks>
+	public enum AudioSessionState
+	{
+		/// <summary>
+		/// The audio session is inactive.
+		/// </summary>
+		AudioSessionStateInactive = 0,
+
+		/// <summary>
+		/// The audio session is active.
+		/// </summary>
+		AudioSessionStateActive = 1,
+
+		/// <summary>
+		/// The audio session has expired.
+		/// </summary>
+		AudioSessionStateExpired = 2 
+	}
+}

+ 63 - 0
sourceCode/trunk/Code/CoreAudio/Enumerations/ConnectorType.cs

@@ -0,0 +1,63 @@
+// -----------------------------------------
+// SoundScribe (TM) and related software.
+// 
+// Copyright (C) 2007-2011 Vannatech
+// http://www.vannatech.com
+// All rights reserved.
+// 
+// This source code is subject to the MIT License.
+// http://www.opensource.org/licenses/mit-license.php
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+// -----------------------------------------
+
+using System;
+using System.Runtime.InteropServices;
+
+namespace Vannatech.CoreAudio.Enumerations
+{
+	/// <summary>
+	/// Indicates the type of connection that a connector is part of.
+	/// </summary>
+	/// <remarks>
+	/// MSDN Reference: http://msdn.microsoft.com/en-us/library/dd370801.aspx
+	/// </remarks>
+	public enum ConnectorType
+	{
+		/// <summary>
+		/// The connector is part of a connection of unknown type.
+		/// </summary>
+		Unknown_Connector,
+
+		/// <summary>
+		/// The connector is part of a physical connection to an auxiliary device that is installed inside the system chassis.
+		/// </summary>
+		Physical_Internal,
+
+		/// <summary>
+		/// The connector is part of a physical connection to an external device.
+		/// </summary>
+		Physical_External,
+
+		/// <summary>
+		/// The connector is part of a software-configured I/O connection.
+		/// </summary>
+		Software_IO,
+
+		/// <summary>
+		/// The connector is part of a permanent connection that is fixed and cannot be configured under software control.
+		/// </summary>
+		Software_Fixed,
+
+		/// <summary>
+		/// The connector is part of a connection to a network.
+		/// </summary>
+		Network 
+	}
+}

+ 43 - 0
sourceCode/trunk/Code/CoreAudio/Enumerations/DataFlow.cs

@@ -0,0 +1,43 @@
+// -----------------------------------------
+// SoundScribe (TM) and related software.
+// 
+// Copyright (C) 2007-2011 Vannatech
+// http://www.vannatech.com
+// All rights reserved.
+// 
+// This source code is subject to the MIT License.
+// http://www.opensource.org/licenses/mit-license.php
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+// -----------------------------------------
+
+using System;
+using System.Runtime.InteropServices;
+
+namespace Vannatech.CoreAudio.Enumerations
+{
+	/// <summary>
+	/// Indicates the data-flow direction of an audio stream through a connector.
+	/// </summary>
+	/// <remarks>
+	/// MSDN Reference: http://msdn.microsoft.com/en-us/library/dd370808.aspx
+	/// </remarks>
+	public enum DataFlow
+	{
+		/// <summary>
+		/// The audio stream flows into the device through the connector.
+		/// </summary>
+		In,
+
+		/// <summary>
+		/// The audio stream flows out of the device through the connector.
+		/// </summary>
+		Out
+	}
+}

+ 48 - 0
sourceCode/trunk/Code/CoreAudio/Enumerations/EDataFlow.cs

@@ -0,0 +1,48 @@
+// -----------------------------------------
+// SoundScribe (TM) and related software.
+// 
+// Copyright (C) 2007-2011 Vannatech
+// http://www.vannatech.com
+// All rights reserved.
+// 
+// This source code is subject to the MIT License.
+// http://www.opensource.org/licenses/mit-license.php
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+// -----------------------------------------
+
+using System;
+using System.Runtime.InteropServices;
+
+namespace Vannatech.CoreAudio.Enumerations
+{
+	/// <summary>
+	/// Defines constants that indicate the direction in which audio data flows between an audio endpoint device and an application.
+	/// </summary>
+	/// <remarks>
+	/// MSDN Reference: http://msdn.microsoft.com/en-us/library/dd370828.aspx
+	/// </remarks>
+	public enum EDataFlow
+	{
+		/// <summary>
+		/// Audio data flows from the application to the audio endpoint device, which renders the stream.
+		/// </summary>
+		eRender = 0,
+
+		/// <summary>
+		/// Audio data flows from the audio endpoint device that captures the stream, to the application.
+		/// </summary>
+		eCapture = 1,
+
+		/// <summary>
+		/// Audio data can flow either from the application to the audio endpoint device, or from the audio endpoint device to the application.
+		/// </summary>
+		eAll = 2
+	}
+}

+ 48 - 0
sourceCode/trunk/Code/CoreAudio/Enumerations/ERole.cs

@@ -0,0 +1,48 @@
+// -----------------------------------------
+// SoundScribe (TM) and related software.
+// 
+// Copyright (C) 2007-2011 Vannatech
+// http://www.vannatech.com
+// All rights reserved.
+// 
+// This source code is subject to the MIT License.
+// http://www.opensource.org/licenses/mit-license.php
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+// -----------------------------------------
+
+using System;
+using System.Runtime.InteropServices;
+
+namespace Vannatech.CoreAudio.Enumerations
+{
+	/// <summary>
+	/// Defines constants that indicate the role that the system has assigned to an audio endpoint device.
+	/// </summary>
+	/// <remarks>
+	/// MSDN Reference: http://msdn.microsoft.com/en-us/library/dd370842.aspx
+	/// </remarks>
+	public enum ERole
+	{
+		/// <summary>
+		/// Games, system notification sounds, and voice commands.
+		/// </summary>
+		eConsole = 0,
+
+		/// <summary>
+		/// Music, movies, narration, and live music recording.
+		/// </summary>
+		eMultimedia = 1,
+
+		/// <summary>
+		/// Voice communications (talking to another person).
+		/// </summary>
+		eCommunications = 2
+	}
+}

+ 88 - 0
sourceCode/trunk/Code/CoreAudio/Enumerations/EndpointFormFactor.cs

@@ -0,0 +1,88 @@
+// -----------------------------------------
+// SoundScribe (TM) and related software.
+// 
+// Copyright (C) 2007-2011 Vannatech
+// http://www.vannatech.com
+// All rights reserved.
+// 
+// This source code is subject to the MIT License.
+// http://www.opensource.org/licenses/mit-license.php
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+// -----------------------------------------
+
+using System;
+using System.Runtime.InteropServices;
+
+namespace Vannatech.CoreAudio.Enumerations
+{
+	/// <summary>
+	/// Defines constants that indicate the general physical attributes of an audio endpoint device.
+	/// </summary>
+	/// <remarks>
+	/// MSDN Reference: http://msdn.microsoft.com/en-us/library/dd370830.aspx
+	/// </remarks>
+	public enum EndpointFormFactor
+	{
+		/// <summary>
+		/// An audio endpoint device that the user accesses remotely through a network.
+		/// </summary>
+		RemoteNetworkDevice = 0,
+
+		/// <summary>
+		/// A set of speakers.
+		/// </summary>
+		Speakers = 1,
+
+		/// <summary>
+		/// An audio endpoint device that sends or receives a line-level a line-level analog signal.
+		/// </summary>
+		LineLevel = 2,
+
+		/// <summary>
+		/// A set of headphones.
+		/// </summary>
+		Headphones = 3,
+
+		/// <summary>
+		/// A microphone.
+		/// </summary>
+		Microphone = 4,
+
+		/// <summary>
+		/// An earphone or a pair of earphones with an attached mouthpiece for two-way communication.
+		/// </summary>
+		Headset = 5,
+
+		/// <summary>
+		/// The part of a telephone that is held in the hand and that contains a speaker and a microphone for two-way communication.
+		/// </summary>
+		Handset = 6,
+
+		/// <summary>
+		/// An audio endpoint device that connects to an audio adapter through a connector for a digital interface of unknown type.
+		/// </summary>
+		UnknownDigitalPassthrough = 7,
+
+		/// <summary>
+		/// An audio endpoint device that connects to an audio adapter through a Sony/Philips Digital Interface (S/PDIF) connector.
+		/// </summary>
+		SPDIF = 8,
+
+		/// <summary>
+		/// An audio endpoint device that connects to an audio adapter through a High-Definition Multimedia Interface (HDMI) connector.
+		/// </summary>
+		DigitalAudioDisplayDevice = 9,
+
+		/// <summary>
+		/// An audio endpoint device with unknown physical attributes.
+		/// </summary>
+		UnknownFormFactor = 10
+	}
+}

+ 43 - 0
sourceCode/trunk/Code/CoreAudio/Enumerations/KSJACK_SINK_CONNECTIONTYPE.cs

@@ -0,0 +1,43 @@
+// -----------------------------------------
+// SoundScribe (TM) and related software.
+// 
+// Copyright (C) 2007-2011 Vannatech
+// http://www.vannatech.com
+// All rights reserved.
+// 
+// This source code is subject to the MIT License.
+// http://www.opensource.org/licenses/mit-license.php
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+// -----------------------------------------
+
+using System;
+using System.Runtime.InteropServices;
+
+namespace Vannatech.CoreAudio.Enumerations
+{
+	/// <summary>
+	/// Defines constants that specify the type of connection.
+	/// </summary>
+	/// <remarks>
+	/// MSDN Reference: http://msdn.microsoft.com/en-us/library/dd316547.aspx
+	/// </remarks>
+	public enum KSJACK_SINK_CONNECTIONTYPE
+	{
+		/// <summary>
+		/// High-Definition Multimedia Interface (HDMI) connection.
+		/// </summary>
+		KSJACK_SINK_CONNECTIONTYPE_HDMI = 0,
+		
+		/// <summary>
+		/// Display port.
+		/// </summary>
+		KSJACK_SINK_CONNECTIONTYPE_DISPLAYPORT = 1 
+	}
+}

+ 43 - 0
sourceCode/trunk/Code/CoreAudio/Enumerations/PartType.cs

@@ -0,0 +1,43 @@
+// -----------------------------------------
+// SoundScribe (TM) and related software.
+// 
+// Copyright (C) 2007-2011 Vannatech
+// http://www.vannatech.com
+// All rights reserved.
+// 
+// This source code is subject to the MIT License.
+// http://www.opensource.org/licenses/mit-license.php
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+// -----------------------------------------
+
+using System;
+using System.Runtime.InteropServices;
+
+namespace Vannatech.CoreAudio.Enumerations
+{
+	/// <summary>
+	/// Defines constants that indicate whether a part in a device topology is a connector or subunit.
+	/// </summary>
+	/// <remarks>
+	/// MSDN Reference: http://msdn.microsoft.com/en-us/library/dd316559.aspx
+	/// </remarks>
+	public enum PartType
+	{
+		/// <summary>
+		/// The part is a connector.
+		/// </summary>
+		Connector,
+
+		/// <summary>
+		/// The part is a subunit.
+		/// </summary>
+		Subunit 
+	}
+}

+ 144 - 0
sourceCode/trunk/Code/CoreAudio/Externals/CLSCTX.cs

@@ -0,0 +1,144 @@
+// -----------------------------------------
+// SoundScribe (TM) and related software.
+// 
+// Copyright (C) 2007-2011 Vannatech
+// http://www.vannatech.com
+// All rights reserved.
+// 
+// This source code is subject to the MIT License.
+// http://www.opensource.org/licenses/mit-license.php
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+// -----------------------------------------
+
+using System;
+
+namespace Vannatech.CoreAudio.Externals
+{
+	/// <summary>
+    /// Values that are used in activation calls to indicate the execution contexts in which an object is to be run.
+	/// </summary>
+	/// <remarks>
+	/// MSDN Reference: http://msdn.microsoft.com/en-us/library/ms693716.aspx
+	/// Note: This item is external to CoreAudio API, and is defined in the Windows COM API.
+	/// </remarks>
+    public enum CLSCTX : uint
+	{
+        /// <summary>
+        /// The code that creates and manages objects of this class is a DLL that runs in the same process as the caller of the function specifying the class context.
+        /// </summary>
+        CLSCTX_INPROC_SERVER = 0x1,
+
+        /// <summary>
+        /// The code that manages objects of this class is an in-process handler.
+        /// </summary>
+        CLSCTX_INPROC_HANDLER = 0x2,
+
+        /// <summary>
+        /// The EXE code that creates and manages objects of this class runs on same machine but is loaded in a separate process space.
+        /// </summary>
+        CLSCTX_LOCAL_SERVER = 0x4,
+
+        /// <summary>
+        /// Obsolete.
+        /// </summary>
+        CLSCTX_INPROC_SERVER16 = 0x8,
+
+        /// <summary>
+        /// A remote context.
+        /// </summary>
+        CLSCTX_REMOTE_SERVER = 0x10,
+
+        /// <summary>
+        /// Obsolete.
+        /// </summary>
+        CLSCTX_INPROC_HANDLER16 = 0x20,
+
+        /// <summary>
+        /// Reserved.
+        /// </summary>
+        CLSCTX_RESERVED1 = 0x40,
+
+        /// <summary>
+        /// Reserved.
+        /// </summary>
+        CLSCTX_RESERVED2 = 0x80,
+
+        /// <summary>
+        /// Reserved.
+        /// </summary>
+        CLSCTX_RESERVED3 = 0x100,
+
+        /// <summary>
+        /// Reserved.
+        /// </summary>
+        CLSCTX_RESERVED4 = 0x200,
+
+        /// <summary>
+        /// Disaables the downloading of code from the directory service or the Internet.
+        /// </summary>
+        CLSCTX_NO_CODE_DOWNLOAD = 0x400,
+
+        /// <summary>
+        /// Reserved.
+        /// </summary>
+        CLSCTX_RESERVED5 = 0x800,
+
+        /// <summary>
+        /// Specify if you want the activation to fail if it uses custom marshalling.
+        /// </summary>
+        CLSCTX_NO_CUSTOM_MARSHAL = 0x1000,
+
+        /// <summary>
+        /// Enables the downloading of code from the directory service or the Internet.
+        /// </summary>
+        CLSCTX_ENABLE_CODE_DOWNLOAD = 0x2000,
+
+        /// <summary>
+        /// Can be used to override the logging of failures
+        /// </summary>
+        CLSCTX_NO_FAILURE_LOG = 0x4000,
+        
+        /// <summary>
+        /// Disables activate-as-activator (AAA) activations for this activation only.
+        /// </summary>
+        CLSCTX_DISABLE_AAA = 0x8000,
+
+        /// <summary>
+        /// Enables activate-as-activator (AAA) activations for this activation only.
+        /// </summary>
+        CLSCTX_ENABLE_AAA = 0x10000,
+
+        /// <summary>
+        /// Begin this activation from the default context of the current apartment.
+        /// </summary>
+        CLSCTX_FROM_DEFAULT_CONTEXT = 0x20000,
+
+        /// <summary>
+        /// Activate or connect to a 32-bit version of the server; fail if one is not registered.
+        /// </summary>
+        CLSCTX_ACTIVATE_32_BIT_SERVER = 0x40000,
+
+        /// <summary>
+        /// Activate or connect to a 64 bit version of the server; fail if one is not registered. 
+        /// </summary>
+        CLSCTX_ACTIVATE_64_BIT_SERVER = 0x80000,
+
+        /// <summary>
+        /// Obsolete.
+        /// </summary>
+        CLSCTX_ENABLE_CLOAKING = 0x100000,
+
+        /// <summary>
+        /// Reserved.
+        /// </summary>
+        CLSCTX_PS_DLL = 0x80000000 
+
+	}
+}

+ 85 - 0
sourceCode/trunk/Code/CoreAudio/Externals/IPropertyStore.cs

@@ -0,0 +1,85 @@
+// -----------------------------------------
+// SoundScribe (TM) and related software.
+// 
+// Copyright (C) 2007-2011 Vannatech
+// http://www.vannatech.com
+// All rights reserved.
+// 
+// This source code is subject to the MIT License.
+// http://www.opensource.org/licenses/mit-license.php
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+// -----------------------------------------
+
+using System;
+using System.Runtime.InteropServices;
+
+namespace Vannatech.CoreAudio.Externals
+{
+    /// <summary>
+	/// Exposes methods for enumerating, getting, and setting property values.
+    /// </summary>
+	/// <remarks>
+	/// MSDN Reference: http://msdn.microsoft.com/en-us/library/bb761474.aspx
+	/// Note: This item is external to CoreAudio API, and is defined in the Windows Property System API.
+	/// </remarks>
+	[Guid("886d8eeb-8cf2-4446-8d02-cdba1dbdcf99")]
+	[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+    public interface IPropertyStore
+    {
+        /// <summary>
+        /// Gets the number of properties attached to the file.
+        /// </summary>
+        /// <param name="propertyCount">Receives the property count.</param>
+        /// <returns>An HRESULT code indicating whether the operation passed of failed.</returns>
+        [PreserveSig]
+        int GetCount(
+            [Out] [MarshalAs(UnmanagedType.U4)] out UInt32 propertyCount);
+
+        /// <summary>
+        /// Gets a property key from an item's array of properties.
+        /// </summary>
+        /// <param name="propertyIndex">The index of the property key in the array of <see cref="PROPERTYKEY"/> structures.</param>
+        /// <param name="propertyKey">The unique identifier for a property.</param>
+        /// <returns>An HRESULT code indicating whether the operation passed of failed.</returns>
+        [PreserveSig]
+        int GetAt(
+			[In] [MarshalAs(UnmanagedType.U4)] UInt32 propertyIndex,
+            [Out] out PROPERTYKEY propertyKey);
+
+        /// <summary>
+        /// Gets data for a specific property.
+        /// </summary>
+        /// <param name="propertyKey">A <see cref="PROPERTYKEY"/> structure containing a unique identifier for the property in question.</param>
+        /// <param name="value">Receives a <see cref="PROPVARIANT"/> structure that contains the property data.</param>
+        /// <returns>An HRESULT code indicating whether the operation passed of failed.</returns>
+        [PreserveSig]
+        int GetValue(
+            [In] ref PROPERTYKEY propertyKey,
+            [Out] out PROPVARIANT value);
+
+        /// <summary>
+        /// Sets a new property value, or replaces or removes an existing value.
+        /// </summary>
+        /// <param name="propertyKey">A <see cref="PROPERTYKEY"/> structure containing a unique identifier for the property in question.</param>
+        /// <param name="value">A <see cref="PROPVARIANT"/> structure that contains the new property data.</param>
+        /// <returns>An HRESULT code indicating whether the operation passed of failed.</returns>
+        [PreserveSig]
+        int SetValue(
+            [In] ref PROPERTYKEY propertyKey,
+            [In] ref PROPVARIANT value);
+
+		/// <summary>
+		/// Saves a property change.
+		/// </summary>
+		/// <returns>An HRESULT code indicating whether the operation passed of failed.</returns>
+		[PreserveSig]
+		int Commit();
+    }
+}

+ 45 - 0
sourceCode/trunk/Code/CoreAudio/Externals/PROPERTYKEY.cs

@@ -0,0 +1,45 @@
+// -----------------------------------------
+// SoundScribe (TM) and related software.
+// 
+// Copyright (C) 2007-2011 Vannatech
+// http://www.vannatech.com
+// All rights reserved.
+// 
+// This source code is subject to the MIT License.
+// http://www.opensource.org/licenses/mit-license.php
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+// -----------------------------------------
+
+using System;
+using System.Runtime.InteropServices;
+
+namespace Vannatech.CoreAudio.Externals
+{
+	/// <summary>
+	/// Specifies the FMTID/PID identifier that programmatically identifies a property.
+	/// </summary>
+	/// <remarks>
+	/// MSDN Reference: http://msdn.microsoft.com/en-us/library/bb773381.aspx
+	/// Note: This item is external to CoreAudio API, and is defined in the Windows Property System API.
+	/// </remarks>
+	[StructLayout(LayoutKind.Sequential)]
+	public struct PROPERTYKEY
+	{
+		/// <summary>
+		/// A unique GUID for the property.
+		/// </summary>
+		public Guid fmtid;
+
+		/// <summary>
+		/// A property identifier (PID).
+		/// </summary>
+		public int pid;
+	}
+}

+ 95 - 0
sourceCode/trunk/Code/CoreAudio/Externals/PROPVARIANT.cs

@@ -0,0 +1,95 @@
+// -----------------------------------------
+// SoundScribe (TM) and related software.
+// 
+// Copyright (C) 2007-2011 Vannatech
+// http://www.vannatech.com
+// All rights reserved.
+// 
+// This source code is subject to the MIT License.
+// http://www.opensource.org/licenses/mit-license.php
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+// -----------------------------------------
+
+using System;
+using System.Runtime.InteropServices;
+
+namespace Vannatech.CoreAudio.Externals
+{
+	/// <summary>
+	/// Used by the <see cref="IPropertyStore.GetValue"/> and <see cref="IPropertyStore.SetValue"/> methods
+	/// of <see cref="IPropertyStore"/> as the primary way to program item properties.
+	/// </summary>
+	/// <remarks>
+	/// MSDN Reference: http://msdn.microsoft.com/en-us/library/aa380072.aspx
+	/// Note: This item is external to CoreAudio API, and is defined in the Windows Structured Storage API.
+	/// </remarks>
+	[StructLayout(LayoutKind.Sequential)]
+	public struct PROPVARIANT
+	{
+		/// <summary>
+		/// Value type tag.
+		/// </summary>
+		public short vt;
+
+		/// <summary>
+		/// Reserved for future use.
+		/// </summary>
+		public short wReserved1;
+
+		/// <summary>
+		/// Reserved for future use.
+		/// </summary>
+		public short wReserved2;
+
+		/// <summary>
+		/// Reserved for future use.
+		/// </summary>
+		public short wReserved3;
+
+        /// <summary>
+        /// Represents the variant data section.
+        /// </summary>
+        public VariantData Data;
+	}
+
+    /// <summary>
+    /// Represents the variant data section of the PROPVARIANT structure.
+    /// </summary>
+    /// <remarks>
+    /// This only provides variants for use within the context of MMDevice properties.
+    /// </remarks>
+    [StructLayout(LayoutKind.Explicit)]
+    public struct VariantData
+    {
+        /// <summary>
+        /// Represents the data as a boolean value.
+        /// </summary>
+        [FieldOffset(0)]
+        public bool AsBoolean;
+
+        /// <summary>
+        /// Represents the data as a unsigned 32-bit integer.
+        /// </summary>
+        [FieldOffset(0)]
+        public UInt32 AsUInt32;
+
+        /// <summary>
+        /// Represents the data as a unicode string pointer.
+        /// </summary>
+        [FieldOffset(0)]
+        public IntPtr AsStringPtr;
+
+        /// <summary>
+        /// Represents the data as a pointer to a WAVEFORMATEX structure.
+        /// </summary>
+        [FieldOffset(4)]
+        public IntPtr AsFormatPtr;
+    }
+}

+ 48 - 0
sourceCode/trunk/Code/CoreAudio/Externals/STGM.cs

@@ -0,0 +1,48 @@
+// -----------------------------------------
+// SoundScribe (TM) and related software.
+// 
+// Copyright (C) 2007-2011 Vannatech
+// http://www.vannatech.com
+// All rights reserved.
+// 
+// This source code is subject to the MIT License.
+// http://www.opensource.org/licenses/mit-license.php
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+// -----------------------------------------
+
+using System;
+
+namespace Vannatech.CoreAudio.Externals
+{
+	/// <summary>
+	/// The STGM constants are flags that indicate conditions for creating and deleting the object and access modes for the object.
+	/// </summary>
+	/// <remarks>
+	/// MSDN Reference: http://msdn.microsoft.com/en-us/library/aa380337.aspx
+	/// Note: This item is external to CoreAudio API, and is defined in the Windows Structured Storage API.
+	/// </remarks>
+	public class STGM
+	{
+		/// <summary>
+		/// Indicates that the object is read-only, meaning that modifications cannot be made.
+		/// </summary>
+		public const int STGM_READ = 0x00000000;
+
+		/// <summary>
+		/// Enables you to save changes to the object, but does not permit access to its data.
+		/// </summary>
+		public const int STGM_WRITE = 0x00000001;
+
+		/// <summary>
+		/// Enables access and modification of object data.
+		/// </summary>
+		public const int STGM_READWRITE = 0x00000002;
+	}
+}

+ 251 - 0
sourceCode/trunk/Code/CoreAudio/Interfaces/Definitions.cs

@@ -0,0 +1,251 @@
+// -----------------------------------------
+// SoundScribe (TM) and related software.
+// 
+// Copyright (C) 2007-2011 Vannatech
+// http://www.vannatech.com
+// All rights reserved.
+// 
+// This source code is subject to the MIT License.
+// http://www.opensource.org/licenses/mit-license.php
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+// -----------------------------------------
+
+using System;
+using System.Runtime.InteropServices;
+using Vannatech.CoreAudio.Constants;
+
+// This file does not contain any actual interface members.
+// It is only intended to abstract away COM specifics, such as IIDs.
+
+namespace Vannatech.CoreAudio.Interfaces
+{
+	// -------------------------------------------------
+	// Begin MMDevice API definitions:
+    // Defined in Mmdeviceapi.h
+	// -------------------------------------------------
+
+    [Guid(ComIIDs.IMMDeviceIID)]
+    [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+    public partial interface IMMDevice { }
+
+    [Guid(ComIIDs.IMMDeviceEnumeratorIID)]
+    [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+    public partial interface IMMDeviceEnumerator { }
+
+    [Guid(ComIIDs.IMMDeviceCollectionIID)]
+    [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+    public partial interface IMMDeviceCollection { }
+
+    [Guid(ComIIDs.IMMEndpointIID)]
+    [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+    public partial interface IMMEndpoint { }
+
+    [Guid(ComIIDs.IMMNotificationClientIID)]
+    [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+    public partial interface IMMNotificationClient { }
+
+
+	// -------------------------------------------------
+	// Begin WASAPI definitions:
+    // Defined in Audioclient.h and Audiopolicy.h
+	// -------------------------------------------------
+
+	[Guid(ComIIDs.IAudioCaptureClientIID)]
+	[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+	public partial interface IAudioCaptureClient { }
+
+	[Guid(ComIIDs.IAudioClientIID)]
+	[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+	public partial interface IAudioClient { }
+
+	[Guid(ComIIDs.IAudioClockIID)]
+	[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+	public partial interface IAudioClock { }
+
+	[Guid(ComIIDs.IAudioClock2IID)]
+	[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+	public partial interface IAudioClock2 { }
+
+	[Guid(ComIIDs.IAudioClockAdjustmentIID)]
+	[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+	public partial interface IAudioClockAdjustment { }
+
+	[Guid(ComIIDs.IAudioRenderClientIID)]
+	[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+	public partial interface IAudioRenderClient { }
+
+	[Guid(ComIIDs.IAudioSessionControlIID)]
+	[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+	public partial interface IAudioSessionControl { }
+
+	[Guid(ComIIDs.IAudioSessionControl2IID)]
+	[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+	public partial interface IAudioSessionControl2 { }
+
+	[Guid(ComIIDs.IAudioSessionEnumeratorIID)]
+	[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+	public partial interface IAudioSessionEnumerator { }
+
+	[Guid(ComIIDs.IAudioSessionEventsIID)]
+	[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+	public partial interface IAudioSessionEvents { }
+
+	[Guid(ComIIDs.IAudioSessionManagerIID)]
+	[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+	public partial interface IAudioSessionManager { }
+
+	[Guid(ComIIDs.IAudioSessionManager2IID)]
+	[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+	public partial interface IAudioSessionManager2 { }
+
+	[Guid(ComIIDs.IAudioSessionNotificationIID)]
+	[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+	public partial interface IAudioSessionNotification { }
+
+	[Guid(ComIIDs.IAudioStreamVolumeIID)]
+	[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+	public partial interface IAudioStreamVolume { }
+
+	[Guid(ComIIDs.IAudioVolumeDuckNotificationIID)]
+	[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+	public partial interface IAudioVolumeDuckNotification { }
+
+	[Guid(ComIIDs.IChannelAudioVolumeIID)]
+	[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+	public partial interface IChannelAudioVolume { }
+
+	[Guid(ComIIDs.ISimpleAudioVolumeIID)]
+	[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+	public partial interface ISimpleAudioVolume { }
+
+
+	// -------------------------------------------------
+	// Begin DeviceTopology API definitions:
+    // Defined in Devicetopology.h
+	// -------------------------------------------------
+
+	[Guid(ComIIDs.IAudioAutoGainControlIID)]
+	[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+	public partial interface IAudioAutoGainControl { }
+
+	[Guid(ComIIDs.IAudioBassIID)]
+	[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+	public partial interface IAudioBass { }
+
+	[Guid(ComIIDs.IAudioChannelConfigIID)]
+	[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+	public partial interface IAudioChannelConfig { }
+
+	[Guid(ComIIDs.IAudioInputSelectorIID)]
+	[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+	public partial interface IAudioInputSelector { }
+
+	[Guid(ComIIDs.IAudioLoudnessIID)]
+	[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+	public partial interface IAudioLoudness { }
+
+	[Guid(ComIIDs.IAudioMidrangeIID)]
+	[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+	public partial interface IAudioMidrange { }
+
+	[Guid(ComIIDs.IAudioMuteIID)]
+	[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+	public partial interface IAudioMute { }
+
+	[Guid(ComIIDs.IAudioOutputSelectorIID)]
+	[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+	public partial interface IAudioOutputSelector { }
+
+	[Guid(ComIIDs.IAudioPeakMeterIID)]
+	[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+	public partial interface IAudioPeakMeter { }
+
+	[Guid(ComIIDs.IAudioTrebleIID)]
+	[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+	public partial interface IAudioTreble { }
+
+	[Guid(ComIIDs.IAudioVolumeLevelIID)]
+	[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+	public partial interface IAudioVolumeLevel { }
+
+	[Guid(ComIIDs.IConnectorIID)]
+	[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+	public partial interface IConnector { }
+
+	[Guid(ComIIDs.IControlChangeNotifyIID)]
+	[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+	public partial interface IControlChangeNotify { }
+
+	[Guid(ComIIDs.IControlInterfaceIID)]
+	[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+	public partial interface IControlInterface { }
+
+	[Guid(ComIIDs.IDeviceSpecificPropertyIID)]
+	[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+	public partial interface IDeviceSpecificProperty { }
+
+	[Guid(ComIIDs.IDeviceTopologyIID)]
+	[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+	public partial interface IDeviceTopology { }
+
+	[Guid(ComIIDs.IKsFormatSupportIID)]
+	[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+	public partial interface IKsFormatSupport { }
+
+	[Guid(ComIIDs.IKsJackDescriptionIID)]
+	[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+	public partial interface IKsJackDescription { }
+
+	[Guid(ComIIDs.IKsJackDescription2IID)]
+	[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+	public partial interface IKsJackDescription2 { }
+
+	[Guid(ComIIDs.IKsJackSinkInformationIID)]
+	[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+	public partial interface IKsJackSinkInformation { }
+
+	[Guid(ComIIDs.IPartIID)]
+	[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+	public partial interface IPart { }
+
+	[Guid(ComIIDs.IPartsListIID)]
+	[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+	public partial interface IPartsList { }
+
+	[Guid(ComIIDs.IPerChannelDbLevelIID)]
+	[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+	public partial interface IPerChannelDbLevel { }
+
+	[Guid(ComIIDs.ISubunitIID)]
+	[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+	public partial interface ISubunit { }
+
+
+	// -------------------------------------------------
+	// Begin EndpointVolume API definitions:
+    // Defined in Endpointvolume.h
+	// -------------------------------------------------
+
+    [Guid(ComIIDs.IAudioEndpointVolumeIID)]
+    [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+    public partial interface IAudioEndpointVolume { }
+
+	[Guid(ComIIDs.IAudioEndpointVolumeExIID)]
+    [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+    public partial interface IAudioEndpointVolumeEx { }
+
+    [Guid(ComIIDs.IAudioMeterInformationIID)]
+    [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+    public partial interface IAudioMeterInformation { }
+
+    [Guid(ComIIDs.IAudioEndpointVolumeCallbackIID)]
+    [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+    public partial interface IAudioEndpointVolumeCallback { }
+}

+ 53 - 0
sourceCode/trunk/Code/CoreAudio/Interfaces/IAudioAutoGainControl.cs

@@ -0,0 +1,53 @@
+// -----------------------------------------
+// SoundScribe (TM) and related software.
+// 
+// Copyright (C) 2007-2011 Vannatech
+// http://www.vannatech.com
+// All rights reserved.
+// 
+// This source code is subject to the MIT License.
+// http://www.opensource.org/licenses/mit-license.php
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+// -----------------------------------------
+
+using System;
+using System.Runtime.InteropServices;
+
+namespace Vannatech.CoreAudio.Interfaces
+{
+    /// <summary>
+	/// Provides access to a hardware automatic gain control (AGC).
+    /// </summary>
+    /// <remarks>
+	/// MSDN Reference: http://msdn.microsoft.com/en-us/library/dd370853.aspx
+    /// </remarks>
+	public partial interface IAudioAutoGainControl
+    {
+		/// <summary>
+		/// Gets the current state (enabled or disabled) of the AGC.
+		/// </summary>
+		/// <param name="isEnabled">Receives the current AGC state.</param>
+		/// <returns>An HRESULT code indicating whether the operation passed of failed.</returns>
+		[PreserveSig]
+		int GetEnabled(
+			[Out] [MarshalAs(UnmanagedType.Bool)] out bool isEnabled);
+
+		/// <summary>
+		/// Enables or disables the AGC.
+		/// </summary>
+		/// <param name="isEnabled">The new AGC state.</param>
+		/// <param name="eventContext">A user context value that is passed to the notification callback.</param>
+		/// <returns>An HRESULT code indicating whether the operation passed of failed.</returns>
+		[PreserveSig]
+		int SetEnabled(
+			[In] [MarshalAs(UnmanagedType.Bool)] bool isEnabled,
+			[In, Optional] [MarshalAs(UnmanagedType.LPStruct)] Guid eventContext);
+    }
+}

+ 35 - 0
sourceCode/trunk/Code/CoreAudio/Interfaces/IAudioBass.cs

@@ -0,0 +1,35 @@
+// -----------------------------------------
+// SoundScribe (TM) and related software.
+// 
+// Copyright (C) 2007-2011 Vannatech
+// http://www.vannatech.com
+// All rights reserved.
+// 
+// This source code is subject to the MIT License.
+// http://www.opensource.org/licenses/mit-license.php
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+// -----------------------------------------
+using System;
+using System.Runtime.InteropServices;
+
+namespace Vannatech.CoreAudio.Interfaces
+{
+    /// <summary>
+	/// Provides access to a hardware bass-level control.
+    /// </summary>
+    /// <remarks>
+	/// MSDN Reference: http://msdn.microsoft.com/en-us/library/dd370857.aspx
+    /// </remarks>
+	public partial interface IAudioBass : IPerChannelDbLevel
+    {
+		// The IAudioBass interface inherits from IPerChannelDbLevel but does not define additional methods or properties.
+		// Note: Although, derived classes normally do not work for COM interfaces, it does when no additional methods are defined in the subclass.
+    }
+}

+ 72 - 0
sourceCode/trunk/Code/CoreAudio/Interfaces/IAudioCaptureClient.cs

@@ -0,0 +1,72 @@
+// -----------------------------------------
+// SoundScribe (TM) and related software.
+// 
+// Copyright (C) 2007-2011 Vannatech
+// http://www.vannatech.com
+// All rights reserved.
+// 
+// This source code is subject to the MIT License.
+// http://www.opensource.org/licenses/mit-license.php
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+// -----------------------------------------
+
+using System;
+using System.Runtime.InteropServices;
+using Vannatech.CoreAudio.Enumerations;
+
+namespace Vannatech.CoreAudio.Interfaces
+{
+    /// <summary>
+	/// Enables a client to read input data from a capture endpoint buffer.
+    /// </summary>
+    /// <remarks>
+	/// MSDN Reference: http://msdn.microsoft.com/en-us/library/dd370858.aspx
+    /// </remarks>
+	public partial interface IAudioCaptureClient
+    {
+		/// <summary>
+		/// Retrieves a pointer to the next available packet of data in the capture endpoint buffer.
+		/// </summary>
+		/// <param name="dataPointer">Receives the starting address of a byte array containing the next data packet that is available for the client to read.</param>
+		/// <param name="frameCount">Receives the number of audio frames available in the data packet</param>
+		/// <param name="bufferStatus">Receives the buffer-status flags.</param>
+		/// <param name="devicePosition">Receives the device position of the first audio frame in the data packet.</param>
+		/// <param name="counterPosition">
+		/// Receives the value of the performance counter at the time that the audio endpoint
+		/// device recorded the device position of the first audio frame in the data packet.
+		/// </param>
+		/// <returns>An HRESULT code indicating whether the operation passed of failed.</returns>
+		[PreserveSig]
+		int GetBuffer(
+			[Out] [MarshalAs(UnmanagedType.SysInt)] out IntPtr dataPointer,
+			[Out] [MarshalAs(UnmanagedType.U4)] out UInt32 frameCount,
+			[Out] [MarshalAs(UnmanagedType.U4)] out AUDCLNT_BUFFERFLAGS bufferStatus,
+			[Out, Optional] [MarshalAs(UnmanagedType.U8)] out UInt64 devicePosition,
+			[Out, Optional] [MarshalAs(UnmanagedType.U8)] out UInt64 counterPosition);
+
+		/// <summary>
+		/// Releases a buffer.
+		/// </summary>
+		/// <param name="numFramesRead">The number of audio frames that the client read from the capture buffer.</param>
+		/// <returns>An HRESULT code indicating whether the operation passed of failed.</returns>
+		[PreserveSig]
+		int ReleaseBuffer(
+			[In] [MarshalAs(UnmanagedType.U4)] UInt32 numFramesRead);
+
+		/// <summary>
+		/// Retrieves the number of frames in the next data packet in the capture endpoint buffer.
+		/// </summary>
+		/// <param name="frameCount">Receives the number of audio frames in the next capture packet.</param>
+		/// <returns>An HRESULT code indicating whether the operation passed of failed.</returns>
+		[PreserveSig]
+		int GetNextPacketSize(
+			[Out] [MarshalAs(UnmanagedType.U4)] out UInt32 frameCount);
+    }
+}

+ 53 - 0
sourceCode/trunk/Code/CoreAudio/Interfaces/IAudioChannelConfig.cs

@@ -0,0 +1,53 @@
+// -----------------------------------------
+// SoundScribe (TM) and related software.
+// 
+// Copyright (C) 2007-2011 Vannatech
+// http://www.vannatech.com
+// All rights reserved.
+// 
+// This source code is subject to the MIT License.
+// http://www.opensource.org/licenses/mit-license.php
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+// -----------------------------------------
+
+using System;
+using System.Runtime.InteropServices;
+
+namespace Vannatech.CoreAudio.Interfaces
+{
+    /// <summary>
+	/// Provides access to a hardware channel-configuration control.
+    /// </summary>
+    /// <remarks>
+	/// MSDN Reference: http://msdn.microsoft.com/en-us/library/dd370862.aspx
+    /// </remarks>
+	public partial interface IAudioChannelConfig
+	{
+		/// <summary>
+		/// Sets the channel-configuration mask in a channel-configuration control.
+		/// </summary>
+		/// <param name="channelConfig">The new channel-configuration mask value.</param>
+		/// <param name="eventContext">A user context value that is passed to the notification callback.</param>
+		/// <returns>An HRESULT code indicating whether the operation passed of failed.</returns>
+		[PreserveSig]
+		int SetChannelConfig(
+			[In] [MarshalAs(UnmanagedType.U4)] UInt32 channelConfig, // TODO: get possible value from ksmedia.h
+			[In, Optional] [MarshalAs(UnmanagedType.LPStruct)] Guid eventContext);
+
+		/// <summary>
+		/// Gets the current channel-configuration mask from a channel-configuration control.
+		/// </summary>
+		/// <param name="channelConfig">Receives the current channel-configuration mask value.</param>
+		/// <returns>An HRESULT code indicating whether the operation passed of failed.</returns>
+		[PreserveSig]
+		int GetChannelConfig(
+			[Out] [MarshalAs(UnmanagedType.U4)] out UInt32 channelConfig); // TODO: get possible value from ksmedia.h
+	}
+}

+ 160 - 0
sourceCode/trunk/Code/CoreAudio/Interfaces/IAudioClient.cs

@@ -0,0 +1,160 @@
+// -----------------------------------------
+// SoundScribe (TM) and related software.
+// 
+// Copyright (C) 2007-2011 Vannatech
+// http://www.vannatech.com
+// All rights reserved.
+// 
+// This source code is subject to the MIT License.
+// http://www.opensource.org/licenses/mit-license.php
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+// -----------------------------------------
+
+using System;
+using System.Runtime.InteropServices;
+using Vannatech.CoreAudio.Externals;
+using Vannatech.CoreAudio.Enumerations;
+using Vannatech.CoreAudio.Constants;
+
+namespace Vannatech.CoreAudio.Interfaces
+{
+    /// <summary>
+	/// Enables a client to create and initialize an audio stream between an audio application and the
+	/// audio engine (for a shared-mode stream) or the hardware buffer (for an exclusive-mode stream).
+    /// </summary>
+    /// <remarks>
+	/// MSDN Reference: http://msdn.microsoft.com/en-us/library/dd370865.aspx
+    /// </remarks>
+	public partial interface IAudioClient
+    {
+		/// <summary>
+		/// Initializes the audio stream.
+		/// </summary>
+		/// <param name="shareMode">The sharing mode for the connection.</param>
+		/// <param name="streamFlags">One or more <see cref="AUDCLNT_STREAMFLAGS_XXX"/> flags to control creation of the stream.</param>
+		/// <param name="bufferDuration">The buffer capacity as a time value.</param>
+		/// <param name="devicePeriod">
+		/// In exclusive mode, this parameter specifies the requested scheduling period for successive
+		/// buffer accesses by the audio endpoint device. In shared mode, it should always be set to zero.
+		/// </param>
+		/// <param name="format">The format descriptor.</param>
+		/// <param name="audioSessionId">The ID of the audio session.</param>
+		/// <returns>An HRESULT code indicating whether the operation succeeded of failed.</returns>
+		[PreserveSig]
+		int Initialize(
+			[In] [MarshalAs(UnmanagedType.I4)] AUDCLNT_SHAREMODE shareMode,
+			[In] [MarshalAs(UnmanagedType.U4)] UInt32 streamFlags,
+			[In] [MarshalAs(UnmanagedType.U8)] UInt64 bufferDuration,
+			[In] [MarshalAs(UnmanagedType.U8)] UInt64 devicePeriod,
+            [In] [MarshalAs(UnmanagedType.SysInt)] IntPtr format, // TODO: Explore options for WAVEFORMATEX definition here
+			[In, Optional] [MarshalAs(UnmanagedType.LPStruct)] Guid audioSessionId);
+
+		/// <summary>
+		/// Retrieves the size (maximum capacity) of the audio buffer associated with the endpoint.
+		/// </summary>
+        /// <param name="size">Receives the number of audio frames that the buffer can hold.</param>
+		/// <returns>An HRESULT code indicating whether the operation succeeded of failed.</returns>
+		[PreserveSig]
+		int GetBufferSize(
+			[Out] [MarshalAs(UnmanagedType.U4)] out UInt32 size);
+
+		/// <summary>
+		/// Retrieves the maximum latency for the current stream and can be called any time after the stream has been initialized.
+		/// </summary>
+		/// <param name="latency">Receives a time value representing the latency.</param>
+		/// <returns>An HRESULT code indicating whether the operation succeeded of failed.</returns>
+		[PreserveSig]
+		int GetStreamLatency(
+            [Out] [MarshalAs(UnmanagedType.U8)] out UInt64 latency);
+
+		/// <summary>
+		/// Retrieves the number of frames of padding in the endpoint buffer.
+		/// </summary>
+		/// <param name="frameCount">Receives the number of audio frames of padding in the buffer.</param>
+		/// <returns>An HRESULT code indicating whether the operation succeeded of failed.</returns>
+		[PreserveSig]
+		int GetCurrentPadding(
+			[Out] [MarshalAs(UnmanagedType.U4)] out UInt32 frameCount);
+
+		/// <summary>
+		/// Indicates whether the audio endpoint device supports a particular stream format.
+		/// </summary>
+		/// <param name="shareMode">The sharing mode for the stream format.</param>
+		/// <param name="format">The specified stream format.</param>
+		/// <param name="closestMatch">The supported format that is closest to the format specified in the format parameter.</param>
+		/// <returns>An HRESULT code indicating whether the operation succeeded of failed.</returns>
+		[PreserveSig]
+		int IsFormatSupported(
+            [In] [MarshalAs(UnmanagedType.I4)] AUDCLNT_SHAREMODE shareMode,
+            [In] [MarshalAs(UnmanagedType.SysInt)] IntPtr format, // TODO: Explore options for WAVEFORMATEX definition here
+			[Out, Optional] out IntPtr closestMatch); // TODO: Sort out WAVEFORMATEX **match (returned)
+
+		/// <summary>
+		/// Retrieves the stream format that the audio engine uses for its internal processing of shared-mode streams.
+		/// </summary>
+        /// <param name="format">Receives the address of the mix format.</param>
+		/// <returns>An HRESULT code indicating whether the operation succeeded of failed.</returns>
+        [PreserveSig]
+        int GetMixFormat(
+            [Out] [MarshalAs(UnmanagedType.SysInt)] out IntPtr format); // TODO: Explore options for WAVEFORMATEX definition here
+
+		/// <summary>
+		/// Retrieves the length of the periodic interval separating successive processing passes by the audio engine on the data in the endpoint buffer.
+		/// </summary>
+		/// <param name="processInterval">Receives a time value specifying the default interval between processing passes by the audio engine.</param>
+		/// <param name="minimumInterval">Receives a time value specifying the minimum interval between processing passes by the audio endpoint device.</param>
+		/// <returns>An HRESULT code indicating whether the operation succeeded of failed.</returns>
+		[PreserveSig]
+		int GetDevicePeriod(
+            [Out, Optional] [MarshalAs(UnmanagedType.U8)] out UInt64 processInterval,
+            [Out, Optional] [MarshalAs(UnmanagedType.U8)] out UInt64 minimumInterval);
+
+		/// <summary>
+		/// Starts the audio stream.
+		/// </summary>
+		/// <returns>An HRESULT code indicating whether the operation succeeded of failed.</returns>
+		[PreserveSig]
+		int Start();
+
+		/// <summary>
+		/// Stops the audio stream.
+		/// </summary>
+		/// <returns>An HRESULT code indicating whether the operation succeeded of failed.</returns>
+		[PreserveSig]
+		int Stop();
+
+		/// <summary>
+		/// Resets the audio stream.
+		/// </summary>
+		/// <returns>An HRESULT code indicating whether the operation succeeded of failed.</returns>
+		[PreserveSig]
+		int Reset();
+
+		/// <summary>
+		/// Sets the event handle that the audio engine will signal each time a buffer becomes ready to be processed by the client.
+		/// </summary>
+		/// <param name="handle">The event handle.</param>
+		/// <returns>An HRESULT code indicating whether the operation succeeded of failed.</returns>
+		[PreserveSig]
+		int SetEventHandle(
+            [In] [MarshalAs(UnmanagedType.SysInt)] IntPtr handle);
+
+		/// <summary>
+		/// Accesses additional services from the audio client object.
+		/// </summary>
+		/// <param name="interfaceId">The interface ID for the requested service.</param>
+		/// <param name="instancePtr">Receives the address of an instance of the requested interface.</param>
+		/// <returns>An HRESULT code indicating whether the operation succeeded of failed.</returns>
+		[PreserveSig]
+		int GetService(
+			[In] [MarshalAs(UnmanagedType.LPStruct)] Guid interfaceId,
+			[Out] [MarshalAs(UnmanagedType.IUnknown)] out object instancePtr);
+    }
+}

+ 61 - 0
sourceCode/trunk/Code/CoreAudio/Interfaces/IAudioClock.cs

@@ -0,0 +1,61 @@
+// -----------------------------------------
+// SoundScribe (TM) and related software.
+// 
+// Copyright (C) 2007-2011 Vannatech
+// http://www.vannatech.com
+// All rights reserved.
+// 
+// This source code is subject to the MIT License.
+// http://www.opensource.org/licenses/mit-license.php
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+// -----------------------------------------
+using System;
+using System.Runtime.InteropServices;
+
+namespace Vannatech.CoreAudio.Interfaces
+{
+    /// <summary>
+	/// Enables a client to monitor a stream's data rate and the current position in the stream.
+    /// </summary>
+    /// <remarks>
+	/// MSDN Reference: http://msdn.microsoft.com/en-us/library/dd370881.aspx
+    /// </remarks>
+	public partial interface IAudioClock
+    {
+		/// <summary>
+		/// Gets the device frequency.
+		/// </summary>
+		/// <param name="frequency">Receives the device frequency.</param>
+		/// <returns>An HRESULT code indicating whether the operation succeeded of failed.</returns>
+		[PreserveSig]
+		int GetFrequency(
+			[Out] [MarshalAs(UnmanagedType.U8)] out UInt64 frequency);
+
+		/// <summary>
+		/// Gets the current position in the stream.
+		/// </summary>
+		/// <param name="devicePosition">Receives the device position.</param>
+		/// <param name="counterPosition">Receives the value of the performance counter at the time that the device read the position.</param>
+		/// <returns>An HRESULT code indicating whether the operation succeeded of failed.</returns>
+		[PreserveSig]
+		int GetPosition(
+			[Out] [MarshalAs(UnmanagedType.U8)] out UInt64 devicePosition,
+			[Out, Optional] [MarshalAs(UnmanagedType.U8)] out UInt64 counterPosition);
+
+		/// <summary>
+		/// Reserved for future use.
+		/// </summary>
+		/// <param name="characteristics">Receives a value that indicates the characteristics of the audio clock.</param>
+		/// <returns>An HRESULT code indicating whether the operation succeeded of failed.</returns>
+		[PreserveSig]
+		int GetCharacteristics(
+			[Out] [MarshalAs(UnmanagedType.U4)] out UInt32 characteristics);
+    }
+}

+ 44 - 0
sourceCode/trunk/Code/CoreAudio/Interfaces/IAudioClock2.cs

@@ -0,0 +1,44 @@
+// -----------------------------------------
+// SoundScribe (TM) and related software.
+// 
+// Copyright (C) 2007-2011 Vannatech
+// http://www.vannatech.com
+// All rights reserved.
+// 
+// This source code is subject to the MIT License.
+// http://www.opensource.org/licenses/mit-license.php
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+// -----------------------------------------
+
+using System;
+using System.Runtime.InteropServices;
+
+namespace Vannatech.CoreAudio.Interfaces
+{
+    /// <summary>
+	/// Used to get the current device position.
+    /// </summary>
+    /// <remarks>
+	/// MSDN Reference: http://msdn.microsoft.com/en-us/library/dd370882.aspx
+    /// </remarks>
+	public partial interface IAudioClock2
+    {
+		/// <summary>
+		/// Gets the current device position, in frames, directly from the hardware.
+		/// </summary>
+		/// <param name="devicePosition">Receives the device position, in frames.</param>
+		/// <param name="counterPosition">Receives the value of the performance counter at the time that the device read the position.</param>
+		/// <returns>An HRESULT code indicating whether the operation succeeded of failed.</returns>
+		[PreserveSig]
+		int GetDevicePosition(
+			[Out] [MarshalAs(UnmanagedType.U8)] out UInt64 devicePosition,
+			[Out, Optional] [MarshalAs(UnmanagedType.U8)] out UInt64 counterPosition);
+    }
+}

+ 42 - 0
sourceCode/trunk/Code/CoreAudio/Interfaces/IAudioClockAdjustment.cs

@@ -0,0 +1,42 @@
+// -----------------------------------------
+// SoundScribe (TM) and related software.
+// 
+// Copyright (C) 2007-2011 Vannatech
+// http://www.vannatech.com
+// All rights reserved.
+// 
+// This source code is subject to the MIT License.
+// http://www.opensource.org/licenses/mit-license.php
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+// -----------------------------------------
+
+using System;
+using System.Runtime.InteropServices;
+
+namespace Vannatech.CoreAudio.Interfaces
+{
+    /// <summary>
+	/// Used to adjust the sample rate of a stream.
+    /// </summary>
+    /// <remarks>
+	/// MSDN Reference: http://msdn.microsoft.com/en-us/library/dd370884.aspx
+    /// </remarks>
+	public partial interface IAudioClockAdjustment
+    {
+		/// <summary>
+		/// Sets the sample rate of a stream.
+		/// </summary>
+		/// <param name="sampleRate">The new sample rate in frames per second.</param>
+		/// <returns>An HRESULT code indicating whether the operation succeeded of failed.</returns>
+		[PreserveSig]
+		int SetSampleRate(
+			[In] [MarshalAs(UnmanagedType.R4)] float sampleRate);
+    }
+}

+ 221 - 0
sourceCode/trunk/Code/CoreAudio/Interfaces/IAudioEndpointVolume.cs

@@ -0,0 +1,221 @@
+// -----------------------------------------
+// SoundScribe (TM) and related software.
+// 
+// Copyright (C) 2007-2011 Vannatech
+// http://www.vannatech.com
+// All rights reserved.
+// 
+// This source code is subject to the MIT License.
+// http://www.opensource.org/licenses/mit-license.php
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+// -----------------------------------------
+
+using System;
+using System.Runtime.InteropServices;
+
+namespace Vannatech.CoreAudio.Interfaces
+{
+    /// <summary>
+    /// Represents the volume controls on the audio stream to or from an audio endpoint device.
+    /// </summary>
+    /// <remarks>
+    /// MSDN Reference: http://msdn.microsoft.com/en-us/library/dd370892.aspx
+    /// </remarks>
+    public partial interface IAudioEndpointVolume
+    {
+        // Note: Any changes to this interface should be repeated in IAudioEndpointVolumeEx.
+
+		/// <summary>
+		/// Registers a client's notification callback interface.
+		/// </summary>
+		/// <param name="client">The <see cref="IAudioEndpointVolumeCallback"/> interface that is registering for notification callbacks.</param>
+		/// <returns>An HRESULT code indicating whether the operation passed of failed.</returns>
+		[PreserveSig]
+		int RegisterControlChangeNotify(
+			[In] [MarshalAs(UnmanagedType.Interface)] IAudioEndpointVolumeCallback client);
+
+		/// <summary>
+		/// Deletes the registration of a client's notification callback interface.
+		/// </summary>
+        /// <param name="client">The <see cref="IAudioEndpointVolumeCallback"/> interface that previously registered for notification callbacks.</param>
+		/// <returns>An HRESULT code indicating whether the operation passed of failed.</returns>
+		[PreserveSig]
+		int UnregisterControlChangeNotify(
+            [In] [MarshalAs(UnmanagedType.Interface)] IAudioEndpointVolumeCallback client);
+
+        /// <summary>
+        /// Gets a count of the channels in the audio stream.
+        /// </summary>
+        /// <param name="channelCount">The number of channels.</param>
+        /// <returns>An HRESULT code indicating whether the operation passed of failed.</returns>
+        [PreserveSig]
+        int GetChannelCount(
+            [Out] [MarshalAs(UnmanagedType.U4)] out UInt32 channelCount);
+
+		/// <summary>
+		/// Sets the master volume level of the audio stream, in decibels.
+		/// </summary>
+		/// <param name="level">The new master volume level in decibels.</param>
+		/// <param name="eventContext">A user context value that is passed to the notification callback.</param>
+		/// <returns>An HRESULT code indicating whether the operation passed of failed.</returns>
+		[PreserveSig]
+		int SetMasterVolumeLevel(
+			[In] [MarshalAs(UnmanagedType.R4)] float level,
+            [In] [MarshalAs(UnmanagedType.LPStruct)] Guid eventContext);
+
+		/// <summary>
+		/// Sets the master volume level, expressed as a normalized, audio-tapered value.
+		/// </summary>
+		/// <param name="level">The new master volume level expressed as a normalized value between 0.0 and 1.0.</param>
+		/// <param name="eventContext">A user context value that is passed to the notification callback.</param>
+		/// <returns>An HRESULT code indicating whether the operation passed of failed.</returns>
+		[PreserveSig]
+		int SetMasterVolumeLevelScalar(
+			[In] [MarshalAs(UnmanagedType.R4)] float level,
+            [In] [MarshalAs(UnmanagedType.LPStruct)] Guid eventContext);
+
+		/// <summary>
+		/// Gets the master volume level of the audio stream, in decibels.
+		/// </summary>
+		/// <param name="level">The volume level in decibels.</param>
+		/// <returns>An HRESULT code indicating whether the operation passed of failed.</returns>
+		[PreserveSig]
+		int GetMasterVolumeLevel(
+			[Out] [MarshalAs(UnmanagedType.R4)] out float level);
+
+		/// <summary>
+		/// Gets the master volume level, expressed as a normalized, audio-tapered value.
+		/// </summary>
+		/// <param name="level">The volume level expressed as a normalized value between 0.0 and 1.0.</param>
+		/// <returns>An HRESULT code indicating whether the operation passed of failed.</returns>
+		[PreserveSig]
+		int GetMasterVolumeLevelScalar(
+			[Out] [MarshalAs(UnmanagedType.R4)] out float level);
+
+		/// <summary>
+		/// Sets the volume level, in decibels, of the specified channel of the audio stream.
+		/// </summary>
+		/// <param name="channelNumber">The channel number.</param>
+		/// <param name="level">The new volume level in decibels.</param>
+		/// <param name="eventContext">A user context value that is passed to the notification callback.</param>
+		/// <returns>An HRESULT code indicating whether the operation passed of failed.</returns>
+		[PreserveSig]
+		int SetChannelVolumeLevel(
+			[In] [MarshalAs(UnmanagedType.U4)] UInt32 channelNumber,
+			[In] [MarshalAs(UnmanagedType.R4)] float level,
+            [In] [MarshalAs(UnmanagedType.LPStruct)] Guid eventContext);
+
+		/// <summary>
+		/// Sets the normalized, audio-tapered volume level of the specified channel in the audio stream.
+		/// </summary>
+		/// <param name="channelNumber">The channel number.</param>
+		/// <param name="level">The new master volume level expressed as a normalized value between 0.0 and 1.0.</param>
+		/// <param name="eventContext">A user context value that is passed to the notification callback.</param>
+		/// <returns>An HRESULT code indicating whether the operation passed of failed.</returns>
+		[PreserveSig]
+		int SetChannelVolumeLevelScalar(
+            [In] [MarshalAs(UnmanagedType.U4)] UInt32 channelNumber,
+			[In] [MarshalAs(UnmanagedType.R4)] float level,
+            [In] [MarshalAs(UnmanagedType.LPStruct)] Guid eventContext);
+
+        /// <summary>
+        /// Gets the volume level, in decibels, of the specified channel in the audio stream.
+        /// </summary>
+        /// <param name="channelNumber">The zero-based channel number.</param>
+		/// <param name="level">The volume level in decibels.</param>
+        /// <returns>An HRESULT code indicating whether the operation passed of failed.</returns>
+        [PreserveSig]
+        int GetChannelVolumeLevel(
+            [In] [MarshalAs(UnmanagedType.U4)] UInt32 channelNumber,
+			[Out] [MarshalAs(UnmanagedType.R4)] out float level);
+
+        /// <summary>
+        /// Gets the normalized, audio-tapered volume level of the specified channel of the audio stream.
+        /// </summary>
+        /// <param name="channelNumber">The zero-based channel number.</param>
+		/// <param name="level">The volume level expressed as a normalized value between 0.0 and 1.0.</param>
+        /// <returns>An HRESULT code indicating whether the operation passed of failed.</returns>
+        [PreserveSig]
+        int GetChannelVolumeLevelScalar(
+            [In] [MarshalAs(UnmanagedType.U4)] UInt32 channelNumber,
+			[Out] [MarshalAs(UnmanagedType.R4)] out float level);
+
+		/// <summary>
+		/// Sets the muting state of the audio stream.
+		/// </summary>
+		/// <param name="isMuted">True to mute the stream, or false to unmute the stream.</param>
+		/// <param name="eventContext">A user context value that is passed to the notification callback.</param>
+		/// <returns>An HRESULT code indicating whether the operation passed of failed.</returns>
+		[PreserveSig]
+		int SetMute(
+			[In] [MarshalAs(UnmanagedType.Bool)] Boolean isMuted,
+            [In] [MarshalAs(UnmanagedType.LPStruct)] Guid eventContext);
+
+        /// <summary>
+        /// Gets the muting state of the audio stream.
+        /// </summary>
+        /// <param name="isMuted">The muting state. True if the stream is muted, false otherwise.</param>
+        /// <returns>An HRESULT code indicating whether the operation passed of failed.</returns>
+        [PreserveSig]
+        int GetMute(
+			[Out] [MarshalAs(UnmanagedType.Bool)] out Boolean isMuted);
+
+		/// <summary>
+		/// Gets information about the current step in the volume range.
+		/// </summary>
+		/// <param name="step">The current zero-based step index.</param>
+		/// <param name="stepCount">The total number of steps in the volume range.</param>
+		/// <returns>An HRESULT code indicating whether the operation passed of failed.</returns>
+		[PreserveSig]
+		int GetVolumeStepInfo(
+            [Out] [MarshalAs(UnmanagedType.U4)] out UInt32 step,
+            [Out] [MarshalAs(UnmanagedType.U4)] out UInt32 stepCount);
+
+		/// <summary>
+		/// Increases the volume level by one step.
+		/// </summary>
+		/// <param name="eventContext">A user context value that is passed to the notification callback.</param>
+		/// <returns>An HRESULT code indicating whether the operation passed of failed.</returns>
+		[PreserveSig]
+		int VolumeStepUp(
+            [In] [MarshalAs(UnmanagedType.LPStruct)] Guid eventContext);
+
+		/// <summary>
+		/// Decreases the volume level by one step.
+		/// </summary>
+		/// <param name="eventContext">A user context value that is passed to the notification callback.</param>
+		/// <returns>An HRESULT code indicating whether the operation passed of failed.</returns>
+		[PreserveSig]
+		int VolumeStepDown(
+            [In] [MarshalAs(UnmanagedType.LPStruct)] Guid eventContext);
+
+		/// <summary>
+		/// Queries the audio endpoint device for its hardware-supported functions.
+		/// </summary>
+		/// <param name="hardwareSupportMask">A hardware support mask that indicates the capabilities of the endpoint.</param>
+		/// <returns>An HRESULT code indicating whether the operation passed of failed.</returns>
+		[PreserveSig]
+		int QueryHardwareSupport(
+			[Out] [MarshalAs(UnmanagedType.U4)] out UInt32 hardwareSupportMask);
+
+        /// <summary>
+        /// Gets the volume range of the audio stream, in decibels.
+        /// </summary>
+		/// <param name="volumeMin">The minimum volume level in decibels.</param>
+		/// <param name="volumeMax">The maximum volume level in decibels.</param>
+		/// <param name="volumeStep">The volume increment level in decibels.</param>
+        /// <returns>An HRESULT code indicating whether the operation passed of failed.</returns>
+        [PreserveSig]
+        int GetVolumeRange(
+            [Out] [MarshalAs(UnmanagedType.R4)] out float volumeMin,
+			[Out] [MarshalAs(UnmanagedType.R4)] out float volumeMax,
+			[Out] [MarshalAs(UnmanagedType.R4)] out float volumeStep);
+    }
+}

+ 43 - 0
sourceCode/trunk/Code/CoreAudio/Interfaces/IAudioEndpointVolumeCallback.cs

@@ -0,0 +1,43 @@
+// -----------------------------------------
+// SoundScribe (TM) and related software.
+// 
+// Copyright (C) 2007-2011 Vannatech
+// http://www.vannatech.com
+// All rights reserved.
+// 
+// This source code is subject to the MIT License.
+// http://www.opensource.org/licenses/mit-license.php
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+// -----------------------------------------
+
+using System;
+using System.Runtime.InteropServices;
+using Vannatech.CoreAudio.Structures;
+
+namespace Vannatech.CoreAudio.Interfaces
+{
+    /// <summary>
+    /// Provides notifications when the volume level or muting state of an audio endpoint device changes.
+    /// </summary>
+    /// <remarks>
+    /// MSDN Reference: http://msdn.microsoft.com/en-us/library/dd370894.aspx
+    /// </remarks>
+    public partial interface IAudioEndpointVolumeCallback
+    {
+        /// <summary>
+        /// Notifies the client that the volume level or muting state of the audio endpoint device has changed.
+        /// </summary>
+        /// <param name="notificationData">The volume-notification data.</param>
+        /// <returns>An HRESULT code indicating whether the operation passed of failed.</returns>
+        [PreserveSig]
+        int OnNotify(
+            [In] IntPtr notificationData);
+    }
+}

+ 240 - 0
sourceCode/trunk/Code/CoreAudio/Interfaces/IAudioEndpointVolumeEx.cs

@@ -0,0 +1,240 @@
+// -----------------------------------------
+// SoundScribe (TM) and related software.
+// 
+// Copyright (C) 2007-2011 Vannatech
+// http://www.vannatech.com
+// All rights reserved.
+// 
+// This source code is subject to the MIT License.
+// http://www.opensource.org/licenses/mit-license.php
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+// -----------------------------------------
+
+using System;
+using System.Runtime.InteropServices;
+
+namespace Vannatech.CoreAudio.Interfaces
+{
+    /// <summary>
+    /// Provides volume controls on the audio stream to or from a device endpoint.
+    /// </summary>
+    /// <remarks>
+    /// MSDN Reference: http://msdn.microsoft.com/en-us/library/dd370899.aspx
+    /// </remarks>
+    public partial interface IAudioEndpointVolumeEx
+    {
+        // Note: We can't derive from IAudioEndpointVolume, as that will produce the wrong vtable.
+
+        #region IAudioEndpointVolume Methods
+
+        /// <summary>
+        /// Registers a client's notification callback interface.
+        /// </summary>
+        /// <param name="client">The <see cref="IAudioEndpointVolumeCallback"/> interface that is registering for notification callbacks.</param>
+        /// <returns>An HRESULT code indicating whether the operation passed of failed.</returns>
+        [PreserveSig]
+        int RegisterControlChangeNotify(
+            [In] IAudioEndpointVolumeCallback client);
+
+        /// <summary>
+        /// Deletes the registration of a client's notification callback interface.
+        /// </summary>
+        /// <param name="clientCallback">The <see cref="IAudioEndpointVolumeCallback"/> interface that previously registered for notification callbacks.</param>
+        /// <returns>An HRESULT code indicating whether the operation passed of failed.</returns>
+        [PreserveSig]
+        int UnregisterControlChangeNotify(
+            [In] IAudioEndpointVolumeCallback clientCallback);
+
+        /// <summary>
+        /// Gets a count of the channels in the audio stream.
+        /// </summary>
+        /// <param name="channelCount">The number of channels.</param>
+        /// <returns>An HRESULT code indicating whether the operation passed of failed.</returns>
+        [PreserveSig]
+        int GetChannelCount(
+            [Out] [MarshalAs(UnmanagedType.U4)] out UInt32 channelCount);
+
+        /// <summary>
+        /// Sets the master volume level of the audio stream, in decibels.
+        /// </summary>
+        /// <param name="level">The new master volume level in decibels.</param>
+        /// <param name="eventContext">A user context value that is passed to the notification callback.</param>
+        /// <returns>An HRESULT code indicating whether the operation passed of failed.</returns>
+        [PreserveSig]
+        int SetMasterVolumeLevel(
+            [In] [MarshalAs(UnmanagedType.R4)] float level,
+            [In] ref Guid eventContext);
+
+        /// <summary>
+        /// Sets the master volume level, expressed as a normalized, audio-tapered value.
+        /// </summary>
+        /// <param name="level">The new master volume level expressed as a normalized value between 0.0 and 1.0.</param>
+        /// <param name="eventContext">A user context value that is passed to the notification callback.</param>
+        /// <returns>An HRESULT code indicating whether the operation passed of failed.</returns>
+        [PreserveSig]
+        int SetMasterVolumeLevelScalar(
+            [In] [MarshalAs(UnmanagedType.R4)] float level,
+            [In] ref Guid eventContext);
+
+        /// <summary>
+        /// Gets the master volume level of the audio stream, in decibels.
+        /// </summary>
+        /// <param name="level">The volume level in decibels.</param>
+        /// <returns>An HRESULT code indicating whether the operation passed of failed.</returns>
+        [PreserveSig]
+        int GetMasterVolumeLevel(
+            [Out] [MarshalAs(UnmanagedType.R4)] out float level);
+
+        /// <summary>
+        /// Gets the master volume level, expressed as a normalized, audio-tapered value.
+        /// </summary>
+        /// <param name="level">The volume level expressed as a normalized value between 0.0 and 1.0.</param>
+        /// <returns>An HRESULT code indicating whether the operation passed of failed.</returns>
+        [PreserveSig]
+        int GetMasterVolumeLevelScalar(
+            [Out] [MarshalAs(UnmanagedType.R4)] out float level);
+
+        /// <summary>
+        /// Sets the volume level, in decibels, of the specified channel of the audio stream.
+        /// </summary>
+        /// <param name="channelNumber">The channel number.</param>
+        /// <param name="level">The new volume level in decibels.</param>
+        /// <param name="eventContext">A user context value that is passed to the notification callback.</param>
+        /// <returns>An HRESULT code indicating whether the operation passed of failed.</returns>
+        [PreserveSig]
+        int SetChannelVolumeLevel(
+            [In] [MarshalAs(UnmanagedType.SysUInt)] UIntPtr channelNumber,
+            [In] [MarshalAs(UnmanagedType.R4)] float level,
+            [In] ref Guid eventContext);
+
+        /// <summary>
+        /// Sets the normalized, audio-tapered volume level of the specified channel in the audio stream.
+        /// </summary>
+        /// <param name="channelNumber">The channel number.</param>
+        /// <param name="level">The new master volume level expressed as a normalized value between 0.0 and 1.0.</param>
+        /// <param name="eventContext">A user context value that is passed to the notification callback.</param>
+        /// <returns>An HRESULT code indicating whether the operation passed of failed.</returns>
+        [PreserveSig]
+        int SetChannelVolumeLevelScalar(
+            [In] [MarshalAs(UnmanagedType.SysUInt)] UIntPtr channelNumber,
+            [In] [MarshalAs(UnmanagedType.R4)] float level,
+            [In] ref Guid eventContext);
+
+        /// <summary>
+        /// Gets the volume level, in decibels, of the specified channel in the audio stream.
+        /// </summary>
+        /// <param name="channelNumber">The zero-based channel number.</param>
+        /// <param name="level">The volume level in decibels.</param>
+        /// <returns>An HRESULT code indicating whether the operation passed of failed.</returns>
+        [PreserveSig]
+        int GetChannelVolumeLevel(
+            [In] [MarshalAs(UnmanagedType.SysUInt)] UIntPtr channelNumber,
+            [Out] [MarshalAs(UnmanagedType.R4)] out float level);
+
+        /// <summary>
+        /// Gets the normalized, audio-tapered volume level of the specified channel of the audio stream.
+        /// </summary>
+        /// <param name="channelNumber">The zero-based channel number.</param>
+        /// <param name="level">The volume level expressed as a normalized value between 0.0 and 1.0.</param>
+        /// <returns>An HRESULT code indicating whether the operation passed of failed.</returns>
+        [PreserveSig]
+        int GetChannelVolumeLevelScalar(
+            [In] [MarshalAs(UnmanagedType.SysUInt)] UIntPtr channelNumber,
+            [Out] [MarshalAs(UnmanagedType.R4)] out float level);
+
+        /// <summary>
+        /// Sets the muting state of the audio stream.
+        /// </summary>
+        /// <param name="isMuted">True to mute the stream, or false to unmute the stream.</param>
+        /// <param name="eventContext">A user context value that is passed to the notification callback.</param>
+        /// <returns>An HRESULT code indicating whether the operation passed of failed.</returns>
+        [PreserveSig]
+        int SetMute(
+            [In] [MarshalAs(UnmanagedType.Bool)] Boolean isMuted,
+            [In] ref Guid eventContext);
+
+        /// <summary>
+        /// Gets the muting state of the audio stream.
+        /// </summary>
+        /// <param name="isMuted">The muting state. True if the stream is muted, false otherwise.</param>
+        /// <returns>An HRESULT code indicating whether the operation passed of failed.</returns>
+        [PreserveSig]
+        int GetMute(
+            [Out] [MarshalAs(UnmanagedType.Bool)] out Boolean isMuted);
+
+        /// <summary>
+        /// Gets information about the current step in the volume range.
+        /// </summary>
+        /// <param name="step">The current zero-based step index.</param>
+        /// <param name="stepCount">The total number of steps in the volume range.</param>
+        /// <returns>An HRESULT code indicating whether the operation passed of failed.</returns>
+        [PreserveSig]
+        int GetVolumeStepInfo(
+            [Out] [MarshalAs(UnmanagedType.SysUInt)] out UIntPtr step,
+            [Out] [MarshalAs(UnmanagedType.SysUInt)] out UIntPtr stepCount);
+
+        /// <summary>
+        /// Increases the volume level by one step.
+        /// </summary>
+        /// <param name="eventContext">A user context value that is passed to the notification callback.</param>
+        /// <returns>An HRESULT code indicating whether the operation passed of failed.</returns>
+        [PreserveSig]
+        int VolumeStepUp(
+            [In] ref Guid eventContext);
+
+        /// <summary>
+        /// Decreases the volume level by one step.
+        /// </summary>
+        /// <param name="eventContext">A user context value that is passed to the notification callback.</param>
+        /// <returns>An HRESULT code indicating whether the operation passed of failed.</returns>
+        [PreserveSig]
+        int VolumeStepDown(
+            [In] ref Guid eventContext);
+
+        /// <summary>
+        /// Queries the audio endpoint device for its hardware-supported functions.
+        /// </summary>
+        /// <param name="hardwareSupportMask">A hardware support mask that indicates the capabilities of the endpoint.</param>
+        /// <returns>An HRESULT code indicating whether the operation passed of failed.</returns>
+        [PreserveSig]
+        int QueryHardwareSupport(
+            [Out] [MarshalAs(UnmanagedType.U4)] out UInt32 hardwareSupportMask);
+
+        /// <summary>
+        /// Gets the volume range of the audio stream, in decibels.
+        /// </summary>
+        /// <param name="volumeMin">The minimum volume level in decibels.</param>
+        /// <param name="volumeMax">The maximum volume level in decibels.</param>
+        /// <param name="volumeStep">The volume increment level in decibels.</param>
+        /// <returns>An HRESULT code indicating whether the operation passed of failed.</returns>
+        [PreserveSig]
+        int GetVolumeRange(
+            [Out] [MarshalAs(UnmanagedType.R4)] out float volumeMin,
+            [Out] [MarshalAs(UnmanagedType.R4)] out float volumeMax,
+            [Out] [MarshalAs(UnmanagedType.R4)] out float volumeStep);
+
+        #endregion
+
+        /// <summary>
+        /// Gets the volume range for a specified channel.
+        /// </summary>
+        /// <param name="channelNumber">The channel number for which to get the volume range.</param>
+		/// <param name="volumeMin">The minimum volume level for the channel, in decibels.</param>
+		/// <param name="volumeMax">The maximum volume level for the channel, in decibels.</param>
+		/// <param name="volumeStep">The volume increment for the channel, in decibels.</param>
+        /// <returns>An HRESULT code indicating whether the operation passed of failed.</returns>
+        [PreserveSig]
+        int GetVolumeRangeChannel(
+            [In] [MarshalAs(UnmanagedType.U4)] UInt32 channelNumber,
+            [Out] [MarshalAs(UnmanagedType.R4)] out float volumeMin,
+			[Out] [MarshalAs(UnmanagedType.R4)] out float volumeMax,
+			[Out] [MarshalAs(UnmanagedType.R4)] out float volumeStep);
+    }
+}

+ 53 - 0
sourceCode/trunk/Code/CoreAudio/Interfaces/IAudioInputSelector.cs

@@ -0,0 +1,53 @@
+// -----------------------------------------
+// SoundScribe (TM) and related software.
+// 
+// Copyright (C) 2007-2011 Vannatech
+// http://www.vannatech.com
+// All rights reserved.
+// 
+// This source code is subject to the MIT License.
+// http://www.opensource.org/licenses/mit-license.php
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+// -----------------------------------------
+
+using System;
+using System.Runtime.InteropServices;
+
+namespace Vannatech.CoreAudio.Interfaces
+{
+    /// <summary>
+	/// Provides access to a hardware multiplexer control (input selector).
+    /// </summary>
+    /// <remarks>
+	/// MSDN Reference: http://msdn.microsoft.com/en-us/library/dd368220.aspx
+    /// </remarks>
+	public partial interface IAudioInputSelector
+    {
+		/// <summary>
+		/// Gets the local ID of the part that is connected to the selector input that is currently selected.
+		/// </summary>
+		/// <param name="partId">Receives the local ID of the part that directly links to the currently selected selector input.</param>
+		/// <returns>An HRESULT code indicating whether the operation succeeded of failed.</returns>
+		[PreserveSig]
+		int GetSelection(
+			[Out] [MarshalAs(UnmanagedType.U4)] out UInt32 partId);
+
+		/// <summary>
+		/// Selects one of the inputs of the input selector.
+		/// </summary>
+		/// <param name="partId">The ID of the new selector input.</param>
+		/// <param name="eventContext">A user context value that is passed to the notification callback.</param>
+		/// <returns>An HRESULT code indicating whether the operation succeeded of failed.</returns>
+		[PreserveSig]
+		int SetSelection(
+			[In] [MarshalAs(UnmanagedType.U4)] UInt32 partId,
+			[In, Optional] [MarshalAs(UnmanagedType.LPStruct)] Guid eventContext);
+    }
+}

+ 53 - 0
sourceCode/trunk/Code/CoreAudio/Interfaces/IAudioLoudness.cs

@@ -0,0 +1,53 @@
+// -----------------------------------------
+// SoundScribe (TM) and related software.
+// 
+// Copyright (C) 2007-2011 Vannatech
+// http://www.vannatech.com
+// All rights reserved.
+// 
+// This source code is subject to the MIT License.
+// http://www.opensource.org/licenses/mit-license.php
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+// -----------------------------------------
+
+using System;
+using System.Runtime.InteropServices;
+
+namespace Vannatech.CoreAudio.Interfaces
+{
+    /// <summary>
+	/// Provides access to a loudness compensation control.
+    /// </summary>
+    /// <remarks>
+	/// MSDN Reference: http://msdn.microsoft.com/en-us/library/dd368224.aspx
+    /// </remarks>
+	public partial interface IAudioLoudness
+    {
+		/// <summary>
+		/// Gets the current state (enabled or disabled) of the loudness control.
+		/// </summary>
+		/// <param name="isEnabled">Receives the current loudness state.</param>
+		/// <returns>An HRESULT code indicating whether the operation succeeded of failed.</returns>
+		[PreserveSig]
+		int GetEnabled(
+			[Out] [MarshalAs(UnmanagedType.Bool)] out bool isEnabled);
+
+		/// <summary>
+		/// Enables or disables the loudness control.
+		/// </summary>
+		/// <param name="isEnabled">Sets the new loudness state.</param>
+		/// <param name="eventContext">A user context value that is passed to the notification callback.</param>
+		/// <returns>An HRESULT code indicating whether the operation succeeded of failed.</returns>
+		[PreserveSig]
+		int SetEnabled(
+			[In] [MarshalAs(UnmanagedType.Bool)] bool isEnabled,
+			[In, Optional] [MarshalAs(UnmanagedType.LPStruct)] Guid eventContext);
+    }
+}

+ 71 - 0
sourceCode/trunk/Code/CoreAudio/Interfaces/IAudioMeterInformation.cs

@@ -0,0 +1,71 @@
+// -----------------------------------------
+// SoundScribe (TM) and related software.
+// 
+// Copyright (C) 2007-2011 Vannatech
+// http://www.vannatech.com
+// All rights reserved.
+// 
+// This source code is subject to the MIT License.
+// http://www.opensource.org/licenses/mit-license.php
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+// -----------------------------------------
+
+using System;
+using System.Runtime.InteropServices;
+
+namespace Vannatech.CoreAudio.Interfaces
+{
+    /// <summary>
+    /// Represents a peak meter on the audio stream to or from an audio endpoint device.
+    /// </summary>
+    /// <remarks>
+    /// MSDN Reference: http://msdn.microsoft.com/en-us/library/dd368227.aspx
+    /// </remarks>
+    public partial interface IAudioMeterInformation
+    {
+		/// <summary>
+		/// Gets the peak sample value for the channels in the audio stream.
+		/// </summary>
+		/// <param name="peak">The peak sample value for the audio stream.</param>
+		/// <returns>An HRESULT code indicating whether the operation passed of failed.</returns>
+		[PreserveSig]
+		int GetPeakValue(
+			[Out] [MarshalAs(UnmanagedType.R4)] out float peak);
+
+		/// <summary>
+		/// Gets the number of channels in the audio stream that are monitored by peak meters.
+		/// </summary>
+		/// <param name="channelCount">The channel count.</param>
+		/// <returns>An HRESULT code indicating whether the operation passed of failed.</returns>
+		[PreserveSig]
+		int GetMeteringChannelCount(
+			[Out] [MarshalAs(UnmanagedType.U4)] out UInt32 channelCount);
+
+        /// <summary>
+        /// Gets the peak sample values for all the channels in the audio stream.
+        /// </summary>
+        /// <param name="channelCount">The channel count.</param>
+        /// <param name="peakValues">An array of peak sample values.</param>
+        /// <returns>An HRESULT code indicating whether the operation passed of failed.</returns>
+        [PreserveSig]
+        int GetChannelsPeakValues(
+            [In] [MarshalAs(UnmanagedType.U4)] UInt32 channelCount,
+            [In, Out] [MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.R4)] float[] peakValues);
+
+        /// <summary>
+        /// Queries the audio endpoint device for its hardware-supported functions.
+        /// </summary>
+        /// <param name="hardwareSupportMask">A hardware support mask that indicates the capabilities of the endpoint.</param>
+        /// <returns>An HRESULT code indicating whether the operation passed of failed.</returns>
+        [PreserveSig]
+        int QueryHardwareSupport(
+			[Out] [MarshalAs(UnmanagedType.U4)] out UInt32 hardwareSupportMask);
+    }
+}

+ 36 - 0
sourceCode/trunk/Code/CoreAudio/Interfaces/IAudioMidrange.cs

@@ -0,0 +1,36 @@
+// -----------------------------------------
+// SoundScribe (TM) and related software.
+// 
+// Copyright (C) 2007-2011 Vannatech
+// http://www.vannatech.com
+// All rights reserved.
+// 
+// This source code is subject to the MIT License.
+// http://www.opensource.org/licenses/mit-license.php
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+// -----------------------------------------
+
+using System;
+using System.Runtime.InteropServices;
+
+namespace Vannatech.CoreAudio.Interfaces
+{
+    /// <summary>
+	/// Provides access to a hardware midrange-level control.
+    /// </summary>
+    /// <remarks>
+	/// MSDN Reference: http://msdn.microsoft.com/en-us/library/dd368232.aspx
+    /// </remarks>
+	public partial interface IAudioMidrange : IPerChannelDbLevel
+    {
+		// The IAudioMidrange interface inherits from IPerChannelDbLevel but does not define additional methods or properties.
+		// Note: Although, derived classes normally do not work for COM interfaces, it does when no additional methods are defined in the subclass.
+    }
+}

+ 53 - 0
sourceCode/trunk/Code/CoreAudio/Interfaces/IAudioMute.cs

@@ -0,0 +1,53 @@
+// -----------------------------------------
+// SoundScribe (TM) and related software.
+// 
+// Copyright (C) 2007-2011 Vannatech
+// http://www.vannatech.com
+// All rights reserved.
+// 
+// This source code is subject to the MIT License.
+// http://www.opensource.org/licenses/mit-license.php
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+// -----------------------------------------
+
+using System;
+using System.Runtime.InteropServices;
+
+namespace Vannatech.CoreAudio.Interfaces
+{
+    /// <summary>
+	/// Provides access to a hardware mute control.
+    /// </summary>
+    /// <remarks>
+	/// MSDN Reference: http://msdn.microsoft.com/en-us/library/dd368233.aspx
+    /// </remarks>
+	public partial interface IAudioMute
+    {
+        /// <summary>
+        /// Enables or disables the mute control.
+        /// </summary>
+        /// <param name="isMuted">The new state of the mute control.</param>
+        /// <param name="eventContext">A user context value that is passed to the notification callback.</param>
+        /// <returns>An HRESULT code indicating whether the operation succeeded of failed.</returns>
+        [PreserveSig]
+        int SetMute(
+            [In] [MarshalAs(UnmanagedType.Bool)] bool isMuted,
+            [In, Optional] [MarshalAs(UnmanagedType.LPStruct)] Guid eventContext);
+
+		/// <summary>
+		/// Gets the current state (enabled or disabled) of the mute control.
+		/// </summary>
+		/// <param name="isMuted">Receives the current state of the mute control.</param>
+		/// <returns>An HRESULT code indicating whether the operation succeeded of failed.</returns>
+		[PreserveSig]
+		int GetMute(
+			[Out] [MarshalAs(UnmanagedType.Bool)] out bool isMuted);
+    }
+}

+ 53 - 0
sourceCode/trunk/Code/CoreAudio/Interfaces/IAudioOutputSelector.cs

@@ -0,0 +1,53 @@
+// -----------------------------------------
+// SoundScribe (TM) and related software.
+// 
+// Copyright (C) 2007-2011 Vannatech
+// http://www.vannatech.com
+// All rights reserved.
+// 
+// This source code is subject to the MIT License.
+// http://www.opensource.org/licenses/mit-license.php
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+// -----------------------------------------
+
+using System;
+using System.Runtime.InteropServices;
+
+namespace Vannatech.CoreAudio.Interfaces
+{
+    /// <summary>
+	/// Provides access to a hardware demultiplexer control (output selector).
+    /// </summary>
+    /// <remarks>
+	/// MSDN Reference: http://msdn.microsoft.com/en-us/library/dd368236.aspx
+    /// </remarks>
+	public partial interface IAudioOutputSelector
+    {
+		/// <summary>
+		/// Gets the local ID of the part that is connected to the selector output that is currently selected.
+		/// </summary>
+		/// <param name="partId">Receives the local ID of the part that has a direct link to the currently selected output.</param>
+		/// <returns>An HRESULT code indicating whether the operation succeeded of failed.</returns>
+		[PreserveSig]
+		int GetSelection(
+			[Out] [MarshalAs(UnmanagedType.U4)] out UInt32 partId);
+
+		/// <summary>
+		/// Selects one of the outputs of the output selector.
+		/// </summary>
+		/// <param name="partId">The ID of the new selector output.</param>
+		/// <param name="eventContext">A user context value that is passed to the notification callback.</param>
+		/// <returns>An HRESULT code indicating whether the operation succeeded of failed.</returns>
+		[PreserveSig]
+		int SetSelection(
+			[In] [MarshalAs(UnmanagedType.U4)] UInt32 partId,
+			[In, Optional] [MarshalAs(UnmanagedType.LPStruct)] Guid eventContext);
+    }
+}

+ 53 - 0
sourceCode/trunk/Code/CoreAudio/Interfaces/IAudioPeakMeter.cs

@@ -0,0 +1,53 @@
+// -----------------------------------------
+// SoundScribe (TM) and related software.
+// 
+// Copyright (C) 2007-2011 Vannatech
+// http://www.vannatech.com
+// All rights reserved.
+// 
+// This source code is subject to the MIT License.
+// http://www.opensource.org/licenses/mit-license.php
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+// -----------------------------------------
+
+using System;
+using System.Runtime.InteropServices;
+
+namespace Vannatech.CoreAudio.Interfaces
+{
+    /// <summary>
+	/// Provides access to a hardware peak-meter control.
+    /// </summary>
+    /// <remarks>
+	/// MSDN Reference: http://msdn.microsoft.com/en-us/library/dd368239.aspx
+    /// </remarks>
+	public partial interface IAudioPeakMeter
+    {
+		/// <summary>
+		/// Gets the number of channels in the audio stream.
+		/// </summary>
+		/// <param name="count">Receives the channel count.</param>
+		/// <returns>An HRESULT code indicating whether the operation succeeded of failed.</returns>
+		[PreserveSig]
+		int GetChannelCount(
+			[Out] [MarshalAs(UnmanagedType.U4)] out UInt32 count);
+
+		/// <summary>
+		/// Gets the peak level that the peak meter recorded for the specified channel since the peak level for that channel was previously read.
+		/// </summary>
+		/// <param name="index">The zero-based channel index.</param>
+		/// <param name="level">Receives the peak meter level in decibels.</param>
+		/// <returns>An HRESULT code indicating whether the operation succeeded of failed.</returns>
+		[PreserveSig]
+		int GetLevel(
+			[In] [MarshalAs(UnmanagedType.U4)] UInt32 index,
+			[Out] [MarshalAs(UnmanagedType.R4)] out float level);
+    }
+}

+ 56 - 0
sourceCode/trunk/Code/CoreAudio/Interfaces/IAudioRenderClient.cs

@@ -0,0 +1,56 @@
+// -----------------------------------------
+// SoundScribe (TM) and related software.
+// 
+// Copyright (C) 2007-2011 Vannatech
+// http://www.vannatech.com
+// All rights reserved.
+// 
+// This source code is subject to the MIT License.
+// http://www.opensource.org/licenses/mit-license.php
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+// -----------------------------------------
+
+using System;
+using System.Runtime.InteropServices;
+using Vannatech.CoreAudio.Enumerations;
+
+namespace Vannatech.CoreAudio.Interfaces
+{
+    /// <summary>
+	/// Enables a client to write output data to a rendering endpoint buffer.
+    /// </summary>
+    /// <remarks>
+	/// MSDN Reference: http://msdn.microsoft.com/en-us/library/dd368242.aspx
+    /// </remarks>
+	public partial interface IAudioRenderClient
+    {
+		/// <summary>
+		/// Retrieves a pointer to the next available space in the rendering endpoint buffer.
+		/// </summary>
+		/// <param name="frameCount">The number of audio frames in the data packet that the caller plans to write to the requested space in the buffer.</param>
+		/// <param name="dataPointer">Receives the starting address of the buffer area into which the caller will write the data packet.</param>
+		/// <returns>An HRESULT code indicating whether the operation succeeded of failed.</returns>
+		[PreserveSig]
+		int GetBuffer(
+			[In] [MarshalAs(UnmanagedType.U4)] UInt32 frameCount,
+			[Out] [MarshalAs(UnmanagedType.SysInt)] out IntPtr dataPointer);
+
+		/// <summary>
+		/// Releases the buffer space acquired in the previous call to the <see cref="IAudioRenderClient.GetBuffer"/> method.
+		/// </summary>
+		/// <param name="frameCount">The number of audio frames written by the client to the data packet.</param>
+		/// <param name="bufferFlag">The buffer-configuration flags. This should be either zero or <see cref="AUDCLNT_BUFFERFLAGS.AUDCLNT_BUFFERFLAGS_SILENT"/></param>
+		/// <returns>An HRESULT code indicating whether the operation succeeded of failed.</returns>
+		[PreserveSig]
+		int ReleaseBuffer(
+			[In] [MarshalAs(UnmanagedType.U4)] UInt32 frameCount,
+			[In] [MarshalAs(UnmanagedType.U4)] UInt32 bufferFlag);
+    }
+}

+ 143 - 0
sourceCode/trunk/Code/CoreAudio/Interfaces/IAudioSessionControl.cs

@@ -0,0 +1,143 @@
+// -----------------------------------------
+// SoundScribe (TM) and related software.
+// 
+// Copyright (C) 2007-2011 Vannatech
+// http://www.vannatech.com
+// All rights reserved.
+// 
+// This source code is subject to the MIT License.
+// http://www.opensource.org/licenses/mit-license.php
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+// -----------------------------------------
+
+using System;
+using System.Runtime.InteropServices;
+using Vannatech.CoreAudio.Enumerations;
+
+namespace Vannatech.CoreAudio.Interfaces
+{
+    /// <summary>
+	/// Enables a client to configure the control parameters for an audio session and to monitor events in the session.
+    /// </summary>
+    /// <remarks>
+	/// MSDN Reference: http://msdn.microsoft.com/en-us/library/dd368246.aspx
+    /// </remarks>
+	public partial interface IAudioSessionControl
+    {
+        // Note: Any changes to this interface should be repeated in IAudioSessionControl2.
+
+		/// <summary>
+		/// Retrieves the current state of the audio session.
+		/// </summary>
+		/// <param name="state">Receives the current session state.</param>
+		/// <returns>An HRESULT code indicating whether the operation succeeded of failed.</returns>
+		[PreserveSig]
+		int GetState(
+			[Out] out AudioSessionState state);
+
+		/// <summary>
+		/// Retrieves the display name for the audio session.
+		/// </summary>
+		/// <param name="displayName">Receives a string that contains the display name.</param>
+		/// <returns>An HRESULT code indicating whether the operation succeeded of failed.</returns>
+		[PreserveSig]
+		int GetDisplayName(
+			[Out] [MarshalAs(UnmanagedType.LPWStr)] out string displayName);
+
+		/// <summary>
+		/// Assigns a display name to the current audio session.
+		/// </summary>
+		/// <param name="displayName">A string that contains the new display name for the session.</param>
+		/// <param name="eventContext">A user context value that is passed to the notification callback.</param>
+		/// <returns>An HRESULT code indicating whether the operation succeeded of failed.</returns>
+		[PreserveSig]
+		int SetDisplayName(
+			[In] [MarshalAs(UnmanagedType.LPWStr)] string displayName,
+			[In] [MarshalAs(UnmanagedType.LPStruct)] Guid eventContext);
+
+		/// <summary>
+		/// Retrieves the path for the display icon for the audio session.
+		/// </summary>
+		/// <param name="iconPath">Receives a string that specifies the fully qualified path of the file that contains the icon.</param>
+		/// <returns>An HRESULT code indicating whether the operation succeeded of failed.</returns>
+		[PreserveSig]
+		int GetIconPath(
+			[Out] [MarshalAs(UnmanagedType.LPWStr)] out string iconPath);
+
+		/// <summary>
+		/// Assigns a display icon to the current session.
+		/// </summary>
+		/// <param name="iconPath">A string that specifies the fully qualified path of the file that contains the new icon.</param>
+		/// <param name="eventContext">A user context value that is passed to the notification callback.</param>
+		/// <returns>An HRESULT code indicating whether the operation succeeded of failed.</returns>
+		[PreserveSig]
+		int SetIconPath(
+			[In] [MarshalAs(UnmanagedType.LPWStr)] string iconPath,
+			[In] [MarshalAs(UnmanagedType.LPStruct)] Guid eventContext);
+
+		/// <summary>
+		/// Retrieves the grouping parameter of the audio session.
+		/// </summary>
+		/// <param name="groupingId">Receives the grouping parameter ID.</param>
+		/// <returns>An HRESULT code indicating whether the operation succeeded of failed.</returns>
+		[PreserveSig]
+		int GetGroupingParam(
+			[Out] out Guid groupingId);
+
+		/// <summary>
+		/// Assigns a session to a grouping of sessions.
+		/// </summary>
+		/// <param name="groupingId">The new grouping parameter ID.</param>
+		/// <param name="eventContext">A user context value that is passed to the notification callback.</param>
+		/// <returns>An HRESULT code indicating whether the operation succeeded of failed.</returns>
+		[PreserveSig]
+		int SetGroupingParam(
+			[In] [MarshalAs(UnmanagedType.LPStruct)] Guid groupingId,
+			[In] [MarshalAs(UnmanagedType.LPStruct)] Guid eventContext);
+
+		/// <summary>
+		/// Registers the client to receive notifications of session events, including changes in the session state.
+		/// </summary>
+		/// <param name="client">A client-implemented <see cref="IAudioSessionEvents"/> interface.</param>
+		/// <returns>An HRESULT code indicating whether the operation succeeded of failed.</returns>
+		[PreserveSig]
+		int RegisterAudioSessionNotification(
+			[In] IAudioSessionEvents client);
+
+		/// <summary>
+		/// Deletes a previous registration by the client to receive notifications.
+		/// </summary>
+		/// <param name="client">A client-implemented <see cref="IAudioSessionEvents"/> interface.</param>
+		/// <returns>An HRESULT code indicating whether the operation succeeded of failed.</returns>
+		[PreserveSig]
+		int UnregisterAudioSessionNotification(
+			[In] IAudioSessionEvents client);
+
+		// TODO: Determine why these methods aren't part of the interface defined in audiopolicy.h
+
+		///// <summary>
+		///// Retrieves the time that the audio session last changed to the active state.
+		///// </summary>
+		///// <param name="date">Receives the time of the last activation.</param>
+		///// <returns>An HRESULT code indicating whether the operation succeeded of failed.</returns>
+		//[PreserveSig]
+		//int GetLastActivation(
+		//    [Out] out DateTime date);
+
+		///// <summary>
+		///// Retrieves the time at which the audio session last became inactive.
+		///// </summary>
+		///// <param name="date">Receives the time of the last inactivation.</param>
+		///// <returns>An HRESULT code indicating whether the operation succeeded of failed.</returns>
+		//[PreserveSig]
+		//int GetLastInactivation(
+		//    [Out] out DateTime date);
+    }
+}

+ 170 - 0
sourceCode/trunk/Code/CoreAudio/Interfaces/IAudioSessionControl2.cs

@@ -0,0 +1,170 @@
+// -----------------------------------------
+// SoundScribe (TM) and related software.
+// 
+// Copyright (C) 2007-2011 Vannatech
+// http://www.vannatech.com
+// All rights reserved.
+// 
+// This source code is subject to the MIT License.
+// http://www.opensource.org/licenses/mit-license.php
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+// -----------------------------------------
+
+using System;
+using System.Runtime.InteropServices;
+using Vannatech.CoreAudio.Enumerations;
+
+namespace Vannatech.CoreAudio.Interfaces
+{
+    /// <summary>
+	/// Used by a client to get information about the audio session.
+    /// </summary>
+    /// <remarks>
+	/// MSDN Reference: http://msdn.microsoft.com/en-us/library/dd368248.aspx
+    /// </remarks>
+	public partial interface IAudioSessionControl2
+    {
+        // Note: We can't derive from IAudioSessionControl, as that will produce the wrong vtable.
+
+        #region IAudioSessionControl Members
+
+        /// <summary>
+        /// Retrieves the current state of the audio session.
+        /// </summary>
+        /// <param name="state">Receives the current session state.</param>
+        /// <returns>An HRESULT code indicating whether the operation succeeded of failed.</returns>
+        [PreserveSig]
+        int GetState(
+            [Out] out AudioSessionState state);
+
+        /// <summary>
+        /// Retrieves the display name for the audio session.
+        /// </summary>
+        /// <param name="displayName">Receives a string that contains the display name.</param>
+        /// <returns>An HRESULT code indicating whether the operation succeeded of failed.</returns>
+        [PreserveSig]
+        int GetDisplayName(
+            [Out] [MarshalAs(UnmanagedType.LPWStr)] out string displayName);
+
+        /// <summary>
+        /// Assigns a display name to the current audio session.
+        /// </summary>
+        /// <param name="displayName">A string that contains the new display name for the session.</param>
+        /// <param name="eventContext">A user context value that is passed to the notification callback.</param>
+        /// <returns>An HRESULT code indicating whether the operation succeeded of failed.</returns>
+        [PreserveSig]
+        int SetDisplayName(
+            [In] [MarshalAs(UnmanagedType.LPWStr)] string displayName,
+            [In] [MarshalAs(UnmanagedType.LPStruct)] Guid eventContext);
+
+        /// <summary>
+        /// Retrieves the path for the display icon for the audio session.
+        /// </summary>
+        /// <param name="iconPath">Receives a string that specifies the fully qualified path of the file that contains the icon.</param>
+        /// <returns>An HRESULT code indicating whether the operation succeeded of failed.</returns>
+        [PreserveSig]
+        int GetIconPath(
+            [Out] [MarshalAs(UnmanagedType.LPWStr)] out string iconPath);
+
+        /// <summary>
+        /// Assigns a display icon to the current session.
+        /// </summary>
+        /// <param name="iconPath">A string that specifies the fully qualified path of the file that contains the new icon.</param>
+        /// <param name="eventContext">A user context value that is passed to the notification callback.</param>
+        /// <returns>An HRESULT code indicating whether the operation succeeded of failed.</returns>
+        [PreserveSig]
+        int SetIconPath(
+            [In] [MarshalAs(UnmanagedType.LPWStr)] string iconPath,
+            [In] [MarshalAs(UnmanagedType.LPStruct)] Guid eventContext);
+
+        /// <summary>
+        /// Retrieves the grouping parameter of the audio session.
+        /// </summary>
+        /// <param name="groupingId">Receives the grouping parameter ID.</param>
+        /// <returns>An HRESULT code indicating whether the operation succeeded of failed.</returns>
+        [PreserveSig]
+        int GetGroupingParam(
+            [Out] out Guid groupingId);
+
+        /// <summary>
+        /// Assigns a session to a grouping of sessions.
+        /// </summary>
+        /// <param name="groupingId">The new grouping parameter ID.</param>
+        /// <param name="eventContext">A user context value that is passed to the notification callback.</param>
+        /// <returns>An HRESULT code indicating whether the operation succeeded of failed.</returns>
+        [PreserveSig]
+        int SetGroupingParam(
+            [In] [MarshalAs(UnmanagedType.LPStruct)] Guid groupingId,
+            [In] [MarshalAs(UnmanagedType.LPStruct)] Guid eventContext);
+
+        /// <summary>
+        /// Registers the client to receive notifications of session events, including changes in the session state.
+        /// </summary>
+        /// <param name="client">A client-implemented <see cref="IAudioSessionEvents"/> interface.</param>
+        /// <returns>An HRESULT code indicating whether the operation succeeded of failed.</returns>
+        [PreserveSig]
+        int RegisterAudioSessionNotification(
+            [In] IAudioSessionEvents client);
+
+        /// <summary>
+        /// Deletes a previous registration by the client to receive notifications.
+        /// </summary>
+        /// <param name="client">A client-implemented <see cref="IAudioSessionEvents"/> interface.</param>
+        /// <returns>An HRESULT code indicating whether the operation succeeded of failed.</returns>
+        [PreserveSig]
+        int UnregisterAudioSessionNotification(
+            [In] IAudioSessionEvents client);
+
+        #endregion
+
+        /// <summary>
+		/// Retrieves the session identifier.
+		/// </summary>
+		/// <param name="sessionId">Receives the audio session identifier.</param>
+		/// <returns>An HRESULT code indicating whether the operation succeeded of failed.</returns>
+		[PreserveSig]
+		int GetSessionIdentifier(
+			[Out] [MarshalAs(UnmanagedType.LPWStr)] out string sessionId);
+
+		/// <summary>
+		/// Retrieves the identifier of the session instance.
+		/// </summary>
+		/// <param name="instanceId">Receives the identifier of a particular instance of the audio session.</param>
+		/// <returns>An HRESULT code indicating whether the operation succeeded of failed.</returns>
+		[PreserveSig]
+		int GetSessionInstanceIdentifier(
+			[Out] [MarshalAs(UnmanagedType.LPWStr)] out string instanceId);
+
+		/// <summary>
+		/// Retrieves the process identifier of the session.
+		/// </summary>
+		/// <param name="processId">Receives the process identifier of the audio session. </param>
+		/// <returns>An HRESULT code indicating whether the operation succeeded of failed.</returns>
+		[PreserveSig]
+		int GetProcessId(
+			[Out] [MarshalAs(UnmanagedType.U4)] out UInt32 processId);
+
+		/// <summary>
+		/// Indicates whether the session is a system sounds session.
+		/// </summary>
+		/// <returns>An HRESULT code returning S_OK (0x0) or S_FALSE (0x1), indicating whether or not the session is a system sounds session.</returns>
+		[PreserveSig]
+		int IsSystemSoundsSession();
+
+		/// <summary>
+		/// Enables or disables the default stream attenuation experience (auto-ducking) provided by the system.
+		/// </summary>
+        /// <param name="optOut">True to disable system auto-ducking, or false to enable.</param>
+		/// <returns>An HRESULT code indicating whether the operation succeeded of failed.</returns>
+		[PreserveSig]
+		int SetDuckingPreference(
+			[In] [MarshalAs(UnmanagedType.Bool)] bool optOut);
+    }
+}

+ 53 - 0
sourceCode/trunk/Code/CoreAudio/Interfaces/IAudioSessionEnumerator.cs

@@ -0,0 +1,53 @@
+// -----------------------------------------
+// SoundScribe (TM) and related software.
+// 
+// Copyright (C) 2007-2011 Vannatech
+// http://www.vannatech.com
+// All rights reserved.
+// 
+// This source code is subject to the MIT License.
+// http://www.opensource.org/licenses/mit-license.php
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+// -----------------------------------------
+
+using System;
+using System.Runtime.InteropServices;
+
+namespace Vannatech.CoreAudio.Interfaces
+{
+    /// <summary>
+	/// Enumerates audio sessions on an audio device.
+    /// </summary>
+    /// <remarks>
+	/// MSDN Reference: http://msdn.microsoft.com/en-us/library/dd368281.aspx
+    /// </remarks>
+	public partial interface IAudioSessionEnumerator
+    {
+		/// <summary>
+		/// Gets the total number of audio sessions that are open on the audio device.
+		/// </summary>
+		/// <param name="count">Receives the total number of audio sessions.</param>
+		/// <returns>An HRESULT code indicating whether the operation succeeded of failed.</returns>
+		[PreserveSig]
+		int GetCount(
+			[Out] [MarshalAs(UnmanagedType.I4)] out Int32 count);
+
+		/// <summary>
+		/// Gets the audio session specified by an audio session number. 
+		/// </summary>
+		/// <param name="index">The zero-based index of the session.</param>
+		/// <param name="session">Receives an <see cref="IAudioSessionControl"/> session object in the collection that is maintained by the session enumerator.</param>
+		/// <returns>An HRESULT code indicating whether the operation succeeded of failed.</returns>
+		[PreserveSig]
+		int GetSession(
+			[In] [MarshalAs(UnmanagedType.I4)] Int32 index,
+			[Out] [MarshalAs(UnmanagedType.Interface)] out IAudioSessionControl session);
+    }
+}

+ 113 - 0
sourceCode/trunk/Code/CoreAudio/Interfaces/IAudioSessionEvents.cs

@@ -0,0 +1,113 @@
+// -----------------------------------------
+// SoundScribe (TM) and related software.
+// 
+// Copyright (C) 2007-2011 Vannatech
+// http://www.vannatech.com
+// All rights reserved.
+// 
+// This source code is subject to the MIT License.
+// http://www.opensource.org/licenses/mit-license.php
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+// -----------------------------------------
+
+using System;
+using System.Runtime.InteropServices;
+using Vannatech.CoreAudio.Enumerations;
+
+namespace Vannatech.CoreAudio.Interfaces
+{
+    /// <summary>
+	/// Provides notifications of session-related events such as changes in the volume level, display name, and session state.
+    /// </summary>
+    /// <remarks>
+	/// MSDN Reference: http://msdn.microsoft.com/en-us/library/dd368289.aspx
+    /// </remarks>
+	public partial interface IAudioSessionEvents
+    {
+		/// <summary>
+		/// Notifies the client that the display name for the session has changed.
+		/// </summary>
+		/// <param name="displayName">The new display name for the session.</param>
+		/// <param name="eventContext">A user context value that is passed to the notification callback.</param>
+		/// <returns>An HRESULT code indicating whether the operation succeeded of failed.</returns>
+		[PreserveSig]
+		int OnDisplayNameChanged(
+			[In] [MarshalAs(UnmanagedType.LPWStr)] string displayName,
+			[In] ref Guid eventContext);
+
+		/// <summary>
+		/// Notifies the client that the display icon for the session has changed.
+		/// </summary>
+		/// <param name="iconPath">The path for the new display icon for the session.</param>
+		/// <param name="eventContext">A user context value that is passed to the notification callback.</param>
+		/// <returns>An HRESULT code indicating whether the operation succeeded of failed.</returns>
+		[PreserveSig]
+		int OnIconPathChanged(
+			[In] [MarshalAs(UnmanagedType.LPWStr)] string iconPath,
+			[In] ref Guid eventContext);
+
+		/// <summary>
+		/// Notifies the client that the volume level or muting state of the session has changed.
+		/// </summary>
+		/// <param name="volume">The new volume level for the audio session.</param>
+		/// <param name="isMuted">The new muting state.</param>
+		/// <param name="eventContext">A user context value that is passed to the notification callback.</param>
+		/// <returns>An HRESULT code indicating whether the operation succeeded of failed.</returns>
+		[PreserveSig]
+		int OnSimpleVolumeChanged(
+			[In] [MarshalAs(UnmanagedType.R4)] float volume,
+			[In] [MarshalAs(UnmanagedType.Bool)] bool isMuted,
+			[In] ref Guid eventContext);
+
+		/// <summary>
+		/// Notifies the client that the volume level of an audio channel in the session submix has changed.
+		/// </summary>
+		/// <param name="channelCount">The channel count.</param>
+		/// <param name="newVolumes">An array of volumnes cooresponding with each channel index.</param>
+		/// <param name="channelIndex">The number of the channel whose volume level changed.</param>
+		/// <param name="eventContext">A user context value that is passed to the notification callback.</param>
+		/// <returns>An HRESULT code indicating whether the operation succeeded of failed.</returns>
+		[PreserveSig]
+		int OnChannelVolumeChanged(
+			[In] [MarshalAs(UnmanagedType.U4)] UInt32 channelCount,
+			[In] [MarshalAs(UnmanagedType.SysInt)] IntPtr newVolumes, // Pointer to float array
+			[In] [MarshalAs(UnmanagedType.U4)] UInt32 channelIndex,
+			[In] ref Guid eventContext);
+
+		/// <summary>
+		/// Notifies the client that the grouping parameter for the session has changed.
+		/// </summary>
+		/// <param name="groupingId">The new grouping parameter for the session.</param>
+		/// <param name="eventContext">A user context value that is passed to the notification callback.</param>
+		/// <returns>An HRESULT code indicating whether the operation succeeded of failed.</returns>
+		[PreserveSig]
+		int OnGroupingParamChanged(
+			[In] ref Guid groupingId,
+			[In] ref Guid eventContext);
+
+		/// <summary>
+		/// Notifies the client that the stream-activity state of the session has changed.
+		/// </summary>
+		/// <param name="state">The new session state.</param>
+		/// <returns>An HRESULT code indicating whether the operation succeeded of failed.</returns>
+		[PreserveSig]
+		int OnStateChanged(
+			[In] AudioSessionState state);
+
+		/// <summary>
+		/// Notifies the client that the session has been disconnected.
+		/// </summary>
+		/// <param name="disconnectReason">The reason that the audio session was disconnected.</param>
+		/// <returns>An HRESULT code indicating whether the operation succeeded of failed.</returns>
+		[PreserveSig]
+		int OnSessionDisconnected(
+			[In] AudioSessionDisconnectReason disconnectReason);
+    }
+}

+ 61 - 0
sourceCode/trunk/Code/CoreAudio/Interfaces/IAudioSessionManager.cs

@@ -0,0 +1,61 @@
+// -----------------------------------------
+// SoundScribe (TM) and related software.
+// 
+// Copyright (C) 2007-2011 Vannatech
+// http://www.vannatech.com
+// All rights reserved.
+// 
+// This source code is subject to the MIT License.
+// http://www.opensource.org/licenses/mit-license.php
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+// -----------------------------------------
+
+using System;
+using System.Runtime.InteropServices;
+
+namespace Vannatech.CoreAudio.Interfaces
+{
+    /// <summary>
+	/// Enables a client to access the session controls and volume controls for both cross-process and process-specific audio sessions.
+    /// </summary>
+    /// <remarks>
+	/// MSDN Reference: http://msdn.microsoft.com/en-us/library/dd370948.aspx
+    /// </remarks>
+	public partial interface IAudioSessionManager
+    {
+        // Note: Any changes to this interface should be repeated in IAudioSessionManager2.
+
+		/// <summary>
+		/// Retrieves an audio session control.
+		/// </summary>
+		/// <param name="sessionId">A new or existing session ID.</param>
+		/// <param name="streamFlags">Audio session flags.</param>
+		/// <param name="sessionControl">Receives an <see cref="IAudioSessionControl"/> interface for the audio session.</param>
+		/// <returns>An HRESULT code indicating whether the operation succeeded of failed.</returns>
+		[PreserveSig]
+		int GetAudioSessionControl(
+			[In, Optional] [MarshalAs(UnmanagedType.LPStruct)] Guid sessionId,
+			[In] [MarshalAs(UnmanagedType.U4)] UInt32 streamFlags,
+			[Out] [MarshalAs(UnmanagedType.Interface)] out IAudioSessionControl sessionControl);
+
+		/// <summary>
+		/// Retrieves a simple audio volume control.
+		/// </summary>
+		/// <param name="sessionId">A new or existing session ID.</param>
+		/// <param name="streamFlags">Audio session flags.</param>
+		/// <param name="audioVolume">Receives an <see cref="ISimpleAudioVolume"/> interface for the audio session.</param>
+		/// <returns>An HRESULT code indicating whether the operation succeeded of failed.</returns>
+		[PreserveSig]
+		int GetSimpleAudioVolume(
+			[In, Optional] [MarshalAs(UnmanagedType.LPStruct)] Guid sessionId,
+			[In] [MarshalAs(UnmanagedType.U4)] UInt32 streamFlags,
+			[Out] [MarshalAs(UnmanagedType.Interface)] out ISimpleAudioVolume audioVolume);
+    }
+}

+ 111 - 0
sourceCode/trunk/Code/CoreAudio/Interfaces/IAudioSessionManager2.cs

@@ -0,0 +1,111 @@
+// -----------------------------------------
+// SoundScribe (TM) and related software.
+// 
+// Copyright (C) 2007-2011 Vannatech
+// http://www.vannatech.com
+// All rights reserved.
+// 
+// This source code is subject to the MIT License.
+// http://www.opensource.org/licenses/mit-license.php
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+// -----------------------------------------
+using System;
+using System.Runtime.InteropServices;
+
+namespace Vannatech.CoreAudio.Interfaces
+{
+    /// <summary>
+	/// Enables an application to manage submixes for the audio device.
+    /// </summary>
+    /// <remarks>
+	/// MSDN Reference: http://msdn.microsoft.com/en-us/library/dd370950.aspx
+    /// </remarks>
+	public partial interface IAudioSessionManager2
+    {
+        // Note: We can't derive from IAudioSessionControl, as that will produce the wrong vtable.
+
+        #region IAudioSessionManager Methods
+
+        /// <summary>
+        /// Retrieves an audio session control.
+        /// </summary>
+        /// <param name="sessionId">A new or existing session ID.</param>
+        /// <param name="streamFlags">Audio session flags.</param>
+        /// <param name="sessionControl">Receives an <see cref="IAudioSessionControl"/> interface for the audio session.</param>
+        /// <returns>An HRESULT code indicating whether the operation succeeded of failed.</returns>
+        [PreserveSig]
+        int GetAudioSessionControl(
+            [In, Optional] [MarshalAs(UnmanagedType.LPStruct)] Guid sessionId,
+            [In] [MarshalAs(UnmanagedType.U4)] UInt32 streamFlags,
+            [Out] [MarshalAs(UnmanagedType.Interface)] out IAudioSessionControl sessionControl);
+
+        /// <summary>
+        /// Retrieves a simple audio volume control.
+        /// </summary>
+        /// <param name="sessionId">A new or existing session ID.</param>
+        /// <param name="streamFlags">Audio session flags.</param>
+        /// <param name="audioVolume">Receives an <see cref="ISimpleAudioVolume"/> interface for the audio session.</param>
+        /// <returns>An HRESULT code indicating whether the operation succeeded of failed.</returns>
+        [PreserveSig]
+        int GetSimpleAudioVolume(
+            [In, Optional] [MarshalAs(UnmanagedType.LPStruct)] Guid sessionId,
+            [In] [MarshalAs(UnmanagedType.U4)] UInt32 streamFlags,
+            [Out] [MarshalAs(UnmanagedType.Interface)] out ISimpleAudioVolume audioVolume);
+
+        #endregion
+
+        /// <summary>
+		/// Gets a pointer to the audio session enumerator object used to enumerate sessions.
+		/// </summary>
+		/// <param name="sessionList">Receives the session enumerator object that the client can use to enumerate audio sessions on the audio device.</param>
+		/// <returns>An HRESULT code indicating whether the operation succeeded of failed.</returns>
+		[PreserveSig]
+		int GetSessionEnumerator(
+			[Out] [MarshalAs(UnmanagedType.Interface)] out IAudioSessionEnumerator sessionList);
+
+		/// <summary>
+		/// Registers the application to receive a notification when a session is created.
+		/// </summary>
+		/// <param name="client">The client to be called when session events are raised.</param>
+		/// <returns>An HRESULT code indicating whether the operation succeeded of failed.</returns>
+		[PreserveSig]
+		int RegisterSessionNotification(
+			[In] IAudioSessionNotification client);
+
+		/// <summary>
+		/// Deletes the registration to receive a notification when a session is created.
+		/// </summary>
+		/// <param name="client">Removes the client from the callback list for session events.</param>
+		/// <returns>An HRESULT code indicating whether the operation succeeded of failed.</returns>
+		[PreserveSig]
+		int UnregisterSessionNotification(
+			[In] IAudioSessionNotification client);
+
+		/// <summary>
+		/// Registers the application to receive ducking notifications.
+		/// </summary>
+		/// <param name="sessionId">A session instance identifier.</param>
+		/// <param name="client">The client to be called when ducking events are raised.</param>
+		/// <returns>An HRESULT code indicating whether the operation succeeded of failed.</returns>
+		[PreserveSig]
+		int RegisterDuckNotification(
+			[In] [MarshalAs(UnmanagedType.LPWStr)] string sessionId,
+			[In] IAudioVolumeDuckNotification client);
+
+		/// <summary>
+		/// Deletes the registration to receive ducking notifications.
+		/// </summary>
+		/// <param name="client">Removes the client from the callback list for ducking events.</param>
+		/// <returns>An HRESULT code indicating whether the operation succeeded of failed.</returns>
+		[PreserveSig]
+		int UnregisterDuckNotification(
+			[In] IAudioVolumeDuckNotification client);
+    }
+}

+ 42 - 0
sourceCode/trunk/Code/CoreAudio/Interfaces/IAudioSessionNotification.cs

@@ -0,0 +1,42 @@
+// -----------------------------------------
+// SoundScribe (TM) and related software.
+// 
+// Copyright (C) 2007-2011 Vannatech
+// http://www.vannatech.com
+// All rights reserved.
+// 
+// This source code is subject to the MIT License.
+// http://www.opensource.org/licenses/mit-license.php
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+// -----------------------------------------
+
+using System;
+using System.Runtime.InteropServices;
+
+namespace Vannatech.CoreAudio.Interfaces
+{
+    /// <summary>
+	/// Provides notification when an audio session is created.
+    /// </summary>
+    /// <remarks>
+	/// MSDN Reference: http://msdn.microsoft.com/en-us/library/dd370969.aspx
+    /// </remarks>
+	public partial interface IAudioSessionNotification
+    {
+		/// <summary>
+		/// Notifies the registered processes that the audio session has been created.
+		/// </summary>
+		/// <param name="sessionControl">The <see cref="IAudioSessionControl"/> interface of the audio session that was created.</param>
+		/// <returns>An HRESULT code indicating whether the operation succeeded of failed.</returns>
+		[PreserveSig]
+		int OnSessionCreated(
+			[In] IAudioSessionControl sessionControl);
+    }
+}

+ 87 - 0
sourceCode/trunk/Code/CoreAudio/Interfaces/IAudioStreamVolume.cs

@@ -0,0 +1,87 @@
+// -----------------------------------------
+// SoundScribe (TM) and related software.
+// 
+// Copyright (C) 2007-2011 Vannatech
+// http://www.vannatech.com
+// All rights reserved.
+// 
+// This source code is subject to the MIT License.
+// http://www.opensource.org/licenses/mit-license.php
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+// -----------------------------------------
+
+using System;
+using System.Runtime.InteropServices;
+
+namespace Vannatech.CoreAudio.Interfaces
+{
+    /// <summary>
+	/// Enables a client to control and monitor the volume levels for all of the channels in an audio stream.
+    /// </summary>
+    /// <remarks>
+	/// MSDN Reference: http://msdn.microsoft.com/en-us/library/dd370977.aspx
+    /// </remarks>
+	public partial interface IAudioStreamVolume
+    {
+		/// <summary>
+		/// Retrieves the number of channels contained in the audio stream.
+		/// </summary>
+		/// <param name="count">Receives the channel count.</param>
+		/// <returns>An HRESULT code indicating whether the operation succeeded of failed.</returns>
+		[PreserveSig]
+		int GetChannelCount(
+			[Out] [MarshalAs(UnmanagedType.U4)] out UInt32 count);
+
+		/// <summary>
+		/// Sets the volume level for the specified channel in the audio stream.
+		/// </summary>
+		/// <param name="index">The zero-based index of the channel.</param>
+		/// <param name="level">The new volume level expressed as a normalized value between 0.0 and 1.0.</param>
+		/// <returns>An HRESULT code indicating whether the operation succeeded of failed.</returns>
+		[PreserveSig]
+		int SetChannelVolume(
+			[In] [MarshalAs(UnmanagedType.U4)] UInt32 index,
+			[In] [MarshalAs(UnmanagedType.R4)] float level);
+
+		/// <summary>
+		/// Retrieves the volume level for the specified channel in the audio stream.
+		/// </summary>
+		/// <param name="index">The zero-based channel index.</param>
+		/// <param name="level">Receives the volume level expressed as a normalized value between 0.0 and 1.0.</param>
+		/// <returns>An HRESULT code indicating whether the operation succeeded of failed.</returns>
+		[PreserveSig]
+		int GetChannelVolume(
+			[In] [MarshalAs(UnmanagedType.U4)] UInt32 index,
+			[Out] [MarshalAs(UnmanagedType.R4)] out float level);
+
+		/// <summary>
+		/// Sets the individual volume levels for all the channels in the audio stream.
+		/// </summary>
+		/// <param name="count">The number of channels in the audio stream. This must match the volume level array length.</param>
+		/// <param name="levels">The new volume levels for each channel in the audio stream, expressed as normalized values between 0.0 and 1.0.</param>
+		/// <returns>An HRESULT code indicating whether the operation succeeded of failed.</returns>
+		[PreserveSig]
+		int SetAllVolumes(
+			[In] [MarshalAs(UnmanagedType.U4)] UInt32 count,
+			[In] [MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.R4)] float[] levels);
+
+		/// <summary>
+		/// Retrieves the volume levels for all the channels in the audio stream.
+		/// </summary>
+		/// <param name="length">The number of elements in the volumes array.</param>
+		/// <param name="volumes">Receives an array of volume levels for the channels in the audio stream.</param>
+		/// <returns>An HRESULT code indicating whether the operation succeeded of failed.</returns>
+		[PreserveSig]
+		int GetAllVolumes(
+			[In] [MarshalAs(UnmanagedType.U4)] UInt32 length,
+			[In, Out] [MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.R4)] float[] volumes);
+
+    }
+}

Some files were not shown because too many files changed in this diff