├── BthhfpDevice.cpp ├── BthhfpDevice.h ├── ContosoKeywordDetector.h ├── EndpointsCommon ├── AudioModule0.h ├── AudioModule1.h ├── AudioModule2.h ├── AudioModuleHelper.cpp ├── AudioModuleHelper.h ├── EndpointsCommon.vcxproj ├── EndpointsCommon.vcxproj.Filters ├── EndpointsCommon.vpj ├── MiniportAudioEngineNode.cpp ├── MiniportStreamAudioEngineNode.cpp ├── NewDelete.cpp ├── NewDelete.h ├── UsbHsDeviceFormats.h ├── bthhfpmictopo.cpp ├── bthhfpmictopo.h ├── bthhfpmictoptable.h ├── bthhfpmicwavtable.h ├── bthhfpmicwbwavtable.h ├── bthhfpminipairs.h ├── bthhfpminwavert.cpp ├── bthhfpspeakertopo.cpp ├── bthhfpspeakertopo.h ├── bthhfpspeakertoptable.h ├── bthhfpspeakerwavtable.h ├── bthhfpspeakerwbwavtable.h ├── bthhfptopo.cpp ├── bthhfptopo.h ├── micarray1toptable.h ├── micarraytopo.cpp ├── micarraytopo.h ├── micarraywavtable.h ├── mintopo.cpp ├── mintopo.h ├── minwavert.cpp ├── minwavert.h ├── minwavertstream.cpp ├── minwavertstream.h ├── simple.h ├── speakerhptopo.cpp ├── speakerhptopo.h ├── speakerhptoptable.h ├── speakerhpwavtable.h ├── speakertopo.cpp ├── speakertopo.h ├── speakertoptable.h ├── speakerwavtable.h ├── usbhsmictopo.cpp ├── usbhsmictopo.h ├── usbhsmictoptable.h ├── usbhsmicwavtable.h ├── usbhsminipairs.h ├── usbhsminwavert.cpp ├── usbhsspeakertopo.cpp ├── usbhsspeakertopo.h ├── usbhsspeakertoptable.h ├── usbhsspeakerwavtable.h ├── usbhstopo.cpp └── usbhstopo.h ├── LICENSE ├── Package ├── package.VcxProj ├── package.VcxProj.Filters └── package.vpj ├── README.md ├── SysVadShared.h ├── TabletAudioSample ├── QCSLoopback.inx ├── QCSLoopback2.inx ├── TabletAudioSample.rc ├── TabletAudioSample.vcxproj ├── TabletAudioSample.vcxproj.Filters ├── TabletAudioSample.vcxproj.user ├── TabletAudioSample.vpj ├── hdmitopo.cpp ├── hdmitopo.h ├── hdmitoptable.h ├── hdmiwavtable.h ├── micarray2toptable.h ├── micarray2wavtable.h ├── micarray3toptable.h ├── micarray3wavtable.h ├── micintopo.cpp ├── micintopo.h ├── micintoptable.h ├── micinwavtable.h ├── minipairs.h ├── spdiftopo.cpp ├── spdiftopo.h ├── spdiftoptable.h └── spdifwavtable.h ├── UnittestData.h ├── UsbHsDevice.cpp ├── UsbHsDevice.h ├── adapter.cpp ├── basetopo.cpp ├── basetopo.h ├── common.cpp ├── common.h ├── hw.cpp ├── hw.h ├── ihvprivatepropertyset.h ├── kshelper.cpp ├── kshelper.h ├── savedata.cpp ├── savedata.h ├── sysvad.h ├── sysvad.sln ├── vcable.cpp └── vcable.h /ContosoKeywordDetector.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) Microsoft Corporation All Rights Reserved 3 | 4 | Contoso voice activation driver definitions 5 | 6 | Hardware manufacturers define identifiers and data structures specific to 7 | their detection technology to pass voice models, keyword data, speaker 8 | data, or any other data relevant to their technology. 9 | 10 | */ 11 | 12 | // 13 | // Identifier for Contoso keyword configuration data. 14 | // 15 | // {6F7DBCC1-202E-498D-99C5-61C36C4EB2DC} 16 | DEFINE_GUID(CONTOSO_KEYWORDCONFIGURATION_IDENTIFIER, 0x6f7dbcc1, 0x202e, 0x498d, 0x99, 0xc5, 0x61, 0xc3, 0x6c, 0x4e, 0xb2, 0xdc); 17 | 18 | // {207F3D0C-5C79-496F-A94C-D3D2934DBFA9} 19 | DEFINE_GUID(CONTOSO_KEYWORDCONFIGURATION_IDENTIFIER2, 0x207f3d0c, 0x5c79, 0x496f, 0xa9, 0x4c, 0xd3, 0xd2, 0x93, 0x4d, 0xbf, 0xa9); 20 | 21 | // {A537F559-2D67-463B-B10E-BEB750A21F31} 22 | DEFINE_GUID(CONTOSO_KEYWORD1, 0xa537f559, 0x2d67, 0x463b, 0xb1, 0xe, 0xbe, 0xb7, 0x50, 0xa2, 0x1f, 0x31); 23 | // {655E417A-80A5-4A77-B3F1-512EAF67ABCF} 24 | DEFINE_GUID(CONTOSO_KEYWORD2, 0x655e417a, 0x80a5, 0x4a77, 0xb3, 0xf1, 0x51, 0x2e, 0xaf, 0x67, 0xab, 0xcf); 25 | 26 | // 27 | // The format of the Contoso keyword pattern matching data. 28 | // 29 | typedef struct 30 | { 31 | SOUNDDETECTOR_PATTERNHEADER Header; 32 | LONGLONG ContosoDetectorConfigurationData; 33 | } CONTOSO_KEYWORDCONFIGURATION; 34 | 35 | // 36 | // The format of the Contoso match result data. 37 | // 38 | typedef struct 39 | { 40 | SOUNDDETECTOR_PATTERNHEADER Header; 41 | LONGLONG ContosoDetectorResultData; 42 | ULONGLONG KeywordStartTimestamp; 43 | ULONGLONG KeywordStopTimestamp; 44 | GUID EventId; 45 | } CONTOSO_KEYWORDDETECTIONRESULT; 46 | -------------------------------------------------------------------------------- /EndpointsCommon/AudioModule0.h: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) Microsoft Corporation All Rights Reserved 4 | 5 | Module Name: 6 | 7 | AudioModule0.h 8 | 9 | Abstract: 10 | 11 | Declaration of Audio Module 0 (system module). 12 | 13 | --*/ 14 | 15 | #ifndef _SYSVAD_AUDIOMODULE0_H_ 16 | #define _SYSVAD_AUDIOMODULE0_H_ 17 | 18 | #include "AudioModuleHelper.h" 19 | 20 | #define AUDIOMODULE0_MAJOR 0x1 21 | #define AUDIOMODULE0_MINOR 0X0 22 | 23 | static const GUID AudioModule0Id = 24 | { 0xe24c8b6f, 0xede7, 0x4255, 0x8b, 0x39, 0x77, 0x97, 0x60, 0x15, 0xd5, 0x93 }; 25 | 26 | enum AudioModule0_Parameter { 27 | AudioModule0Parameter1 = 0, 28 | AudioModule0Parameter2 29 | }; 30 | 31 | typedef struct _AUDIOMODULE0_CUSTOM_COMMAND { 32 | ULONG Verb; // get, set and support 33 | AudioModule0_Parameter ParameterId; 34 | } AUDIOMODULE0_CUSTOM_COMMAND, *PAUDIOMODULE0_CUSTOM_COMMAND; 35 | 36 | enum AudioModule0_Notification_Type { 37 | AudioModule0ParameterChanged = 0, 38 | }; 39 | 40 | typedef struct _AUDIOMODULE0_CUSTOM_NOTIFICATION { 41 | ULONG Type; 42 | union { 43 | struct { 44 | ULONG ParameterId; 45 | } ParameterChanged; 46 | }; 47 | } AUDIOMODULE0_CUSTOM_NOTIFICATION, *PAUDIOMODULE0_CUSTOM_NOTIFICATION; 48 | 49 | typedef struct _AUDIOMODULE0_NOTIFICATION { 50 | KSAUDIOMODULE_NOTIFICATION Header; 51 | AUDIOMODULE0_CUSTOM_NOTIFICATION CustomNotification; 52 | } AUDIOMODULE0_NOTIFICATION, *PAUDIOMODULE0_NOTIFICATION; 53 | 54 | typedef struct _AUDIOMODULE0_CONTEXT { 55 | ULONG Parameter1; 56 | BYTE Parameter2; 57 | ULONG InstanceId; 58 | AUDIOMODULE0_NOTIFICATION Notification; 59 | PPORTCLSNOTIFICATIONS PortNotifications; 60 | } AUDIOMODULE0_CONTEXT, *PAUDIOMODULE0_CONTEXT; 61 | 62 | static 63 | ULONG AudioModule0_ValidParameter1List[] = 64 | { 65 | 1, 2, 5 66 | }; 67 | 68 | static 69 | AUDIOMODULE_PARAMETER_INFO AudioModule0_ParameterInfo[] = 70 | { 71 | { 72 | KSPROPERTY_TYPE_GET | KSPROPERTY_TYPE_SET | KSPROPERTY_TYPE_BASICSUPPORT, 73 | AUDIOMODULE_PARAMETER_FLAG_CHANGE_NOTIFICATION, 74 | (ULONG)RTL_FIELD_SIZE(AUDIOMODULE0_CONTEXT, Parameter1), 75 | VT_UI4, 76 | AudioModule0_ValidParameter1List, 77 | SIZEOF_ARRAY(AudioModule0_ValidParameter1List) 78 | }, 79 | { 80 | KSPROPERTY_TYPE_GET | KSPROPERTY_TYPE_BASICSUPPORT, 81 | 0, 82 | (ULONG)RTL_FIELD_SIZE(AUDIOMODULE0_CONTEXT, Parameter2), 83 | VT_UI1, 84 | NULL, 85 | 0 86 | }, 87 | }; 88 | 89 | inline 90 | #pragma code_seg("PAGE") 91 | NTSTATUS 92 | AudioModule0_InitClass( 93 | _In_ const AUDIOMODULE_DESCRIPTOR * Module, 94 | _Inout_opt_ PVOID Context, 95 | _In_ size_t Size, 96 | _In_ KSAUDIOMODULE_NOTIFICATION * NotificationHeader, 97 | _In_opt_ PPORTCLSNOTIFICATIONS PortNotifications 98 | ) 99 | { 100 | PAUDIOMODULE0_CONTEXT ctx = (PAUDIOMODULE0_CONTEXT)Context; 101 | 102 | UNREFERENCED_PARAMETER(Module); 103 | 104 | PAGED_CODE(); 105 | 106 | if (Context == NULL) 107 | { 108 | ASSERT(FALSE); // this should not happen. 109 | return STATUS_INTERNAL_ERROR; 110 | } 111 | 112 | ASSERT(Size != 0); 113 | RtlZeroMemory(Context, Size); 114 | 115 | ctx->Notification.Header = *NotificationHeader; 116 | ctx->PortNotifications = PortNotifications; 117 | if (ctx->PortNotifications != NULL) 118 | { 119 | ctx->PortNotifications->AddRef(); 120 | } 121 | 122 | return STATUS_SUCCESS; 123 | } 124 | 125 | inline 126 | #pragma code_seg("PAGE") 127 | NTSTATUS 128 | AudioModule0_InitInstance( 129 | _In_ const AUDIOMODULE_DESCRIPTOR * Module, 130 | _In_opt_ PVOID TemplateContext, 131 | _Inout_opt_ PVOID Context, 132 | _In_ size_t Size, 133 | _In_ ULONG InstanceId 134 | ) 135 | { 136 | PAUDIOMODULE0_CONTEXT ctx = (PAUDIOMODULE0_CONTEXT)Context; 137 | 138 | UNREFERENCED_PARAMETER(Module); 139 | 140 | PAGED_CODE(); 141 | 142 | if (Context == NULL) 143 | { 144 | ASSERT(FALSE); // this should not happen. 145 | return STATUS_INTERNAL_ERROR; 146 | } 147 | 148 | ASSERT(TemplateContext != NULL); 149 | ASSERT(Size != 0); 150 | 151 | RtlCopyMemory(Context, TemplateContext, Size); 152 | 153 | ctx->InstanceId = InstanceId; 154 | ctx->Notification.Header.ProviderId.InstanceId = InstanceId; 155 | if (ctx->PortNotifications != NULL) 156 | { 157 | ctx->PortNotifications->AddRef(); 158 | } 159 | 160 | return STATUS_SUCCESS; 161 | } 162 | 163 | inline 164 | #pragma code_seg("PAGE") 165 | VOID 166 | AudioModule0_Cleanup( 167 | _In_ PVOID Context 168 | ) 169 | { 170 | PAUDIOMODULE0_CONTEXT ctx = (PAUDIOMODULE0_CONTEXT)Context; 171 | 172 | PAGED_CODE(); 173 | 174 | if (Context == NULL) 175 | { 176 | ASSERT(FALSE); // this should not happen. 177 | return; 178 | } 179 | 180 | SAFE_RELEASE(ctx->PortNotifications); 181 | } 182 | 183 | inline 184 | #pragma code_seg("PAGE") 185 | NTSTATUS 186 | AudioModule0_Handler( 187 | _Inout_opt_ PVOID Context, 188 | _In_reads_bytes_(InBufferCb) PVOID InBuffer, 189 | _In_ ULONG InBufferCb, 190 | _Out_writes_bytes_opt_(*OutBufferCb) PVOID OutBuffer, 191 | _Inout_ ULONG * OutBufferCb 192 | ) 193 | { 194 | NTSTATUS status = STATUS_SUCCESS; 195 | BOOL fNewValue = FALSE; 196 | PVOID currentValue; 197 | PVOID inBuffer = NULL; 198 | ULONG inBufferCb = 0; 199 | 200 | PAUDIOMODULE0_CONTEXT ctx = (PAUDIOMODULE0_CONTEXT)Context; 201 | AUDIOMODULE_PARAMETER_INFO * parameterInfo = NULL; 202 | AUDIOMODULE0_CUSTOM_COMMAND * command = NULL; 203 | 204 | PAGED_CODE(); 205 | 206 | if (ctx == NULL) 207 | { 208 | ASSERT(FALSE); // this should not happen. 209 | status = STATUS_INTERNAL_ERROR; 210 | goto exit; 211 | } 212 | 213 | // 214 | // Basic parameter validation (module specific). 215 | // 216 | if (InBuffer == NULL || InBufferCb == 0) 217 | { 218 | return STATUS_INVALID_PARAMETER; 219 | } 220 | 221 | if (InBufferCb < sizeof(AUDIOMODULE0_CUSTOM_COMMAND)) 222 | { 223 | return STATUS_INVALID_PARAMETER; 224 | } 225 | 226 | command = (AUDIOMODULE0_CUSTOM_COMMAND*)InBuffer; 227 | 228 | // 229 | // Validate the parameter referenced in the command. 230 | // 231 | switch (command->ParameterId) 232 | { 233 | case AudioModule0Parameter1: 234 | currentValue = &ctx->Parameter1; 235 | parameterInfo = &AudioModule0_ParameterInfo[AudioModule0Parameter1]; 236 | break; 237 | 238 | case AudioModule0Parameter2: 239 | currentValue = &ctx->Parameter2; 240 | parameterInfo = &AudioModule0_ParameterInfo[AudioModule0Parameter2]; 241 | break; 242 | 243 | default: 244 | status = STATUS_INVALID_PARAMETER; 245 | goto exit; 246 | } 247 | 248 | // 249 | // Update input buffer ptr/size. 250 | // 251 | inBuffer = (PVOID)((ULONG_PTR)InBuffer + sizeof(AUDIOMODULE0_CUSTOM_COMMAND)); 252 | inBufferCb = InBufferCb - sizeof(AUDIOMODULE0_CUSTOM_COMMAND); 253 | 254 | if (inBufferCb == 0) 255 | { 256 | inBuffer = NULL; 257 | } 258 | 259 | status = AudioModule_GenericHandler( 260 | command->Verb, 261 | command->ParameterId, 262 | parameterInfo, 263 | currentValue, 264 | inBuffer, 265 | inBufferCb, 266 | OutBuffer, 267 | OutBufferCb, 268 | &fNewValue); 269 | 270 | if (!NT_SUCCESS(status)) 271 | { 272 | goto exit; 273 | } 274 | 275 | if (fNewValue && ctx->PortNotifications && 276 | (parameterInfo->Flags & AUDIOMODULE_PARAMETER_FLAG_CHANGE_NOTIFICATION)) 277 | { 278 | // This logic assumes that access to this function is serialized. 279 | ctx->Notification.CustomNotification.Type = AudioModule0ParameterChanged; 280 | ctx->Notification.CustomNotification.ParameterChanged.ParameterId = 281 | command->ParameterId; 282 | 283 | AudioModule_SendNotification(ctx->PortNotifications, 284 | (PVOID)&ctx->Notification, 285 | (USHORT)sizeof(ctx->Notification)); 286 | } 287 | 288 | // Normalize error code. 289 | status = STATUS_SUCCESS; 290 | 291 | exit: 292 | return status; 293 | } 294 | 295 | #endif // _SYSVAD_AUDIOMODULE0_H_ 296 | 297 | 298 | -------------------------------------------------------------------------------- /EndpointsCommon/AudioModule2.h: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) Microsoft Corporation All Rights Reserved 4 | 5 | Module Name: 6 | 7 | AudioModule2.h 8 | 9 | Abstract: 10 | 11 | Declaration of Audio Module 2. 12 | 13 | --*/ 14 | 15 | #ifndef _SYSVAD_AUDIOMODULE2_H_ 16 | #define _SYSVAD_AUDIOMODULE2_H_ 17 | 18 | #include "AudioModuleHelper.h" 19 | 20 | #define AUDIOMODULE2_MAJOR 0x2 21 | #define AUDIOMODULE2_MINOR 0X0 22 | 23 | static const GUID AudioModule2Id = 24 | { 0xcc2a9527, 0x19d9, 0x4784, 0x8d, 0xd4, 0x6c, 0x1f, 0xe0, 0x1e, 0x37, 0x26 }; 25 | 26 | enum AudioModule2_Parameter { 27 | AudioModule2Parameter1 = 0, 28 | AudioModule2Parameter2 29 | }; 30 | 31 | typedef struct _AUDIOMODULE2_CUSTOM_COMMAND { 32 | ULONG Verb; // get, set and support 33 | AudioModule2_Parameter ParameterId; 34 | } AUDIOMODULE2_CUSTOM_COMMAND, *PAUDIOMODULE2_CUSTOM_COMMAND; 35 | 36 | enum AudioModule2_Notification_Type { 37 | AudioModule2ParameterChanged = 0, 38 | }; 39 | 40 | typedef struct _AUDIOMODULE2_CUSTOM_NOTIFICATION { 41 | ULONG Type; 42 | union { 43 | struct { 44 | ULONG ParameterId; 45 | } ParameterChanged; 46 | }; 47 | } AUDIOMODULE2_CUSTOM_NOTIFICATION, *PAUDIOMODULE2_CUSTOM_NOTIFICATION; 48 | 49 | typedef struct _AUDIOMODULE2_NOTIFICATION { 50 | KSAUDIOMODULE_NOTIFICATION Header; 51 | AUDIOMODULE2_CUSTOM_NOTIFICATION CustomNotification; 52 | } AUDIOMODULE2_NOTIFICATION, *PAUDIOMODULE2_NOTIFICATION; 53 | 54 | typedef struct _AUDIOMODULE2_CONTEXT { 55 | ULONG Parameter1; 56 | USHORT Parameter2; 57 | ULONG InstanceId; 58 | AUDIOMODULE2_NOTIFICATION Notification; 59 | PPORTCLSNOTIFICATIONS PortNotifications; 60 | } AUDIOMODULE2_CONTEXT, *PAUDIOMODULE2_CONTEXT; 61 | 62 | static 63 | ULONG AudioModule2_ValidParameter1List[] = 64 | { 65 | 1, 0xfffffffe 66 | }; 67 | 68 | static 69 | AUDIOMODULE_PARAMETER_INFO AudioModule2_ParameterInfo[] = 70 | { 71 | { 72 | KSPROPERTY_TYPE_GET | KSPROPERTY_TYPE_SET | KSPROPERTY_TYPE_BASICSUPPORT, 73 | AUDIOMODULE_PARAMETER_FLAG_CHANGE_NOTIFICATION, 74 | (ULONG)RTL_FIELD_SIZE(AUDIOMODULE2_CONTEXT, Parameter1), 75 | VT_UI4, 76 | AudioModule2_ValidParameter1List, 77 | SIZEOF_ARRAY(AudioModule2_ValidParameter1List) 78 | }, 79 | { 80 | KSPROPERTY_TYPE_GET | KSPROPERTY_TYPE_BASICSUPPORT, 81 | 0, 82 | (ULONG)RTL_FIELD_SIZE(AUDIOMODULE2_CONTEXT, Parameter2), 83 | VT_UI2, 84 | NULL, 85 | 0 86 | }, 87 | }; 88 | 89 | inline 90 | #pragma code_seg("PAGE") 91 | NTSTATUS 92 | AudioModule2_InitClass( 93 | _In_ const AUDIOMODULE_DESCRIPTOR * Module, 94 | _Inout_opt_ PVOID Context, 95 | _In_ size_t Size, 96 | _In_ KSAUDIOMODULE_NOTIFICATION * NotificationHeader, 97 | _In_opt_ PPORTCLSNOTIFICATIONS PortNotifications 98 | ) 99 | { 100 | PAUDIOMODULE2_CONTEXT ctx = (PAUDIOMODULE2_CONTEXT)Context; 101 | 102 | UNREFERENCED_PARAMETER(Module); 103 | 104 | PAGED_CODE(); 105 | 106 | if (Context == NULL) 107 | { 108 | ASSERT(FALSE); // this should not happen. 109 | return STATUS_INTERNAL_ERROR; 110 | } 111 | 112 | ASSERT(Size != 0); 113 | RtlZeroMemory(Context, Size); 114 | 115 | ctx->Notification.Header = *NotificationHeader; 116 | ctx->PortNotifications = PortNotifications; 117 | if (ctx->PortNotifications != NULL) 118 | { 119 | ctx->PortNotifications->AddRef(); 120 | } 121 | 122 | return STATUS_SUCCESS; 123 | } 124 | 125 | inline 126 | #pragma code_seg("PAGE") 127 | NTSTATUS 128 | AudioModule2_InitInstance( 129 | _In_ const AUDIOMODULE_DESCRIPTOR * Module, 130 | _In_opt_ PVOID TemplateContext, 131 | _Inout_opt_ PVOID Context, 132 | _In_ size_t Size, 133 | _In_ ULONG InstanceId 134 | ) 135 | { 136 | PAUDIOMODULE2_CONTEXT ctx = (PAUDIOMODULE2_CONTEXT)Context; 137 | 138 | UNREFERENCED_PARAMETER(Module); 139 | 140 | PAGED_CODE(); 141 | 142 | if (Context == NULL) 143 | { 144 | ASSERT(FALSE); // this should not happen. 145 | return STATUS_INTERNAL_ERROR; 146 | } 147 | 148 | ASSERT(TemplateContext != NULL); 149 | ASSERT(Size != 0); 150 | 151 | RtlCopyMemory(Context, TemplateContext, Size); 152 | 153 | ctx->InstanceId = InstanceId; 154 | ctx->Notification.Header.ProviderId.InstanceId = InstanceId; 155 | if (ctx->PortNotifications != NULL) 156 | { 157 | ctx->PortNotifications->AddRef(); 158 | } 159 | 160 | return STATUS_SUCCESS; 161 | } 162 | 163 | inline 164 | #pragma code_seg("PAGE") 165 | VOID 166 | AudioModule2_Cleanup( 167 | _In_ PVOID Context 168 | ) 169 | { 170 | PAUDIOMODULE2_CONTEXT ctx = (PAUDIOMODULE2_CONTEXT)Context; 171 | 172 | PAGED_CODE(); 173 | 174 | if (Context == NULL) 175 | { 176 | ASSERT(FALSE); // this should not happen. 177 | return; 178 | } 179 | 180 | SAFE_RELEASE(ctx->PortNotifications); 181 | } 182 | 183 | inline 184 | #pragma code_seg("PAGE") 185 | NTSTATUS 186 | AudioModule2_Handler( 187 | _Inout_opt_ PVOID Context, 188 | _In_reads_bytes_(InBufferCb) PVOID InBuffer, 189 | _In_ ULONG InBufferCb, 190 | _Out_writes_bytes_opt_(*OutBufferCb) PVOID OutBuffer, 191 | _Inout_ ULONG * OutBufferCb 192 | ) 193 | { 194 | NTSTATUS status = STATUS_SUCCESS; 195 | BOOL fNewValue = FALSE; 196 | PVOID currentValue; 197 | PVOID inBuffer = NULL; 198 | ULONG inBufferCb = 0; 199 | 200 | PAUDIOMODULE2_CONTEXT ctx = (PAUDIOMODULE2_CONTEXT)Context; 201 | AUDIOMODULE_PARAMETER_INFO * parameterInfo = NULL; 202 | AUDIOMODULE2_CUSTOM_COMMAND * command = NULL; 203 | 204 | PAGED_CODE(); 205 | 206 | if (ctx == NULL) 207 | { 208 | ASSERT(FALSE); // this should not happen. 209 | status = STATUS_INTERNAL_ERROR; 210 | goto exit; 211 | } 212 | 213 | // 214 | // Basic parameter validation (module specific). 215 | // 216 | if (InBuffer == NULL || InBufferCb == 0) 217 | { 218 | return STATUS_INVALID_PARAMETER; 219 | } 220 | 221 | if (InBufferCb < sizeof(AUDIOMODULE2_CUSTOM_COMMAND)) 222 | { 223 | return STATUS_INVALID_PARAMETER; 224 | } 225 | 226 | command = (AUDIOMODULE2_CUSTOM_COMMAND*)InBuffer; 227 | 228 | // 229 | // Validate the parameter referenced in the command. 230 | // 231 | switch (command->ParameterId) 232 | { 233 | case AudioModule2Parameter1: 234 | currentValue = &ctx->Parameter1; 235 | parameterInfo = &AudioModule2_ParameterInfo[AudioModule0Parameter1]; 236 | break; 237 | 238 | case AudioModule2Parameter2: 239 | currentValue = &ctx->Parameter2; 240 | parameterInfo = &AudioModule2_ParameterInfo[AudioModule2Parameter2]; 241 | break; 242 | 243 | default: 244 | status = STATUS_INVALID_PARAMETER; 245 | goto exit; 246 | } 247 | 248 | // 249 | // Update input buffer ptr/size. 250 | // 251 | inBuffer = (PVOID)((ULONG_PTR)InBuffer + sizeof(AUDIOMODULE2_CUSTOM_COMMAND)); 252 | inBufferCb = InBufferCb - sizeof(AUDIOMODULE2_CUSTOM_COMMAND); 253 | 254 | if (inBufferCb == 0) 255 | { 256 | inBuffer = NULL; 257 | } 258 | 259 | status = AudioModule_GenericHandler( 260 | command->Verb, 261 | command->ParameterId, 262 | parameterInfo, 263 | currentValue, 264 | inBuffer, 265 | inBufferCb, 266 | OutBuffer, 267 | OutBufferCb, 268 | &fNewValue); 269 | 270 | if (!NT_SUCCESS(status)) 271 | { 272 | goto exit; 273 | } 274 | 275 | if (fNewValue && ctx->PortNotifications && 276 | (parameterInfo->Flags & AUDIOMODULE_PARAMETER_FLAG_CHANGE_NOTIFICATION)) 277 | { 278 | // This logic assumes that access to this function is serialized. 279 | ctx->Notification.CustomNotification.Type = AudioModule2ParameterChanged; 280 | ctx->Notification.CustomNotification.ParameterChanged.ParameterId = 281 | command->ParameterId; 282 | 283 | AudioModule_SendNotification(ctx->PortNotifications, 284 | (PVOID)&ctx->Notification, 285 | (USHORT)sizeof(ctx->Notification)); 286 | } 287 | 288 | // Normalize error code. 289 | status = STATUS_SUCCESS; 290 | 291 | exit: 292 | return status; 293 | } 294 | 295 | #endif // _SYSVAD_AUDIOMODULE2_H_ 296 | 297 | -------------------------------------------------------------------------------- /EndpointsCommon/AudioModuleHelper.h: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) Microsoft Corporation All Rights Reserved 4 | 5 | Module Name: 6 | 7 | AudioModuleHelper.h 8 | 9 | Abstract: 10 | 11 | Simple helper for Audio Modules logic. 12 | 13 | --*/ 14 | 15 | #ifndef _SYSVAD_AUDIOMODULEHELPER_H_ 16 | #define _SYSVAD_AUDIOMODULEHELPER_H_ 17 | 18 | // 19 | // Module helper functions. 20 | // 21 | #pragma code_seg("PAGE") 22 | NTSTATUS 23 | AudioModule_GenericHandler_BasicSupport( 24 | _In_ PAUDIOMODULE_PARAMETER_INFO ParameterInfo, 25 | _Out_writes_bytes_opt_(*BufferCb) PVOID Buffer, 26 | _Inout_ ULONG * BufferCb 27 | ); 28 | 29 | #pragma code_seg("PAGE") 30 | BOOLEAN 31 | IsAudioModuleParameterValid( 32 | _In_ PAUDIOMODULE_PARAMETER_INFO ParameterInfo, 33 | _In_reads_bytes_opt_(BufferCb) PVOID Buffer, 34 | _In_ ULONG BufferCb 35 | ); 36 | 37 | #pragma code_seg("PAGE") 38 | AUDIOMODULE * 39 | AudioModule_FindModuleInList( 40 | _In_ AUDIOMODULE * AudioModules, 41 | _In_ ULONG AudioModuleCount, 42 | _In_ GUID * ClassId, 43 | _In_ ULONG InstanceId 44 | ); 45 | 46 | #pragma code_seg("PAGE") 47 | NTSTATUS 48 | AudioModule_GenericHandler( 49 | _In_ ULONG Verb, 50 | _In_ ULONG ParameterId, 51 | _In_ PAUDIOMODULE_PARAMETER_INFO ParameterInfo, 52 | _Inout_updates_bytes_(ParameterInfo->Size) PVOID CurrentValue, 53 | _In_reads_bytes_opt_(InBufferCb) PVOID InBuffer, 54 | _In_ ULONG InBufferCb, 55 | _Out_writes_bytes_opt_(*OutBufferCb) PVOID OutBuffer, 56 | _Inout_ ULONG * OutBufferCb, 57 | _In_ BOOL * ParameterChanged 58 | ); 59 | 60 | // 61 | // Miniport/Stream helper functions. 62 | // 63 | #pragma code_seg("PAGE") 64 | NTSTATUS 65 | AudioModule_GenericHandler_ModulesListRequest( 66 | _In_ PPCPROPERTY_REQUEST PropertyRequest, 67 | _In_ AUDIOMODULE * AudioModules, 68 | _In_ ULONG AudioModuleCount 69 | ); 70 | 71 | #pragma code_seg("PAGE") 72 | NTSTATUS 73 | AudioModule_GenericHandler_ModuleCommand( 74 | _In_ PPCPROPERTY_REQUEST PropertyRequest, 75 | _In_ AUDIOMODULE * AudioModules, 76 | _In_ ULONG AudioModuleCount 77 | ); 78 | 79 | #pragma code_seg("PAGE") 80 | NTSTATUS 81 | AudioModule_GenericHandler_ModuleNotificationDeviceId( 82 | _In_ PPCPROPERTY_REQUEST PropertyRequest, 83 | _In_ const GUID * NotificationDeviceId 84 | ); 85 | 86 | #pragma code_seg("PAGE") 87 | VOID 88 | AudioModule_SendNotification( 89 | _In_ PPORTCLSNOTIFICATIONS PortNotifications, 90 | _In_ PVOID NotificationBuffer, 91 | _In_ USHORT NotificationBufferCb 92 | ); 93 | #endif // _SYSVAD_AUDIOMODULEHELPER_H_ 94 | 95 | 96 | -------------------------------------------------------------------------------- /EndpointsCommon/EndpointsCommon.vcxproj.Filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx;* 6 | {CDBBEDA3-98E9-4C7A-BDB1-25EC47D0B087} 7 | 8 | 9 | h;hpp;hxx;hm;inl;inc;xsd 10 | {FA3DF57E-BA19-4783-831B-CF9D4D594F70} 11 | 12 | 13 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms;man;xml 14 | {CB830E4F-01DA-4D35-9789-E7DB0D02A79C} 15 | 16 | 17 | inf;inv;inx;mof;mc; 18 | {49F92783-3B39-4D0C-A153-8C346F754749} 19 | 20 | 21 | 22 | 23 | Source Files 24 | 25 | 26 | 27 | 28 | Header Files 29 | 30 | 31 | -------------------------------------------------------------------------------- /EndpointsCommon/MiniportAudioEngineNode.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amanison/OpenAudioCable/107b2ae7fc1377c6b67cdb1910e3d4fe1d34e189/EndpointsCommon/MiniportAudioEngineNode.cpp -------------------------------------------------------------------------------- /EndpointsCommon/NewDelete.cpp: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * NewDelete.cpp - CPP placement new and delete operators implementation 3 | ***************************************************************************** 4 | * Copyright (c) Microsoft Corporation All Rights Reserved 5 | * 6 | * Module Name: 7 | * 8 | * NewDelete.cpp 9 | * 10 | * Abstract: 11 | * 12 | * Definition of placement new and delete operators. 13 | * 14 | */ 15 | 16 | #ifdef _NEW_DELETE_OPERATORS_ 17 | #ifdef __cplusplus 18 | extern "C" { 19 | #include 20 | } 21 | #else 22 | #include 23 | #endif 24 | 25 | #include "newDelete.h" 26 | #include "sysvad.h" 27 | 28 | #pragma code_seg() 29 | /***************************************************************************** 30 | * Functions 31 | */ 32 | 33 | /***************************************************************************** 34 | * ::new() 35 | ***************************************************************************** 36 | * New function for creating objects with a specified allocation tag. 37 | */ 38 | PVOID operator new 39 | ( 40 | size_t iSize, 41 | _When_((poolType & NonPagedPoolMustSucceed) != 0, 42 | __drv_reportError("Must succeed pool allocations are forbidden. " 43 | "Allocation failures cause a system crash")) 44 | POOL_TYPE poolType, 45 | ULONG tag 46 | ) 47 | { 48 | PVOID result = ExAllocatePoolWithTag(poolType, iSize, tag); 49 | 50 | if (result) 51 | { 52 | RtlZeroMemory(result, iSize); 53 | } 54 | 55 | return result; 56 | } 57 | 58 | 59 | /***************************************************************************** 60 | * ::new() 61 | ***************************************************************************** 62 | * New function for creating objects with a specified allocation tag. 63 | */ 64 | PVOID operator new 65 | ( 66 | size_t iSize, 67 | _When_((poolType & NonPagedPoolMustSucceed) != 0, 68 | __drv_reportError("Must succeed pool allocations are forbidden. " 69 | "Allocation failures cause a system crash")) 70 | POOL_TYPE poolType 71 | ) 72 | { 73 | PVOID result = ExAllocatePoolWithTag(poolType, iSize, SYSVAD_POOLTAG); 74 | 75 | if (result) 76 | { 77 | RtlZeroMemory(result, iSize); 78 | } 79 | 80 | return result; 81 | } 82 | 83 | 84 | /***************************************************************************** 85 | * ::delete() 86 | ***************************************************************************** 87 | * Delete with tag function. 88 | */ 89 | void __cdecl operator delete 90 | ( 91 | PVOID pVoid, 92 | ULONG tag 93 | ) 94 | { 95 | if (pVoid) 96 | { 97 | ExFreePoolWithTag(pVoid, tag); 98 | } 99 | } 100 | 101 | 102 | /***************************************************************************** 103 | * ::delete() 104 | ***************************************************************************** 105 | * Sized Delete function. 106 | */ 107 | void __cdecl operator delete 108 | ( 109 | _Pre_maybenull_ __drv_freesMem(Mem) PVOID pVoid, 110 | _In_ size_t cbSize 111 | ) 112 | { 113 | UNREFERENCED_PARAMETER(cbSize); 114 | 115 | if (pVoid) 116 | { 117 | ExFreePoolWithTag(pVoid, SYSVAD_POOLTAG); 118 | } 119 | } 120 | 121 | 122 | /***************************************************************************** 123 | * ::delete() 124 | ***************************************************************************** 125 | * Sized Array Delete function. 126 | */ 127 | void __cdecl operator delete[] 128 | ( 129 | _Pre_maybenull_ __drv_freesMem(Mem) PVOID pVoid, 130 | _In_ size_t cbSize 131 | ) 132 | { 133 | UNREFERENCED_PARAMETER(cbSize); 134 | 135 | if (pVoid) 136 | { 137 | ExFreePoolWithTag(pVoid, SYSVAD_POOLTAG); 138 | } 139 | } 140 | 141 | 142 | /***************************************************************************** 143 | * ::delete() 144 | ***************************************************************************** 145 | * Array Delete function. 146 | */ 147 | void __cdecl operator delete[] 148 | ( 149 | _Pre_maybenull_ __drv_freesMem(Mem) PVOID pVoid 150 | ) 151 | { 152 | if (pVoid) 153 | { 154 | ExFreePoolWithTag(pVoid, SYSVAD_POOLTAG); 155 | } 156 | } 157 | #endif//_NEW_DELETE_OPERATORS_ 158 | -------------------------------------------------------------------------------- /EndpointsCommon/NewDelete.h: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) Microsoft Corporation All Rights Reserved 4 | 5 | Module Name: 6 | 7 | NewDelete.h 8 | 9 | Abstract: 10 | 11 | Declaration of placement new and delete operators. 12 | 13 | 14 | --*/ 15 | #pragma once 16 | 17 | #ifdef _NEW_DELETE_OPERATORS_ 18 | 19 | /***************************************************************************** 20 | * Functions 21 | */ 22 | 23 | /***************************************************************************** 24 | * ::new() 25 | ***************************************************************************** 26 | * New function for creating objects with a specified allocation tag and 27 | * pool type 28 | */ 29 | PVOID operator new 30 | ( 31 | size_t iSize, 32 | _When_((poolType & NonPagedPoolMustSucceed) != 0, 33 | __drv_reportError("Must succeed pool allocations are forbidden. " 34 | "Allocation failures cause a system crash")) 35 | POOL_TYPE poolType, 36 | ULONG tag 37 | ); 38 | 39 | 40 | /***************************************************************************** 41 | * ::new() 42 | ***************************************************************************** 43 | * New function for creating objects with a specified pool type. 44 | */ 45 | PVOID operator new 46 | ( 47 | size_t iSize, 48 | _When_((poolType & NonPagedPoolMustSucceed) != 0, 49 | __drv_reportError("Must succeed pool allocations are forbidden. " 50 | "Allocation failures cause a system crash")) 51 | POOL_TYPE poolType 52 | ); 53 | 54 | 55 | /***************************************************************************** 56 | * ::delete() 57 | ***************************************************************************** 58 | * Delete with tag function. 59 | */ 60 | void __cdecl operator delete 61 | ( 62 | PVOID pVoid, 63 | ULONG tag 64 | ); 65 | 66 | 67 | /***************************************************************************** 68 | * ::delete() 69 | ***************************************************************************** 70 | * Sized Delete function. 71 | */ 72 | void __cdecl operator delete 73 | ( 74 | _Pre_maybenull_ __drv_freesMem(Mem) PVOID pVoid, 75 | _In_ size_t cbSize 76 | ); 77 | 78 | 79 | /***************************************************************************** 80 | * ::delete() 81 | ***************************************************************************** 82 | * Basic Delete function. 83 | */ 84 | void __cdecl operator delete 85 | ( 86 | PVOID pVoid 87 | ); 88 | 89 | 90 | /***************************************************************************** 91 | * ::delete() 92 | ***************************************************************************** 93 | * Sized Array Delete function. 94 | */ 95 | void __cdecl operator delete[] 96 | ( 97 | _Pre_maybenull_ __drv_freesMem(Mem) PVOID pVoid, 98 | _In_ size_t cbSize 99 | ); 100 | 101 | 102 | /***************************************************************************** 103 | * ::delete() 104 | ***************************************************************************** 105 | * Array Delete function. 106 | */ 107 | void __cdecl operator delete[] 108 | ( 109 | _Pre_maybenull_ __drv_freesMem(Mem) PVOID pVoid 110 | ); 111 | 112 | #endif//_NEW_DELETE_OPERATORS_ 113 | 114 | -------------------------------------------------------------------------------- /EndpointsCommon/UsbHsDeviceFormats.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------- 2 | // 3 | // Formats 4 | // This reflects the Data formats of the hardware mixer output 5 | // Hardware vendor should retrieve these formats from the hardware and use to figure 6 | // out an intersection with the sideband data-range 7 | // 8 | // Defines a data structure containing the KSDATAFORMAT_WAVEFORMATEXTENSIBLE 9 | // structure for Audio Driver to build data range intersection 10 | // 11 | // NOTE: This is defined here because of the dependencies on the ks headers 12 | //---------------------------------------------------------------------------- 13 | 14 | static 15 | KSDATAFORMAT_WAVEFORMATEXTENSIBLE UsbHsSpeakerSupportedDeviceFormats[] = 16 | { 17 | { // 0 18 | { 19 | sizeof(KSDATAFORMAT_WAVEFORMATEXTENSIBLE), 20 | 0, 21 | 0, 22 | 0, 23 | STATICGUIDOF(KSDATAFORMAT_TYPE_AUDIO), 24 | STATICGUIDOF(KSDATAFORMAT_SUBTYPE_PCM), 25 | STATICGUIDOF(KSDATAFORMAT_SPECIFIER_WAVEFORMATEX) 26 | }, 27 | { 28 | { 29 | WAVE_FORMAT_EXTENSIBLE, 30 | 2, 31 | 44100, 32 | 176400, 33 | 4, 34 | 16, 35 | sizeof(WAVEFORMATEXTENSIBLE) - sizeof(WAVEFORMATEX) 36 | }, 37 | 16, 38 | KSAUDIO_SPEAKER_STEREO, 39 | STATICGUIDOF(KSDATAFORMAT_SUBTYPE_PCM) 40 | } 41 | }, 42 | { // 1 43 | { 44 | sizeof(KSDATAFORMAT_WAVEFORMATEXTENSIBLE), 45 | 0, 46 | 0, 47 | 0, 48 | STATICGUIDOF(KSDATAFORMAT_TYPE_AUDIO), 49 | STATICGUIDOF(KSDATAFORMAT_SUBTYPE_PCM), 50 | STATICGUIDOF(KSDATAFORMAT_SPECIFIER_WAVEFORMATEX) 51 | }, 52 | { 53 | { 54 | WAVE_FORMAT_EXTENSIBLE, 55 | 1, 56 | 44100, 57 | 88200, 58 | 2, 59 | 16, 60 | sizeof(WAVEFORMATEXTENSIBLE) - sizeof(WAVEFORMATEX) 61 | }, 62 | 16, 63 | KSAUDIO_SPEAKER_MONO, 64 | STATICGUIDOF(KSDATAFORMAT_SUBTYPE_PCM) 65 | } 66 | }, 67 | { // 2 68 | { 69 | sizeof(KSDATAFORMAT_WAVEFORMATEXTENSIBLE), 70 | 0, 71 | 0, 72 | 0, 73 | STATICGUIDOF(KSDATAFORMAT_TYPE_AUDIO), 74 | STATICGUIDOF(KSDATAFORMAT_SUBTYPE_PCM), 75 | STATICGUIDOF(KSDATAFORMAT_SPECIFIER_WAVEFORMATEX) 76 | }, 77 | { 78 | { 79 | WAVE_FORMAT_EXTENSIBLE, 80 | 2, 81 | 48000, 82 | 192000, 83 | 4, 84 | 16, 85 | sizeof(WAVEFORMATEXTENSIBLE) - sizeof(WAVEFORMATEX) 86 | }, 87 | 16, 88 | KSAUDIO_SPEAKER_STEREO, 89 | STATICGUIDOF(KSDATAFORMAT_SUBTYPE_PCM) 90 | } 91 | }, 92 | { // 3 93 | { 94 | sizeof(KSDATAFORMAT_WAVEFORMATEXTENSIBLE), 95 | 0, 96 | 0, 97 | 0, 98 | STATICGUIDOF(KSDATAFORMAT_TYPE_AUDIO), 99 | STATICGUIDOF(KSDATAFORMAT_SUBTYPE_PCM), 100 | STATICGUIDOF(KSDATAFORMAT_SPECIFIER_WAVEFORMATEX) 101 | }, 102 | { 103 | { 104 | WAVE_FORMAT_EXTENSIBLE, 105 | 1, 106 | 48000, 107 | 96000, 108 | 2, 109 | 16, 110 | sizeof(WAVEFORMATEXTENSIBLE) - sizeof(WAVEFORMATEX) 111 | }, 112 | 16, 113 | KSAUDIO_SPEAKER_MONO, 114 | STATICGUIDOF(KSDATAFORMAT_SUBTYPE_PCM) 115 | } 116 | }, 117 | { // 4 118 | { 119 | sizeof(KSDATAFORMAT_WAVEFORMATEXTENSIBLE), 120 | 0, 121 | 0, 122 | 0, 123 | STATICGUIDOF(KSDATAFORMAT_TYPE_AUDIO), 124 | STATICGUIDOF(KSDATAFORMAT_SUBTYPE_PCM), 125 | STATICGUIDOF(KSDATAFORMAT_SPECIFIER_WAVEFORMATEX) 126 | }, 127 | { 128 | { 129 | WAVE_FORMAT_EXTENSIBLE, 130 | 2, 131 | 48000, 132 | 288000, 133 | 6, 134 | 24, 135 | sizeof(WAVEFORMATEXTENSIBLE) - sizeof(WAVEFORMATEX) 136 | }, 137 | 24, 138 | KSAUDIO_SPEAKER_STEREO, 139 | STATICGUIDOF(KSDATAFORMAT_SUBTYPE_PCM) 140 | } 141 | } 142 | }; 143 | 144 | static 145 | KSDATAFORMAT_WAVEFORMATEXTENSIBLE UsbHsMicSupportedDeviceFormats[] = 146 | { 147 | { // 0 148 | { 149 | sizeof(KSDATAFORMAT_WAVEFORMATEXTENSIBLE), 150 | 0, 151 | 0, 152 | 0, 153 | STATICGUIDOF(KSDATAFORMAT_TYPE_AUDIO), 154 | STATICGUIDOF(KSDATAFORMAT_SUBTYPE_PCM), 155 | STATICGUIDOF(KSDATAFORMAT_SPECIFIER_WAVEFORMATEX) 156 | }, 157 | { 158 | { 159 | WAVE_FORMAT_EXTENSIBLE, 160 | 2, 161 | 44100, 162 | 176400, 163 | 4, 164 | 16, 165 | sizeof(WAVEFORMATEXTENSIBLE) - sizeof(WAVEFORMATEX) 166 | }, 167 | 16, 168 | KSAUDIO_SPEAKER_STEREO, 169 | STATICGUIDOF(KSDATAFORMAT_SUBTYPE_PCM) 170 | } 171 | }, 172 | { // 1 173 | { 174 | sizeof(KSDATAFORMAT_WAVEFORMATEXTENSIBLE), 175 | 0, 176 | 0, 177 | 0, 178 | STATICGUIDOF(KSDATAFORMAT_TYPE_AUDIO), 179 | STATICGUIDOF(KSDATAFORMAT_SUBTYPE_PCM), 180 | STATICGUIDOF(KSDATAFORMAT_SPECIFIER_WAVEFORMATEX) 181 | }, 182 | { 183 | { 184 | WAVE_FORMAT_EXTENSIBLE, 185 | 1, 186 | 44100, 187 | 88200, 188 | 2, 189 | 16, 190 | sizeof(WAVEFORMATEXTENSIBLE) - sizeof(WAVEFORMATEX) 191 | }, 192 | 16, 193 | KSAUDIO_SPEAKER_MONO, 194 | STATICGUIDOF(KSDATAFORMAT_SUBTYPE_PCM) 195 | } 196 | }, 197 | { // 2 198 | { 199 | sizeof(KSDATAFORMAT_WAVEFORMATEXTENSIBLE), 200 | 0, 201 | 0, 202 | 0, 203 | STATICGUIDOF(KSDATAFORMAT_TYPE_AUDIO), 204 | STATICGUIDOF(KSDATAFORMAT_SUBTYPE_PCM), 205 | STATICGUIDOF(KSDATAFORMAT_SPECIFIER_WAVEFORMATEX) 206 | }, 207 | { 208 | { 209 | WAVE_FORMAT_EXTENSIBLE, 210 | 2, 211 | 48000, 212 | 192000, 213 | 4, 214 | 16, 215 | sizeof(WAVEFORMATEXTENSIBLE) - sizeof(WAVEFORMATEX) 216 | }, 217 | 16, 218 | KSAUDIO_SPEAKER_STEREO, 219 | STATICGUIDOF(KSDATAFORMAT_SUBTYPE_PCM) 220 | } 221 | }, 222 | { // 3 223 | { 224 | sizeof(KSDATAFORMAT_WAVEFORMATEXTENSIBLE), 225 | 0, 226 | 0, 227 | 0, 228 | STATICGUIDOF(KSDATAFORMAT_TYPE_AUDIO), 229 | STATICGUIDOF(KSDATAFORMAT_SUBTYPE_PCM), 230 | STATICGUIDOF(KSDATAFORMAT_SPECIFIER_WAVEFORMATEX) 231 | }, 232 | { 233 | { 234 | WAVE_FORMAT_EXTENSIBLE, 235 | 1, 236 | 48000, 237 | 96000, 238 | 2, 239 | 16, 240 | sizeof(WAVEFORMATEXTENSIBLE) - sizeof(WAVEFORMATEX) 241 | }, 242 | 16, 243 | KSAUDIO_SPEAKER_MONO, 244 | STATICGUIDOF(KSDATAFORMAT_SUBTYPE_PCM) 245 | } 246 | }, 247 | { // 4 248 | { 249 | sizeof(KSDATAFORMAT_WAVEFORMATEXTENSIBLE), 250 | 0, 251 | 0, 252 | 0, 253 | STATICGUIDOF(KSDATAFORMAT_TYPE_AUDIO), 254 | STATICGUIDOF(KSDATAFORMAT_SUBTYPE_PCM), 255 | STATICGUIDOF(KSDATAFORMAT_SPECIFIER_WAVEFORMATEX) 256 | }, 257 | { 258 | { 259 | WAVE_FORMAT_EXTENSIBLE, 260 | 2, 261 | 48000, 262 | 288000, 263 | 6, 264 | 24, 265 | sizeof(WAVEFORMATEXTENSIBLE) - sizeof(WAVEFORMATEX) 266 | }, 267 | 24, 268 | KSAUDIO_SPEAKER_STEREO, 269 | STATICGUIDOF(KSDATAFORMAT_SUBTYPE_PCM) 270 | } 271 | } 272 | }; 273 | -------------------------------------------------------------------------------- /EndpointsCommon/bthhfpmictopo.cpp: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) Microsoft Corporation All Rights Reserved 4 | 5 | Module Name: 6 | 7 | bthhfpmictopo.cpp 8 | 9 | Abstract: 10 | 11 | Implementation of topology miniport for the mic (external: headphone). 12 | 13 | --*/ 14 | #ifdef SYSVAD_BTH_BYPASS 15 | 16 | #pragma warning (disable : 4127) 17 | 18 | #include 19 | #include "simple.h" 20 | #include "mintopo.h" 21 | #include "bthhfptopo.h" 22 | #include "bthhfpmictopo.h" 23 | #include "bthhfpmictoptable.h" 24 | 25 | //============================================================================= 26 | #pragma code_seg("PAGE") 27 | NTSTATUS 28 | PropertyHandler_BthHfpMicTopoFilter 29 | ( 30 | _In_ PPCPROPERTY_REQUEST PropertyRequest 31 | ) 32 | /*++ 33 | 34 | Routine Description: 35 | 36 | Redirects property request to miniport object 37 | 38 | Arguments: 39 | 40 | PropertyRequest - 41 | 42 | Return Value: 43 | 44 | NT status code. 45 | 46 | --*/ 47 | { 48 | PAGED_CODE(); 49 | 50 | ASSERT(PropertyRequest); 51 | 52 | DPF_ENTER(("[PropertyHandler_BthHfpMicTopoFilter]")); 53 | 54 | // PropertryRequest structure is filled by portcls. 55 | // MajorTarget is a pointer to miniport object for miniports. 56 | // 57 | NTSTATUS ntStatus = STATUS_INVALID_DEVICE_REQUEST; 58 | 59 | // 60 | // This line shows how to get a pointer to the miniport topology object. 61 | // 62 | PCMiniportTopology pMiniport = (PCMiniportTopology)PropertyRequest->MajorTarget; 63 | UNREFERENCED_VAR(pMiniport); 64 | 65 | if (IsEqualGUIDAligned(*PropertyRequest->PropertyItem->Set, KSPROPSETID_Jack)) 66 | { 67 | switch(PropertyRequest->PropertyItem->Id) 68 | { 69 | case KSPROPERTY_JACK_DESCRIPTION: 70 | ntStatus = PropertyHandler_BthHfpJackDescription( 71 | PropertyRequest, 72 | ARRAYSIZE(BthHfpMicJackDescriptions), 73 | BthHfpMicJackDescriptions); 74 | break; 75 | 76 | case KSPROPERTY_JACK_DESCRIPTION2: 77 | ntStatus = PropertyHandler_BthHfpJackDescription2( 78 | PropertyRequest, 79 | ARRAYSIZE(BthHfpMicJackDescriptions), 80 | BthHfpMicJackDescriptions); 81 | break; 82 | 83 | case KSPROPERTY_JACK_CONTAINERID: 84 | ntStatus = PropertyHandler_BthHfpJackContainerId( 85 | PropertyRequest, 86 | ARRAYSIZE(BthHfpMicJackDescriptions), 87 | BthHfpMicJackDescriptions); 88 | break; 89 | } 90 | } 91 | else if (IsEqualGUIDAligned(*PropertyRequest->PropertyItem->Set, KSPROPSETID_BtAudio)) 92 | { 93 | switch(PropertyRequest->PropertyItem->Id) 94 | { 95 | case KSPROPERTY_ONESHOT_RECONNECT: 96 | ntStatus = PropertyHandler_BthHfpOneShotReconnect(PropertyRequest); 97 | break; 98 | 99 | case KSPROPERTY_ONESHOT_DISCONNECT: 100 | ntStatus = PropertyHandler_BthHfpOneDisconnect(PropertyRequest); 101 | break; 102 | } 103 | } 104 | 105 | return ntStatus; 106 | } // PropertyHandler_BthHfpMicTopoFilter 107 | 108 | //============================================================================= 109 | #pragma code_seg("PAGE") 110 | NTSTATUS 111 | PropertyHandler_BthHfpMicVolumeLevel 112 | ( 113 | _In_ PPCPROPERTY_REQUEST PropertyRequest 114 | ) 115 | /*++ 116 | 117 | Routine Description: 118 | 119 | Handles ( KSPROPSETID_Audio, KSPROPERTY_AUDIO_VOLUMELEVEL ) 120 | 121 | Arguments: 122 | 123 | PropertyRequest - 124 | 125 | Return Value: 126 | 127 | NT status code. 128 | 129 | --*/ 130 | { 131 | PAGED_CODE(); 132 | 133 | ASSERT(PropertyRequest); 134 | 135 | DPF_ENTER(("[PropertyHandler_BthHfpMicVolumeLevel]")); 136 | 137 | NTSTATUS ntStatus = STATUS_INVALID_DEVICE_REQUEST; 138 | PCMiniportTopology miniport = (PCMiniportTopology)PropertyRequest->MajorTarget; 139 | PSIDEBANDDEVICECOMMON bthHfpDevice = NULL; 140 | ULONG channel = (ULONG)-1; 141 | 142 | bthHfpDevice = miniport->GetSidebandDevice(); // weak ref. 143 | ASSERT(bthHfpDevice != NULL); 144 | 145 | if (bthHfpDevice->IsVolumeSupported(miniport->m_DeviceType) == FALSE) 146 | { 147 | ntStatus = miniport->PropertyHandlerGeneric(PropertyRequest); 148 | } 149 | else if (PropertyRequest->Verb & KSPROPERTY_TYPE_BASICSUPPORT) 150 | { 151 | ntStatus = PropertyHandler_BthHfpVolumeLevel_BasicSupport(PropertyRequest); 152 | } 153 | else if (PropertyRequest->InstanceSize >= sizeof(ULONG)) 154 | { 155 | // Instance is the channel #, Bluetooth HFP supports mono streams. 156 | channel = *(PULONG(PropertyRequest->Instance)); 157 | 158 | if (channel == 0) 159 | { 160 | ULONG cbNeeded = sizeof(LONG); 161 | 162 | if (PropertyRequest->ValueSize == 0) 163 | { 164 | PropertyRequest->ValueSize = cbNeeded; 165 | ntStatus = STATUS_BUFFER_OVERFLOW; 166 | } 167 | else if (PropertyRequest->ValueSize < cbNeeded) 168 | { 169 | ntStatus = STATUS_BUFFER_TOO_SMALL; 170 | } 171 | else 172 | { 173 | LONG* volume = (LONG*)PropertyRequest->Value; 174 | 175 | if (PropertyRequest->Verb & KSPROPERTY_TYPE_GET) 176 | { 177 | ntStatus = bthHfpDevice->GetVolume(eBthHfpMicDevice, channel, volume); 178 | } 179 | else if (PropertyRequest->Verb & KSPROPERTY_TYPE_SET) 180 | { 181 | ntStatus = bthHfpDevice->SetVolume(eBthHfpMicDevice, *volume, channel); 182 | } 183 | } 184 | } 185 | } 186 | 187 | return ntStatus; 188 | } 189 | 190 | //============================================================================= 191 | #pragma code_seg("PAGE") 192 | NTSTATUS 193 | PropertyHandler_BthHfpMicTopoNode 194 | ( 195 | _In_ PPCPROPERTY_REQUEST PropertyRequest 196 | ) 197 | /*++ 198 | 199 | Routine Description: 200 | 201 | Redirects property request to miniport object 202 | 203 | Arguments: 204 | 205 | PropertyRequest - 206 | 207 | Return Value: 208 | 209 | NT status code. 210 | 211 | --*/ 212 | { 213 | PAGED_CODE(); 214 | 215 | ASSERT(PropertyRequest); 216 | 217 | DPF_ENTER(("[PropertyHandler_BthHfpMicTopoNode]")); 218 | 219 | // PropertryRequest structure is filled by portcls. 220 | // MajorTarget is a pointer to miniport object for miniports. 221 | // 222 | NTSTATUS ntStatus = STATUS_INVALID_DEVICE_REQUEST; 223 | 224 | // 225 | // This line shows how to get a pointer to the miniport topology object. 226 | // 227 | PCMiniportTopology pMiniport = (PCMiniportTopology)PropertyRequest->MajorTarget; 228 | UNREFERENCED_VAR(pMiniport); 229 | 230 | if (IsEqualGUIDAligned(*PropertyRequest->PropertyItem->Set, KSPROPSETID_Audio)) 231 | { 232 | if (PropertyRequest->PropertyItem->Id == KSPROPERTY_AUDIO_VOLUMELEVEL) 233 | { 234 | ntStatus = PropertyHandler_BthHfpMicVolumeLevel(PropertyRequest); 235 | } 236 | } 237 | 238 | return ntStatus; 239 | } // PropertyHandler_BthHfpMicTopoFilter 240 | 241 | //============================================================================= 242 | #pragma code_seg() 243 | NTSTATUS 244 | PropertyHandler_BthHfpMicTopoNodeEvent 245 | ( 246 | _In_ PPCEVENT_REQUEST EventRequest 247 | ) 248 | { 249 | ASSERT(EventRequest); 250 | 251 | DPF_ENTER(("[PropertyHandler_BthHfpMicTopoNodeEvent]")); 252 | 253 | // Validate the node. 254 | if (EventRequest->Node != KSNODE_TOPO_VOLUME) 255 | return STATUS_INVALID_PARAMETER; 256 | 257 | return PropertyHandler_BthHfpTopoNodeEvent(EventRequest); 258 | } 259 | 260 | //============================================================================= 261 | #pragma code_seg() 262 | NTSTATUS 263 | PropertyHandler_BthHfpMicTopoFilterEvent 264 | ( 265 | _In_ PPCEVENT_REQUEST EventRequest 266 | ) 267 | { 268 | ASSERT(EventRequest); 269 | 270 | DPF_ENTER(("[PropertyHandler_BthHfpMicTopoFilterEvent]")); 271 | 272 | return PropertyHandler_BthHfpTopoNodeEvent(EventRequest); 273 | } 274 | 275 | #pragma code_seg() 276 | #endif // SYSVAD_BTH_BYPASS 277 | 278 | 279 | 280 | -------------------------------------------------------------------------------- /EndpointsCommon/bthhfpmictopo.h: -------------------------------------------------------------------------------- 1 | 2 | /*++ 3 | 4 | Copyright (c) Microsoft Corporation All Rights Reserved 5 | 6 | Module Name: 7 | 8 | bthhfpmictopo.h 9 | 10 | Abstract: 11 | 12 | Declaration of topology miniport for the mic (external: headphone). 13 | 14 | --*/ 15 | 16 | #ifndef _SYSVAD_BTHHFPMICTOPO_H_ 17 | #define _SYSVAD_BTHHFPMICTOPO_H_ 18 | 19 | // Function declarations. 20 | NTSTATUS 21 | PropertyHandler_BthHfpMicTopoFilter( 22 | _In_ PPCPROPERTY_REQUEST PropertyRequest 23 | ); 24 | 25 | NTSTATUS 26 | PropertyHandler_BthHfpMicTopoNode( 27 | _In_ PPCPROPERTY_REQUEST PropertyRequest 28 | ); 29 | 30 | NTSTATUS 31 | PropertyHandler_BthHfpMicTopoNodeEvent( 32 | _In_ PPCEVENT_REQUEST EventRequest 33 | ); 34 | 35 | NTSTATUS 36 | PropertyHandler_BthHfpMicTopoFilterEvent( 37 | _In_ PPCEVENT_REQUEST EventRequest 38 | ); 39 | 40 | #endif // _SYSVAD_BTHHFPMICTOPO_H_ 41 | 42 | -------------------------------------------------------------------------------- /EndpointsCommon/bthhfpminwavert.cpp: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) Microsoft Corporation All Rights Reserved 4 | 5 | Module Name: 6 | 7 | bthhfpminwavert.cpp 8 | 9 | Abstract: 10 | 11 | Implementation of wavert miniport. 12 | 13 | --*/ 14 | #ifdef SYSVAD_BTH_BYPASS 15 | 16 | #pragma warning (disable : 4127) 17 | 18 | #include 19 | #include 20 | #include "simple.h" 21 | #include "minwavert.h" 22 | #include "minwavertstream.h" 23 | #include "IHVPrivatePropertySet.h" 24 | 25 | 26 | //============================================================================= 27 | #pragma code_seg("PAGE") 28 | NTSTATUS 29 | CMiniportWaveRT::PropertyHandler_BthHfpAudioEffectsDiscoveryEffectsList 30 | ( 31 | _In_ PPCPROPERTY_REQUEST PropertyRequest 32 | ) 33 | /*++ 34 | 35 | Routine Description: 36 | 37 | Handles ( KSPROPSETID_AudioEffectsDiscovery, KSPROPERTY_AUDIOEFFECTSDISCOVERY_EFFECTSLIST ) 38 | 39 | Arguments: 40 | 41 | PropertyRequest - 42 | 43 | Return Value: 44 | 45 | NT status code. 46 | 47 | --*/ 48 | { 49 | PAGED_CODE(); 50 | 51 | DPF_ENTER(("[PropertyHandler_BthHfpAudioEffectsDiscoveryEffectsList]")); 52 | 53 | NTSTATUS ntStatus = STATUS_INVALID_PARAMETER; 54 | ULONG nPinId = (ULONG)-1; 55 | 56 | // 57 | // Validate Pin ID. 58 | // 59 | if (PropertyRequest->InstanceSize >= sizeof(ULONG)) 60 | { 61 | nPinId = *(PULONG(PropertyRequest->Instance)); 62 | 63 | // This prop is valid only on streaming pins. 64 | if (IsSystemRenderPin(nPinId) || IsSystemCapturePin(nPinId)) 65 | { 66 | ntStatus = STATUS_SUCCESS; 67 | } 68 | else if (IsBridgePin(nPinId) || 69 | IsLoopbackPin(nPinId) || 70 | IsOffloadPin(nPinId)) 71 | { 72 | ntStatus = STATUS_NOT_SUPPORTED; 73 | } 74 | } 75 | 76 | IF_FAILED_JUMP(ntStatus, Done); 77 | 78 | // 79 | // Valid actions: get and basicsupport. 80 | // 81 | ntStatus = STATUS_INVALID_PARAMETER; 82 | 83 | if (PropertyRequest->Verb & KSPROPERTY_TYPE_BASICSUPPORT) 84 | { 85 | ntStatus = 86 | PropertyHandler_BasicSupport 87 | ( 88 | PropertyRequest, 89 | KSPROPERTY_TYPE_BASICSUPPORT | KSPROPERTY_TYPE_GET, 90 | VT_ILLEGAL 91 | ); 92 | } 93 | else if (PropertyRequest->Verb & KSPROPERTY_TYPE_GET) 94 | { 95 | ASSERT(m_pSidebandDevice != NULL); 96 | 97 | // 98 | // bSidebandNrecPresent is set to TRUE when the HF (remote device) handles NR + EC. 99 | // Note that GetNRECDisableStatus() returns TRUE if the HF notified the AG to disable 100 | // the NR + EC locally. 101 | // 102 | BOOL bSidebandNrecPresent = m_pSidebandDevice->IsNRECSupported() && m_pSidebandDevice->GetNRECDisableStatus(); 103 | 104 | // If it is HFP render pin (data flow in) or if the NR-EC is not supported, 105 | // return size 0 effect list 106 | if (IsSystemRenderPin(nPinId) || !bSidebandNrecPresent) 107 | { 108 | PropertyRequest->ValueSize = 0; 109 | ntStatus = STATUS_SUCCESS; 110 | } 111 | else 112 | { 113 | // Compute total size, two effects: NS and EC (see below). 114 | ULONG cbMinSize = sizeof(GUID) * 2; 115 | 116 | if (PropertyRequest->ValueSize == 0) 117 | { 118 | PropertyRequest->ValueSize = cbMinSize; 119 | ntStatus = STATUS_BUFFER_OVERFLOW; 120 | } 121 | else if (PropertyRequest->ValueSize < cbMinSize) 122 | { 123 | ntStatus = STATUS_BUFFER_TOO_SMALL; 124 | } 125 | else 126 | { 127 | PGUID effectList = PGUID(PropertyRequest->Value); 128 | 129 | *effectList = AUDIO_EFFECT_TYPE_ACOUSTIC_ECHO_CANCELLATION; 130 | *(effectList + 1) = AUDIO_EFFECT_TYPE_NOISE_SUPPRESSION; 131 | 132 | PropertyRequest->ValueSize = cbMinSize; 133 | ntStatus = STATUS_SUCCESS; 134 | } 135 | } 136 | } 137 | 138 | Done: 139 | 140 | return ntStatus; 141 | } 142 | 143 | //============================================================================= 144 | #pragma code_seg("PAGE") 145 | NTSTATUS 146 | PropertyHandler_BthHfpWaveFilter 147 | ( 148 | _In_ PPCPROPERTY_REQUEST PropertyRequest 149 | ) 150 | /*++ 151 | 152 | Routine Description: 153 | 154 | Redirects general property request to miniport object 155 | 156 | Arguments: 157 | 158 | PropertyRequest - 159 | 160 | Return Value: 161 | 162 | NT status code. 163 | 164 | --*/ 165 | { 166 | PAGED_CODE(); 167 | 168 | NTSTATUS ntStatus = STATUS_INVALID_DEVICE_REQUEST; 169 | CMiniportWaveRT* waveRt = reinterpret_cast(PropertyRequest->MajorTarget); 170 | 171 | if (waveRt == NULL) 172 | { 173 | return STATUS_INVALID_PARAMETER; 174 | } 175 | 176 | waveRt->AddRef(); 177 | 178 | if (IsEqualGUIDAligned(*PropertyRequest->PropertyItem->Set, KSPROPSETID_Pin)) 179 | { 180 | switch (PropertyRequest->PropertyItem->Id) 181 | { 182 | case KSPROPERTY_PIN_PROPOSEDATAFORMAT: 183 | ntStatus = waveRt->PropertyHandlerProposedFormat(PropertyRequest); 184 | break; 185 | 186 | case KSPROPERTY_PIN_PROPOSEDATAFORMAT2: 187 | ntStatus = waveRt->PropertyHandlerProposedFormat2(PropertyRequest); 188 | break; 189 | 190 | default: 191 | DPF(D_TERSE, ("[PropertyHandler_BthHfpWaveFilter: Invalid Device Request]")); 192 | } 193 | } 194 | else if (IsEqualGUIDAligned(*PropertyRequest->PropertyItem->Set, KSPROPSETID_AudioEffectsDiscovery)) 195 | { 196 | switch(PropertyRequest->PropertyItem->Id) 197 | { 198 | case KSPROPERTY_AUDIOEFFECTSDISCOVERY_EFFECTSLIST: 199 | ntStatus = waveRt->PropertyHandler_BthHfpAudioEffectsDiscoveryEffectsList(PropertyRequest); 200 | break; 201 | 202 | default: 203 | DPF(D_TERSE, ("[PropertyHandler_BthHfpWaveFilter: Invalid Device Request]")); 204 | } 205 | } 206 | 207 | waveRt->Release(); 208 | 209 | return ntStatus; 210 | } // PropertyHandler_BthHfpWaveFilter 211 | 212 | #pragma code_seg("PAGE") 213 | #endif // SYSVAD_BTH_BYPASS 214 | 215 | 216 | 217 | 218 | -------------------------------------------------------------------------------- /EndpointsCommon/bthhfpspeakertopo.cpp: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) Microsoft Corporation All Rights Reserved 4 | 5 | Module Name: 6 | 7 | bthhfpspeakertopo.cpp 8 | 9 | Abstract: 10 | 11 | Implementation of topology miniport for the Bluetooth Hands-Free Profile speaker (external). 12 | 13 | --*/ 14 | #ifdef SYSVAD_BTH_BYPASS 15 | 16 | #pragma warning (disable : 4127) 17 | 18 | #include 19 | #include "simple.h" 20 | #include "mintopo.h" 21 | #include "bthhfptopo.h" 22 | #include "bthhfpspeakertopo.h" 23 | #include "bthhfpspeakertoptable.h" 24 | 25 | //============================================================================= 26 | #pragma code_seg("PAGE") 27 | NTSTATUS 28 | PropertyHandler_BthHfpSpeakerTopoFilter 29 | ( 30 | _In_ PPCPROPERTY_REQUEST PropertyRequest 31 | ) 32 | /*++ 33 | 34 | Routine Description: 35 | 36 | Redirects property request to miniport object 37 | 38 | Arguments: 39 | 40 | PropertyRequest - 41 | 42 | Return Value: 43 | 44 | NT status code. 45 | 46 | --*/ 47 | { 48 | PAGED_CODE(); 49 | 50 | ASSERT(PropertyRequest); 51 | 52 | DPF_ENTER(("[PropertyHandler_BthHfpSpeakerTopoFilter]")); 53 | 54 | // PropertryRequest structure is filled by portcls. 55 | // MajorTarget is a pointer to miniport object for miniports. 56 | // 57 | NTSTATUS ntStatus = STATUS_INVALID_DEVICE_REQUEST; 58 | 59 | // 60 | // This line shows how to get a pointer to the miniport topology object. 61 | // 62 | PCMiniportTopology pMiniport = (PCMiniportTopology)PropertyRequest->MajorTarget; 63 | UNREFERENCED_VAR(pMiniport); 64 | 65 | if (IsEqualGUIDAligned(*PropertyRequest->PropertyItem->Set, KSPROPSETID_Jack)) 66 | { 67 | switch(PropertyRequest->PropertyItem->Id) 68 | { 69 | case KSPROPERTY_JACK_DESCRIPTION: 70 | ntStatus = PropertyHandler_BthHfpJackDescription( 71 | PropertyRequest, 72 | ARRAYSIZE(BthHfpSpeakerJackDescriptions), 73 | BthHfpSpeakerJackDescriptions); 74 | break; 75 | 76 | case KSPROPERTY_JACK_DESCRIPTION2: 77 | ntStatus = PropertyHandler_BthHfpJackDescription2( 78 | PropertyRequest, 79 | ARRAYSIZE(BthHfpSpeakerJackDescriptions), 80 | BthHfpSpeakerJackDescriptions); 81 | break; 82 | 83 | case KSPROPERTY_JACK_CONTAINERID: 84 | ntStatus = PropertyHandler_BthHfpJackContainerId( 85 | PropertyRequest, 86 | ARRAYSIZE(BthHfpSpeakerJackDescriptions), 87 | BthHfpSpeakerJackDescriptions); 88 | break; 89 | } 90 | } 91 | else if (IsEqualGUIDAligned(*PropertyRequest->PropertyItem->Set, KSPROPSETID_BtAudio)) 92 | { 93 | switch(PropertyRequest->PropertyItem->Id) 94 | { 95 | case KSPROPERTY_ONESHOT_RECONNECT: 96 | ntStatus = PropertyHandler_BthHfpOneShotReconnect(PropertyRequest); 97 | break; 98 | 99 | case KSPROPERTY_ONESHOT_DISCONNECT: 100 | ntStatus = PropertyHandler_BthHfpOneDisconnect(PropertyRequest); 101 | break; 102 | } 103 | } 104 | 105 | return ntStatus; 106 | } // PropertyHandler_BthHfpSpeakerTopoFilter 107 | 108 | //============================================================================= 109 | #pragma code_seg("PAGE") 110 | NTSTATUS 111 | PropertyHandler_BthHfpSpeakerVolumeLevel 112 | ( 113 | _In_ PPCPROPERTY_REQUEST PropertyRequest 114 | ) 115 | /*++ 116 | 117 | Routine Description: 118 | 119 | Handles ( KSPROPSETID_Audio, KSPROPERTY_AUDIO_VOLUMELEVEL ) 120 | 121 | Arguments: 122 | 123 | PropertyRequest - 124 | 125 | Return Value: 126 | 127 | NT status code. 128 | 129 | --*/ 130 | { 131 | PAGED_CODE(); 132 | 133 | ASSERT(PropertyRequest); 134 | 135 | DPF_ENTER(("[PropertyHandler_BthHfpSpeakerVolumeLevel]")); 136 | 137 | NTSTATUS ntStatus = STATUS_INVALID_DEVICE_REQUEST; 138 | PCMiniportTopology miniport = (PCMiniportTopology)PropertyRequest->MajorTarget; 139 | PSIDEBANDDEVICECOMMON bthHfpDevice = NULL; 140 | ULONG channel = (ULONG)-1; 141 | 142 | bthHfpDevice = miniport->GetSidebandDevice(); // weak ref. 143 | ASSERT(bthHfpDevice != NULL); 144 | 145 | if (bthHfpDevice->IsVolumeSupported(miniport->m_DeviceType) == FALSE) 146 | { 147 | ntStatus = miniport->PropertyHandlerGeneric(PropertyRequest); 148 | } 149 | else if (PropertyRequest->Verb & KSPROPERTY_TYPE_BASICSUPPORT) 150 | { 151 | ntStatus = PropertyHandler_BthHfpVolumeLevel_BasicSupport(PropertyRequest); 152 | } 153 | else if (PropertyRequest->InstanceSize >= sizeof(ULONG)) 154 | { 155 | // Instance is the channel #, Bluetooth HFP supports mono streams. 156 | channel = *(PULONG(PropertyRequest->Instance)); 157 | 158 | if (channel == 0) 159 | { 160 | ULONG cbNeeded = sizeof(LONG); 161 | 162 | if (PropertyRequest->ValueSize == 0) 163 | { 164 | PropertyRequest->ValueSize = cbNeeded; 165 | ntStatus = STATUS_BUFFER_OVERFLOW; 166 | } 167 | else if (PropertyRequest->ValueSize < cbNeeded) 168 | { 169 | ntStatus = STATUS_BUFFER_TOO_SMALL; 170 | } 171 | else 172 | { 173 | LONG* volume = (LONG*)PropertyRequest->Value; 174 | 175 | if (PropertyRequest->Verb & KSPROPERTY_TYPE_GET) 176 | { 177 | ntStatus = bthHfpDevice->GetVolume(eBthHfpSpeakerDevice, channel, volume); 178 | } 179 | else if (PropertyRequest->Verb & KSPROPERTY_TYPE_SET) 180 | { 181 | ntStatus = bthHfpDevice->SetVolume(eBthHfpSpeakerDevice, *volume, channel); 182 | } 183 | } 184 | } 185 | } 186 | 187 | return ntStatus; 188 | } 189 | 190 | //============================================================================= 191 | #pragma code_seg("PAGE") 192 | NTSTATUS 193 | PropertyHandler_BthHfpSpeakerTopoNode 194 | ( 195 | _In_ PPCPROPERTY_REQUEST PropertyRequest 196 | ) 197 | /*++ 198 | 199 | Routine Description: 200 | 201 | Redirects property request to miniport object 202 | 203 | Arguments: 204 | 205 | PropertyRequest - 206 | 207 | Return Value: 208 | 209 | NT status code. 210 | 211 | --*/ 212 | { 213 | PAGED_CODE(); 214 | 215 | ASSERT(PropertyRequest); 216 | 217 | DPF_ENTER(("[PropertyHandler_BthHfpSpeakerTopoNode]")); 218 | 219 | // PropertryRequest structure is filled by portcls. 220 | // MajorTarget is a pointer to miniport object for miniports. 221 | // 222 | NTSTATUS ntStatus = STATUS_INVALID_DEVICE_REQUEST; 223 | 224 | // 225 | // This line shows how to get a pointer to the miniport topology object. 226 | // 227 | PCMiniportTopology pMiniport = (PCMiniportTopology)PropertyRequest->MajorTarget; 228 | UNREFERENCED_VAR(pMiniport); 229 | 230 | if (IsEqualGUIDAligned(*PropertyRequest->PropertyItem->Set, KSPROPSETID_Audio)) 231 | { 232 | if (PropertyRequest->PropertyItem->Id == KSPROPERTY_AUDIO_VOLUMELEVEL) 233 | { 234 | ntStatus = PropertyHandler_BthHfpSpeakerVolumeLevel(PropertyRequest); 235 | } 236 | } 237 | 238 | return ntStatus; 239 | } // PropertyHandler_BthHfpSpeakerTopoFilter 240 | 241 | //============================================================================= 242 | #pragma code_seg() 243 | NTSTATUS 244 | PropertyHandler_BthHfpSpeakerTopoNodeEvent 245 | ( 246 | _In_ PPCEVENT_REQUEST EventRequest 247 | ) 248 | { 249 | ASSERT(EventRequest); 250 | 251 | DPF_ENTER(("[PropertyHandler_BthHfpSpeakerTopoNodeEvent]")); 252 | 253 | // Validate the node. 254 | if (EventRequest->Node != KSNODE_TOPO_VOLUME) 255 | return STATUS_INVALID_PARAMETER; 256 | 257 | return PropertyHandler_BthHfpTopoNodeEvent(EventRequest); 258 | } 259 | 260 | //============================================================================= 261 | #pragma code_seg() 262 | NTSTATUS 263 | PropertyHandler_BthHfpSpeakerTopoFilterEvent 264 | ( 265 | _In_ PPCEVENT_REQUEST EventRequest 266 | ) 267 | { 268 | ASSERT(EventRequest); 269 | 270 | DPF_ENTER(("[PropertyHandler_BthHfpSpeakerTopoFilterEvent]")); 271 | 272 | return PropertyHandler_BthHfpTopoNodeEvent(EventRequest); 273 | } 274 | 275 | #pragma code_seg() 276 | #endif // SYSVAD_BTH_BYPASS 277 | 278 | 279 | 280 | -------------------------------------------------------------------------------- /EndpointsCommon/bthhfpspeakertopo.h: -------------------------------------------------------------------------------- 1 | 2 | /*++ 3 | 4 | Copyright (c) Microsoft Corporation All Rights Reserved 5 | 6 | Module Name: 7 | 8 | bthhfpspeakertopo.h 9 | 10 | Abstract: 11 | 12 | Declaration of topology miniport for the Bluetooth Hands-Free Profile speaker (external). 13 | 14 | --*/ 15 | 16 | #ifndef _SYSVAD_BTHHFPSPEAKERTOPO_H_ 17 | #define _SYSVAD_BTHHFPSPEAKERTOPO_H_ 18 | 19 | // Function declarations. 20 | NTSTATUS 21 | PropertyHandler_BthHfpSpeakerTopoFilter( 22 | _In_ PPCPROPERTY_REQUEST PropertyRequest 23 | ); 24 | 25 | NTSTATUS 26 | PropertyHandler_BthHfpSpeakerTopoNode( 27 | _In_ PPCPROPERTY_REQUEST PropertyRequest 28 | ); 29 | 30 | NTSTATUS 31 | PropertyHandler_BthHfpSpeakerTopoNodeEvent( 32 | _In_ PPCEVENT_REQUEST EventRequest 33 | ); 34 | 35 | NTSTATUS 36 | PropertyHandler_BthHfpSpeakerTopoFilterEvent( 37 | _In_ PPCEVENT_REQUEST EventRequest 38 | ); 39 | 40 | #endif // _SYSVAD_BTHHFPSPEAKERTOPO_H_ 41 | 42 | -------------------------------------------------------------------------------- /EndpointsCommon/bthhfptopo.h: -------------------------------------------------------------------------------- 1 | 2 | /*++ 3 | 4 | Copyright (c) Microsoft Corporation All Rights Reserved 5 | 6 | Module Name: 7 | 8 | bthhfptopo.h 9 | 10 | Abstract: 11 | 12 | Declaration of topology miniport for the mic (external: headphone). 13 | 14 | --*/ 15 | 16 | #ifndef _SYSVAD_BTHHFPTOPO_H_ 17 | #define _SYSVAD_BTHHFPTOPO_H_ 18 | 19 | NTSTATUS 20 | PropertyHandler_BthHfpVolumeLevel_BasicSupport( 21 | _In_ PPCPROPERTY_REQUEST PropertyRequest 22 | ); 23 | 24 | NTSTATUS 25 | PropertyHandler_BthHfpJackDescription( 26 | _In_ PPCPROPERTY_REQUEST PropertyRequest, 27 | _In_ ULONG cJackDescriptions, 28 | _In_reads_(cJackDescriptions) PKSJACK_DESCRIPTION * JackDescriptions 29 | ); 30 | 31 | NTSTATUS 32 | PropertyHandler_BthHfpJackDescription2( 33 | _In_ PPCPROPERTY_REQUEST PropertyRequest, 34 | _In_ ULONG cJackDescriptions, 35 | _In_reads_(cJackDescriptions) PKSJACK_DESCRIPTION * JackDescriptions 36 | ); 37 | 38 | NTSTATUS 39 | PropertyHandler_BthHfpJackContainerId( 40 | _In_ PPCPROPERTY_REQUEST PropertyRequest, 41 | _In_ ULONG cJackDescriptions, 42 | _In_reads_(cJackDescriptions) PKSJACK_DESCRIPTION * JackDescriptions 43 | ); 44 | 45 | NTSTATUS 46 | PropertyHandler_BthHfpOneShotReconnect( 47 | _In_ PPCPROPERTY_REQUEST PropertyRequest 48 | ); 49 | 50 | NTSTATUS 51 | PropertyHandler_BthHfpOneDisconnect( 52 | _In_ PPCPROPERTY_REQUEST PropertyRequest 53 | ); 54 | 55 | NTSTATUS 56 | PropertyHandler_BthHfpTopoNodeEvent( 57 | _In_ PPCEVENT_REQUEST EventRequest 58 | ); 59 | 60 | #endif // _SYSVAD_BTHHFPTOPO_H_ 61 | 62 | -------------------------------------------------------------------------------- /EndpointsCommon/micarraytopo.h: -------------------------------------------------------------------------------- 1 | 2 | /*++ 3 | 4 | Copyright (c) Microsoft Corporation All Rights Reserved 5 | 6 | Module Name: 7 | 8 | micarraytopo.h 9 | 10 | Abstract: 11 | 12 | Declaration of mic array topology miniport. 13 | 14 | --*/ 15 | 16 | #ifndef _SYSVAD_MICARRAYTOPO_H_ 17 | #define _SYSVAD_MICARRAYTOPO_H_ 18 | 19 | #include "basetopo.h" 20 | 21 | //============================================================================= 22 | // Classes 23 | //============================================================================= 24 | 25 | /////////////////////////////////////////////////////////////////////////////// 26 | // CMicArrayMiniportTopology 27 | // 28 | 29 | class CMicArrayMiniportTopology : 30 | public CMiniportTopologySYSVAD, 31 | public IMiniportTopology, 32 | public CUnknown 33 | { 34 | public: 35 | DECLARE_STD_UNKNOWN(); 36 | CMicArrayMiniportTopology 37 | ( 38 | _In_opt_ PUNKNOWN UnknownOuter, 39 | _In_ PCFILTER_DESCRIPTOR *FilterDesc, 40 | _In_ USHORT DeviceMaxChannels, 41 | _In_ eDeviceType DeviceType 42 | ) 43 | : CUnknown(UnknownOuter), 44 | CMiniportTopologySYSVAD(FilterDesc, DeviceMaxChannels), 45 | m_DeviceType(DeviceType) 46 | { 47 | ASSERT(m_DeviceType == eMicArrayDevice1 || 48 | m_DeviceType == eMicArrayDevice2 || 49 | m_DeviceType == eMicArrayDevice3); 50 | } 51 | 52 | ~CMicArrayMiniportTopology(); 53 | 54 | IMP_IMiniportTopology; 55 | 56 | NTSTATUS PropertyHandlerMicArrayGeometry 57 | ( 58 | _In_ PPCPROPERTY_REQUEST PropertyRequest 59 | ); 60 | 61 | NTSTATUS PropertyHandlerMicProperties 62 | ( 63 | _In_ PPCPROPERTY_REQUEST PropertyRequest 64 | ); 65 | 66 | NTSTATUS PropertyHandlerJackDescription 67 | ( 68 | _In_ PPCPROPERTY_REQUEST PropertyRequest 69 | ); 70 | 71 | NTSTATUS PropertyHandlerJackDescription2 72 | ( 73 | _In_ PPCPROPERTY_REQUEST PropertyRequest 74 | ); 75 | 76 | protected: 77 | eDeviceType m_DeviceType; 78 | 79 | protected: 80 | bool IsFront() 81 | { 82 | return m_DeviceType == eMicArrayDevice1; 83 | } 84 | 85 | bool IsBack() 86 | { 87 | return m_DeviceType == eMicArrayDevice2; 88 | } 89 | 90 | bool IsCombined() 91 | { 92 | return m_DeviceType == eMicArrayDevice3; 93 | } 94 | }; 95 | 96 | typedef CMicArrayMiniportTopology *PCMicArrayMiniportTopology; 97 | 98 | 99 | NTSTATUS 100 | CreateMicArrayMiniportTopology( 101 | _Out_ PUNKNOWN * Unknown, 102 | _In_ REFCLSID, 103 | _In_opt_ PUNKNOWN UnknownOuter, 104 | _When_((PoolType & NonPagedPoolMustSucceed) != 0, 105 | __drv_reportError("Must succeed pool allocations are forbidden. " 106 | "Allocation failures cause a system crash")) 107 | _In_ POOL_TYPE PoolType, 108 | _In_ PUNKNOWN UnknownAdapter, 109 | _In_opt_ PVOID DeviceContext, 110 | _In_ PENDPOINT_MINIPAIR MiniportPair 111 | ); 112 | 113 | NTSTATUS PropertyHandler_MicArrayTopoFilter(_In_ PPCPROPERTY_REQUEST PropertyRequest); 114 | NTSTATUS PropertyHandler_MicArrayTopology(_In_ PPCPROPERTY_REQUEST PropertyRequest); 115 | 116 | #endif // _SYSVAD_MICARRAYTOPO_H_ 117 | 118 | -------------------------------------------------------------------------------- /EndpointsCommon/mintopo.h: -------------------------------------------------------------------------------- 1 | 2 | /*++ 3 | 4 | Copyright (c) Microsoft Corporation All Rights Reserved 5 | 6 | Module Name: 7 | 8 | minitopo.h 9 | 10 | Abstract: 11 | 12 | Declaration of topology miniport. 13 | 14 | --*/ 15 | 16 | #ifndef _SYSVAD_MINTOPO_H_ 17 | #define _SYSVAD_MINTOPO_H_ 18 | 19 | #include "basetopo.h" 20 | 21 | //============================================================================= 22 | // Classes 23 | //============================================================================= 24 | 25 | /////////////////////////////////////////////////////////////////////////////// 26 | // CMiniportTopology 27 | // 28 | 29 | class CMiniportTopology : 30 | public CMiniportTopologySYSVAD, 31 | public IMiniportTopology, 32 | public CUnknown 33 | { 34 | private: 35 | eDeviceType m_DeviceType; 36 | 37 | 38 | union { 39 | PVOID m_DeviceContext; 40 | #if defined(SYSVAD_BTH_BYPASS) || defined(SYSVAD_USB_SIDEBAND) 41 | PSIDEBANDDEVICECOMMON m_pSidebandDevice; 42 | #endif // defined(SYSVAD_BTH_BYPASS) || defined(SYSVAD_USB_SIDEBAND) 43 | }; 44 | 45 | public: 46 | DECLARE_STD_UNKNOWN(); 47 | CMiniportTopology 48 | ( 49 | _In_opt_ PUNKNOWN UnknownOuter, 50 | _In_ PCFILTER_DESCRIPTOR *FilterDesc, 51 | _In_ USHORT DeviceMaxChannels, 52 | _In_ eDeviceType DeviceType, 53 | _In_opt_ PVOID DeviceContext 54 | ) 55 | : CUnknown(UnknownOuter), 56 | CMiniportTopologySYSVAD(FilterDesc, DeviceMaxChannels), 57 | m_DeviceType(DeviceType), 58 | m_DeviceContext(DeviceContext) 59 | { 60 | 61 | #if defined(SYSVAD_BTH_BYPASS) || defined(SYSVAD_USB_SIDEBAND) 62 | if (IsSidebandDevice()) 63 | { 64 | if (m_pSidebandDevice != NULL) 65 | { 66 | // This ref is released on dtor. 67 | m_pSidebandDevice->AddRef(); // strong ref. 68 | } 69 | } 70 | #endif // defined(SYSVAD_BTH_BYPASS) || defined(SYSVAD_USB_SIDEBAND) 71 | } 72 | 73 | ~CMiniportTopology(); 74 | 75 | IMP_IMiniportTopology; 76 | 77 | NTSTATUS PropertyHandlerJackDescription 78 | ( 79 | _In_ PPCPROPERTY_REQUEST PropertyRequest, 80 | _In_ ULONG cJackDescriptions, 81 | _In_reads_(cJackDescriptions) PKSJACK_DESCRIPTION *JackDescriptions 82 | ); 83 | 84 | NTSTATUS PropertyHandlerJackDescription2 85 | ( 86 | _In_ PPCPROPERTY_REQUEST PropertyRequest, 87 | _In_ ULONG cJackDescriptions, 88 | _In_reads_(cJackDescriptions) PKSJACK_DESCRIPTION *JackDescriptions, 89 | _In_ DWORD JackCapabilities 90 | ); 91 | 92 | 93 | #if defined(SYSVAD_BTH_BYPASS) || defined(SYSVAD_USB_SIDEBAND) 94 | BOOL IsSidebandDevice() 95 | { 96 | return (m_DeviceType == eBthHfpMicDevice || 97 | m_DeviceType == eBthHfpSpeakerDevice || 98 | m_DeviceType == eUsbHsMicDevice || 99 | m_DeviceType == eUsbHsSpeakerDevice || 100 | m_DeviceType == eA2dpHpSpeakerDevice) ? TRUE : FALSE; 101 | } 102 | 103 | // Returns a weak ref to the Bluetooth HFP device. 104 | PSIDEBANDDEVICECOMMON GetSidebandDevice() 105 | { 106 | PSIDEBANDDEVICECOMMON sidebandDevice = NULL; 107 | 108 | if (IsSidebandDevice()) 109 | { 110 | if (m_pSidebandDevice != NULL) 111 | { 112 | sidebandDevice = m_pSidebandDevice; 113 | } 114 | } 115 | 116 | return sidebandDevice; 117 | } 118 | 119 | static 120 | VOID 121 | EvtSpeakerVolumeHandler 122 | ( 123 | _In_opt_ PVOID Context 124 | ); 125 | 126 | static 127 | VOID 128 | EvtSpeakerConnectionStatusHandler 129 | ( 130 | _In_opt_ PVOID Context 131 | ); 132 | 133 | static 134 | VOID 135 | EvtMicVolumeHandler 136 | ( 137 | _In_opt_ PVOID Context 138 | ); 139 | 140 | static 141 | VOID 142 | EvtMicConnectionStatusHandler 143 | ( 144 | _In_opt_ PVOID Context 145 | ); 146 | #endif // defined(SYSVAD_BTH_BYPASS) defined(SYSVAD_USB_SIDEBAND) 147 | 148 | PVOID GetDeviceContext() { return m_DeviceContext; } 149 | 150 | friend NTSTATUS PropertyHandler_BthHfpVolumeLevel_BasicSupport( 151 | _In_ PPCPROPERTY_REQUEST PropertyRequest); 152 | friend NTSTATUS PropertyHandler_BthHfpJackContainerId( 153 | _In_ PPCPROPERTY_REQUEST PropertyRequest, 154 | _In_ ULONG cJackDescriptions, 155 | _In_reads_(cJackDescriptions) PKSJACK_DESCRIPTION * JackDescriptions); 156 | friend NTSTATUS PropertyHandler_BthHfpMicVolumeLevel( 157 | _In_ PPCPROPERTY_REQUEST PropertyRequest); 158 | friend NTSTATUS PropertyHandler_BthHfpSpeakerVolumeLevel( 159 | _In_ PPCPROPERTY_REQUEST PropertyRequest); 160 | friend NTSTATUS PropertyHandler_UsbHsJackContainerId( 161 | _In_ PPCPROPERTY_REQUEST PropertyRequest, 162 | _In_ ULONG cJackDescriptions, 163 | _In_reads_(cJackDescriptions) PKSJACK_DESCRIPTION * JackDescriptions); 164 | friend NTSTATUS PropertyHandler_UsbHsVolumeLevel_BasicSupport( 165 | _In_ PPCPROPERTY_REQUEST PropertyRequest); 166 | friend NTSTATUS PropertyHandler_UsbHsMicVolumeLevel( 167 | _In_ PPCPROPERTY_REQUEST PropertyRequest); 168 | friend NTSTATUS PropertyHandler_UsbHsMute_BasicSupport( 169 | _In_ PPCPROPERTY_REQUEST PropertyRequest); 170 | friend NTSTATUS PropertyHandler_UsbHsMicMute( 171 | _In_ PPCPROPERTY_REQUEST PropertyRequest); 172 | friend NTSTATUS PropertyHandler_A2dpHpJackContainerId( 173 | _In_ PPCPROPERTY_REQUEST PropertyRequest, 174 | _In_ ULONG cJackDescriptions, 175 | _In_reads_(cJackDescriptions) PKSJACK_DESCRIPTION * JackDescriptions); 176 | friend NTSTATUS PropertyHandler_A2dpHpVolumeLevel_BasicSupport( 177 | _In_ PPCPROPERTY_REQUEST PropertyRequest); 178 | friend NTSTATUS PropertyHandler_A2dpHpMute_BasicSupport( 179 | _In_ PPCPROPERTY_REQUEST PropertyRequest); 180 | }; 181 | 182 | typedef CMiniportTopology *PCMiniportTopology; 183 | 184 | NTSTATUS CMiniportTopology_EventHandler_JackState 185 | ( 186 | _In_ PPCEVENT_REQUEST EventRequest 187 | ); 188 | 189 | #endif // _SYSVAD_MINTOPO_H_ 190 | 191 | 192 | -------------------------------------------------------------------------------- /EndpointsCommon/simple.h: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) Microsoft Corporation All Rights Reserved 4 | 5 | Module Name: 6 | 7 | simple.h 8 | 9 | Abstract: 10 | 11 | Node and Pin numbers and other common definitions for simple sample. 12 | 13 | --*/ 14 | 15 | #ifndef _SYSVAD_SIMPLE_H_ 16 | #define _SYSVAD_SIMPLE_H_ 17 | 18 | // Name Guid 19 | // {946A7B1A-EBBC-422a-A81F-F07C8D40D3B4} 20 | #define STATIC_NAME_SYSVAD_SIMPLE\ 21 | 0x946a7b1a, 0xebbc, 0x422a, 0xa8, 0x1f, 0xf0, 0x7c, 0x8d, 0x40, 0xd3, 0xb4 22 | DEFINE_GUIDSTRUCT("946A7B1A-EBBC-422a-A81F-F07C8D40D3B4", NAME_SYSVAD_SIMPLE); 23 | #define NAME_SYSVAD_SIMPLE DEFINE_GUIDNAMED(NAME_SYSVAD_SIMPLE) 24 | 25 | //---------------------------------------------------- 26 | // New defines for the render endpoints. 27 | //---------------------------------------------------- 28 | 29 | // Default pin instances. 30 | #define MAX_INPUT_SYSTEM_STREAMS 1 31 | #define MAX_INPUT_OFFLOAD_STREAMS 3 32 | #define MAX_OUTPUT_LOOPBACK_STREAMS 1 33 | 34 | // Wave pins - offloading supported. 35 | enum 36 | { 37 | KSPIN_WAVE_RENDER_SINK_SYSTEM = 0, 38 | KSPIN_WAVE_RENDER_SINK_OFFLOAD, 39 | KSPIN_WAVE_RENDER_SINK_LOOPBACK, 40 | KSPIN_WAVE_RENDER_SOURCE 41 | }; 42 | 43 | // Wave pins - no mix, no offload 44 | enum 45 | { 46 | KSPIN_WAVE_RENDER3_SINK_SYSTEM = 0, 47 | KSPIN_WAVE_RENDER3_SOURCE 48 | }; 49 | 50 | // Wave Topology nodes - offloading supported. 51 | enum 52 | { 53 | KSNODE_WAVE_AUDIO_ENGINE = 0 54 | }; 55 | 56 | // Wave pins - offloading is NOT supported. 57 | enum 58 | { 59 | KSPIN_WAVE_RENDER2_SINK_SYSTEM = 0, 60 | KSPIN_WAVE_RENDER2_SINK_LOOPBACK, 61 | KSPIN_WAVE_RENDER2_SOURCE 62 | }; 63 | 64 | // Wave pins - cellular 65 | enum 66 | { 67 | KSPIN_WAVE_BIDI = 0, 68 | KSPIN_WAVE_BIDI_BRIDGE 69 | }; 70 | 71 | // Wave Topology nodes - offloading is NOT supported. 72 | enum 73 | { 74 | KSNODE_WAVE_SUM = 0, 75 | KSNODE_WAVE_VOLUME, 76 | KSNODE_WAVE_MUTE, 77 | KSNODE_WAVE_PEAKMETER 78 | }; 79 | 80 | // Topology pins. 81 | enum 82 | { 83 | KSPIN_TOPO_WAVEOUT_SOURCE = 0, 84 | KSPIN_TOPO_LINEOUT_DEST, 85 | }; 86 | 87 | // Topology pins - cellular 88 | enum 89 | { 90 | KSPIN_TOPO_BIDI1 = 0, 91 | KSPIN_TOPO_BIDI1_BRIDGE, 92 | KSPIN_TOPO_BIDI2, 93 | KSPIN_TOPO_BIDI2_BRIDGE 94 | }; 95 | 96 | // Topology nodes. 97 | enum 98 | { 99 | KSNODE_TOPO_WAVEOUT_VOLUME = 0, 100 | KSNODE_TOPO_WAVEOUT_MUTE, 101 | KSNODE_TOPO_WAVEOUT_PEAKMETER 102 | }; 103 | 104 | //---------------------------------------------------- 105 | // New defines for the capture endpoints. 106 | //---------------------------------------------------- 107 | 108 | // Default pin instances. 109 | #define MAX_INPUT_STREAMS 1 // Number of capture streams. 110 | 111 | // Wave pins 112 | enum 113 | { 114 | KSPIN_WAVE_BRIDGE = 0, 115 | KSPIN_WAVEIN_HOST, 116 | KSPIN_WAVEIN_KEYWORD, 117 | }; 118 | 119 | // Wave pins - FM 120 | enum 121 | { 122 | KSPIN_WAVE_FMRX = 0, 123 | KSPIN_WAVE_FMRX_BRIDGE 124 | }; 125 | 126 | // Wave Topology nodes. 127 | enum 128 | { 129 | KSNODE_WAVE_ADC = 0 130 | }; 131 | 132 | // Wave Topology nodes. 133 | enum 134 | { 135 | KSNODE_WAVE_DAC = 0 136 | }; 137 | 138 | // topology pins. 139 | enum 140 | { 141 | KSPIN_TOPO_MIC_ELEMENTS, 142 | KSPIN_TOPO_BRIDGE 143 | }; 144 | 145 | // topology nodes. 146 | enum 147 | { 148 | KSNODE_TOPO_VOLUME, 149 | KSNODE_TOPO_MUTE, 150 | KSNODE_TOPO_PEAKMETER 151 | }; 152 | 153 | // Topology pins - FM 154 | enum 155 | { 156 | KSPIN_TOPO_FMRX, 157 | KSPIN_TOPO_FMRX_BRIDGE 158 | }; 159 | 160 | // data format attribute range definitions. 161 | static 162 | KSATTRIBUTE PinDataRangeSignalProcessingModeAttribute = 163 | { 164 | sizeof(KSATTRIBUTE), 165 | 0, 166 | STATICGUIDOF(KSATTRIBUTEID_AUDIOSIGNALPROCESSING_MODE), 167 | }; 168 | 169 | static 170 | PKSATTRIBUTE PinDataRangeAttributes[] = 171 | { 172 | &PinDataRangeSignalProcessingModeAttribute, 173 | }; 174 | 175 | static 176 | KSATTRIBUTE_LIST PinDataRangeAttributeList = 177 | { 178 | ARRAYSIZE(PinDataRangeAttributes), 179 | PinDataRangeAttributes, 180 | }; 181 | 182 | #endif // _SYSVAD_SIMPLE_H_ 183 | 184 | -------------------------------------------------------------------------------- /EndpointsCommon/speakerhptopo.h: -------------------------------------------------------------------------------- 1 | 2 | /*++ 3 | 4 | Copyright (c) Microsoft Corporation All Rights Reserved 5 | 6 | Module Name: 7 | 8 | speakerhptopo.h 9 | 10 | Abstract: 11 | 12 | Declaration of topology miniport for the speaker (external: headphone). 13 | 14 | --*/ 15 | 16 | #ifndef _SYSVAD_SPEAKERHPTOPO_H_ 17 | #define _SYSVAD_SPEAKERHPTOPO_H_ 18 | 19 | NTSTATUS PropertyHandler_SpeakerHpTopoFilter(_In_ PPCPROPERTY_REQUEST PropertyRequest); 20 | 21 | #endif // _SYSVAD_SPEAKERHPTOPO_H_ 22 | -------------------------------------------------------------------------------- /EndpointsCommon/speakerhptoptable.h: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) Microsoft Corporation All Rights Reserved 4 | 5 | Module Name: 6 | 7 | speakerhptoptable.h 8 | 9 | Abstract: 10 | 11 | Declaration of topology tables for the speaker (external: headphone). 12 | 13 | --*/ 14 | 15 | #ifndef _SYSVAD_SPEAKERHPTOPTABLE_H_ 16 | #define _SYSVAD_SPEAKERHPTOPTABLE_H_ 17 | 18 | #include 19 | 20 | //============================================================================= 21 | static 22 | KSJACK_DESCRIPTION SpeakerHpJackDesc = 23 | { 24 | KSAUDIO_SPEAKER_MONO, 25 | JACKDESC_RGB(179, 201, 140), 26 | eConnTypeCombination, 27 | eGeoLocRear, 28 | eGenLocPrimaryBox, 29 | ePortConnJack, 30 | TRUE 31 | }; 32 | 33 | //============================================================================= 34 | static 35 | KSDATARANGE SpeakerHpTopoPinDataRangesBridge[] = 36 | { 37 | { 38 | sizeof(KSDATARANGE), 39 | 0, 40 | 0, 41 | 0, 42 | STATICGUIDOF(KSDATAFORMAT_TYPE_AUDIO), 43 | STATICGUIDOF(KSDATAFORMAT_SUBTYPE_ANALOG), 44 | STATICGUIDOF(KSDATAFORMAT_SPECIFIER_NONE) 45 | } 46 | }; 47 | 48 | //============================================================================= 49 | static 50 | PKSDATARANGE SpeakerHpTopoPinDataRangePointersBridge[] = 51 | { 52 | &SpeakerHpTopoPinDataRangesBridge[0] 53 | }; 54 | 55 | //============================================================================= 56 | static 57 | PCPIN_DESCRIPTOR SpeakerHpTopoMiniportPins[] = 58 | { 59 | // KSPIN - topology filter in-pin 60 | { 61 | 0, 62 | 0, 63 | 0, // InstanceCount 64 | NULL, // AutomationTable 65 | { // KsPinDescriptor 66 | 0, // InterfacesCount 67 | NULL, // Interfaces 68 | 0, // MediumsCount 69 | NULL, // Mediums 70 | SIZEOF_ARRAY(SpeakerHpTopoPinDataRangePointersBridge),// DataRangesCount 71 | SpeakerHpTopoPinDataRangePointersBridge, // DataRanges 72 | KSPIN_DATAFLOW_IN, // DataFlow 73 | KSPIN_COMMUNICATION_NONE, // Communication 74 | &KSCATEGORY_AUDIO, // Category 75 | NULL, // Name 76 | 0 // Reserved 77 | } 78 | }, 79 | // KSPIN - topology filter out-pin 80 | { 81 | 0, 82 | 0, 83 | 0, // InstanceCount 84 | NULL, // AutomationTable 85 | { // KsPinDescriptor 86 | 0, // InterfacesCount 87 | NULL, // Interfaces 88 | 0, // MediumsCount 89 | NULL, // Mediums 90 | SIZEOF_ARRAY(SpeakerHpTopoPinDataRangePointersBridge),// DataRangesCount 91 | SpeakerHpTopoPinDataRangePointersBridge, // DataRanges 92 | KSPIN_DATAFLOW_OUT, // DataFlow 93 | KSPIN_COMMUNICATION_NONE, // Communication 94 | &KSNODETYPE_HEADPHONES, // Category 95 | NULL, // Name 96 | 0 // Reserved 97 | } 98 | } 99 | }; 100 | 101 | //============================================================================= 102 | // Only return a KSJACK_DESCRIPTION for the physical bridge pin. 103 | static 104 | PKSJACK_DESCRIPTION SpeakerHpJackDescriptions[] = 105 | { 106 | NULL, 107 | &SpeakerHpJackDesc 108 | }; 109 | 110 | //============================================================================= 111 | static 112 | PCCONNECTION_DESCRIPTOR SpeakerHpTopoMiniportConnections[] = 113 | { 114 | // FromNode, FromPin, ToNode, ToPin 115 | { PCFILTER_NODE, KSPIN_TOPO_WAVEOUT_SOURCE, PCFILTER_NODE, KSPIN_TOPO_LINEOUT_DEST} 116 | }; 117 | 118 | 119 | //============================================================================= 120 | static 121 | PCPROPERTY_ITEM PropertiesSpeakerHpTopoFilter[] = 122 | { 123 | { 124 | &KSPROPSETID_Jack, 125 | KSPROPERTY_JACK_DESCRIPTION, 126 | KSPROPERTY_TYPE_GET | KSPROPERTY_TYPE_BASICSUPPORT, 127 | PropertyHandler_SpeakerHpTopoFilter 128 | }, 129 | { 130 | &KSPROPSETID_Jack, 131 | KSPROPERTY_JACK_DESCRIPTION2, 132 | KSPROPERTY_TYPE_GET | KSPROPERTY_TYPE_BASICSUPPORT, 133 | PropertyHandler_SpeakerHpTopoFilter 134 | } 135 | }; 136 | 137 | static PCEVENT_ITEM SpeakerHpJackInfoChangeEvent[] = 138 | { 139 | { 140 | &KSEVENTSETID_PinCapsChange, // Something changed 141 | KSEVENT_PINCAPS_JACKINFOCHANGE, // Jack Info Changes 142 | KSEVENT_TYPE_ENABLE | KSEVENT_TYPE_BASICSUPPORT, 143 | CMiniportTopology_EventHandler_JackState 144 | } 145 | }; 146 | 147 | DEFINE_PCAUTOMATION_TABLE_PROP_EVENT(AutomationSpeakerHpTopoFilter, PropertiesSpeakerHpTopoFilter, SpeakerHpJackInfoChangeEvent); 148 | 149 | //============================================================================= 150 | static 151 | PCFILTER_DESCRIPTOR SpeakerHpTopoMiniportFilterDescriptor = 152 | { 153 | 0, // Version 154 | &AutomationSpeakerHpTopoFilter, // AutomationTable 155 | sizeof(PCPIN_DESCRIPTOR), // PinSize 156 | SIZEOF_ARRAY(SpeakerHpTopoMiniportPins), // PinCount 157 | SpeakerHpTopoMiniportPins, // Pins 158 | sizeof(PCNODE_DESCRIPTOR), // NodeSize 159 | 0, // NodeCount 160 | NULL, // Nodes 161 | SIZEOF_ARRAY(SpeakerHpTopoMiniportConnections), // ConnectionCount 162 | SpeakerHpTopoMiniportConnections, // Connections 163 | 0, // CategoryCount 164 | NULL // Categories 165 | }; 166 | 167 | #endif // _SYSVAD_SPEAKERHPTOPTABLE_H_ 168 | 169 | 170 | -------------------------------------------------------------------------------- /EndpointsCommon/speakertopo.cpp: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) Microsoft Corporation All Rights Reserved 4 | 5 | Module Name: 6 | 7 | speakertopo.cpp 8 | 9 | Abstract: 10 | 11 | Implementation of topology miniport for the speaker (internal). 12 | 13 | --*/ 14 | 15 | #pragma warning (disable : 4127) 16 | 17 | #include 18 | #include "simple.h" 19 | #include "mintopo.h" 20 | #include "speakertopo.h" 21 | #include "speakertoptable.h" 22 | 23 | 24 | #pragma code_seg("PAGE") 25 | //============================================================================= 26 | NTSTATUS 27 | PropertyHandler_SpeakerTopoFilter 28 | ( 29 | _In_ PPCPROPERTY_REQUEST PropertyRequest 30 | ) 31 | /*++ 32 | 33 | Routine Description: 34 | 35 | Redirects property request to miniport object 36 | 37 | Arguments: 38 | 39 | PropertyRequest - 40 | 41 | Return Value: 42 | 43 | NT status code. 44 | 45 | --*/ 46 | { 47 | PAGED_CODE(); 48 | 49 | ASSERT(PropertyRequest); 50 | 51 | DPF_ENTER(("[PropertyHandler_SpeakerTopoFilter]")); 52 | 53 | // PropertryRequest structure is filled by portcls. 54 | // MajorTarget is a pointer to miniport object for miniports. 55 | // 56 | NTSTATUS ntStatus = STATUS_INVALID_DEVICE_REQUEST; 57 | PCMiniportTopology pMiniport = (PCMiniportTopology)PropertyRequest->MajorTarget; 58 | 59 | if (IsEqualGUIDAligned(*PropertyRequest->PropertyItem->Set, KSPROPSETID_Jack)) 60 | { 61 | if (PropertyRequest->PropertyItem->Id == KSPROPERTY_JACK_DESCRIPTION) 62 | { 63 | ntStatus = pMiniport->PropertyHandlerJackDescription( 64 | PropertyRequest, 65 | ARRAYSIZE(SpeakerJackDescriptions), 66 | SpeakerJackDescriptions 67 | ); 68 | } 69 | else if (PropertyRequest->PropertyItem->Id == KSPROPERTY_JACK_DESCRIPTION2) 70 | { 71 | ntStatus = pMiniport->PropertyHandlerJackDescription2( 72 | PropertyRequest, 73 | ARRAYSIZE(SpeakerJackDescriptions), 74 | SpeakerJackDescriptions, 75 | 0 // jack capabilities 76 | ); 77 | } 78 | } 79 | 80 | return ntStatus; 81 | } // PropertyHandler_SpeakerTopoFilter 82 | 83 | #pragma code_seg() 84 | 85 | -------------------------------------------------------------------------------- /EndpointsCommon/speakertopo.h: -------------------------------------------------------------------------------- 1 | 2 | /*++ 3 | 4 | Copyright (c) Microsoft Corporation All Rights Reserved 5 | 6 | Module Name: 7 | 8 | speakertopo.h 9 | 10 | Abstract: 11 | 12 | Declaration of topology miniport for the speaker (internal). 13 | 14 | --*/ 15 | 16 | #ifndef _SYSVAD_SPEAKERTOPO_H_ 17 | #define _SYSVAD_SPEAKERTOPO_H_ 18 | 19 | NTSTATUS PropertyHandler_SpeakerTopoFilter(_In_ PPCPROPERTY_REQUEST PropertyRequest); 20 | 21 | #endif // _SYSVAD_SPEAKERTOPO_H_ 22 | -------------------------------------------------------------------------------- /EndpointsCommon/speakertoptable.h: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) Microsoft Corporation All Rights Reserved 4 | 5 | Module Name: 6 | 7 | speakertoptable.h 8 | 9 | Abstract: 10 | 11 | Declaration of topology tables. 12 | 13 | --*/ 14 | 15 | #ifndef _SYSVAD_SPEAKERTOPTABLE_H_ 16 | #define _SYSVAD_SPEAKERTOPTABLE_H_ 17 | 18 | //============================================================================= 19 | static 20 | KSDATARANGE SpeakerTopoPinDataRangesBridge[] = 21 | { 22 | { 23 | sizeof(KSDATARANGE), 24 | 0, 25 | 0, 26 | 0, 27 | STATICGUIDOF(KSDATAFORMAT_TYPE_AUDIO), 28 | STATICGUIDOF(KSDATAFORMAT_SUBTYPE_ANALOG), 29 | STATICGUIDOF(KSDATAFORMAT_SPECIFIER_NONE) 30 | } 31 | }; 32 | 33 | //============================================================================= 34 | static 35 | PKSDATARANGE SpeakerTopoPinDataRangePointersBridge[] = 36 | { 37 | &SpeakerTopoPinDataRangesBridge[0] 38 | }; 39 | 40 | //============================================================================= 41 | static 42 | PCPIN_DESCRIPTOR SpeakerTopoMiniportPins[] = 43 | { 44 | // KSPIN_TOPO_WAVEOUT_SOURCE 45 | { 46 | 0, 47 | 0, 48 | 0, // InstanceCount 49 | NULL, // AutomationTable 50 | { // KsPinDescriptor 51 | 0, // InterfacesCount 52 | NULL, // Interfaces 53 | 0, // MediumsCount 54 | NULL, // Mediums 55 | SIZEOF_ARRAY(SpeakerTopoPinDataRangePointersBridge),// DataRangesCount 56 | SpeakerTopoPinDataRangePointersBridge, // DataRanges 57 | KSPIN_DATAFLOW_IN, // DataFlow 58 | KSPIN_COMMUNICATION_NONE, // Communication 59 | &KSCATEGORY_AUDIO, // Category 60 | NULL, // Name 61 | 0 // Reserved 62 | } 63 | }, 64 | // KSPIN_TOPO_LINEOUT_DEST 65 | { 66 | 0, 67 | 0, 68 | 0, // InstanceCount 69 | NULL, // AutomationTable 70 | { // KsPinDescriptor 71 | 0, // InterfacesCount 72 | NULL, // Interfaces 73 | 0, // MediumsCount 74 | NULL, // Mediums 75 | SIZEOF_ARRAY(SpeakerTopoPinDataRangePointersBridge),// DataRangesCount 76 | SpeakerTopoPinDataRangePointersBridge, // DataRanges 77 | KSPIN_DATAFLOW_OUT, // DataFlow 78 | KSPIN_COMMUNICATION_NONE, // Communication 79 | &KSNODETYPE_SPEAKER, // Category 80 | NULL, // Name 81 | 0 // Reserved 82 | } 83 | } 84 | }; 85 | 86 | //============================================================================= 87 | static 88 | KSJACK_DESCRIPTION SpeakerJackDescBridge = 89 | { 90 | KSAUDIO_SPEAKER_STEREO, 91 | 0xB3C98C, // Color spec for green 92 | eConnTypeUnknown, 93 | eGeoLocFront, 94 | eGenLocPrimaryBox, 95 | ePortConnIntegratedDevice, 96 | TRUE 97 | }; 98 | 99 | // Only return a KSJACK_DESCRIPTION for the physical bridge pin. 100 | static 101 | PKSJACK_DESCRIPTION SpeakerJackDescriptions[] = 102 | { 103 | NULL, 104 | &SpeakerJackDescBridge 105 | }; 106 | 107 | 108 | //============================================================================= 109 | static 110 | PCCONNECTION_DESCRIPTOR SpeakerTopoMiniportConnections[] = 111 | { 112 | // FromNode, FromPin, ToNode, ToPin 113 | { PCFILTER_NODE, KSPIN_TOPO_WAVEOUT_SOURCE, PCFILTER_NODE, KSPIN_TOPO_LINEOUT_DEST} 114 | }; 115 | 116 | 117 | //============================================================================= 118 | static 119 | PCPROPERTY_ITEM PropertiesSpeakerTopoFilter[] = 120 | { 121 | { 122 | &KSPROPSETID_Jack, 123 | KSPROPERTY_JACK_DESCRIPTION, 124 | KSPROPERTY_TYPE_GET | 125 | KSPROPERTY_TYPE_BASICSUPPORT, 126 | PropertyHandler_SpeakerTopoFilter 127 | }, 128 | { 129 | &KSPROPSETID_Jack, 130 | KSPROPERTY_JACK_DESCRIPTION2, 131 | KSPROPERTY_TYPE_GET | 132 | KSPROPERTY_TYPE_BASICSUPPORT, 133 | PropertyHandler_SpeakerTopoFilter 134 | } 135 | }; 136 | 137 | DEFINE_PCAUTOMATION_TABLE_PROP(AutomationSpeakerTopoFilter, PropertiesSpeakerTopoFilter); 138 | 139 | //============================================================================= 140 | static 141 | PCFILTER_DESCRIPTOR SpeakerTopoMiniportFilterDescriptor = 142 | { 143 | 0, // Version 144 | &AutomationSpeakerTopoFilter, // AutomationTable 145 | sizeof(PCPIN_DESCRIPTOR), // PinSize 146 | SIZEOF_ARRAY(SpeakerTopoMiniportPins), // PinCount 147 | SpeakerTopoMiniportPins, // Pins 148 | sizeof(PCNODE_DESCRIPTOR), // NodeSize 149 | 0, // NodeCount 150 | NULL, // Nodes 151 | SIZEOF_ARRAY(SpeakerTopoMiniportConnections), // ConnectionCount 152 | SpeakerTopoMiniportConnections, // Connections 153 | 0, // CategoryCount 154 | NULL // Categories 155 | }; 156 | 157 | #endif // _SYSVAD_SPEAKERTOPTABLE_H_ 158 | 159 | -------------------------------------------------------------------------------- /EndpointsCommon/usbhsmictopo.h: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) Microsoft Corporation All Rights Reserved 4 | 5 | Module Name: 6 | 7 | usbhsmictopo.h 8 | 9 | Abstract: 10 | 11 | Declaration of topology miniport for the mic (external: headphone). 12 | 13 | --*/ 14 | 15 | #ifndef _SYSVAD_USBHSMICTOPO_H_ 16 | #define _SYSVAD_USBHSMICTOPO_H_ 17 | 18 | // Function declarations. 19 | NTSTATUS 20 | PropertyHandler_UsbHsMicTopoFilter( 21 | _In_ PPCPROPERTY_REQUEST PropertyRequest 22 | ); 23 | 24 | NTSTATUS 25 | PropertyHandler_UsbHsMicTopoNode( 26 | _In_ PPCPROPERTY_REQUEST PropertyRequest 27 | ); 28 | 29 | NTSTATUS 30 | PropertyHandler_UsbHsMicTopoNodeEvent( 31 | _In_ PPCEVENT_REQUEST EventRequest 32 | ); 33 | 34 | NTSTATUS 35 | PropertyHandler_UsbHsMicTopoFilterEvent( 36 | _In_ PPCEVENT_REQUEST EventRequest 37 | ); 38 | 39 | #endif // _SYSVAD_USBHSMICTOPO_H_ 40 | 41 | -------------------------------------------------------------------------------- /EndpointsCommon/usbhsminwavert.cpp: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) Microsoft Corporation All Rights Reserved 4 | 5 | Module Name: 6 | 7 | usbhsminwavert.cpp 8 | 9 | Abstract: 10 | 11 | Implementation of wavert miniport. 12 | 13 | --*/ 14 | #ifdef SYSVAD_USB_SIDEBAND 15 | 16 | #pragma warning (disable : 4127) 17 | 18 | #include 19 | #include 20 | #include "simple.h" 21 | #include "minwavert.h" 22 | #include "minwavertstream.h" 23 | #include "IHVPrivatePropertySet.h" 24 | 25 | 26 | //============================================================================= 27 | #pragma code_seg("PAGE") 28 | NTSTATUS 29 | CMiniportWaveRT::PropertyHandler_UsbHsAudioEffectsDiscoveryEffectsList 30 | ( 31 | _In_ PPCPROPERTY_REQUEST PropertyRequest 32 | ) 33 | /*++ 34 | 35 | Routine Description: 36 | 37 | Handles ( KSPROPSETID_AudioEffectsDiscovery, KSPROPERTY_AUDIOEFFECTSDISCOVERY_EFFECTSLIST ) 38 | 39 | Arguments: 40 | 41 | PropertyRequest - 42 | 43 | Return Value: 44 | 45 | NT status code. 46 | 47 | --*/ 48 | { 49 | PAGED_CODE(); 50 | 51 | DPF_ENTER(("[PropertyHandler_UsbHsAudioEffectsDiscoveryEffectsList]")); 52 | 53 | NTSTATUS ntStatus = STATUS_INVALID_PARAMETER; 54 | ULONG nPinId = (ULONG)-1; 55 | 56 | // 57 | // Validate Pin ID. 58 | // 59 | if (PropertyRequest->InstanceSize >= sizeof(ULONG)) 60 | { 61 | nPinId = *(PULONG(PropertyRequest->Instance)); 62 | 63 | // This prop is valid only on streaming pins. 64 | if (IsSystemRenderPin(nPinId) || IsSystemCapturePin(nPinId)) 65 | { 66 | ntStatus = STATUS_SUCCESS; 67 | } 68 | else if (IsBridgePin(nPinId) || 69 | IsLoopbackPin(nPinId) || 70 | IsOffloadPin(nPinId)) 71 | { 72 | ntStatus = STATUS_NOT_SUPPORTED; 73 | } 74 | } 75 | 76 | IF_FAILED_JUMP(ntStatus, Done); 77 | 78 | // 79 | // Valid actions: get and basicsupport. 80 | // 81 | ntStatus = STATUS_INVALID_PARAMETER; 82 | 83 | if (PropertyRequest->Verb & KSPROPERTY_TYPE_BASICSUPPORT) 84 | { 85 | ntStatus = 86 | PropertyHandler_BasicSupport 87 | ( 88 | PropertyRequest, 89 | KSPROPERTY_TYPE_BASICSUPPORT | KSPROPERTY_TYPE_GET, 90 | VT_ILLEGAL 91 | ); 92 | } 93 | else if (PropertyRequest->Verb & KSPROPERTY_TYPE_GET) 94 | { 95 | ASSERT(m_pSidebandDevice != NULL); 96 | 97 | 98 | // If it is render pin (data flow in), 99 | // return size 0 effect list 100 | if (IsSystemRenderPin(nPinId)) 101 | { 102 | PropertyRequest->ValueSize = 0; 103 | ntStatus = STATUS_SUCCESS; 104 | } 105 | else 106 | { 107 | // Compute total size, two effects: NS and EC (see below). 108 | ULONG cbMinSize = sizeof(GUID) * 2; 109 | 110 | if (PropertyRequest->ValueSize == 0) 111 | { 112 | PropertyRequest->ValueSize = cbMinSize; 113 | ntStatus = STATUS_BUFFER_OVERFLOW; 114 | } 115 | else if (PropertyRequest->ValueSize < cbMinSize) 116 | { 117 | ntStatus = STATUS_BUFFER_TOO_SMALL; 118 | } 119 | else 120 | { 121 | PGUID effectList = PGUID(PropertyRequest->Value); 122 | 123 | *effectList = AUDIO_EFFECT_TYPE_ACOUSTIC_ECHO_CANCELLATION; 124 | *(effectList + 1) = AUDIO_EFFECT_TYPE_NOISE_SUPPRESSION; 125 | 126 | PropertyRequest->ValueSize = cbMinSize; 127 | ntStatus = STATUS_SUCCESS; 128 | } 129 | } 130 | } 131 | 132 | Done: 133 | 134 | return ntStatus; 135 | } 136 | 137 | //============================================================================= 138 | #pragma code_seg("PAGE") 139 | NTSTATUS 140 | PropertyHandler_UsbHsWaveFilter 141 | ( 142 | _In_ PPCPROPERTY_REQUEST PropertyRequest 143 | ) 144 | /*++ 145 | 146 | Routine Description: 147 | 148 | Redirects general property request to miniport object 149 | 150 | Arguments: 151 | 152 | PropertyRequest - 153 | 154 | Return Value: 155 | 156 | NT status code. 157 | 158 | --*/ 159 | { 160 | PAGED_CODE(); 161 | 162 | NTSTATUS ntStatus = STATUS_INVALID_DEVICE_REQUEST; 163 | CMiniportWaveRT* waveRt = reinterpret_cast(PropertyRequest->MajorTarget); 164 | 165 | if (waveRt == NULL) 166 | { 167 | return STATUS_INVALID_PARAMETER; 168 | } 169 | 170 | waveRt->AddRef(); 171 | 172 | if (IsEqualGUIDAligned(*PropertyRequest->PropertyItem->Set, KSPROPSETID_Pin)) 173 | { 174 | switch (PropertyRequest->PropertyItem->Id) 175 | { 176 | case KSPROPERTY_PIN_PROPOSEDATAFORMAT: 177 | ntStatus = waveRt->PropertyHandlerProposedFormat(PropertyRequest); 178 | break; 179 | 180 | case KSPROPERTY_PIN_PROPOSEDATAFORMAT2: 181 | ntStatus = waveRt->PropertyHandlerProposedFormat2(PropertyRequest); 182 | break; 183 | 184 | default: 185 | DPF(D_TERSE, ("[PropertyHandler_UsbHsWaveFilter: Invalid Device Request]")); 186 | } 187 | } 188 | else if (IsEqualGUIDAligned(*PropertyRequest->PropertyItem->Set, KSPROPSETID_AudioEffectsDiscovery)) 189 | { 190 | switch(PropertyRequest->PropertyItem->Id) 191 | { 192 | case KSPROPERTY_AUDIOEFFECTSDISCOVERY_EFFECTSLIST: 193 | ntStatus = waveRt->PropertyHandler_UsbHsAudioEffectsDiscoveryEffectsList(PropertyRequest); 194 | break; 195 | 196 | default: 197 | DPF(D_TERSE, ("[PropertyHandler_UsbHsWaveFilter: Invalid Device Request]")); 198 | } 199 | } 200 | 201 | waveRt->Release(); 202 | 203 | return ntStatus; 204 | } // PropertyHandler_UsbHsWaveFilter 205 | 206 | #pragma code_seg("PAGE") 207 | #endif // SYSVAD_USB_SIDEBAND 208 | 209 | 210 | 211 | 212 | -------------------------------------------------------------------------------- /EndpointsCommon/usbhsspeakertopo.cpp: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) Microsoft Corporation All Rights Reserved 4 | 5 | Module Name: 6 | 7 | usbhsspeakertopo.cpp 8 | 9 | Abstract: 10 | 11 | Implementation of topology miniport for the USB Headset speaker (external). 12 | 13 | --*/ 14 | #ifdef SYSVAD_USB_SIDEBAND 15 | 16 | #pragma warning (disable : 4127) 17 | 18 | #include 19 | #include "simple.h" 20 | #include "mintopo.h" 21 | #include "usbhstopo.h" 22 | #include "usbhsspeakertopo.h" 23 | #include "usbhsspeakertoptable.h" 24 | 25 | //============================================================================= 26 | #pragma code_seg("PAGE") 27 | NTSTATUS 28 | PropertyHandler_UsbHsSpeakerTopoFilter 29 | ( 30 | _In_ PPCPROPERTY_REQUEST PropertyRequest 31 | ) 32 | /*++ 33 | 34 | Routine Description: 35 | 36 | Redirects property request to miniport object 37 | 38 | Arguments: 39 | 40 | PropertyRequest - 41 | 42 | Return Value: 43 | 44 | NT status code. 45 | 46 | --*/ 47 | { 48 | PAGED_CODE(); 49 | 50 | ASSERT(PropertyRequest); 51 | 52 | DPF_ENTER(("[PropertyHandler_UsbHsSpeakerTopoFilter]")); 53 | 54 | // PropertryRequest structure is filled by portcls. 55 | // MajorTarget is a pointer to miniport object for miniports. 56 | // 57 | NTSTATUS ntStatus = STATUS_INVALID_DEVICE_REQUEST; 58 | 59 | // 60 | // This line shows how to get a pointer to the miniport topology object. 61 | // 62 | PCMiniportTopology pMiniport = (PCMiniportTopology)PropertyRequest->MajorTarget; 63 | UNREFERENCED_VAR(pMiniport); 64 | 65 | if (IsEqualGUIDAligned(*PropertyRequest->PropertyItem->Set, KSPROPSETID_Jack)) 66 | { 67 | switch(PropertyRequest->PropertyItem->Id) 68 | { 69 | case KSPROPERTY_JACK_DESCRIPTION: 70 | ntStatus = PropertyHandler_UsbHsJackDescription( 71 | PropertyRequest, 72 | ARRAYSIZE(UsbHsSpeakerJackDescriptions), 73 | UsbHsSpeakerJackDescriptions); 74 | break; 75 | 76 | case KSPROPERTY_JACK_DESCRIPTION2: 77 | ntStatus = PropertyHandler_UsbHsJackDescription2( 78 | PropertyRequest, 79 | ARRAYSIZE(UsbHsSpeakerJackDescriptions), 80 | UsbHsSpeakerJackDescriptions); 81 | break; 82 | 83 | case KSPROPERTY_JACK_CONTAINERID: 84 | ntStatus = PropertyHandler_UsbHsJackContainerId( 85 | PropertyRequest, 86 | ARRAYSIZE(UsbHsSpeakerJackDescriptions), 87 | UsbHsSpeakerJackDescriptions); 88 | break; 89 | } 90 | } 91 | 92 | return ntStatus; 93 | } // PropertyHandler_UsbHsSpeakerTopoFilter 94 | 95 | //============================================================================= 96 | #pragma code_seg() 97 | NTSTATUS 98 | PropertyHandler_UsbHsSpeakerTopoFilterEvent 99 | ( 100 | _In_ PPCEVENT_REQUEST EventRequest 101 | ) 102 | { 103 | ASSERT(EventRequest); 104 | 105 | DPF_ENTER(("[PropertyHandler_UsbHsSpeakerTopoFilterEvent]")); 106 | 107 | return PropertyHandler_UsbHsTopoNodeEvent(EventRequest); 108 | } 109 | 110 | #pragma code_seg() 111 | #endif // SYSVAD_USB_SIDEBAND 112 | 113 | 114 | -------------------------------------------------------------------------------- /EndpointsCommon/usbhsspeakertopo.h: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) Microsoft Corporation All Rights Reserved 4 | 5 | Module Name: 6 | 7 | usbhsspeakertopo.h 8 | 9 | Abstract: 10 | 11 | Declaration of topology miniport for the USB Headset speaker (external). 12 | 13 | --*/ 14 | 15 | #ifndef _SYSVAD_USBHSSPEAKERTOPO_H_ 16 | #define _SYSVAD_USBHSSPEAKERTOPO_H_ 17 | 18 | // Function declarations. 19 | NTSTATUS 20 | PropertyHandler_UsbHsSpeakerTopoFilter( 21 | _In_ PPCPROPERTY_REQUEST PropertyRequest 22 | ); 23 | 24 | NTSTATUS 25 | PropertyHandler_UsbHsSpeakerTopoFilterEvent( 26 | _In_ PPCEVENT_REQUEST EventRequest 27 | ); 28 | 29 | #endif // _SYSVAD_USBHSSPEAKERTOPO_H_ 30 | 31 | -------------------------------------------------------------------------------- /EndpointsCommon/usbhsspeakertoptable.h: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) Microsoft Corporation All Rights Reserved 4 | 5 | Module Name: 6 | 7 | usbhsspeakertoptable.h 8 | 9 | Abstract: 10 | 11 | Declaration of topology tables for the USB Headset speaker (external). 12 | 13 | --*/ 14 | 15 | #ifndef _SYSVAD_USBHSSPEAKERTOPTABLE_H_ 16 | #define _SYSVAD_USBHSSPEAKERTOPTABLE_H_ 17 | 18 | #include "usbhsspeakertopo.h" 19 | 20 | //============================================================================= 21 | static 22 | KSDATARANGE UsbHsSpeakerTopoPinDataRangesBridge[] = 23 | { 24 | { 25 | sizeof(KSDATARANGE), 26 | 0, 27 | 0, 28 | 0, 29 | STATICGUIDOF(KSDATAFORMAT_TYPE_AUDIO), 30 | STATICGUIDOF(KSDATAFORMAT_SUBTYPE_ANALOG), 31 | STATICGUIDOF(KSDATAFORMAT_SPECIFIER_NONE) 32 | } 33 | }; 34 | 35 | //============================================================================= 36 | static 37 | PKSDATARANGE UsbHsSpeakerTopoPinDataRangePointersBridge[] = 38 | { 39 | &UsbHsSpeakerTopoPinDataRangesBridge[0] 40 | }; 41 | 42 | //============================================================================= 43 | static 44 | PCPIN_DESCRIPTOR UsbHsSpeakerTopoMiniportPins[] = 45 | { 46 | // KSPIN_TOPO_WAVEOUT_SOURCE 47 | { 48 | 0, 49 | 0, 50 | 0, // InstanceCount 51 | NULL, // AutomationTable 52 | { // KsPinDescriptor 53 | 0, // InterfacesCount 54 | NULL, // Interfaces 55 | 0, // MediumsCount 56 | NULL, // Mediums 57 | SIZEOF_ARRAY(UsbHsSpeakerTopoPinDataRangePointersBridge),// DataRangesCount 58 | UsbHsSpeakerTopoPinDataRangePointersBridge, // DataRanges 59 | KSPIN_DATAFLOW_IN, // DataFlow 60 | KSPIN_COMMUNICATION_NONE, // Communication 61 | &KSCATEGORY_AUDIO, // Category 62 | NULL, // Name 63 | 0 // Reserved 64 | } 65 | }, 66 | // KSPIN_TOPO_LINEOUT_DEST 67 | { 68 | 0, 69 | 0, 70 | 0, // InstanceCount 71 | NULL, // AutomationTable 72 | { // KsPinDescriptor 73 | 0, // InterfacesCount 74 | NULL, // Interfaces 75 | 0, // MediumsCount 76 | NULL, // Mediums 77 | SIZEOF_ARRAY(UsbHsSpeakerTopoPinDataRangePointersBridge),// DataRangesCount 78 | UsbHsSpeakerTopoPinDataRangePointersBridge, // DataRanges 79 | KSPIN_DATAFLOW_OUT, // DataFlow 80 | KSPIN_COMMUNICATION_NONE, // Communication 81 | &KSNODETYPE_HEADSET_SPEAKERS, // Category 82 | NULL, // Name 83 | 0 // Reserved 84 | } 85 | } 86 | }; 87 | 88 | //============================================================================= 89 | static 90 | KSJACK_DESCRIPTION UsbHsSpeakerJackDesc = 91 | { 92 | KSAUDIO_SPEAKER_STEREO, 93 | 0, // color 94 | eConnTypeOtherDigital, 95 | eGeoLocBottom, 96 | eGenLocPrimaryBox, 97 | ePortConnJack, 98 | FALSE // run-time code sets this value. 99 | }; 100 | 101 | // Only return a KSJACK_DESCRIPTION for the physical bridge pin. 102 | static 103 | PKSJACK_DESCRIPTION UsbHsSpeakerJackDescriptions[] = 104 | { 105 | NULL, 106 | &UsbHsSpeakerJackDesc 107 | }; 108 | 109 | //============================================================================= 110 | static 111 | PCCONNECTION_DESCRIPTOR UsbHsSpeakerTopoMiniportConnections[] = 112 | { 113 | // FromNode, FromPin, ToNode, ToPin 114 | { PCFILTER_NODE, KSPIN_TOPO_WAVEOUT_SOURCE, PCFILTER_NODE, KSPIN_TOPO_LINEOUT_DEST } 115 | }; 116 | 117 | //============================================================================= 118 | static 119 | PCPROPERTY_ITEM UsbHsSpeakerPropertiesTopoFilter[] = 120 | { 121 | { 122 | &KSPROPSETID_Jack, 123 | KSPROPERTY_JACK_DESCRIPTION, 124 | KSPROPERTY_TYPE_GET | KSPROPERTY_TYPE_BASICSUPPORT, 125 | PropertyHandler_UsbHsSpeakerTopoFilter 126 | }, 127 | { 128 | &KSPROPSETID_Jack, 129 | KSPROPERTY_JACK_DESCRIPTION2, 130 | KSPROPERTY_TYPE_GET | KSPROPERTY_TYPE_BASICSUPPORT, 131 | PropertyHandler_UsbHsSpeakerTopoFilter 132 | }, 133 | { 134 | &KSPROPSETID_Jack, 135 | KSPROPERTY_JACK_CONTAINERID, 136 | KSPROPERTY_TYPE_GET | KSPROPERTY_TYPE_BASICSUPPORT, 137 | PropertyHandler_UsbHsSpeakerTopoFilter 138 | } 139 | }; 140 | 141 | static 142 | PCEVENT_ITEM UsbHsSpeakerPropertiesTopoFilterEvent[] = 143 | { 144 | { 145 | &KSEVENTSETID_PinCapsChange, // Something changed! 146 | KSEVENT_PINCAPS_JACKINFOCHANGE, // The only event-property defined. 147 | KSEVENT_TYPE_ENABLE | KSEVENT_TYPE_BASICSUPPORT, 148 | PropertyHandler_UsbHsSpeakerTopoFilterEvent 149 | } 150 | }; 151 | 152 | DEFINE_PCAUTOMATION_TABLE_PROP_EVENT(AutomationUsbHsSpeakerTopoFilterWithEvent, 153 | UsbHsSpeakerPropertiesTopoFilter, 154 | UsbHsSpeakerPropertiesTopoFilterEvent); 155 | 156 | //============================================================================= 157 | static 158 | PCFILTER_DESCRIPTOR UsbHsSpeakerTopoMiniportFilterDescriptor = 159 | { 160 | 0, // Version 161 | &AutomationUsbHsSpeakerTopoFilterWithEvent, // AutomationTable 162 | sizeof(PCPIN_DESCRIPTOR), // PinSize 163 | SIZEOF_ARRAY(UsbHsSpeakerTopoMiniportPins), // PinCount 164 | UsbHsSpeakerTopoMiniportPins, // Pins 165 | sizeof(PCNODE_DESCRIPTOR), // NodeSize 166 | 0, // NodeCount 167 | NULL, // Nodes 168 | SIZEOF_ARRAY(UsbHsSpeakerTopoMiniportConnections), // ConnectionCount 169 | UsbHsSpeakerTopoMiniportConnections, // Connections 170 | 0, // CategoryCount 171 | NULL // Categories 172 | }; 173 | 174 | #endif // _SYSVAD_USBHSSPEAKERTOPTABLE_H_ 175 | 176 | 177 | -------------------------------------------------------------------------------- /EndpointsCommon/usbhstopo.h: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) Microsoft Corporation All Rights Reserved 4 | 5 | Module Name: 6 | 7 | usbhstopo.h 8 | 9 | Abstract: 10 | 11 | Declaration of topology miniport for the mic (external: USB headphone). 12 | 13 | --*/ 14 | 15 | #ifndef _SYSVAD_USBHSTOPO_H_ 16 | #define _SYSVAD_USBHSTOPO_H_ 17 | 18 | NTSTATUS 19 | PropertyHandler_UsbHsVolumeLevel_BasicSupport( 20 | _In_ PPCPROPERTY_REQUEST PropertyRequest 21 | ); 22 | 23 | NTSTATUS 24 | PropertyHandler_UsbHsMicVolumeLevel( 25 | _In_ PPCPROPERTY_REQUEST PropertyRequest 26 | ); 27 | 28 | NTSTATUS 29 | PropertyHandler_UsbHsMute_BasicSupport( 30 | _In_ PPCPROPERTY_REQUEST PropertyRequest 31 | ); 32 | 33 | NTSTATUS 34 | PropertyHandler_UsbHsMicMute( 35 | _In_ PPCPROPERTY_REQUEST PropertyRequest 36 | ); 37 | 38 | NTSTATUS 39 | PropertyHandler_UsbHsJackDescription( 40 | _In_ PPCPROPERTY_REQUEST PropertyRequest, 41 | _In_ ULONG cJackDescriptions, 42 | _In_reads_(cJackDescriptions) PKSJACK_DESCRIPTION * JackDescriptions 43 | ); 44 | 45 | NTSTATUS 46 | PropertyHandler_UsbHsJackDescription2( 47 | _In_ PPCPROPERTY_REQUEST PropertyRequest, 48 | _In_ ULONG cJackDescriptions, 49 | _In_reads_(cJackDescriptions) PKSJACK_DESCRIPTION * JackDescriptions 50 | ); 51 | 52 | NTSTATUS 53 | PropertyHandler_UsbHsJackContainerId( 54 | _In_ PPCPROPERTY_REQUEST PropertyRequest, 55 | _In_ ULONG cJackDescriptions, 56 | _In_reads_(cJackDescriptions) PKSJACK_DESCRIPTION * JackDescriptions 57 | ); 58 | 59 | NTSTATUS 60 | PropertyHandler_UsbHsTopoNodeEvent( 61 | _In_ PPCEVENT_REQUEST EventRequest 62 | ); 63 | 64 | #endif // _SYSVAD_USBHSTOPO_H_ 65 | 66 | -------------------------------------------------------------------------------- /Package/package.VcxProj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | ARM64 7 | 8 | 9 | Debug 10 | Win32 11 | 12 | 13 | Release 14 | ARM64 15 | 16 | 17 | Release 18 | Win32 19 | 20 | 21 | Debug 22 | x64 23 | 24 | 25 | Release 26 | x64 27 | 28 | 29 | 30 | 31 | {E4DF0EEE-D35B-47F2-A9B1-41EA97C465FF} 32 | 33 | 34 | 35 | WindowsKernelModeDriver10.0 36 | Utility 37 | Package 38 | true 39 | Debug 40 | 41 | 42 | 43 | {830B14D5-0E32-4F9E-AEFA-4C9F6FC13C2A} 44 | {E9D167E6-E633-4284-8F02-FF86DF3B6D7F} 45 | $(MSBuildProjectName) 46 | 47 | 48 | Windows10 49 | true 50 | 51 | 52 | Windows10 53 | false 54 | 55 | 56 | Windows10 57 | true 58 | 59 | 60 | Windows10 61 | true 62 | 63 | 64 | Windows10 65 | false 66 | 67 | 68 | Windows10 69 | false 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | DbgengKernelDebugger 81 | False 82 | None 83 | 84 | 85 | 86 | 87 | 88 | %PathToInf% 89 | False 90 | False 91 | True 92 | 93 | 133563 94 | 95 | 96 | 97 | 98 | 99 | 100 | -------------------------------------------------------------------------------- /Package/package.VcxProj.Filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx;* 6 | {0924612D-FBA7-477E-BBB9-B3B6EA7C6B03} 7 | 8 | 9 | h;hpp;hxx;hm;inl;inc;xsd 10 | {97311738-0AD8-4F7E-AC88-9C9BEAF53AEE} 11 | 12 | 13 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms;man;xml 14 | {8DC1C4F0-C285-400E-A983-77A339891354} 15 | 16 | 17 | inf;inv;inx;mof;mc; 18 | {9F086F34-79D2-4FAA-87FD-C2DBEFCED0BA} 19 | 20 | 21 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # OpenAudioCable 2 | Virtual Audio Loopback Cable for Windows 3 | -------------------------------------------------------------------------------- /SysVadShared.h: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) Microsoft Corporation All Rights Reserved 4 | 5 | Module Name: 6 | 7 | SysvadShared.h 8 | 9 | Abstract: 10 | 11 | Header file for common stuffs between sample SWAP APO and the SysVad sample. 12 | */ 13 | #ifndef _SYSVADSHARED_H_ 14 | #define _SYSVADSHARED_H_ 15 | 16 | // {D849C827-B24B-4C3D-A26E-338F4FF07ED5} 17 | //DEFINE_GUID(KSPROPSETID_SysVAD, 0xd849c827, 0xb24b, 0x4c3d, 0xa2, 0x6e, 0x33, 0x8f, 0x4f, 0xf0, 0x7e, 0xd5); 18 | 19 | 20 | #define STATIC_KSPROPSETID_SysVAD\ 21 | 0xd849c827, 0xb24b, 0x4c3d, 0xa2, 0x6e, 0x33, 0x8f, 0x4f, 0xf0, 0x7e, 0xd5 22 | DEFINE_GUIDSTRUCT("D849C827-B24B-4C3D-A26E-338F4FF07ED5", KSPROPSETID_SysVAD); 23 | #define KSPROPSETID_SysVAD DEFINE_GUIDNAMED(KSPROPSETID_SysVAD) 24 | 25 | 26 | typedef enum{ 27 | KSPROPERTY_SYSVAD_DEFAULTSTREAMEFFECTS 28 | } KSPROPERTY_SYSVAD; 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /TabletAudioSample/QCSLoopback.inx: -------------------------------------------------------------------------------- 1 | [Version] 2 | Signature = "$Windows NT$" 3 | Class = MEDIA 4 | Provider = %ProviderName% 5 | ClassGUID = {4d36e96c-e325-11ce-bfc1-08002be10318} 6 | DriverVer = 11/20/2020, 1.0.0.1 7 | CatalogFile = sysvad.cat 8 | PnpLockDown = 1 9 | 10 | [SourceDisksNames] 11 | 222="QCSVAC Driver Disk","",222 12 | 13 | [SourceDisksFiles] 14 | QCSLoopback.sys=222 15 | 16 | [SignatureAttributes] 17 | QCSLoopback.sys=SignatureAttributes.DRM 18 | 19 | [SignatureAttributes.DRM] 20 | DRMLevel=1300 21 | 22 | [SignatureAttributes.PETrust] 23 | PETrust=true 24 | 25 | [Manufacturer] 26 | %MfgName%=QCSVAC,NT$ARCH$ 27 | 28 | [QCSVAC.NT$ARCH$] 29 | %QCSVAC_SA.DeviceDesc%=QCSVAC_SA, Root\sysvad_QCSLoopback 30 | 31 | [DestinationDirs] 32 | QCSVAC_SA.CopyList=13 ; 13=Package's DriverStore directory 33 | 34 | ;====================================================== 35 | ; QCSVAC_SA 36 | ;====================================================== 37 | [QCSVAC_SA.CopyList] 38 | QCSLoopback.sys 39 | 40 | [QCSVAC_SA.AddReg] 41 | HKR,,AssociatedFilters,,"wdmaud,redbook" 42 | HKR,,Driver,,QCSLoopback.sys 43 | 44 | ; 45 | ; For demo only, please review these power management settings for your architecture. 46 | ; 47 | HKR,PowerSettings,SingleComponentMultiFxStates,3,1,0,0,0 ; Turn on multi Fx support. 48 | HKR,PowerSettings,ConservationIdleTime,3,3,0,0,0 ; 3 seconds for idle power management when on battery 49 | HKR,PowerSettings,PerformanceIdleTime,3,3,0,0,0 ; 3 seconds for idle power management when on AC power 50 | HKR,PowerSettings,IdlePowerState,3,3,0,0,0 ; go to D3 for idle power management 51 | 52 | HKR,Drivers,SubClasses,,"wave,mixer" 53 | 54 | HKR,Drivers\wave\wdmaud.drv,Driver,,wdmaud.drv 55 | HKR,Drivers\mixer\wdmaud.drv,Driver,,wdmaud.drv 56 | 57 | HKR,Drivers\wave\wdmaud.drv,Description,,%QCSVAC_SA.DeviceDesc% 58 | HKR,Drivers\mixer\wdmaud.drv,Description,,%QCSVAC_SA.DeviceDesc% 59 | 60 | HKR,%MEDIA_CATEGORIES%\%MicrophoneCustomNameGUID%,Name,,%MicrophoneCustomName% 61 | 62 | ;====================================================== 63 | ; render interfaces: speaker (internal) 64 | ;====================================================== 65 | [QCSVAC.I.WaveSpeaker] 66 | AddReg=QCSVAC.I.WaveSpeaker.AddReg 67 | 68 | [QCSVAC.I.WaveSpeaker.AddReg] 69 | HKR,,CLSID,,%Proxy.CLSID% 70 | HKR,,FriendlyName,,%QCSVAC.WaveSpeaker.szPname% 71 | 72 | [QCSVAC.I.TopologySpeaker] 73 | AddReg=QCSVAC.I.TopologySpeaker.AddReg 74 | 75 | [QCSVAC.I.TopologySpeaker.AddReg] 76 | HKR,,CLSID,,%Proxy.CLSID% 77 | HKR,,FriendlyName,,%QCSVAC.TopologySpeaker.szPname% 78 | 79 | HKR,EP\0,%PKEY_AudioEndpoint_Association%,,%KSNODETYPE_ANY% 80 | HKR,FX\0,%PKEY_FX_Association%,,%KSNODETYPE_ANY% 81 | 82 | ; The following lines opt-in to pull mode. 83 | ;HKR,EP\0,%PKEY_AudioEndpoint_Supports_EventDriven_Mode%,0x00010001,0x1 84 | 85 | ;====================================================== 86 | ; capture interfaces: microphone (internal) 87 | ;====================================================== 88 | [QCSVAC.I.WaveMicrophone] 89 | AddReg=QCSVAC.I.WaveMicrophone.AddReg 90 | [QCSVAC.I.WaveMicrophone.AddReg] 91 | HKR,,CLSID,,%Proxy.CLSID% 92 | HKR,,FriendlyName,,%QCSVAC.WaveMicrophone.szPname% 93 | 94 | [QCSVAC.I.TopologyMicrophone] 95 | AddReg=QCSVAC.I.TopologyMicrophone.AddReg 96 | 97 | [QCSVAC.I.TopologyMicrophone.AddReg] 98 | HKR,,CLSID,,%Proxy.CLSID% 99 | HKR,,FriendlyName,,%QCSVAC.TopologyMicrophone.szPname% 100 | 101 | HKR,EP\0,%PKEY_AudioEndpoint_Association%,,%KSNODETYPE_ANY% 102 | HKR,FX\0,%PKEY_FX_Association%,,%KSNODETYPE_ANY% 103 | 104 | ; The following lines opt-in to pull mode. 105 | ;HKR,EP\0,%PKEY_AudioEndpoint_Supports_EventDriven_Mode%,0x00010001,0x1 106 | 107 | ; The following line overrides the default volume (in dB) for an endpoint. 108 | ; It is only applicable when hardware volume is not implemented. 109 | ; Float value expressed in fixed point 16.16 format and stored as a DWORD. 110 | ; 10 dB 111 | ;HKR,EP\0,%PKEY_AudioEndpoint_Default_VolumeInDb%,0x00010001,0xA0000 112 | ;-10 dB 113 | ;HKR,EP\0,%PKEY_AudioEndpoint_Default_VolumeInDb%,0x00010001,0xFFF60000 114 | 115 | ;====================================================== 116 | ; QCSVAC_SA 117 | ;====================================================== 118 | [QCSVAC_SA.NT] 119 | Include=ks.inf,wdmaudio.inf 120 | Needs=KS.Registration, WDMAUDIO.Registration 121 | CopyFiles=QCSVAC_SA.CopyList 122 | AddReg=QCSVAC_SA.AddReg 123 | 124 | [QCSVAC_SA.NT.Interfaces] 125 | ; 126 | ; Interfaces for speaker (internal) render endpoint. 127 | ; 128 | AddInterface=%KSCATEGORY_AUDIO%, %KSNAME_WaveSpeaker%, QCSVAC.I.WaveSpeaker 129 | AddInterface=%KSCATEGORY_RENDER%, %KSNAME_WaveSpeaker%, QCSVAC.I.WaveSpeaker 130 | AddInterface=%KSCATEGORY_REALTIME%, %KSNAME_WaveSpeaker%, QCSVAC.I.WaveSpeaker 131 | AddInterface=%KSCATEGORY_AUDIO%, %KSNAME_TopologySpeaker%, QCSVAC.I.TopologySpeaker 132 | AddInterface=%KSCATEGORY_TOPOLOGY%, %KSNAME_TopologySpeaker%, QCSVAC.I.TopologySpeaker 133 | 134 | ; 135 | ; Interfaces for microphone (internal) capture endpoint 136 | ; 137 | AddInterface=%KSCATEGORY_AUDIO%, %KSNAME_WaveMicrophone%, QCSVAC.I.WaveMicrophone 138 | AddInterface=%KSCATEGORY_REALTIME%, %KSNAME_WaveMicrophone%, QCSVAC.I.WaveMicrophone 139 | AddInterface=%KSCATEGORY_CAPTURE%, %KSNAME_WaveMicrophone%, QCSVAC.I.WaveMicrophone 140 | AddInterface=%KSCATEGORY_AUDIO%, %KSNAME_TopologyMicrophone%, QCSVAC.I.TopologyMicrophone 141 | AddInterface=%KSCATEGORY_TOPOLOGY%, %KSNAME_TopologyMicrophone%, QCSVAC.I.TopologyMicrophone 142 | 143 | [QCSVAC_SA.NT.Services] 144 | AddService=sysvad_qcsloopback,0x00000002,sysvad_QCSLoopback_Service_Inst 145 | 146 | [sysvad_QCSLoopback_Service_Inst] 147 | DisplayName=%QCSVAC_QCSLoopback.SvcDesc% 148 | ServiceType=1 149 | StartType=3 150 | ErrorControl=1 151 | ServiceBinary=%13%\QCSLoopback.sys 152 | 153 | [QCSVAC_SA.NT.HW] 154 | AddReg = AUDIOHW.AddReg 155 | 156 | [AUDIOHW.AddReg] 157 | ; FILE_DEVICE_SOUND 158 | HKR,,DeviceType,0x10001,0x0000001D 159 | ; SDDL_DEVOBJ_SYS_ALL_ADM_RWX_WORLD_RWX_RES_RWX 160 | HKR,,Security,,"D:P(A;;GA;;;SY)(A;;GRGWGX;;;BA)(A;;GRGWGX;;;WD)(A;;GRGWGX;;;RC)" 161 | 162 | ;====================================================== 163 | ; WDF 164 | ;====================================================== 165 | [QCSVAC_SA.NT.Wdf] 166 | KmdfService = sysvad_qcsloopback, QCSVAC_SA_WdfSect 167 | [QCSVAC_SA_WdfSect] 168 | KmdfLibraryVersion = 1.15 169 | 170 | ;====================================================== 171 | ; COMMON 172 | ;====================================================== 173 | [Strings] 174 | 175 | ;Non-localizable 176 | 177 | KSNAME_WaveSpeaker="WaveSpeaker" 178 | KSNAME_TopologySpeaker="TopologySpeaker" 179 | 180 | KSNAME_WaveMicrophone="WaveMicrophone" 181 | KSNAME_TopologyMicrophone="TopologyMicrophone" 182 | 183 | Proxy.CLSID="{17CCA71B-ECD7-11D0-B908-00A0C9223196}" 184 | KSCATEGORY_AUDIO="{6994AD04-93EF-11D0-A3CC-00A0C9223196}" 185 | KSCATEGORY_RENDER="{65E8773E-8F56-11D0-A3B9-00A0C9223196}" 186 | KSCATEGORY_CAPTURE="{65E8773D-8F56-11D0-A3B9-00A0C9223196}" 187 | KSCATEGORY_REALTIME ="{EB115FFC-10C8-4964-831D-6DCB02E6F23F}" 188 | KSCATEGORY_TOPOLOGY = "{DDA54A40-1E4C-11D1-A050-405705C10000}" 189 | 190 | KSNODETYPE_ANY = "{00000000-0000-0000-0000-000000000000}" 191 | 192 | PKEY_AudioEndpoint_Association = "{1DA5D803-D492-4EDD-8C23-E0C0FFEE7F0E},2" 193 | ;PKEY_AudioEndpoint_Supports_EventDriven_Mode = "{1DA5D803-D492-4EDD-8C23-E0C0FFEE7F0E},7" 194 | ;PKEY_AudioEndpoint_Default_VolumeInDb = "{1DA5D803-D492-4EDD-8C23-E0C0FFEE7F0E},9" 195 | 196 | PKEY_FX_Association = "{D04E05A6-594B-4FB6-A80D-01AF5EED7D1D},0" 197 | ;PKEY_FX_EndpointEffectClsid = "{D04E05A6-594B-4fb6-A80D-01AF5EED7D1D},7" 198 | ;PKEY_FX_KeywordDetector_ModeEffectClsid = "{D04E05A6-594B-4fb6-A80D-01AF5EED7D1D},9" 199 | 200 | ; Driver developers would replace these CLSIDs with those of their own APOs 201 | ;FX_DISCOVER_EFFECTS_APO_CLSID = "{889C03C8-ABAD-4004-BF0A-BC7BB825E166}" 202 | 203 | MEDIA_CATEGORIES = "MediaCategories" 204 | MicrophoneCustomNameGUID = {d48deb08-fd1c-4d1e-b821-9064d49ae96e} 205 | 206 | ;Localizable 207 | 208 | ProviderName = "QCS" 209 | MfgName = "QCS" 210 | MsCopyRight = "BSD" 211 | 212 | QCSVAC_SA.DeviceDesc="Virtual Audio Cable (WDM) - QCSVAC" 213 | QCSVAC_QCSLoopback.SvcDesc="Virtual Audio Cable (WDM) - QCSVAC" 214 | 215 | ;; friendly names 216 | QCSVAC.WaveSpeaker.szPname="QCSVAC Wave Speaker" 217 | QCSVAC.TopologySpeaker.szPname="QCSVAC Topology Speaker" 218 | 219 | QCSVAC.WaveMicrophone.szPname="QCSVAC Wave Microphone" 220 | QCSVAC.TopologyMicrophone.szPname="QCSVAC Topology Microphone" 221 | 222 | MicrophoneCustomName= "Internal Microphone" 223 | -------------------------------------------------------------------------------- /TabletAudioSample/QCSLoopback2.inx: -------------------------------------------------------------------------------- 1 | [Version] 2 | Signature = "$Windows NT$" 3 | Class = MEDIA 4 | Provider = %ProviderName% 5 | ClassGUID = {4d36e96c-e325-11ce-bfc1-08002be10318} 6 | DriverVer = 11/20/2020, 1.0.0.1 7 | CatalogFile = sysvad.cat 8 | PnpLockDown = 1 9 | 10 | [SourceDisksNames] 11 | 222="QCSVAC Driver Disk","",222 12 | 13 | [SourceDisksFiles] 14 | QCSLoopback.sys=222 15 | 16 | [SignatureAttributes] 17 | QCSLoopback.sys=SignatureAttributes.DRM 18 | 19 | [SignatureAttributes.DRM] 20 | DRMLevel=1300 21 | 22 | [SignatureAttributes.PETrust] 23 | PETrust=true 24 | 25 | [Manufacturer] 26 | %MfgName%=QCSVAC,NT$ARCH$ 27 | 28 | [QCSVAC.NT$ARCH$] 29 | %QCSVAC_SA.DeviceDesc%=QCSVAC_SA, Root\sysvad_QCSLoopback 30 | 31 | [DestinationDirs] 32 | QCSVAC_SA.CopyList=13 ; 13=Package's DriverStore directory 33 | 34 | ;====================================================== 35 | ; QCSVAC_SA 36 | ;====================================================== 37 | [QCSVAC_SA.CopyList] 38 | QCSLoopback.sys 39 | 40 | [QCSVAC_SA.AddReg] 41 | HKR,,AssociatedFilters,,"wdmaud,redbook" 42 | HKR,,Driver,,QCSLoopback.sys 43 | 44 | HKR,Drivers,SubClasses,,"wave,mixer" 45 | 46 | HKR,Drivers\wave\wdmaud.drv,Driver,,wdmaud.drv 47 | HKR,Drivers\mixer\wdmaud.drv,Driver,,wdmaud.drv 48 | 49 | HKR,Drivers\wave\wdmaud.drv,Description,,%QCSVAC_SA.DeviceDesc% 50 | HKR,Drivers\mixer\wdmaud.drv,Description,,%QCSVAC_SA.DeviceDesc% 51 | 52 | ;;HKR,%MEDIA_CATEGORIES%\%MicrophoneCustomNameGUID%,Name,,%MicrophoneCustomName% 53 | 54 | ;====================================================== 55 | ; render interfaces: speaker (internal) 56 | ;====================================================== 57 | [QCSVAC.I.WaveSpeaker] 58 | AddReg=QCSVAC.I.WaveSpeaker.AddReg 59 | 60 | [QCSVAC.I.WaveSpeaker.AddReg] 61 | HKR,,CLSID,,%Proxy.CLSID% 62 | HKR,,FriendlyName,,%QCSVAC.WaveSpeaker.szPname% 63 | 64 | [QCSVAC.I.TopologySpeaker] 65 | AddReg=QCSVAC.I.TopologySpeaker.AddReg 66 | 67 | [QCSVAC.I.TopologySpeaker.AddReg] 68 | HKR,,CLSID,,%Proxy.CLSID% 69 | HKR,,FriendlyName,,%QCSVAC.TopologySpeaker.szPname% 70 | 71 | HKR,EP\0,%PKEY_AudioEndpoint_Association%,,%KSNODETYPE_ANY% 72 | HKR,FX\0,%PKEY_FX_Association%,,%KSNODETYPE_ANY% 73 | 74 | ; The following lines opt-in to pull mode. 75 | ;HKR,EP\0,%PKEY_AudioEndpoint_Supports_EventDriven_Mode%,0x00010001,0x1 76 | 77 | ;====================================================== 78 | ; capture interfaces: microphone (internal) 79 | ;====================================================== 80 | [QCSVAC.I.WaveMicrophone] 81 | AddReg=QCSVAC.I.WaveMicrophone.AddReg 82 | [QCSVAC.I.WaveMicrophone.AddReg] 83 | HKR,,CLSID,,%Proxy.CLSID% 84 | HKR,,FriendlyName,,%QCSVAC.WaveMicrophone.szPname% 85 | 86 | [QCSVAC.I.TopologyMicrophone] 87 | AddReg=QCSVAC.I.TopologyMicrophone.AddReg 88 | 89 | [QCSVAC.I.TopologyMicrophone.AddReg] 90 | HKR,,CLSID,,%Proxy.CLSID% 91 | HKR,,FriendlyName,,%QCSVAC.TopologyMicrophone.szPname% 92 | 93 | HKR,EP\0,%PKEY_AudioEndpoint_Association%,,%KSNODETYPE_ANY% 94 | HKR,FX\0,%PKEY_FX_Association%,,%KSNODETYPE_ANY% 95 | 96 | ; The following lines opt-in to pull mode. 97 | ;HKR,EP\0,%PKEY_AudioEndpoint_Supports_EventDriven_Mode%,0x00010001,0x1 98 | 99 | ; The following line overrides the default volume (in dB) for an endpoint. 100 | ; It is only applicable when hardware volume is not implemented. 101 | ; Float value expressed in fixed point 16.16 format and stored as a DWORD. 102 | ; 10 dB 103 | ;HKR,EP\0,%PKEY_AudioEndpoint_Default_VolumeInDb%,0x00010001,0xA0000 104 | ;-10 dB 105 | ;HKR,EP\0,%PKEY_AudioEndpoint_Default_VolumeInDb%,0x00010001,0xFFF60000 106 | 107 | ;====================================================== 108 | ; QCSVAC_SA 109 | ;====================================================== 110 | [QCSVAC_SA.NT] 111 | Include=ks.inf,wdmaudio.inf 112 | Needs=KS.Registration, WDMAUDIO.Registration 113 | CopyFiles=QCSVAC_SA.CopyList 114 | AddReg=QCSVAC_SA.AddReg 115 | 116 | [QCSVAC_SA.NT.Interfaces] 117 | ; 118 | ; Interfaces for speaker (internal) render endpoint. 119 | ; 120 | AddInterface=%KSCATEGORY_AUDIO%, %KSNAME_WaveSpeaker%, QCSVAC.I.WaveSpeaker 121 | AddInterface=%KSCATEGORY_RENDER%, %KSNAME_WaveSpeaker%, QCSVAC.I.WaveSpeaker 122 | AddInterface=%KSCATEGORY_REALTIME%, %KSNAME_WaveSpeaker%, QCSVAC.I.WaveSpeaker 123 | AddInterface=%KSCATEGORY_AUDIO%, %KSNAME_TopologySpeaker%, QCSVAC.I.TopologySpeaker 124 | AddInterface=%KSCATEGORY_TOPOLOGY%, %KSNAME_TopologySpeaker%, QCSVAC.I.TopologySpeaker 125 | 126 | ; 127 | ; Interfaces for microphone (internal) capture endpoint 128 | ; 129 | AddInterface=%KSCATEGORY_AUDIO%, %KSNAME_WaveMicrophone%, QCSVAC.I.WaveMicrophone 130 | AddInterface=%KSCATEGORY_REALTIME%, %KSNAME_WaveMicrophone%, QCSVAC.I.WaveMicrophone 131 | AddInterface=%KSCATEGORY_CAPTURE%, %KSNAME_WaveMicrophone%, QCSVAC.I.WaveMicrophone 132 | AddInterface=%KSCATEGORY_AUDIO%, %KSNAME_TopologyMicrophone%, QCSVAC.I.TopologyMicrophone 133 | AddInterface=%KSCATEGORY_TOPOLOGY%, %KSNAME_TopologyMicrophone%, QCSVAC.I.TopologyMicrophone 134 | 135 | [QCSVAC_SA.NT.Services] 136 | AddService=sysvad_qcsloopback,0x00000002,sysvad_QCSLoopback_Service_Inst 137 | 138 | [sysvad_QCSLoopback_Service_Inst] 139 | DisplayName=%QCSVAC_QCSLoopback.SvcDesc% 140 | ServiceType=1 141 | StartType=3 142 | ErrorControl=1 143 | ServiceBinary=%13%\QCSLoopback.sys 144 | 145 | [QCSVAC_SA.NT.HW] 146 | AddReg = AUDIOHW.AddReg 147 | 148 | [AUDIOHW.AddReg] 149 | ; FILE_DEVICE_SOUND 150 | HKR,,DeviceType,0x10001,0x0000001D 151 | ; SDDL_DEVOBJ_SYS_ALL_ADM_RWX_WORLD_RWX_RES_RWX 152 | HKR,,Security,,"D:P(A;;GA;;;SY)(A;;GRGWGX;;;BA)(A;;GRGWGX;;;WD)(A;;GRGWGX;;;RC)" 153 | 154 | ;====================================================== 155 | ; WDF 156 | ;====================================================== 157 | [QCSVAC_SA.NT.Wdf] 158 | KmdfService = sysvad_qcsloopback, QCSVAC_SA_WdfSect 159 | [QCSVAC_SA_WdfSect] 160 | KmdfLibraryVersion = 1.15 161 | 162 | ;====================================================== 163 | ; COMMON 164 | ;====================================================== 165 | [Strings] 166 | 167 | ;Non-localizable 168 | 169 | KSNAME_WaveSpeaker="WaveSpeaker" 170 | KSNAME_TopologySpeaker="TopologySpeaker" 171 | 172 | KSNAME_WaveMicrophone="WaveMicrophone" 173 | KSNAME_TopologyMicrophone="TopologyMicrophone" 174 | 175 | Proxy.CLSID="{17CCA71B-ECD7-11D0-B908-00A0C9223196}" 176 | KSCATEGORY_AUDIO="{6994AD04-93EF-11D0-A3CC-00A0C9223196}" 177 | KSCATEGORY_RENDER="{65E8773E-8F56-11D0-A3B9-00A0C9223196}" 178 | KSCATEGORY_CAPTURE="{65E8773D-8F56-11D0-A3B9-00A0C9223196}" 179 | KSCATEGORY_REALTIME ="{EB115FFC-10C8-4964-831D-6DCB02E6F23F}" 180 | KSCATEGORY_TOPOLOGY = "{DDA54A40-1E4C-11D1-A050-405705C10000}" 181 | 182 | KSNODETYPE_ANY = "{00000000-0000-0000-0000-000000000000}" 183 | 184 | PKEY_AudioEndpoint_Association = "{1DA5D803-D492-4EDD-8C23-E0C0FFEE7F0E},2" 185 | ;PKEY_AudioEndpoint_Supports_EventDriven_Mode = "{1DA5D803-D492-4EDD-8C23-E0C0FFEE7F0E},7" 186 | ;PKEY_AudioEndpoint_Default_VolumeInDb = "{1DA5D803-D492-4EDD-8C23-E0C0FFEE7F0E},9" 187 | 188 | PKEY_FX_Association = "{D04E05A6-594B-4FB6-A80D-01AF5EED7D1D},0" 189 | ;PKEY_FX_EndpointEffectClsid = "{D04E05A6-594B-4fb6-A80D-01AF5EED7D1D},7" 190 | ;PKEY_FX_KeywordDetector_ModeEffectClsid = "{D04E05A6-594B-4fb6-A80D-01AF5EED7D1D},9" 191 | 192 | ; Driver developers would replace these CLSIDs with those of their own APOs 193 | ;FX_DISCOVER_EFFECTS_APO_CLSID = "{889C03C8-ABAD-4004-BF0A-BC7BB825E166}" 194 | 195 | MEDIA_CATEGORIES = "MediaCategories" 196 | MicrophoneCustomNameGUID = {d48deb08-fd1c-4d1e-b821-9064d49ae96e} 197 | 198 | ;Localizable 199 | 200 | ProviderName = "QCS" 201 | MfgName = "QCS" 202 | MsCopyRight = "BSD" 203 | 204 | QCSVAC_SA.DeviceDesc="Virtual Audio Cable (WDM) - QCSVAC" 205 | QCSVAC_QCSLoopback.SvcDesc="Virtual Audio Cable (WDM) - QCSVAC" 206 | 207 | ;; friendly names 208 | QCSVAC.WaveSpeaker.szPname="QCSVAC Wave Speaker" 209 | QCSVAC.TopologySpeaker.szPname="QCSVAC Topology Speaker" 210 | 211 | QCSVAC.WaveMicrophone.szPname="QCSVAC Wave Microphone" 212 | QCSVAC.TopologyMicrophone.szPname="QCSVAC Topology Microphone" 213 | 214 | MicrophoneCustomName= "Internal Microphone" 215 | -------------------------------------------------------------------------------- /TabletAudioSample/TabletAudioSample.rc: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) Microsoft Corporation All Rights Reserved 4 | 5 | Module Name: 6 | 7 | TabletAudioSample.rc 8 | 9 | Abstract: 10 | 11 | 12 | --*/ 13 | 14 | #include 15 | 16 | #include 17 | 18 | #define VER_FILETYPE VFT_DRV 19 | #define VER_FILESUBTYPE VFT2_DRV_SOUND 20 | #define VER_FILEDESCRIPTION_STR "Microsoft Virtual Audio Tablet Sample Driver" 21 | #define VER_INTERNALNAME_STR "TabletAudioSample.sys" 22 | #define VER_ORIGINALFILENAME_STR "TabletAudioSample.sys" 23 | 24 | #define VER_LEGALCOPYRIGHT_YEARS "2013" 25 | #define VER_LEGALCOPYRIGHT_STR "Copyright (C) Microsoft Corp." VER_LEGALCOPYRIGHT_YEARS 26 | 27 | #include "common.ver" 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /TabletAudioSample/TabletAudioSample.vcxproj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /TabletAudioSample/hdmitopo.h: -------------------------------------------------------------------------------- 1 | 2 | /*++ 3 | 4 | Copyright (c) Microsoft Corporation All Rights Reserved 5 | 6 | Module Name: 7 | 8 | hdmitopo.h 9 | 10 | Abstract: 11 | 12 | Declaration of topology miniport for the hdmi endpoint. 13 | 14 | --*/ 15 | 16 | #ifndef _SYSVAD_HDMITOPO_H_ 17 | #define _SYSVAD_HDMITOPO_H_ 18 | 19 | #include "basetopo.h" 20 | 21 | //============================================================================= 22 | // Classes 23 | //============================================================================= 24 | 25 | /////////////////////////////////////////////////////////////////////////////// 26 | // CHdmiMiniportTopology 27 | // 28 | 29 | class CHdmiMiniportTopology : 30 | public CMiniportTopologySYSVAD, 31 | public IMiniportTopology, 32 | public CUnknown 33 | { 34 | public: 35 | DECLARE_STD_UNKNOWN(); 36 | CHdmiMiniportTopology 37 | ( 38 | _In_opt_ PUNKNOWN UnknownOuter, 39 | _In_ PCFILTER_DESCRIPTOR *FilterDesc, 40 | _In_ USHORT DeviceMaxChannels 41 | ) 42 | : CUnknown(UnknownOuter), 43 | CMiniportTopologySYSVAD(FilterDesc, DeviceMaxChannels) 44 | {} 45 | 46 | ~CHdmiMiniportTopology(); 47 | 48 | IMP_IMiniportTopology; 49 | 50 | NTSTATUS PropertyHandlerJackSinkInfo 51 | ( 52 | _In_ PPCPROPERTY_REQUEST PropertyRequest 53 | ); 54 | 55 | NTSTATUS PropertyHandlerJackDescription 56 | ( 57 | _In_ PPCPROPERTY_REQUEST PropertyRequest 58 | ); 59 | 60 | NTSTATUS PropertyHandlerJackDescription2 61 | ( 62 | _In_ PPCPROPERTY_REQUEST PropertyRequest 63 | ); 64 | }; 65 | 66 | typedef CHdmiMiniportTopology *PCHdmiMiniportTopology; 67 | 68 | 69 | NTSTATUS 70 | CreateHdmiMiniportTopology( 71 | _Out_ PUNKNOWN * Unknown, 72 | _In_ REFCLSID, 73 | _In_opt_ PUNKNOWN UnknownOuter, 74 | _When_((PoolType & NonPagedPoolMustSucceed) != 0, 75 | __drv_reportError("Must succeed pool allocations are forbidden. " 76 | "Allocation failures cause a system crash")) 77 | _In_ POOL_TYPE PoolType, 78 | _In_ PUNKNOWN UnknownAdapter, 79 | _In_opt_ PVOID DeviceContext, 80 | _In_ PENDPOINT_MINIPAIR MiniportPair 81 | ); 82 | 83 | NTSTATUS PropertyHandler_HdmiTopoFilter(_In_ PPCPROPERTY_REQUEST PropertyRequest); 84 | 85 | #endif // _SYSVAD_HDMITOPO_H_ 86 | 87 | -------------------------------------------------------------------------------- /TabletAudioSample/hdmitoptable.h: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) Microsoft Corporation All Rights Reserved 4 | 5 | Module Name: 6 | 7 | hdmitoptable.h 8 | 9 | Abstract: 10 | 11 | Declaration of topology tables for the hdmi endpoint. 12 | 13 | --*/ 14 | 15 | #ifndef _SYSVAD_HDMITOPTABLE_H_ 16 | #define _SYSVAD_HDMITOPTABLE_H_ 17 | 18 | //============================================================================= 19 | static 20 | KSDATARANGE HdmiTopoPinDataRangesBridge[] = 21 | { 22 | { 23 | sizeof(KSDATARANGE), 24 | 0, 25 | 0, 26 | 0, 27 | STATICGUIDOF(KSDATAFORMAT_TYPE_AUDIO), 28 | STATICGUIDOF(KSDATAFORMAT_SUBTYPE_ANALOG), 29 | STATICGUIDOF(KSDATAFORMAT_SPECIFIER_NONE) 30 | }, 31 | { 32 | sizeof(KSDATARANGE), 33 | 0, 34 | 0, 35 | 0, 36 | STATICGUIDOF(KSDATAFORMAT_TYPE_AUDIO), 37 | STATICGUIDOF(KSDATAFORMAT_SUBTYPE_IEC61937_DOLBY_DIGITAL), 38 | STATICGUIDOF(KSDATAFORMAT_SPECIFIER_NONE) 39 | }, 40 | { 41 | sizeof(KSDATARANGE), 42 | 0, 43 | 0, 44 | 0, 45 | STATICGUIDOF(KSDATAFORMAT_TYPE_AUDIO), 46 | STATICGUIDOF(KSDATAFORMAT_SUBTYPE_IEC61937_DOLBY_MLP), 47 | STATICGUIDOF(KSDATAFORMAT_SPECIFIER_NONE) 48 | }, 49 | { 50 | sizeof(KSDATARANGE), 51 | 0, 52 | 0, 53 | 0, 54 | STATICGUIDOF(KSDATAFORMAT_TYPE_AUDIO), 55 | STATICGUIDOF(KSDATAFORMAT_SUBTYPE_IEC61937_DTS), 56 | STATICGUIDOF(KSDATAFORMAT_SPECIFIER_NONE) 57 | }, 58 | { 59 | sizeof(KSDATARANGE), 60 | 0, 61 | 0, 62 | 0, 63 | STATICGUIDOF(KSDATAFORMAT_TYPE_AUDIO), 64 | STATICGUIDOF(KSDATAFORMAT_SUBTYPE_IEC61937_DTS_HD), 65 | STATICGUIDOF(KSDATAFORMAT_SPECIFIER_NONE) 66 | }, 67 | { 68 | sizeof(KSDATARANGE), 69 | 0, 70 | 0, 71 | 0, 72 | STATICGUIDOF(KSDATAFORMAT_TYPE_AUDIO), 73 | STATICGUIDOF(KSDATAFORMAT_SUBTYPE_IEC61937_DOLBY_MAT20), 74 | STATICGUIDOF(KSDATAFORMAT_SPECIFIER_NONE) 75 | }, 76 | { 77 | sizeof(KSDATARANGE), 78 | 0, 79 | 0, 80 | 0, 81 | STATICGUIDOF(KSDATAFORMAT_TYPE_AUDIO), 82 | STATICGUIDOF(KSDATAFORMAT_SUBTYPE_IEC61937_DOLBY_MAT21), 83 | STATICGUIDOF(KSDATAFORMAT_SPECIFIER_NONE) 84 | } 85 | }; 86 | 87 | //============================================================================= 88 | static 89 | PKSDATARANGE HdmiTopoPinDataRangePointersBridge[] = 90 | { 91 | &HdmiTopoPinDataRangesBridge[0], 92 | &HdmiTopoPinDataRangesBridge[1], 93 | &HdmiTopoPinDataRangesBridge[2], 94 | &HdmiTopoPinDataRangesBridge[3], 95 | &HdmiTopoPinDataRangesBridge[4], 96 | &HdmiTopoPinDataRangesBridge[5], 97 | &HdmiTopoPinDataRangesBridge[6] 98 | }; 99 | 100 | //============================================================================= 101 | static 102 | PCPIN_DESCRIPTOR HdmiTopoMiniportPins[] = 103 | { 104 | // KSPIN_TOPO_WAVEOUT_SOURCE 105 | { 106 | 0, 107 | 0, 108 | 0, // InstanceCount 109 | NULL, // AutomationTable 110 | { // KsPinDescriptor 111 | 0, // InterfacesCount 112 | NULL, // Interfaces 113 | 0, // MediumsCount 114 | NULL, // Mediums 115 | SIZEOF_ARRAY(HdmiTopoPinDataRangePointersBridge), // DataRangesCount 116 | HdmiTopoPinDataRangePointersBridge, // DataRanges 117 | KSPIN_DATAFLOW_IN, // DataFlow 118 | KSPIN_COMMUNICATION_NONE, // Communication 119 | &KSCATEGORY_AUDIO, // Category 120 | NULL, // Name 121 | 0 // Reserved 122 | } 123 | }, 124 | // KSPIN_TOPO_LINEOUT_DEST 125 | { 126 | 0, 127 | 0, 128 | 0, // InstanceCount 129 | NULL, // AutomationTable 130 | { // KsPinDescriptor 131 | 0, // InterfacesCount 132 | NULL, // Interfaces 133 | 0, // MediumsCount 134 | NULL, // Mediums 135 | SIZEOF_ARRAY(HdmiTopoPinDataRangePointersBridge), // DataRangesCount 136 | HdmiTopoPinDataRangePointersBridge, // DataRanges 137 | KSPIN_DATAFLOW_OUT, // DataFlow 138 | KSPIN_COMMUNICATION_NONE, // Communication 139 | &KSNODETYPE_HDMI_INTERFACE, // Category 140 | NULL, // Name 141 | 0 // Reserved 142 | } 143 | } 144 | }; 145 | 146 | //============================================================================= 147 | static 148 | KSJACK_DESCRIPTION HdmiJackDesc = 149 | { 150 | KSAUDIO_SPEAKER_STEREO, 151 | 0x0000, // no color 152 | eConnTypeOtherDigital, 153 | eGeoLocHDMI, 154 | eGenLocPrimaryBox, 155 | ePortConnJack, 156 | TRUE 157 | }; 158 | 159 | // Only return a KSJACK_DESCRIPTION for the physical bridge pin. 160 | static 161 | PKSJACK_DESCRIPTION HdmiJackDescriptions[] = 162 | { 163 | NULL, 164 | &HdmiJackDesc 165 | }; 166 | 167 | //============================================================================= 168 | static 169 | PCCONNECTION_DESCRIPTOR HdmiTopoMiniportConnections[] = 170 | { 171 | // FromNode, FromPin, ToNode, ToPin 172 | { PCFILTER_NODE, KSPIN_TOPO_WAVEOUT_SOURCE, PCFILTER_NODE, KSPIN_TOPO_LINEOUT_DEST} 173 | }; 174 | 175 | 176 | //============================================================================= 177 | static 178 | PCPROPERTY_ITEM PropertiesHdmiTopoFilter[] = 179 | { 180 | { 181 | &KSPROPSETID_Jack, 182 | KSPROPERTY_JACK_DESCRIPTION, 183 | KSPROPERTY_TYPE_GET | KSPROPERTY_TYPE_BASICSUPPORT, 184 | PropertyHandler_HdmiTopoFilter 185 | }, 186 | { 187 | &KSPROPSETID_Jack, 188 | KSPROPERTY_JACK_DESCRIPTION2, 189 | KSPROPERTY_TYPE_GET | KSPROPERTY_TYPE_BASICSUPPORT, 190 | PropertyHandler_HdmiTopoFilter 191 | }, 192 | { 193 | &KSPROPSETID_Jack, 194 | KSPROPERTY_JACK_SINK_INFO, 195 | KSPROPERTY_TYPE_GET | KSPROPERTY_TYPE_BASICSUPPORT, 196 | PropertyHandler_HdmiTopoFilter 197 | } 198 | }; 199 | 200 | DEFINE_PCAUTOMATION_TABLE_PROP(AutomationHdmiTopoFilter, PropertiesHdmiTopoFilter); 201 | 202 | //============================================================================= 203 | static 204 | PCFILTER_DESCRIPTOR HdmiTopoMiniportFilterDescriptor = 205 | { 206 | 0, // Version 207 | &AutomationHdmiTopoFilter, // AutomationTable 208 | sizeof(PCPIN_DESCRIPTOR), // PinSize 209 | SIZEOF_ARRAY(HdmiTopoMiniportPins), // PinCount 210 | HdmiTopoMiniportPins, // Pins 211 | sizeof(PCNODE_DESCRIPTOR), // NodeSize 212 | 0, // NodeCount 213 | NULL, // Nodes 214 | SIZEOF_ARRAY(HdmiTopoMiniportConnections), // ConnectionCount 215 | HdmiTopoMiniportConnections, // Connections 216 | 0, // CategoryCount 217 | NULL // Categories 218 | }; 219 | 220 | #endif // _SYSVAD_HDMITOPTABLE_H_ 221 | 222 | 223 | -------------------------------------------------------------------------------- /TabletAudioSample/micarray2toptable.h: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) Microsoft Corporation All Rights Reserved 4 | 5 | Module Name: 6 | 7 | micarray2toptable.h 8 | 9 | Abstract: 10 | 11 | Declaration of topology tables for the mic array (back). 12 | 13 | --*/ 14 | 15 | #ifndef _SYSVAD_MICARRAY2TOPTABLE_H_ 16 | #define _SYSVAD_MICARRAY2TOPTABLE_H_ 17 | 18 | // 19 | // {3fe0e3e1-ad16-4772-8382-4129169018ce} 20 | DEFINE_GUID(MICARRAY2_CUSTOM_NAME, 21 | 0x3fe0e3e1, 0xad16, 0x4772, 0x83, 0x82, 0x41, 0x29, 0x16, 0x90, 0x18, 0xce); 22 | 23 | //============================================================================= 24 | static 25 | KSDATARANGE MicArray2TopoPinDataRangesBridge[] = 26 | { 27 | { 28 | sizeof(KSDATARANGE), 29 | 0, 30 | 0, 31 | 0, 32 | STATICGUIDOF(KSDATAFORMAT_TYPE_AUDIO), 33 | STATICGUIDOF(KSDATAFORMAT_SUBTYPE_ANALOG), 34 | STATICGUIDOF(KSDATAFORMAT_SPECIFIER_NONE) 35 | } 36 | }; 37 | 38 | //============================================================================= 39 | static 40 | PKSDATARANGE MicArray2TopoPinDataRangePointersBridge[] = 41 | { 42 | &MicArray2TopoPinDataRangesBridge[0] 43 | }; 44 | 45 | //============================================================================= 46 | static 47 | PCPIN_DESCRIPTOR MicArray2TopoMiniportPins[] = 48 | { 49 | // KSPIN_TOPO_MIC_ELEMENTS 50 | { 51 | 0, 52 | 0, 53 | 0, // InstanceCount 54 | NULL, // AutomationTable 55 | { // KsPinDescriptor 56 | 0, // InterfacesCount 57 | NULL, // Interfaces 58 | 0, // MediumsCount 59 | NULL, // Mediums 60 | SIZEOF_ARRAY(MicArray2TopoPinDataRangePointersBridge), // DataRangesCount 61 | MicArray2TopoPinDataRangePointersBridge, // DataRanges 62 | KSPIN_DATAFLOW_IN, // DataFlow 63 | KSPIN_COMMUNICATION_NONE, // Communication 64 | &KSNODETYPE_MICROPHONE_ARRAY, // Category 65 | &MICARRAY2_CUSTOM_NAME, // Name 66 | 0 // Reserved 67 | } 68 | }, 69 | 70 | // KSPIN_TOPO_BRIDGE 71 | { 72 | 0, 73 | 0, 74 | 0, // InstanceCount 75 | NULL, // AutomationTable 76 | { // KsPinDescriptor 77 | 0, // InterfacesCount 78 | NULL, // Interfaces 79 | 0, // MediumsCount 80 | NULL, // Mediums 81 | SIZEOF_ARRAY(MicArray2TopoPinDataRangePointersBridge), // DataRangesCount 82 | MicArray2TopoPinDataRangePointersBridge, // DataRanges 83 | KSPIN_DATAFLOW_OUT, // DataFlow 84 | KSPIN_COMMUNICATION_NONE, // Communication 85 | &KSCATEGORY_AUDIO, // Category 86 | NULL, // Name 87 | 0 // Reserved 88 | } 89 | } 90 | }; 91 | 92 | //============================================================================= 93 | static 94 | PCPROPERTY_ITEM MicArray2PropertiesVolume[] = 95 | { 96 | { 97 | &KSPROPSETID_Audio, 98 | KSPROPERTY_AUDIO_VOLUMELEVEL, 99 | KSPROPERTY_TYPE_GET | KSPROPERTY_TYPE_SET | KSPROPERTY_TYPE_BASICSUPPORT, 100 | PropertyHandler_MicArrayTopology 101 | } 102 | }; 103 | 104 | DEFINE_PCAUTOMATION_TABLE_PROP(AutomationMicArray2Volume, MicArray2PropertiesVolume); 105 | 106 | //============================================================================= 107 | static 108 | PCPROPERTY_ITEM MicArray2PropertiesMute[] = 109 | { 110 | { 111 | &KSPROPSETID_Audio, 112 | KSPROPERTY_AUDIO_MUTE, 113 | KSPROPERTY_TYPE_GET | KSPROPERTY_TYPE_SET | KSPROPERTY_TYPE_BASICSUPPORT, 114 | PropertyHandler_MicArrayTopology 115 | } 116 | }; 117 | 118 | DEFINE_PCAUTOMATION_TABLE_PROP(AutomationMicArray2Mute, MicArray2PropertiesMute); 119 | 120 | //============================================================================= 121 | static 122 | PCPROPERTY_ITEM MicArray2PropertiesPeakMeter[] = 123 | { 124 | { 125 | &KSPROPSETID_Audio, 126 | KSPROPERTY_AUDIO_PEAKMETER2, 127 | KSPROPERTY_TYPE_GET | KSPROPERTY_TYPE_BASICSUPPORT, 128 | PropertyHandler_MicArrayTopology 129 | }, 130 | { 131 | &KSPROPSETID_Audio, 132 | KSPROPERTY_AUDIO_CPU_RESOURCES, 133 | KSPROPERTY_TYPE_GET | KSPROPERTY_TYPE_BASICSUPPORT, 134 | PropertyHandler_MicArrayTopology 135 | } 136 | }; 137 | 138 | DEFINE_PCAUTOMATION_TABLE_PROP(AutomationMicArray2PeakMeter, MicArray2PropertiesPeakMeter); 139 | 140 | //============================================================================= 141 | static 142 | PCNODE_DESCRIPTOR MicArray2TopologyNodes[] = 143 | { 144 | // KSNODE_TOPO_VOLUME 145 | { 146 | 0, // Flags 147 | &AutomationMicArray2Volume, // AutomationTable 148 | &KSNODETYPE_VOLUME, // Type 149 | &KSAUDFNAME_MIC_VOLUME // Name 150 | }, 151 | // KSNODE_TOPO_MUTE 152 | { 153 | 0, // Flags 154 | &AutomationMicArray2Mute, // AutomationTable 155 | &KSNODETYPE_MUTE, // Type 156 | &KSAUDFNAME_MIC_MUTE // Name 157 | }, 158 | // KSNODE_TOPO_PEAKMETER 159 | { 160 | 0, // Flags 161 | &AutomationMicArray2PeakMeter, // AutomationTable 162 | &KSNODETYPE_PEAKMETER, // Type 163 | &KSAUDFNAME_PEAKMETER // Name 164 | } 165 | }; 166 | 167 | C_ASSERT( KSNODE_TOPO_VOLUME == 0 ); 168 | C_ASSERT( KSNODE_TOPO_MUTE == 1 ); 169 | C_ASSERT( KSNODE_TOPO_PEAKMETER == 2 ); 170 | 171 | 172 | //============================================================================= 173 | static 174 | PCCONNECTION_DESCRIPTOR MicArray2TopoMiniportConnections[] = 175 | { 176 | // FromNode, FromPin, ToNode, ToPin 177 | { PCFILTER_NODE, KSPIN_TOPO_MIC_ELEMENTS, KSNODE_TOPO_VOLUME, 1 }, 178 | { KSNODE_TOPO_VOLUME, 0, KSNODE_TOPO_MUTE, 1 }, 179 | { KSNODE_TOPO_MUTE, 0, KSNODE_TOPO_PEAKMETER, 1 }, 180 | { KSNODE_TOPO_PEAKMETER, 0, PCFILTER_NODE, KSPIN_TOPO_BRIDGE } 181 | }; 182 | 183 | 184 | //============================================================================= 185 | static 186 | PCPROPERTY_ITEM MicArray2PropertiesTopoFilter[] = 187 | { 188 | { 189 | &KSPROPSETID_Jack, 190 | KSPROPERTY_JACK_DESCRIPTION, 191 | KSPROPERTY_TYPE_GET | KSPROPERTY_TYPE_BASICSUPPORT, 192 | PropertyHandler_MicArrayTopoFilter 193 | }, 194 | { 195 | &KSPROPSETID_Jack, 196 | KSPROPERTY_JACK_DESCRIPTION2, 197 | KSPROPERTY_TYPE_GET | KSPROPERTY_TYPE_BASICSUPPORT, 198 | PropertyHandler_MicArrayTopoFilter 199 | }, 200 | { 201 | &KSPROPSETID_Audio, 202 | KSPROPERTY_AUDIO_MIC_ARRAY_GEOMETRY, 203 | KSPROPERTY_TYPE_GET | KSPROPERTY_TYPE_BASICSUPPORT, 204 | PropertyHandler_MicArrayTopoFilter 205 | } 206 | }; 207 | 208 | DEFINE_PCAUTOMATION_TABLE_PROP(AutomationMicArray2TopoFilter, MicArray2PropertiesTopoFilter); 209 | 210 | //============================================================================= 211 | static 212 | PCFILTER_DESCRIPTOR MicArray2TopoMiniportFilterDescriptor = 213 | { 214 | 0, // Version 215 | &AutomationMicArray2TopoFilter, // AutomationTable 216 | sizeof(PCPIN_DESCRIPTOR), // PinSize 217 | SIZEOF_ARRAY(MicArray2TopoMiniportPins), // PinCount 218 | MicArray2TopoMiniportPins, // Pins 219 | sizeof(PCNODE_DESCRIPTOR), // NodeSize 220 | SIZEOF_ARRAY(MicArray2TopologyNodes), // NodeCount 221 | MicArray2TopologyNodes, // Nodes 222 | SIZEOF_ARRAY(MicArray2TopoMiniportConnections),// ConnectionCount 223 | MicArray2TopoMiniportConnections, // Connections 224 | 0, // CategoryCount 225 | NULL // Categories 226 | }; 227 | 228 | #endif // _SYSVAD_MICARRAY2TOPTABLE_H_ 229 | 230 | -------------------------------------------------------------------------------- /TabletAudioSample/micarray3toptable.h: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) Microsoft Corporation All Rights Reserved 4 | 5 | Module Name: 6 | 7 | micarray3toptable.h 8 | 9 | Abstract: 10 | 11 | Declaration of topology tables for the mic array (front/back). 12 | 13 | --*/ 14 | 15 | #ifndef _SYSVAD_MICARRAY3TOPTABLE_H_ 16 | #define _SYSVAD_MICARRAY3TOPTABLE_H_ 17 | 18 | // 19 | // {c04bdb7c-2138-48da-9dd4-2af9ff2e58c2} 20 | DEFINE_GUID(MICARRAY3_CUSTOM_NAME, 21 | 0xc04bdb7c, 0x2138, 0x48da, 0x9d, 0xd4, 0x2a, 0xf9, 0xff, 0x2e, 0x58, 0xc2); 22 | 23 | //============================================================================= 24 | static 25 | KSDATARANGE MicArray3TopoPinDataRangesBridge[] = 26 | { 27 | { 28 | sizeof(KSDATARANGE), 29 | 0, 30 | 0, 31 | 0, 32 | STATICGUIDOF(KSDATAFORMAT_TYPE_AUDIO), 33 | STATICGUIDOF(KSDATAFORMAT_SUBTYPE_ANALOG), 34 | STATICGUIDOF(KSDATAFORMAT_SPECIFIER_NONE) 35 | } 36 | }; 37 | 38 | //============================================================================= 39 | static 40 | PKSDATARANGE MicArray3TopoPinDataRangePointersBridge[] = 41 | { 42 | &MicArray3TopoPinDataRangesBridge[0] 43 | }; 44 | 45 | //============================================================================= 46 | static 47 | PCPIN_DESCRIPTOR MicArray3TopoMiniportPins[] = 48 | { 49 | // KSPIN_TOPO_MIC_ELEMENTS 50 | { 51 | 0, 52 | 0, 53 | 0, // InstanceCount 54 | NULL, // AutomationTable 55 | { // KsPinDescriptor 56 | 0, // InterfacesCount 57 | NULL, // Interfaces 58 | 0, // MediumsCount 59 | NULL, // Mediums 60 | SIZEOF_ARRAY(MicArray3TopoPinDataRangePointersBridge), // DataRangesCount 61 | MicArray3TopoPinDataRangePointersBridge, // DataRanges 62 | KSPIN_DATAFLOW_IN, // DataFlow 63 | KSPIN_COMMUNICATION_NONE, // Communication 64 | &KSNODETYPE_MICROPHONE_ARRAY, // Category 65 | &MICARRAY3_CUSTOM_NAME, // Name 66 | 0 // Reserved 67 | } 68 | }, 69 | 70 | // KSPIN_TOPO_BRIDGE 71 | { 72 | 0, 73 | 0, 74 | 0, // InstanceCount 75 | NULL, // AutomationTable 76 | { // KsPinDescriptor 77 | 0, // InterfacesCount 78 | NULL, // Interfaces 79 | 0, // MediumsCount 80 | NULL, // Mediums 81 | SIZEOF_ARRAY(MicArray3TopoPinDataRangePointersBridge), // DataRangesCount 82 | MicArray3TopoPinDataRangePointersBridge, // DataRanges 83 | KSPIN_DATAFLOW_OUT, // DataFlow 84 | KSPIN_COMMUNICATION_NONE, // Communication 85 | &KSCATEGORY_AUDIO, // Category 86 | NULL, // Name 87 | 0 // Reserved 88 | } 89 | } 90 | }; 91 | 92 | //============================================================================= 93 | static 94 | PCPROPERTY_ITEM MicArray3PropertiesVolume[] = 95 | { 96 | { 97 | &KSPROPSETID_Audio, 98 | KSPROPERTY_AUDIO_VOLUMELEVEL, 99 | KSPROPERTY_TYPE_GET | KSPROPERTY_TYPE_SET | KSPROPERTY_TYPE_BASICSUPPORT, 100 | PropertyHandler_MicArrayTopology 101 | } 102 | }; 103 | 104 | DEFINE_PCAUTOMATION_TABLE_PROP(AutomationMicArray3Volume, MicArray3PropertiesVolume); 105 | 106 | //============================================================================= 107 | static 108 | PCPROPERTY_ITEM MicArray3PropertiesMute[] = 109 | { 110 | { 111 | &KSPROPSETID_Audio, 112 | KSPROPERTY_AUDIO_MUTE, 113 | KSPROPERTY_TYPE_GET | KSPROPERTY_TYPE_SET | KSPROPERTY_TYPE_BASICSUPPORT, 114 | PropertyHandler_MicArrayTopology 115 | } 116 | }; 117 | 118 | DEFINE_PCAUTOMATION_TABLE_PROP(AutomationMicArray3Mute, MicArray3PropertiesMute); 119 | 120 | //============================================================================= 121 | static 122 | PCPROPERTY_ITEM MicArray3PropertiesPeakMeter[] = 123 | { 124 | { 125 | &KSPROPSETID_Audio, 126 | KSPROPERTY_AUDIO_PEAKMETER2, 127 | KSPROPERTY_TYPE_GET | KSPROPERTY_TYPE_BASICSUPPORT, 128 | PropertyHandler_MicArrayTopology 129 | }, 130 | { 131 | &KSPROPSETID_Audio, 132 | KSPROPERTY_AUDIO_CPU_RESOURCES, 133 | KSPROPERTY_TYPE_GET | KSPROPERTY_TYPE_BASICSUPPORT, 134 | PropertyHandler_MicArrayTopology 135 | } 136 | }; 137 | 138 | DEFINE_PCAUTOMATION_TABLE_PROP(AutomationMicArray3PeakMeter, MicArray3PropertiesPeakMeter); 139 | 140 | //============================================================================= 141 | static 142 | PCNODE_DESCRIPTOR MicArray3TopologyNodes[] = 143 | { 144 | // KSNODE_TOPO_VOLUME 145 | { 146 | 0, // Flags 147 | &AutomationMicArray3Volume, // AutomationTable 148 | &KSNODETYPE_VOLUME, // Type 149 | &KSAUDFNAME_MIC_VOLUME // Name 150 | }, 151 | // KSNODE_TOPO_MUTE 152 | { 153 | 0, // Flags 154 | &AutomationMicArray3Mute, // AutomationTable 155 | &KSNODETYPE_MUTE, // Type 156 | &KSAUDFNAME_MIC_MUTE // Name 157 | }, 158 | // KSNODE_TOPO_PEAKMETER 159 | { 160 | 0, // Flags 161 | &AutomationMicArray3PeakMeter, // AutomationTable 162 | &KSNODETYPE_PEAKMETER, // Type 163 | &KSAUDFNAME_PEAKMETER // Name 164 | } 165 | }; 166 | 167 | C_ASSERT( KSNODE_TOPO_VOLUME == 0 ); 168 | C_ASSERT( KSNODE_TOPO_MUTE == 1 ); 169 | C_ASSERT( KSNODE_TOPO_PEAKMETER == 2 ); 170 | 171 | //============================================================================= 172 | static 173 | PCCONNECTION_DESCRIPTOR MicArray3TopoMiniportConnections[] = 174 | { 175 | // FromNode, FromPin, ToNode, ToPin 176 | { PCFILTER_NODE, KSPIN_TOPO_MIC_ELEMENTS, KSNODE_TOPO_VOLUME, 1 }, 177 | { KSNODE_TOPO_VOLUME, 0, KSNODE_TOPO_MUTE, 1 }, 178 | { KSNODE_TOPO_MUTE, 0, KSNODE_TOPO_PEAKMETER, 1 }, 179 | { KSNODE_TOPO_PEAKMETER, 0, PCFILTER_NODE, KSPIN_TOPO_BRIDGE } 180 | }; 181 | 182 | 183 | //============================================================================= 184 | static 185 | PCPROPERTY_ITEM MicArray3PropertiesTopoFilter[] = 186 | { 187 | { 188 | &KSPROPSETID_Jack, 189 | KSPROPERTY_JACK_DESCRIPTION, 190 | KSPROPERTY_TYPE_GET | KSPROPERTY_TYPE_BASICSUPPORT, 191 | PropertyHandler_MicArrayTopoFilter 192 | }, 193 | { 194 | &KSPROPSETID_Jack, 195 | KSPROPERTY_JACK_DESCRIPTION2, 196 | KSPROPERTY_TYPE_GET | KSPROPERTY_TYPE_BASICSUPPORT, 197 | PropertyHandler_MicArrayTopoFilter 198 | }, 199 | { 200 | &KSPROPSETID_Audio, 201 | KSPROPERTY_AUDIO_MIC_ARRAY_GEOMETRY, 202 | KSPROPERTY_TYPE_GET | KSPROPERTY_TYPE_BASICSUPPORT, 203 | PropertyHandler_MicArrayTopoFilter 204 | } 205 | }; 206 | 207 | DEFINE_PCAUTOMATION_TABLE_PROP(AutomationMicArray3TopoFilter, MicArray3PropertiesTopoFilter); 208 | 209 | //============================================================================= 210 | static 211 | PCFILTER_DESCRIPTOR MicArray3TopoMiniportFilterDescriptor = 212 | { 213 | 0, // Version 214 | &AutomationMicArray3TopoFilter, // AutomationTable 215 | sizeof(PCPIN_DESCRIPTOR), // PinSize 216 | SIZEOF_ARRAY(MicArray3TopoMiniportPins), // PinCount 217 | MicArray3TopoMiniportPins, // Pins 218 | sizeof(PCNODE_DESCRIPTOR), // NodeSize 219 | SIZEOF_ARRAY(MicArray3TopologyNodes), // NodeCount 220 | MicArray3TopologyNodes, // Nodes 221 | SIZEOF_ARRAY(MicArray3TopoMiniportConnections),// ConnectionCount 222 | MicArray3TopoMiniportConnections, // Connections 223 | 0, // CategoryCount 224 | NULL // Categories 225 | }; 226 | 227 | #endif // _SYSVAD_MICARRAY3TOPTABLE_H_ 228 | 229 | -------------------------------------------------------------------------------- /TabletAudioSample/micintopo.h: -------------------------------------------------------------------------------- 1 | 2 | /*++ 3 | 4 | Copyright (c) Microsoft Corporation All Rights Reserved 5 | 6 | Module Name: 7 | 8 | micintopo.h 9 | 10 | Abstract: 11 | 12 | Declaration of topology miniport for the mic (external: headphone). 13 | 14 | --*/ 15 | 16 | #ifndef _SYSVAD_MICINTOPO_H_ 17 | #define _SYSVAD_MICINTOPO_H_ 18 | 19 | NTSTATUS PropertyHandler_MicInTopoFilter(_In_ PPCPROPERTY_REQUEST PropertyRequest); 20 | 21 | #endif // _SYSVAD_MICINTOPO_H_ 22 | -------------------------------------------------------------------------------- /TabletAudioSample/spdiftopo.cpp: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) Microsoft Corporation All Rights Reserved 4 | 5 | Module Name: 6 | 7 | spdiftopo.cpp 8 | 9 | Abstract: 10 | 11 | Implementation of topology miniport for the spdif (internal). 12 | 13 | --*/ 14 | 15 | #pragma warning (disable : 4127) 16 | 17 | #include 18 | #include "simple.h" 19 | #include "mintopo.h" 20 | #include "spdiftopo.h" 21 | #include "spdiftoptable.h" 22 | 23 | 24 | #pragma code_seg("PAGE") 25 | 26 | //============================================================================= 27 | NTSTATUS 28 | PropertyHandler_SpdifTopoFilter 29 | ( 30 | _In_ PPCPROPERTY_REQUEST PropertyRequest 31 | ) 32 | /*++ 33 | 34 | Routine Description: 35 | 36 | Redirects property request to miniport object 37 | 38 | Arguments: 39 | 40 | PropertyRequest - 41 | 42 | Return Value: 43 | 44 | NT status code. 45 | 46 | --*/ 47 | { 48 | PAGED_CODE(); 49 | 50 | ASSERT(PropertyRequest); 51 | 52 | DPF_ENTER(("[PropertyHandler_SpdifTopoFilter]")); 53 | 54 | // PropertryRequest structure is filled by portcls. 55 | // MajorTarget is a pointer to miniport object for miniports. 56 | // 57 | NTSTATUS ntStatus = STATUS_INVALID_DEVICE_REQUEST; 58 | PCMiniportTopology pMiniport = (PCMiniportTopology)PropertyRequest->MajorTarget; 59 | 60 | if (IsEqualGUIDAligned(*PropertyRequest->PropertyItem->Set, KSPROPSETID_Jack)) 61 | { 62 | if (PropertyRequest->PropertyItem->Id == KSPROPERTY_JACK_DESCRIPTION) 63 | { 64 | ntStatus = pMiniport->PropertyHandlerJackDescription( 65 | PropertyRequest, 66 | ARRAYSIZE(SpdifJackDescriptions), 67 | SpdifJackDescriptions 68 | ); 69 | } 70 | else if (PropertyRequest->PropertyItem->Id == KSPROPERTY_JACK_DESCRIPTION2) 71 | { 72 | ntStatus = pMiniport->PropertyHandlerJackDescription2( 73 | PropertyRequest, 74 | ARRAYSIZE(SpdifJackDescriptions), 75 | SpdifJackDescriptions, 76 | 0 // jack capabilities 77 | ); 78 | } 79 | } 80 | 81 | return ntStatus; 82 | } // PropertyHandler_SpdifTopoFilter 83 | 84 | #pragma code_seg() 85 | 86 | -------------------------------------------------------------------------------- /TabletAudioSample/spdiftopo.h: -------------------------------------------------------------------------------- 1 | 2 | /*++ 3 | 4 | Copyright (c) Microsoft Corporation All Rights Reserved 5 | 6 | Module Name: 7 | 8 | speakertopo.h 9 | 10 | Abstract: 11 | 12 | Declaration of topology miniport for the speaker (internal). 13 | 14 | --*/ 15 | 16 | #ifndef _SYSVAD_SPDIFTOPO_H_ 17 | #define _SYSVAD_SPDIFTOPO_H_ 18 | 19 | NTSTATUS PropertyHandler_SpdifTopoFilter(_In_ PPCPROPERTY_REQUEST PropertyRequest); 20 | 21 | #endif // _SYSVAD_SPDIFTOPO_H_ 22 | -------------------------------------------------------------------------------- /TabletAudioSample/spdiftoptable.h: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) Microsoft Corporation All Rights Reserved 4 | 5 | Module Name: 6 | 7 | spdiftoptable.h 8 | 9 | Abstract: 10 | 11 | Declaration of topology tables for the SPDIF endpoint. 12 | 13 | --*/ 14 | 15 | #ifndef _SYSVAD_SPDIFTOPTABLE_H_ 16 | #define _SYSVAD_SPDIFTOPTABLE_H_ 17 | 18 | //============================================================================= 19 | static 20 | KSDATARANGE SpdifTopoPinDataRangesBridge[] = 21 | { 22 | { 23 | sizeof(KSDATARANGE), 24 | 0, 25 | 0, 26 | 0, 27 | STATICGUIDOF(KSDATAFORMAT_TYPE_AUDIO), 28 | STATICGUIDOF(KSDATAFORMAT_SUBTYPE_ANALOG), 29 | STATICGUIDOF(KSDATAFORMAT_SPECIFIER_NONE) 30 | }, 31 | { 32 | sizeof(KSDATARANGE), 33 | 0, 34 | 0, 35 | 0, 36 | STATICGUIDOF(KSDATAFORMAT_TYPE_AUDIO), 37 | STATICGUIDOF(KSDATAFORMAT_SUBTYPE_IEC61937_DOLBY_DIGITAL), 38 | STATICGUIDOF(KSDATAFORMAT_SPECIFIER_NONE) 39 | } 40 | }; 41 | 42 | //============================================================================= 43 | static 44 | PKSDATARANGE SpdifTopoPinDataRangePointersBridge[] = 45 | { 46 | &SpdifTopoPinDataRangesBridge[0], 47 | &SpdifTopoPinDataRangesBridge[1] 48 | }; 49 | 50 | //============================================================================= 51 | static 52 | PCPIN_DESCRIPTOR SpdifTopoMiniportPins[] = 53 | { 54 | // KSPIN_TOPO_WAVEOUT_SOURCE 55 | { 56 | 0, 57 | 0, 58 | 0, // InstanceCount 59 | NULL, // AutomationTable 60 | { // KsPinDescriptor 61 | 0, // InterfacesCount 62 | NULL, // Interfaces 63 | 0, // MediumsCount 64 | NULL, // Mediums 65 | SIZEOF_ARRAY(SpdifTopoPinDataRangePointersBridge), // DataRangesCount 66 | SpdifTopoPinDataRangePointersBridge, // DataRanges 67 | KSPIN_DATAFLOW_IN, // DataFlow 68 | KSPIN_COMMUNICATION_NONE, // Communication 69 | &KSCATEGORY_AUDIO, // Category 70 | NULL, // Name 71 | 0 // Reserved 72 | } 73 | }, 74 | // KSPIN_TOPO_LINEOUT_DEST 75 | { 76 | 0, 77 | 0, 78 | 0, // InstanceCount 79 | NULL, // AutomationTable 80 | { // KsPinDescriptor 81 | 0, // InterfacesCount 82 | NULL, // Interfaces 83 | 0, // MediumsCount 84 | NULL, // Mediums 85 | SIZEOF_ARRAY(SpdifTopoPinDataRangePointersBridge), // DataRangesCount 86 | SpdifTopoPinDataRangePointersBridge, // DataRanges 87 | KSPIN_DATAFLOW_OUT, // DataFlow 88 | KSPIN_COMMUNICATION_NONE, // Communication 89 | &KSNODETYPE_SPDIF_INTERFACE, // Category 90 | NULL, // Name 91 | 0 // Reserved 92 | } 93 | } 94 | }; 95 | 96 | //============================================================================= 97 | static 98 | KSJACK_DESCRIPTION SpdifJackDesc = 99 | { 100 | KSAUDIO_SPEAKER_STEREO, 101 | 0x0000, // no color 102 | eConnTypeOtherDigital, 103 | eGeoLocRear, 104 | eGenLocPrimaryBox, 105 | ePortConnJack, 106 | TRUE 107 | }; 108 | 109 | // Only return a KSJACK_DESCRIPTION for the physical bridge pin. 110 | static 111 | PKSJACK_DESCRIPTION SpdifJackDescriptions[] = 112 | { 113 | NULL, 114 | &SpdifJackDesc 115 | }; 116 | 117 | //============================================================================= 118 | static 119 | PCCONNECTION_DESCRIPTOR SpdifTopoMiniportConnections[] = 120 | { 121 | // FromNode, FromPin, ToNode, ToPin 122 | { PCFILTER_NODE, KSPIN_TOPO_WAVEOUT_SOURCE, PCFILTER_NODE, KSPIN_TOPO_LINEOUT_DEST} 123 | }; 124 | 125 | 126 | //============================================================================= 127 | static 128 | PCPROPERTY_ITEM PropertiesSpdifTopoFilter[] = 129 | { 130 | { 131 | &KSPROPSETID_Jack, 132 | KSPROPERTY_JACK_DESCRIPTION, 133 | KSPROPERTY_TYPE_GET | KSPROPERTY_TYPE_BASICSUPPORT, 134 | PropertyHandler_SpdifTopoFilter 135 | }, 136 | { 137 | &KSPROPSETID_Jack, 138 | KSPROPERTY_JACK_DESCRIPTION2, 139 | KSPROPERTY_TYPE_GET | KSPROPERTY_TYPE_BASICSUPPORT, 140 | PropertyHandler_SpdifTopoFilter 141 | } 142 | }; 143 | 144 | DEFINE_PCAUTOMATION_TABLE_PROP(AutomationSpdifTopoFilter, PropertiesSpdifTopoFilter); 145 | 146 | //============================================================================= 147 | static 148 | PCFILTER_DESCRIPTOR SpdifTopoMiniportFilterDescriptor = 149 | { 150 | 0, // Version 151 | &AutomationSpdifTopoFilter, // AutomationTable 152 | sizeof(PCPIN_DESCRIPTOR), // PinSize 153 | SIZEOF_ARRAY(SpdifTopoMiniportPins), // PinCount 154 | SpdifTopoMiniportPins, // Pins 155 | sizeof(PCNODE_DESCRIPTOR), // NodeSize 156 | 0, // NodeCount 157 | NULL, // Nodes 158 | SIZEOF_ARRAY(SpdifTopoMiniportConnections), // ConnectionCount 159 | SpdifTopoMiniportConnections, // Connections 160 | 0, // CategoryCount 161 | NULL // Categories 162 | }; 163 | 164 | #endif // _SYSVAD_SPDIFTOPTABLE_H_ 165 | 166 | 167 | -------------------------------------------------------------------------------- /UnittestData.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _SYSVAD_UNITTESTDATA_H_ 3 | #define _SYSVAD_UNITTESTDATA_H_ 4 | 5 | #define WAVERT_CURRENT_WRITE_POSITION_DATA 100 6 | #define STREAM_PRESENTATION_POSITION_DATA 1000 7 | #define LINEAR_BUFFER_POSITION_DATA 10000 8 | 9 | 10 | #define BUFFER_SIZE_RANGE_MIN 1200390 11 | #define BUFFER_SIZE_RANGE_MAX 1200393 12 | 13 | #define MS_PER_SEC 1000 14 | #define MIN_BUFFER_DURATION_MS 10 15 | #define MAX_BUFFER_DURATION_MS 2000 16 | 17 | #endif // _SYSVAD_UNITTESTDATA_H_ -------------------------------------------------------------------------------- /basetopo.h: -------------------------------------------------------------------------------- 1 | 2 | /*++ 3 | 4 | Copyright (c) Microsoft Corporation All Rights Reserved 5 | 6 | Module Name: 7 | 8 | basetopo.h 9 | 10 | Abstract: 11 | 12 | Declaration of topology miniport. 13 | 14 | --*/ 15 | 16 | #ifndef _SYSVAD_BASETOPO_H_ 17 | #define _SYSVAD_BASETOPO_H_ 18 | 19 | //============================================================================= 20 | // Classes 21 | //============================================================================= 22 | 23 | /////////////////////////////////////////////////////////////////////////////// 24 | // CMiniportTopologySYSVAD 25 | // 26 | 27 | class CMiniportTopologySYSVAD 28 | { 29 | protected: 30 | PADAPTERCOMMON m_AdapterCommon; // Adapter common object. 31 | PPCFILTER_DESCRIPTOR m_FilterDescriptor; // Filter descriptor. 32 | PPORTEVENTS m_PortEvents; // Event interface. 33 | USHORT m_DeviceMaxChannels; // Max device channels. 34 | 35 | public: 36 | CMiniportTopologySYSVAD( 37 | _In_ PCFILTER_DESCRIPTOR *FilterDesc, 38 | _In_ USHORT DeviceMaxChannels 39 | ); 40 | 41 | ~CMiniportTopologySYSVAD(); 42 | 43 | NTSTATUS GetDescription 44 | ( 45 | _Out_ PPCFILTER_DESCRIPTOR * Description 46 | ); 47 | 48 | NTSTATUS DataRangeIntersection 49 | ( 50 | _In_ ULONG PinId, 51 | _In_ PKSDATARANGE ClientDataRange, 52 | _In_ PKSDATARANGE MyDataRange, 53 | _In_ ULONG OutputBufferLength, 54 | _Out_writes_bytes_to_opt_(OutputBufferLength, *ResultantFormatLength) 55 | PVOID ResultantFormat OPTIONAL, 56 | _Out_ PULONG ResultantFormatLength 57 | ); 58 | 59 | NTSTATUS Init 60 | ( 61 | _In_ PUNKNOWN UnknownAdapter, 62 | _In_ PPORTTOPOLOGY Port_ 63 | ); 64 | 65 | // PropertyHandlers. 66 | NTSTATUS PropertyHandlerGeneric 67 | ( 68 | _In_ PPCPROPERTY_REQUEST PropertyRequest 69 | ); 70 | 71 | NTSTATUS PropertyHandlerMuxSource 72 | ( 73 | _In_ PPCPROPERTY_REQUEST PropertyRequest 74 | ); 75 | 76 | NTSTATUS PropertyHandlerDevSpecific 77 | ( 78 | _In_ PPCPROPERTY_REQUEST PropertyRequest 79 | ); 80 | 81 | VOID AddEventToEventList 82 | ( 83 | _In_ PKSEVENT_ENTRY EventEntry 84 | ); 85 | 86 | VOID GenerateEventList 87 | ( 88 | _In_opt_ GUID *Set, 89 | _In_ ULONG EventId, 90 | _In_ BOOL PinEvent, 91 | _In_ ULONG PinId, 92 | _In_ BOOL NodeEvent, 93 | _In_ ULONG NodeId 94 | ); 95 | }; 96 | 97 | #endif 98 | 99 | -------------------------------------------------------------------------------- /hw.h: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) Microsoft Corporation All Rights Reserved 4 | 5 | Module Name: 6 | 7 | hw.h 8 | 9 | Abstract: 10 | 11 | Declaration of SYSVAD HW class. 12 | SYSVAD HW has an array for storing mixer and volume settings 13 | for the topology. 14 | 15 | --*/ 16 | 17 | #ifndef _SYSVAD_HW_H_ 18 | #define _SYSVAD_HW_H_ 19 | 20 | //============================================================================= 21 | // Defines 22 | //============================================================================= 23 | // BUGBUG we should dynamically allocate this... 24 | #define MAX_TOPOLOGY_NODES 20 25 | 26 | //============================================================================= 27 | // Classes 28 | //============================================================================= 29 | /////////////////////////////////////////////////////////////////////////////// 30 | // CSYSVADHW 31 | // This class represents virtual SYSVAD HW. An array representing volume 32 | // registers and mute registers. 33 | 34 | class CSYSVADHW 35 | { 36 | public: 37 | protected: 38 | BOOL m_MuteControls[MAX_TOPOLOGY_NODES]; 39 | LONG m_VolumeControls[MAX_TOPOLOGY_NODES]; 40 | LONG m_PeakMeterControls[MAX_TOPOLOGY_NODES]; 41 | ULONG m_ulMux; // Mux selection 42 | BOOL m_bDevSpecific; 43 | INT m_iDevSpecific; 44 | UINT m_uiDevSpecific; 45 | 46 | private: 47 | 48 | public: 49 | CSYSVADHW(); 50 | 51 | void MixerReset(); 52 | BOOL bGetDevSpecific(); 53 | void bSetDevSpecific 54 | ( 55 | _In_ BOOL bDevSpecific 56 | ); 57 | INT iGetDevSpecific(); 58 | void iSetDevSpecific 59 | ( 60 | _In_ INT iDevSpecific 61 | ); 62 | UINT uiGetDevSpecific(); 63 | void uiSetDevSpecific 64 | ( 65 | _In_ UINT uiDevSpecific 66 | ); 67 | BOOL GetMixerMute 68 | ( 69 | _In_ ULONG ulNode, 70 | _In_ ULONG ulChannel 71 | ); 72 | void SetMixerMute 73 | ( 74 | _In_ ULONG ulNode, 75 | _In_ ULONG ulChannel, 76 | _In_ BOOL fMute 77 | ); 78 | ULONG GetMixerMux(); 79 | void SetMixerMux 80 | ( 81 | _In_ ULONG ulNode 82 | ); 83 | LONG GetMixerVolume 84 | ( 85 | _In_ ULONG ulNode, 86 | _In_ ULONG ulChannel 87 | ); 88 | void SetMixerVolume 89 | ( 90 | _In_ ULONG ulNode, 91 | _In_ ULONG ulChannel, 92 | _In_ LONG lVolume 93 | ); 94 | 95 | LONG GetMixerPeakMeter 96 | ( 97 | _In_ ULONG ulNode, 98 | _In_ ULONG ulChannel 99 | ); 100 | 101 | protected: 102 | private: 103 | }; 104 | typedef CSYSVADHW *PCSYSVADHW; 105 | 106 | #endif // _SYSVAD_HW_H_ 107 | 108 | -------------------------------------------------------------------------------- /ihvprivatepropertyset.h: -------------------------------------------------------------------------------- 1 | //=========================================================================== 2 | // HARDWARE OFFLOAD PIN DEFINITIONS 3 | //=========================================================================== 4 | #define STATIC_KSPROPSETID_OffloadPin\ 5 | 0xfb05301, 0x5a11, 0x400a, 0x99, 0x6b, 0x12,0xdf, 0x99, 0x28, 0x36, 0xde 6 | 7 | DEFINE_GUIDSTRUCT("0FB05301-5A11-400a-996B-12DF992836DE", KSPROPSETID_OffloadPin); 8 | 9 | #define KSPROPSETID_OffloadPin DEFINE_GUIDNAMED(KSPROPSETID_OffloadPin) 10 | 11 | typedef enum { 12 | KSPROPERTY_OFFLOAD_PIN_GET_STREAM_OBJECT_POINTER, 13 | KSPROPERTY_OFFLOAD_PIN_VERIFY_STREAM_OBJECT_POINTER 14 | } KSPROPERTY_OFFLOAD_PIN; 15 | -------------------------------------------------------------------------------- /kshelper.h: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) Microsoft Corporation All Rights Reserved 4 | 5 | Module Name: 6 | 7 | kshelper.h 8 | 9 | Abstract: 10 | 11 | Helper functions for sysvad 12 | 13 | --*/ 14 | #ifndef _SYSVAD_KSHELPER_H_ 15 | #define _SYSVAD_KSHELPER_H_ 16 | 17 | #include 18 | #include 19 | 20 | PWAVEFORMATEX 21 | GetWaveFormatEx 22 | ( 23 | _In_ PKSDATAFORMAT pDataFormat 24 | ); 25 | 26 | NTSTATUS 27 | ValidatePropertyParams 28 | ( 29 | _In_ PPCPROPERTY_REQUEST PropertyRequest, 30 | _In_ ULONG cbValueSize, 31 | _In_ ULONG cbInstanceSize = 0 32 | ); 33 | 34 | NTSTATUS 35 | PropertyHandler_BasicSupport 36 | ( 37 | _In_ PPCPROPERTY_REQUEST PropertyRequest, 38 | _In_ ULONG Flags, 39 | _In_ DWORD PropTypeSetId 40 | ); 41 | 42 | NTSTATUS 43 | PropertyHandler_BasicSupportVolume 44 | ( 45 | _In_ PPCPROPERTY_REQUEST PropertyRequest, 46 | _In_ ULONG MaxChannels 47 | ); 48 | 49 | NTSTATUS 50 | PropertyHandler_BasicSupportMute 51 | ( 52 | _In_ PPCPROPERTY_REQUEST PropertyRequest, 53 | _In_ ULONG MaxChannels 54 | ); 55 | 56 | NTSTATUS 57 | PropertyHandler_BasicSupportPeakMeter2 58 | ( 59 | _In_ PPCPROPERTY_REQUEST PropertyRequest, 60 | _In_ ULONG MaxChannels 61 | ); 62 | 63 | NTSTATUS 64 | PropertyHandler_CpuResources 65 | ( 66 | _In_ PPCPROPERTY_REQUEST PropertyRequest 67 | ); 68 | 69 | NTSTATUS 70 | PropertyHandler_Volume 71 | ( 72 | _In_ PADAPTERCOMMON AdapterCommon, 73 | _In_ PPCPROPERTY_REQUEST PropertyRequest, 74 | _In_ ULONG MaxChannels 75 | ); 76 | 77 | NTSTATUS 78 | PropertyHandler_Mute 79 | ( 80 | _In_ PADAPTERCOMMON AdapterCommon, 81 | _In_ PPCPROPERTY_REQUEST PropertyRequest, 82 | _In_ ULONG MaxChannels 83 | ); 84 | 85 | NTSTATUS 86 | PropertyHandler_PeakMeter2 87 | ( 88 | _In_ PADAPTERCOMMON AdapterCommon, 89 | _In_ PPCPROPERTY_REQUEST PropertyRequest, 90 | _In_ ULONG MaxChannels 91 | ); 92 | 93 | //============================================================================= 94 | // Property helpers 95 | //============================================================================= 96 | 97 | NTSTATUS 98 | SysvadPropertyDispatch 99 | ( 100 | _In_ PPCPROPERTY_REQUEST PropertyRequest 101 | ); 102 | 103 | // Use this structure to define property items with extra data allowing easier 104 | // definition of separate get, set, and support handlers dispatched through 105 | // SysvadPropertyDispatch. 106 | typedef struct 107 | { 108 | PCPROPERTY_ITEM PropertyItem; // Standard PCPROPERTY_ITEM 109 | ULONG MinProperty; // Minimum size of the property instance data 110 | ULONG MinData; // Minimum size of the property value 111 | PCPFNPROPERTY_HANDLER GetHandler; // Property get handler (NULL if GET not supported) 112 | PCPFNPROPERTY_HANDLER SetHandler; // Property set handler (NULL if SET not supported) 113 | PCPFNPROPERTY_HANDLER SupportHandler; // Property support handler (NULL for common handler) 114 | VOID *ContextData; // Optional context information for the handler, NULL for unused 115 | ULONG ContextDataSize; // Size of the data held at ContextData, 0 for unused 116 | } SYSVADPROPERTY_ITEM; 117 | 118 | // The following macros facilitate adding property handlers to a class, allowing 119 | // easier declaration and definition of a "thunk" routine that directly handles 120 | // the property request and calls into a class instance method. Note that as 121 | // written, the thunk routine assumes PAGED_CODE. 122 | #define DECLARE_CLASSPROPERTYHANDLER(theClass, theMethod) \ 123 | NTSTATUS theClass##_##theMethod \ 124 | ( \ 125 | _In_ PPCPROPERTY_REQUEST PropertyRequest \ 126 | ); 127 | 128 | #define DECLARE_PROPERTYHANDLER(theMethod) \ 129 | NTSTATUS theMethod \ 130 | ( \ 131 | _In_ PPCPROPERTY_REQUEST PropertyRequest \ 132 | ); 133 | 134 | #define DEFINE_CLASSPROPERTYHANDLER(theClass, theMethod) \ 135 | NTSTATUS theClass##_##theMethod \ 136 | ( \ 137 | _In_ PPCPROPERTY_REQUEST PropertyRequest \ 138 | ) \ 139 | { \ 140 | NTSTATUS status; \ 141 | \ 142 | PAGED_CODE(); \ 143 | \ 144 | theClass* p = reinterpret_cast(PropertyRequest->MajorTarget); \ 145 | \ 146 | p->AddRef(); \ 147 | status = p->theMethod(PropertyRequest); \ 148 | p->Release(); \ 149 | \ 150 | return status; \ 151 | } \ 152 | NTSTATUS theClass::theMethod \ 153 | ( \ 154 | _In_ PPCPROPERTY_REQUEST PropertyRequest \ 155 | ) 156 | 157 | 158 | 159 | 160 | #endif // _SYSVAD_KSHELPER_H_ 161 | 162 | -------------------------------------------------------------------------------- /savedata.h: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) Microsoft Corporation All Rights Reserved 4 | 5 | Module Name: 6 | 7 | savedata.h 8 | 9 | Abstract: 10 | 11 | Declaration of SYSVAD data saving class. This class supplies services 12 | to save data to disk. 13 | 14 | 15 | --*/ 16 | 17 | #ifndef _SYSVAD_SAVEDATA_H 18 | #define _SYSVAD_SAVEDATA_H 19 | 20 | //----------------------------------------------------------------------------- 21 | // Forward declaration 22 | //----------------------------------------------------------------------------- 23 | class CSaveData; 24 | typedef CSaveData *PCSaveData; 25 | 26 | 27 | //----------------------------------------------------------------------------- 28 | // Structs 29 | //----------------------------------------------------------------------------- 30 | 31 | // Parameter to workitem. 32 | #include 33 | typedef struct _SAVEWORKER_PARAM { 34 | PIO_WORKITEM WorkItem; 35 | ULONG ulFrameNo; 36 | ULONG ulDataSize; 37 | PBYTE pData; 38 | PCSaveData pSaveData; 39 | KEVENT EventDone; 40 | } SAVEWORKER_PARAM; 41 | typedef SAVEWORKER_PARAM *PSAVEWORKER_PARAM; 42 | #include 43 | 44 | // wave file header. 45 | #include 46 | typedef struct _OUTPUT_FILE_HEADER 47 | { 48 | DWORD dwRiff; 49 | DWORD dwFileSize; 50 | DWORD dwWave; 51 | DWORD dwFormat; 52 | DWORD dwFormatLength; 53 | } OUTPUT_FILE_HEADER; 54 | typedef OUTPUT_FILE_HEADER *POUTPUT_FILE_HEADER; 55 | 56 | typedef struct _OUTPUT_DATA_HEADER 57 | { 58 | DWORD dwData; 59 | DWORD dwDataLength; 60 | } OUTPUT_DATA_HEADER; 61 | typedef OUTPUT_DATA_HEADER *POUTPUT_DATA_HEADER; 62 | 63 | #include 64 | 65 | //----------------------------------------------------------------------------- 66 | // Classes 67 | //----------------------------------------------------------------------------- 68 | 69 | /////////////////////////////////////////////////////////////////////////////// 70 | // CSaveData 71 | // Saves the wave data to disk. 72 | // 73 | IO_WORKITEM_ROUTINE SaveFrameWorkerCallback; 74 | 75 | class CSaveData 76 | { 77 | protected: 78 | UNICODE_STRING m_FileName; // DataFile name. 79 | HANDLE m_FileHandle; // DataFile handle. 80 | PBYTE m_pDataBuffer; // Data buffer. 81 | ULONG m_ulBufferSize; // Total buffer size. 82 | 83 | ULONG m_ulFrameIndex; // Current Frame. 84 | ULONG m_ulFrameCount; // Frame count. 85 | ULONG m_ulFrameSize; 86 | ULONG m_ulBufferOffset; // index in buffer. 87 | PBOOL m_fFrameUsed; // Frame usage table. 88 | KSPIN_LOCK m_FrameInUseSpinLock; // Spinlock for synch. 89 | KMUTEX m_FileSync; // Synchronizes file access 90 | 91 | OBJECT_ATTRIBUTES m_objectAttributes; // Used for opening file. 92 | 93 | OUTPUT_FILE_HEADER m_FileHeader; 94 | PWAVEFORMATEX m_waveFormat; 95 | OUTPUT_DATA_HEADER m_DataHeader; 96 | PLARGE_INTEGER m_pFilePtr; 97 | 98 | static PDEVICE_OBJECT m_pDeviceObject; 99 | static ULONG m_ulStreamId; 100 | static ULONG m_ulOffloadStreamId; 101 | static PSAVEWORKER_PARAM m_pWorkItems; 102 | 103 | BOOL m_fWriteDisabled; 104 | 105 | BOOL m_bInitialized; 106 | 107 | public: 108 | CSaveData(); 109 | ~CSaveData(); 110 | 111 | static NTSTATUS InitializeWorkItems 112 | ( 113 | _In_ PDEVICE_OBJECT DeviceObject 114 | ); 115 | static void DestroyWorkItems 116 | ( 117 | void 118 | ); 119 | void Disable 120 | ( 121 | _In_ BOOL fDisable 122 | ); 123 | static PSAVEWORKER_PARAM GetNewWorkItem 124 | ( 125 | void 126 | ); 127 | NTSTATUS Initialize 128 | ( 129 | _In_ BOOL _bOffloaded 130 | ); 131 | static NTSTATUS SetDeviceObject 132 | ( 133 | _In_ PDEVICE_OBJECT DeviceObject 134 | ); 135 | static PDEVICE_OBJECT GetDeviceObject 136 | ( 137 | void 138 | ); 139 | void ReadData 140 | ( 141 | _Inout_updates_bytes_all_(ulByteCount) PBYTE pBuffer, 142 | _In_ ULONG ulByteCount 143 | ); 144 | NTSTATUS SetDataFormat 145 | ( 146 | _In_ PKSDATAFORMAT pDataFormat 147 | ); 148 | NTSTATUS SetMaxWriteSize 149 | ( 150 | _In_ ULONG ulMaxWriteSize 151 | ); 152 | void WaitAllWorkItems 153 | ( 154 | void 155 | ); 156 | void WriteData 157 | ( 158 | _In_reads_bytes_(ulByteCount) PBYTE pBuffer, 159 | _In_ ULONG ulByteCount 160 | ); 161 | 162 | private: 163 | NTSTATUS FileClose 164 | ( 165 | void 166 | ); 167 | NTSTATUS FileOpen 168 | ( 169 | _In_ BOOL fOverWrite 170 | ); 171 | NTSTATUS FileWrite 172 | ( 173 | _In_reads_bytes_(ulDataSize) PBYTE pData, 174 | _In_ ULONG ulDataSize 175 | ); 176 | NTSTATUS FileWriteHeader 177 | ( 178 | void 179 | ); 180 | 181 | void SaveFrame 182 | ( 183 | _In_ ULONG ulFrameNo, 184 | _In_ ULONG ulDataSize 185 | ); 186 | 187 | friend 188 | IO_WORKITEM_ROUTINE SaveFrameWorkerCallback; 189 | }; 190 | typedef CSaveData *PCSaveData; 191 | 192 | #endif 193 | 194 | -------------------------------------------------------------------------------- /sysvad.h: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) Microsoft Corporation All Rights Reserved 4 | 5 | Module Name: 6 | 7 | Sysvad.h 8 | 9 | Abstract: 10 | 11 | Header file for common stuff. 12 | 13 | --*/ 14 | 15 | #ifndef _SYSVAD_H_ 16 | #define _SYSVAD_H_ 17 | 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include "NewDelete.h" 27 | 28 | //============================================================================= 29 | // Defines 30 | //============================================================================= 31 | 32 | // Version number. Revision numbers are specified for each sample. 33 | #define SYSVAD_VERSION 1 34 | 35 | // Revision number. 36 | #define SYSVAD_REVISION 0 37 | 38 | // Product Id 39 | // {5B722BF8-F0AB-47ee-B9C8-8D61D31375A1} 40 | #define STATIC_PID_SYSVAD\ 41 | 0x5b722bf8, 0xf0ab, 0x47ee, 0xb9, 0xc8, 0x8d, 0x61, 0xd3, 0x13, 0x75, 0xa1 42 | DEFINE_GUIDSTRUCT("5B722BF8-F0AB-47ee-B9C8-8D61D31375A1", PID_SYSVAD); 43 | #define PID_SYSVAD DEFINE_GUIDNAMED(PID_SYSVAD) 44 | 45 | // Pool tag used for SYSVAD allocations 46 | #define SYSVAD_POOLTAG 'DVSM' 47 | 48 | // Debug module name 49 | #define STR_MODULENAME "SYSVAD: " 50 | 51 | // Debug utility macros 52 | #define D_FUNC 4 53 | #define D_BLAB DEBUGLVL_BLAB 54 | #define D_VERBOSE DEBUGLVL_VERBOSE 55 | #define D_TERSE DEBUGLVL_TERSE 56 | #define D_ERROR DEBUGLVL_ERROR 57 | #define DPF _DbgPrintF 58 | #define DPF_ENTER(x) DPF(D_FUNC, x) 59 | 60 | // Channel orientation 61 | #define CHAN_LEFT 0 62 | #define CHAN_RIGHT 1 63 | #define CHAN_MASTER (-1) 64 | 65 | // Dma Settings. 66 | #define DMA_BUFFER_SIZE 0x16000 67 | 68 | #define KSPROPERTY_TYPE_ALL KSPROPERTY_TYPE_BASICSUPPORT | \ 69 | KSPROPERTY_TYPE_GET | \ 70 | KSPROPERTY_TYPE_SET 71 | 72 | // Specific node numbers 73 | #define DEV_SPECIFIC_VT_BOOL 9 74 | #define DEV_SPECIFIC_VT_I4 10 75 | #define DEV_SPECIFIC_VT_UI4 11 76 | 77 | #define _100NS_PER_MILLISECOND 10000 // number of 100ns units per millisecond 78 | 79 | // Default volume settings. 80 | #define VOLUME_STEPPING_DELTA 0x8000 81 | #define VOLUME_SIGNED_MAXIMUM 0x00000000 82 | #define VOLUME_SIGNED_MINIMUM (-96 * 0x10000) 83 | 84 | // Default peak meter settings 85 | #define PEAKMETER_STEPPING_DELTA 0x1000 86 | #define PEAKMETER_SIGNED_MAXIMUM LONG_MAX 87 | #define PEAKMETER_SIGNED_MINIMUM LONG_MIN 88 | 89 | #define VALUE_NORMALIZE_P(v, step) \ 90 | ((((v) + (step)/2) / (step)) * (step)) 91 | 92 | #define VALUE_NORMALIZE(v, step) \ 93 | ((v) > 0 ? VALUE_NORMALIZE_P((v), (step)) : -(VALUE_NORMALIZE_P(-(v), (step)))) 94 | 95 | #define VALUE_NORMALIZE_IN_RANGE_EX(v, min, max, step) \ 96 | ((v) > (max) ? (max) : \ 97 | (v) < (min) ? (min) : \ 98 | VALUE_NORMALIZE((v), (step))) 99 | 100 | // to normalize volume values. 101 | #define VOLUME_NORMALIZE_IN_RANGE(v) \ 102 | VALUE_NORMALIZE_IN_RANGE_EX((v), VOLUME_SIGNED_MINIMUM, VOLUME_SIGNED_MAXIMUM, VOLUME_STEPPING_DELTA) 103 | 104 | // to normalize sample peak meter. 105 | #define PEAKMETER_NORMALIZE_IN_RANGE(v) \ 106 | VALUE_NORMALIZE_IN_RANGE_EX((v), PEAKMETER_SIGNED_MINIMUM, PEAKMETER_SIGNED_MAXIMUM, PEAKMETER_STEPPING_DELTA) 107 | 108 | #define ALL_CHANNELS_ID UINT32_MAX 109 | 110 | // Macros to assist with pin instance counting 111 | #define VERIFY_PIN_INSTANCE_RESOURCES_AVAILABLE(status, allocated, max) \ 112 | status = (allocated < max) ? STATUS_SUCCESS : STATUS_INSUFFICIENT_RESOURCES 113 | 114 | #define ALLOCATE_PIN_INSTANCE_RESOURCES(allocated) \ 115 | allocated++ 116 | 117 | #define FREE_PIN_INSTANCE_RESOURCES(allocated) \ 118 | allocated-- 119 | 120 | // Define the value data type for supported sound detector patterns. Only 121 | // one pattern type is supported in this sample. 122 | typedef struct { 123 | KSMULTIPLE_ITEM MultipleItem; 124 | GUID PatternType[1]; 125 | } CONTOSO_SUPPORTEDPATTERNSVALUE; 126 | 127 | //============================================================================= 128 | // Typedefs 129 | //============================================================================= 130 | 131 | // Flags to identify stream processing mode 132 | typedef enum { 133 | CONNECTIONTYPE_TOPOLOGY_OUTPUT = 0, 134 | CONNECTIONTYPE_WAVE_OUTPUT = 1 135 | } CONNECTIONTYPE; 136 | 137 | // Connection table for registering topology/wave bridge connection 138 | typedef struct _PHYSICALCONNECTIONTABLE 139 | { 140 | ULONG ulTopology; 141 | ULONG ulWave; 142 | CONNECTIONTYPE eType; 143 | } PHYSICALCONNECTIONTABLE, *PPHYSICALCONNECTIONTABLE; 144 | 145 | // 146 | // This is the structure of the portclass FDO device extension Nt has created 147 | // for us. We keep the adapter common object here. 148 | // 149 | struct IAdapterCommon; 150 | typedef struct _PortClassDeviceContext // 32 64 Byte offsets for 32 and 64 bit architectures 151 | { 152 | ULONG_PTR m_pulReserved1[2]; // 0-7 0-15 First two pointers are reserved. 153 | PDEVICE_OBJECT m_DoNotUsePhysicalDeviceObject; // 8-11 16-23 Reserved pointer to our Physical Device Object (PDO). 154 | PVOID m_pvReserved2; // 12-15 24-31 Reserved pointer to our Start Device function. 155 | PVOID m_pvReserved3; // 16-19 32-39 "Out Memory" according to DDK. 156 | IAdapterCommon* m_pCommon; // 20-23 40-47 Pointer to our adapter common object. 157 | #ifdef _USE_SingleComponentMultiFxStates 158 | POHANDLE m_poHandle; // 24-27 48-55 PoFxDevice handle. 159 | #else 160 | PVOID m_pvUnused1; // 24-27 48-55 Unused space. 161 | #endif // _USE_SingleComponentMultiFxStates 162 | PVOID m_pvUnused2; // 28-31 56-63 Unused space. 163 | 164 | // Anything after above line should not be used. 165 | // This actually goes on for (64*sizeof(ULONG_PTR)) but it is all opaque. 166 | } PortClassDeviceContext; 167 | 168 | // 169 | // Major/MinorTarget to object casting. 170 | // 171 | #define MajorTarget_to_Obj(ptr) \ 172 | reinterpret_cast(ptr) 173 | 174 | #define MinorTarget_to_Obj(ptr) \ 175 | static_cast(reinterpret_cast(ptr)) 176 | 177 | // 178 | // Global settings. 179 | // 180 | extern DWORD g_DoNotCreateDataFiles; 181 | extern DWORD g_DisableBthScoBypass; 182 | extern UNICODE_STRING g_RegistryPath; 183 | 184 | //============================================================================= 185 | // Function prototypes 186 | //============================================================================= 187 | 188 | // Generic topology handler 189 | NTSTATUS PropertyHandler_Topology 190 | ( 191 | _In_ PPCPROPERTY_REQUEST PropertyRequest 192 | ); 193 | 194 | // Default WaveFilter automation table. 195 | // Handles the GeneralComponentId request. 196 | NTSTATUS PropertyHandler_WaveFilter 197 | ( 198 | _In_ PPCPROPERTY_REQUEST PropertyRequest 199 | ); 200 | 201 | NTSTATUS PropertyHandler_OffloadPin 202 | ( 203 | _In_ PPCPROPERTY_REQUEST PropertyRequest 204 | ); 205 | 206 | NTSTATUS PropertyHandler_GenericPin 207 | ( 208 | _In_ PPCPROPERTY_REQUEST PropertyRequest 209 | ); 210 | 211 | // common.h uses some of the above definitions. 212 | #include "common.h" 213 | #include "kshelper.h" 214 | 215 | #endif 216 | 217 | -------------------------------------------------------------------------------- /sysvad.sln: -------------------------------------------------------------------------------- 1 | Microsoft Visual Studio Solution File, Format Version 12.00 2 | # Visual Studio Version 16 3 | VisualStudioVersion = 16.0.30611.23 4 | MinimumVisualStudioVersion = 12.0 5 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Package", "Package", "{FA56D96B-290B-4C73-A5E1-02C1861D3224}" 6 | EndProject 7 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "EndpointsCommon", "EndpointsCommon", "{0B4B8E51-20A8-43A4-A8DA-42FF90D628AC}" 8 | EndProject 9 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "TabletAudioSample", "TabletAudioSample", "{C06F6070-75EE-4F57-8D35-4AC2AB08D029}" 10 | EndProject 11 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "package", "Package\package.VcxProj", "{830B14D5-0E32-4F9E-AEFA-4C9F6FC13C2A}" 12 | EndProject 13 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "EndpointsCommon", "EndpointsCommon\EndpointsCommon.vcxproj", "{33E61864-6F2C-4F9F-BE70-8F8985A4F283}" 14 | EndProject 15 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TabletAudioSample", "TabletAudioSample\TabletAudioSample.vcxproj", "{E4DF0EEE-D35B-47F2-A9B1-41EA97C465FF}" 16 | ProjectSection(ProjectDependencies) = postProject 17 | {33E61864-6F2C-4F9F-BE70-8F8985A4F283} = {33E61864-6F2C-4F9F-BE70-8F8985A4F283} 18 | EndProjectSection 19 | EndProject 20 | Global 21 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 22 | Debug|ARM64 = Debug|ARM64 23 | Debug|Win32 = Debug|Win32 24 | Debug|x64 = Debug|x64 25 | Release|ARM64 = Release|ARM64 26 | Release|Win32 = Release|Win32 27 | Release|x64 = Release|x64 28 | EndGlobalSection 29 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 30 | {830B14D5-0E32-4F9E-AEFA-4C9F6FC13C2A}.Debug|ARM64.ActiveCfg = Debug|ARM64 31 | {830B14D5-0E32-4F9E-AEFA-4C9F6FC13C2A}.Debug|ARM64.Build.0 = Debug|ARM64 32 | {830B14D5-0E32-4F9E-AEFA-4C9F6FC13C2A}.Debug|Win32.ActiveCfg = Debug|Win32 33 | {830B14D5-0E32-4F9E-AEFA-4C9F6FC13C2A}.Debug|Win32.Build.0 = Debug|Win32 34 | {830B14D5-0E32-4F9E-AEFA-4C9F6FC13C2A}.Debug|x64.ActiveCfg = Debug|x64 35 | {830B14D5-0E32-4F9E-AEFA-4C9F6FC13C2A}.Debug|x64.Build.0 = Debug|x64 36 | {830B14D5-0E32-4F9E-AEFA-4C9F6FC13C2A}.Release|ARM64.ActiveCfg = Release|ARM64 37 | {830B14D5-0E32-4F9E-AEFA-4C9F6FC13C2A}.Release|ARM64.Build.0 = Release|ARM64 38 | {830B14D5-0E32-4F9E-AEFA-4C9F6FC13C2A}.Release|Win32.ActiveCfg = Release|Win32 39 | {830B14D5-0E32-4F9E-AEFA-4C9F6FC13C2A}.Release|Win32.Build.0 = Release|Win32 40 | {830B14D5-0E32-4F9E-AEFA-4C9F6FC13C2A}.Release|x64.ActiveCfg = Release|x64 41 | {830B14D5-0E32-4F9E-AEFA-4C9F6FC13C2A}.Release|x64.Build.0 = Release|x64 42 | {33E61864-6F2C-4F9F-BE70-8F8985A4F283}.Debug|ARM64.ActiveCfg = Debug|ARM64 43 | {33E61864-6F2C-4F9F-BE70-8F8985A4F283}.Debug|ARM64.Build.0 = Debug|ARM64 44 | {33E61864-6F2C-4F9F-BE70-8F8985A4F283}.Debug|Win32.ActiveCfg = Debug|Win32 45 | {33E61864-6F2C-4F9F-BE70-8F8985A4F283}.Debug|Win32.Build.0 = Debug|Win32 46 | {33E61864-6F2C-4F9F-BE70-8F8985A4F283}.Debug|x64.ActiveCfg = Debug|x64 47 | {33E61864-6F2C-4F9F-BE70-8F8985A4F283}.Debug|x64.Build.0 = Debug|x64 48 | {33E61864-6F2C-4F9F-BE70-8F8985A4F283}.Release|ARM64.ActiveCfg = Release|ARM64 49 | {33E61864-6F2C-4F9F-BE70-8F8985A4F283}.Release|ARM64.Build.0 = Release|ARM64 50 | {33E61864-6F2C-4F9F-BE70-8F8985A4F283}.Release|Win32.ActiveCfg = Release|Win32 51 | {33E61864-6F2C-4F9F-BE70-8F8985A4F283}.Release|Win32.Build.0 = Release|Win32 52 | {33E61864-6F2C-4F9F-BE70-8F8985A4F283}.Release|x64.ActiveCfg = Release|x64 53 | {33E61864-6F2C-4F9F-BE70-8F8985A4F283}.Release|x64.Build.0 = Release|x64 54 | {E4DF0EEE-D35B-47F2-A9B1-41EA97C465FF}.Debug|ARM64.ActiveCfg = Debug|ARM64 55 | {E4DF0EEE-D35B-47F2-A9B1-41EA97C465FF}.Debug|ARM64.Build.0 = Debug|ARM64 56 | {E4DF0EEE-D35B-47F2-A9B1-41EA97C465FF}.Debug|Win32.ActiveCfg = Debug|Win32 57 | {E4DF0EEE-D35B-47F2-A9B1-41EA97C465FF}.Debug|Win32.Build.0 = Debug|Win32 58 | {E4DF0EEE-D35B-47F2-A9B1-41EA97C465FF}.Debug|x64.ActiveCfg = Debug|x64 59 | {E4DF0EEE-D35B-47F2-A9B1-41EA97C465FF}.Debug|x64.Build.0 = Debug|x64 60 | {E4DF0EEE-D35B-47F2-A9B1-41EA97C465FF}.Release|ARM64.ActiveCfg = Release|ARM64 61 | {E4DF0EEE-D35B-47F2-A9B1-41EA97C465FF}.Release|ARM64.Build.0 = Release|ARM64 62 | {E4DF0EEE-D35B-47F2-A9B1-41EA97C465FF}.Release|Win32.ActiveCfg = Release|Win32 63 | {E4DF0EEE-D35B-47F2-A9B1-41EA97C465FF}.Release|Win32.Build.0 = Release|Win32 64 | {E4DF0EEE-D35B-47F2-A9B1-41EA97C465FF}.Release|x64.ActiveCfg = Release|x64 65 | {E4DF0EEE-D35B-47F2-A9B1-41EA97C465FF}.Release|x64.Build.0 = Release|x64 66 | EndGlobalSection 67 | GlobalSection(SolutionProperties) = preSolution 68 | HideSolutionNode = FALSE 69 | EndGlobalSection 70 | GlobalSection(NestedProjects) = preSolution 71 | {830B14D5-0E32-4F9E-AEFA-4C9F6FC13C2A} = {FA56D96B-290B-4C73-A5E1-02C1861D3224} 72 | {33E61864-6F2C-4F9F-BE70-8F8985A4F283} = {0B4B8E51-20A8-43A4-A8DA-42FF90D628AC} 73 | {E4DF0EEE-D35B-47F2-A9B1-41EA97C465FF} = {C06F6070-75EE-4F57-8D35-4AC2AB08D029} 74 | EndGlobalSection 75 | GlobalSection(ExtensibilityGlobals) = postSolution 76 | SolutionGuid = {6DB4FE19-4FE0-4DC4-B898-C46E01E6BDF4} 77 | EndGlobalSection 78 | EndGlobal 79 | -------------------------------------------------------------------------------- /vcable.h: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) Microsoft Corporation All Rights Reserved 4 | 5 | Module Name: 6 | 7 | vcable.h 8 | 9 | Abstract: 10 | 11 | Declaration of SYSVAD data saving class. This class supplies services 12 | to save data to disk. 13 | 14 | 15 | --*/ 16 | 17 | #ifndef _SYSVAD_VCABLE_H 18 | #define _SYSVAD_VCABLE_H 19 | 20 | //----------------------------------------------------------------------------- 21 | // Forward declaration 22 | //----------------------------------------------------------------------------- 23 | class CVCable; 24 | typedef CVCable *PCVCable; 25 | 26 | 27 | //----------------------------------------------------------------------------- 28 | // Structs 29 | //----------------------------------------------------------------------------- 30 | 31 | // Parameter to workitem. 32 | #include 33 | typedef struct _SAVEWORKER_PARAM { 34 | //PIO_WORKITEM WorkItem; 35 | ULONG ulFrameNo; 36 | ULONG ulDataSize; 37 | PBYTE pData; 38 | PCVCable pVCable; 39 | KEVENT EventDone; 40 | } SAVEWORKER_PARAM; 41 | typedef SAVEWORKER_PARAM *PSAVEWORKER_PARAM; 42 | #include 43 | 44 | // wave file header. 45 | #include 46 | typedef struct _OUTPUT_DATA_HEADER 47 | { 48 | DWORD dwData; 49 | DWORD dwDataLength; 50 | } OUTPUT_DATA_HEADER; 51 | typedef OUTPUT_DATA_HEADER *POUTPUT_DATA_HEADER; 52 | 53 | #include 54 | 55 | //----------------------------------------------------------------------------- 56 | // Classes 57 | //----------------------------------------------------------------------------- 58 | 59 | /////////////////////////////////////////////////////////////////////////////// 60 | // CVCable 61 | // Provides a loopback of output to an input stream 62 | // 63 | IO_WORKITEM_ROUTINE SaveFrameWorkerCallback; 64 | 65 | class CVCable 66 | { 67 | protected: 68 | PBYTE m_pDataBuffer; // Data buffer. 69 | ULONG m_ulBufferSize; // Total buffer size. 70 | ULONG m_ulWriteOffset; // index in buffer. 71 | ULONG m_ulReadOffset; // index in buffer. 72 | 73 | KSPIN_LOCK m_FrameInUseSpinLock; // Spinlock for synch. 74 | 75 | bool m_Mute; 76 | 77 | static ULONG m_ulStreamId; 78 | 79 | BOOL m_fWriteDisabled; 80 | 81 | bool m_bCaptureInitialized; 82 | bool m_bRenderInitialized; 83 | 84 | public: 85 | 86 | void Disable( _In_ BOOL fDisable ); 87 | NTSTATUS Initialize(); 88 | //NTSTATUS SetMaxWriteSize( _In_ ULONG ulMaxWriteSize ); 89 | 90 | void SetMute(_In_ bool b) { m_Mute = b; } 91 | 92 | 93 | bool isCapture() const { return m_bCaptureInitialized; } 94 | void setCapture(_In_ bool b = true) { m_bCaptureInitialized = b; } 95 | bool isRender() const { return m_bRenderInitialized; } 96 | void setRender(_In_ bool b = true) { m_bRenderInitialized = b; } 97 | 98 | void ReadData( _Inout_updates_bytes_all_(ulByteCount) PBYTE pBuffer, 99 | _In_ ULONG ulByteCount); 100 | 101 | void WriteData(_In_reads_bytes_(ulByteCount) PBYTE pBuffer, 102 | _In_ ULONG ulByteCount); 103 | 104 | void LoopData( _Out_writes_bytes_(BufferLength) PBYTE pBuffer, 105 | _In_ ULONG ulByteCount); 106 | 107 | static CVCable* getCable( _In_ BOOL capture ); 108 | 109 | private: 110 | CVCable(); 111 | ~CVCable(); 112 | 113 | bool m_Initialized; 114 | 115 | static CVCable* m_pInstance; 116 | 117 | }; 118 | typedef CVCable *PCVCable; 119 | 120 | #endif 121 | 122 | --------------------------------------------------------------------------------