├── .gitignore ├── CODE_OF_CONDUCT.md ├── CollectAudioLogs ├── CollectAudioLogs.cmd ├── CollectAudioLogs.ps1 ├── I-can-make-it-happen-glitch.cmd ├── I-can-make-it-happen-other.cmd ├── I-can-make-it-happen-ttt.cmd ├── I-cannot-make-it-happen.cmd ├── README.txt ├── RegistryToXml.psm1 ├── audio-glitches-manual.wprp ├── audio-info-manual.wprp └── tttraceall.psm1 ├── LICENSE ├── README.md ├── SECURITY.md ├── SUPPORT.md ├── Samples └── Audio │ └── sysvad │ ├── A2dpHpDevice.cpp │ ├── A2dpHpDevice.h │ ├── APO │ ├── AecApo │ │ ├── AecApo.h │ │ ├── AecApo.png │ │ ├── AecApo.vcxproj │ │ ├── AecApo.vcxproj.Filters │ │ ├── AecApoDll.cpp │ │ ├── AecApoDll.def │ │ ├── AecApoDll.idl │ │ ├── AecApoDll.rc │ │ ├── AecApoDll.rgs │ │ ├── AecApoMfx.cpp │ │ ├── AecApoMfx.rgs │ │ ├── Resource.h │ │ └── packages.config │ ├── DelayAPO │ │ ├── Delay.cpp │ │ ├── DelayAPO.h │ │ ├── DelayAPO.vcxproj │ │ ├── DelayAPO.vcxproj.Filters │ │ ├── DelayAPODll.cpp │ │ ├── DelayAPODll.def │ │ ├── DelayAPODll.idl │ │ ├── DelayAPODll.rc │ │ ├── DelayAPODll.rgs │ │ ├── DelayAPOInterface.idl │ │ ├── DelayAPOMFX.cpp │ │ ├── DelayAPOMFX.rgs │ │ ├── DelayAPOSFX.cpp │ │ ├── DelayAPOSFX.rgs │ │ ├── Resource.h │ │ ├── delayapo.png │ │ └── packages.config │ ├── Inc │ │ ├── CommonMacros.h │ │ ├── CustomPropKeys.h │ │ └── tlist.h │ ├── KWSApo │ │ ├── KWSApo.cpp │ │ ├── KWSApo.h │ │ ├── KWSApo.png │ │ ├── KWSApo.vcxproj │ │ ├── KWSApo.vcxproj.Filters │ │ ├── KWSApoDll.cpp │ │ ├── KWSApoDll.def │ │ ├── KWSApoDll.idl │ │ ├── KWSApoDll.rc │ │ ├── KWSApoDll.rgs │ │ ├── KWSApoInterface.idl │ │ ├── KWSApoMfx.cpp │ │ ├── KWSApoMfx.rgs │ │ ├── Resource.h │ │ └── packages.config │ └── SwapAPO │ │ ├── Resource.h │ │ ├── SwapAPO.h │ │ ├── SwapAPO.vcxproj │ │ ├── SwapAPO.vcxproj.Filters │ │ ├── SwapAPODll.cpp │ │ ├── SwapAPODll.def │ │ ├── SwapAPODll.idl │ │ ├── SwapAPODll.rc │ │ ├── SwapAPODll.rgs │ │ ├── SwapAPOInterface.idl │ │ ├── SwapAPOMFX.rgs │ │ ├── SwapAPOSFX.rgs │ │ ├── packages.config │ │ ├── swap.cpp │ │ ├── swapapo.png │ │ ├── swapapomfx.cpp │ │ └── swapaposfx.cpp │ ├── BthhfpDevice.cpp │ ├── BthhfpDevice.h │ ├── ContosoKeywordDetector.h │ ├── EndpointsCommon │ ├── A2dpHpDeviceFormats.h │ ├── AudioModule0.h │ ├── AudioModule1.h │ ├── AudioModule2.h │ ├── AudioModuleHelper.cpp │ ├── AudioModuleHelper.h │ ├── EndpointsCommon.vcxproj │ ├── EndpointsCommon.vcxproj.Filters │ ├── MiniportAudioEngineNode.cpp │ ├── MiniportStreamAudioEngineNode.cpp │ ├── NewDelete.cpp │ ├── NewDelete.h │ ├── UsbHsDeviceFormats.h │ ├── a2dphpminipairs.h │ ├── a2dphpminwavert.cpp │ ├── a2dphpspeakertopo.cpp │ ├── a2dphpspeakertopo.h │ ├── a2dphpspeakertoptable.h │ ├── a2dphpspeakerwavtable.h │ ├── a2dphptopo.cpp │ ├── a2dphptopo.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 │ ├── packages.config │ ├── 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 │ ├── KeywordDetectorAdapter │ ├── KeywordDetectorContosoAdapter.cpp │ ├── KeywordDetectorContosoAdapter.def │ ├── KeywordDetectorContosoAdapter.idl │ ├── KeywordDetectorContosoAdapter.rc │ ├── KeywordDetectorContosoAdapter.vcxproj │ ├── KeywordDetectorContosoAdapter.vcxproj.Filters │ ├── dllmain.cpp │ ├── packages.config │ ├── stdafx.cpp │ ├── stdafx.h │ └── targetver.h │ ├── Package │ ├── package.VcxProj │ └── package.VcxProj.Filters │ ├── README.md │ ├── SysVadShared.h │ ├── TabletAudioSample │ ├── ComponentizedApoSample.inx │ ├── ComponentizedAudioSample.inx │ ├── ComponentizedAudioSampleExtension.inx │ ├── TabletAudioSample.rc │ ├── TabletAudioSample.vcxproj │ ├── TabletAudioSample.vcxproj.Filters │ ├── 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 │ ├── packages.config │ ├── spdiftopo.cpp │ ├── spdiftopo.h │ ├── spdiftoptable.h │ └── spdifwavtable.h │ ├── ToneGenerator.cpp │ ├── ToneGenerator.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 └── USBPowerSettings ├── USBAudioPowerSettings.cmd └── USBAudioPowerSettings.ps1 /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Microsoft Open Source Code of Conduct 2 | 3 | This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). 4 | 5 | Resources: 6 | 7 | - [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/) 8 | - [Microsoft Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) 9 | - Contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with questions or concerns 10 | -------------------------------------------------------------------------------- /CollectAudioLogs/CollectAudioLogs.cmd: -------------------------------------------------------------------------------- 1 | @rem Copyright (c) Microsoft Corporation. All rights reserved. 2 | @echo off 3 | setlocal 4 | 5 | set script=%~dp0CollectAudioLogs.ps1 6 | 7 | rem look out for WOW64 file system redirection 8 | set powershell="%windir%\system32\WindowsPowerShell\v1.0\PowerShell.exe" 9 | if not "%PROCESSOR_ARCHITEW6432%" == "" ( 10 | set powershell="%windir%\sysnative\WindowsPowerShell\v1.0\PowerShell.exe" 11 | ) 12 | 13 | rem pass arguments we received to the PowerShell script 14 | set command= ^ 15 | Start-Process powershell.exe ^ 16 | -Verb RunAs ^ 17 | -ArgumentList ^ 18 | '-NoProfile -NoExit -ExecutionPolicy Bypass -File "%script%" %*' 19 | 20 | call %powershell% -NoExit -NoProfile -Command "& { %command% }" 21 | -------------------------------------------------------------------------------- /CollectAudioLogs/I-can-make-it-happen-glitch.cmd: -------------------------------------------------------------------------------- 1 | @rem Copyright (c) Microsoft Corporation. All rights reserved. 2 | @rem Run this one if you can make the problem happen 3 | @rem and the problem is bad-sounding audio 4 | @echo off 5 | 6 | call %~dp0CollectAudioLogs.cmd -problem glitch 7 | -------------------------------------------------------------------------------- /CollectAudioLogs/I-can-make-it-happen-other.cmd: -------------------------------------------------------------------------------- 1 | @rem Copyright (c) Microsoft Corporation. All rights reserved. 2 | @rem Run this one if you can make the problem happen 3 | @rem and the problem is something other than bad-sounding audio 4 | @echo off 5 | 6 | call %~dp0CollectAudioLogs.cmd -problem other 7 | -------------------------------------------------------------------------------- /CollectAudioLogs/I-can-make-it-happen-ttt.cmd: -------------------------------------------------------------------------------- 1 | @rem Copyright (c) Microsoft Corporation. All rights reserved. 2 | @rem Run this one if someone asks for "time travel traces" 3 | @echo off 4 | 5 | call %~dp0CollectAudioLogs.cmd -problem ttt 6 | -------------------------------------------------------------------------------- /CollectAudioLogs/I-cannot-make-it-happen.cmd: -------------------------------------------------------------------------------- 1 | @rem Copyright (c) Microsoft Corporation. All rights reserved. 2 | @rem Run this one if you can't make the problem happen 3 | @echo off 4 | 5 | call %~dp0CollectAudioLogs.cmd -problem norepro 6 | -------------------------------------------------------------------------------- /CollectAudioLogs/README.txt: -------------------------------------------------------------------------------- 1 | 1. Double click one of the following files: 2 | 1a. I-can-make-it-happen-glitch.cmd if the problem is bad-sounding audio and you can make it happen. 3 | 1b. I-can-make-it-happen-other.cmd if the problem is something else and you can make it happen. 4 | 1c. I-can-make-it-happen-ttt.cmd if you can make it happen and you want to grab time-travel traces. 5 | 1d. I-cannot-make-it-happen.cmd if you want to grab after-the-fact logs only. 6 | 2. Some of these may ask you some yes-or-no questions. 7 | 3. If you are making it happen, press Enter when you are done, to stop tracing. 8 | 4. When everything is done, COMPUTERNAME_.zip in the script directory will have the logs. 9 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) Microsoft Corporation. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Project 2 | 3 | This project will contain open source tools and utilities shared by the Microsoft Windows Audio team. 4 | 5 | ### CollectAudioLogs 6 | 7 | This is a script for collecting audio logs, which are used when diagnosing audio problems. This tool is primarily used in collaboration with a developer on the Windows Audio team, though the data may be useful for audio driver developers and software venders that are creating [Audio Processing Objects (APOs)](https://learn.microsoft.com/en-us/windows-hardware/drivers/audio/audio-processing-object-architecture) 8 | 9 | The logs collected by this script are mostly identical to the logs collected by feedback hub. To collect the equivalant audio logs using the feedback hub, you would first go into Feedback Hub Settings and enable "save a local copy of diagnostics when giving feedback." You would then file a feedback under "Devices and Drivers"->"Audio and Sound" with the "Recreate my problem" option. 10 | 11 | There are two notable exceptions with the logs collected using this script versus the logs collected using Feedback Hub. First, the logs collected by this script are more compact than the files collected by feedback hub, having all of the log files in a flatter directory structure makes it a little more friendly for manual analysis. Second, this script has the option to collect [Time Travel Traces](https://learn.microsoft.com/en-us/windows-hardware/drivers/debugger/time-travel-debugging-overview) of the Windows Audio Services. Feedback hub does not have the ability to collect Time Travel Traces. 12 | 13 | Some important things to keep in mind when collecting Time Travel Traces. In order to collect Time Travel Traces of Windows services, some security features on these services need to be disabled. This script queries if the security features are enabled for the services, disables the security features, restarts the services for collecting the Time Travel Traces, and then restores the security settings and restarts the services again after tracing is completed. In the event the script is interruped in the middle of collection, it is important to note that Shadowstacks and CET may be disabled for services running on the system. It is possible that disabling and restarting the service will lose system state and remove the ability to reproduce a bug, so it is best to collect logs or file a feedback without Time Travel Tracing first, in order to ensure that some logs are collected and the bug is not lost. Also, Time Travel Tracing is CPU intensive, and it is expected that when enabled there may be audio glitching and other audible artifacts caused by slow audio processing. Time Travel Tracing should not be collected when investigating issues with audio quality, normal audio feedback logs are sufficient for diagnosing audio glitch and quality problems. 14 | 15 | When will the information in these logs be useful and what is collected? I'm glad you asked. :) 16 | 17 | When you open the .zip file, you will see a repro.etl file. This file can be viewed in [Windows Performance Analyzer](https://learn.microsoft.com/en-us/windows-hardware/test/wpt/getting-started--windows-performance-analyzer--wpa-). This file contains logging from the logging providers specified in the .wprp file included with the script. This includes the logging providers for the windows audio services, along with many of the providers for audio drivers and APOs. This is a "circular" log, when the specified log size is reached, newer log entries overwrite older log entries. There is a lot of logging collected for each frame of audio data when audio playback or capture is running. The result is that this log often only collects about 30 to 60 seconds worth of activity by the audio services before overwriting earlier events. For issues which require multiple tries to reproduce the problem, the log will not grow unbounded. Just be sure to stop log collection within 30 seconds of the issue being reproduced. 18 | 19 | If Time Travel Tracing is enabled, you will see three .run and .out files for the Time Travel Trace. The two svchost.run files are for AudioSrv and AudioEndpointBuilder, audiodg.run is for AudioDG. Audio Processing Objects (APOs) run inside of the [AudioDG.exe](https://learn.microsoft.com/en-us/windows-hardware/drivers/audio/windows-audio-architecture) process, and Time Travel Traces can be invaluable for software vendors diagnosing failures with their APO's. Also, when collaborating with a developer on the Windows audio team, time travel traces of AudioSrv and AudioEndpointBuilder can help with quickly identifying and resolving issues. 20 | 21 | Finally, when you indicate to collect "additional system information," there are various other files containing PNP logs and registry keys which are interesting to the audio system, such as the MMDevice registry keys which contain information about all of the audio endpoints in the system, and the pnpstate.pnp which contains driver installation information from the PNP system. Most of these files are plain text. The PNP export contains the same information that is visible in the device manager and event viewer, including driver installation dates, driver versions, driver inf's, event viewer data for PNP, and driver state/failure information. Often the information contained in these logs are necessary for interpreting the logging collected in the repro.etl file, so it is recommended to always collect this information at least once. When collecting a sequence of logs to demonstrate a problem, the additional system information is typically only needed for one collection, the remainder of logs can contain only the repro.etl. 22 | 23 | 24 | ## Contributing 25 | 26 | This project welcomes contributions and suggestions. Most contributions require you to agree to a 27 | Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us 28 | the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com. 29 | 30 | When you submit a pull request, a CLA bot will automatically determine whether you need to provide 31 | a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions 32 | provided by the bot. You will only need to do this once across all repos using our CLA. 33 | 34 | This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). 35 | For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or 36 | contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments. 37 | 38 | ## Trademarks 39 | 40 | This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft 41 | trademarks or logos is subject to and must follow 42 | [Microsoft's Trademark & Brand Guidelines](https://www.microsoft.com/en-us/legal/intellectualproperty/trademarks/usage/general). 43 | Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship. 44 | Any use of third-party trademarks or logos are subject to those third-party's policies. 45 | -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | ## Security 4 | 5 | Microsoft takes the security of our software products and services seriously, which includes all source code repositories managed through our GitHub organizations, which include [Microsoft](https://github.com/Microsoft), [Azure](https://github.com/Azure), [DotNet](https://github.com/dotnet), [AspNet](https://github.com/aspnet) and [Xamarin](https://github.com/xamarin). 6 | 7 | If you believe you have found a security vulnerability in any Microsoft-owned repository that meets [Microsoft's definition of a security vulnerability](https://aka.ms/security.md/definition), please report it to us as described below. 8 | 9 | ## Reporting Security Issues 10 | 11 | **Please do not report security vulnerabilities through public GitHub issues.** 12 | 13 | Instead, please report them to the Microsoft Security Response Center (MSRC) at [https://msrc.microsoft.com/create-report](https://aka.ms/security.md/msrc/create-report). 14 | 15 | If you prefer to submit without logging in, send email to [secure@microsoft.com](mailto:secure@microsoft.com). If possible, encrypt your message with our PGP key; please download it from the [Microsoft Security Response Center PGP Key page](https://aka.ms/security.md/msrc/pgp). 16 | 17 | You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Additional information can be found at [microsoft.com/msrc](https://www.microsoft.com/msrc). 18 | 19 | Please include the requested information listed below (as much as you can provide) to help us better understand the nature and scope of the possible issue: 20 | 21 | * Type of issue (e.g. buffer overflow, SQL injection, cross-site scripting, etc.) 22 | * Full paths of source file(s) related to the manifestation of the issue 23 | * The location of the affected source code (tag/branch/commit or direct URL) 24 | * Any special configuration required to reproduce the issue 25 | * Step-by-step instructions to reproduce the issue 26 | * Proof-of-concept or exploit code (if possible) 27 | * Impact of the issue, including how an attacker might exploit the issue 28 | 29 | This information will help us triage your report more quickly. 30 | 31 | If you are reporting for a bug bounty, more complete reports can contribute to a higher bounty award. Please visit our [Microsoft Bug Bounty Program](https://aka.ms/security.md/msrc/bounty) page for more details about our active programs. 32 | 33 | ## Preferred Languages 34 | 35 | We prefer all communications to be in English. 36 | 37 | ## Policy 38 | 39 | Microsoft follows the principle of [Coordinated Vulnerability Disclosure](https://aka.ms/security.md/cvd). 40 | 41 | 42 | -------------------------------------------------------------------------------- /SUPPORT.md: -------------------------------------------------------------------------------- 1 | ## How to file issues and get help 2 | 3 | This project uses GitHub Issues to track bugs and feature requests. Please search the existing 4 | issues before filing new issues to avoid duplicates. For new issues, file your bug or 5 | feature request as a new Issue. 6 | 7 | ## Microsoft Support Policy 8 | 9 | Support for this PROJECT is limited to the resources listed above. 10 | -------------------------------------------------------------------------------- /Samples/Audio/sysvad/APO/AecApo/AecApo.h: -------------------------------------------------------------------------------- 1 | // 2 | // AecApo.h -- Copyright (c) Microsoft Corporation. All rights reserved. 3 | // 4 | // Description: 5 | // 6 | // Declaration of the CAecApoMFX class. 7 | // 8 | 9 | #pragma once 10 | 11 | #include 12 | #include 13 | #include 14 | 15 | #include 16 | #include 17 | 18 | #include 19 | 20 | #include 21 | 22 | _Analysis_mode_(_Analysis_code_type_user_driver_) 23 | 24 | #pragma AVRT_VTABLES_BEGIN 25 | // Aec APO class - MFX 26 | class CAecApoMFX : 27 | public CComObjectRootEx, 28 | public CComCoClass, 29 | public CBaseAudioProcessingObject, 30 | public IAudioSystemEffects3, 31 | public IAudioProcessingObjectNotifications, 32 | public IApoAcousticEchoCancellation, 33 | public IApoAuxiliaryInputConfiguration, 34 | public IApoAuxiliaryInputRT 35 | { 36 | public: 37 | // constructor 38 | CAecApoMFX() 39 | : CBaseAudioProcessingObject(sm_RegProperties) 40 | { 41 | } 42 | 43 | DECLARE_REGISTRY_RESOURCEID(IDR_AECAPOMFX) 44 | 45 | BEGIN_COM_MAP(CAecApoMFX) 46 | COM_INTERFACE_ENTRY(IAudioSystemEffects) 47 | COM_INTERFACE_ENTRY(IAudioSystemEffects2) 48 | COM_INTERFACE_ENTRY(IAudioSystemEffects3) 49 | COM_INTERFACE_ENTRY(IAudioProcessingObjectNotifications) 50 | COM_INTERFACE_ENTRY(IAudioProcessingObjectRT) 51 | COM_INTERFACE_ENTRY(IAudioProcessingObject) 52 | COM_INTERFACE_ENTRY(IAudioProcessingObjectConfiguration) 53 | COM_INTERFACE_ENTRY(IApoAcousticEchoCancellation) 54 | COM_INTERFACE_ENTRY(IApoAuxiliaryInputConfiguration) 55 | COM_INTERFACE_ENTRY(IApoAuxiliaryInputRT) 56 | END_COM_MAP() 57 | 58 | DECLARE_PROTECT_FINAL_CONSTRUCT() 59 | 60 | public: 61 | STDMETHOD_(void, APOProcess)(UINT32 u32NumInputConnections, 62 | APO_CONNECTION_PROPERTY** ppInputConnections, UINT32 u32NumOutputConnections, 63 | APO_CONNECTION_PROPERTY** ppOutputConnections); 64 | 65 | STDMETHOD(GetLatency)(HNSTIME* pTime); 66 | 67 | STDMETHOD(LockForProcess)(UINT32 u32NumInputConnections, 68 | APO_CONNECTION_DESCRIPTOR** ppInputConnections, 69 | UINT32 u32NumOutputConnections, APO_CONNECTION_DESCRIPTOR** ppOutputConnections); 70 | 71 | STDMETHOD(Initialize)(UINT32 cbDataSize, BYTE* pbyData); 72 | 73 | // IAudioSystemEffects2 74 | STDMETHOD(GetEffectsList)(_Outptr_result_buffer_maybenull_(*pcEffects) LPGUID *ppEffectsIds, _Out_ UINT *pcEffects, _In_ HANDLE Event); 75 | 76 | // IAudioProcessingObject 77 | STDMETHOD(IsInputFormatSupported)(IAudioMediaType *pOutputFormat, IAudioMediaType *pRequestedInputFormat, IAudioMediaType **ppSupportedInputFormat); 78 | STDMETHOD(IsOutputFormatSupported)(IAudioMediaType *pInputFormat, IAudioMediaType *pRequestedOutputFormat, IAudioMediaType **ppSupportedOutputFormat); 79 | 80 | // IAPOAuxiliaryInputConfiguration 81 | STDMETHOD(AddAuxiliaryInput)( 82 | DWORD dwInputId, 83 | UINT32 cbDataSize, 84 | BYTE *pbyData, 85 | APO_CONNECTION_DESCRIPTOR *pInputConnection 86 | ) override; 87 | STDMETHOD(RemoveAuxiliaryInput)( 88 | DWORD dwInputId 89 | ) override; 90 | STDMETHOD(IsInputFormatSupported)( 91 | IAudioMediaType* pRequestedInputFormat, 92 | IAudioMediaType** ppSupportedInputFormat 93 | ) override; 94 | 95 | // IAPOAuxiliaryInputRT 96 | STDMETHOD_(void, AcceptInput)( 97 | DWORD dwInputId, 98 | const APO_CONNECTION_PROPERTY *pInputConnection 99 | ) override; 100 | 101 | // IAudioSystemEffects3 102 | STDMETHOD(GetControllableSystemEffectsList)( 103 | _Outptr_result_buffer_maybenull_(*numEffects) AUDIO_SYSTEMEFFECT** effects, _Out_ UINT* numEffects, _In_opt_ HANDLE event) override; 104 | 105 | STDMETHODIMP SetAudioSystemEffectState(GUID, AUDIO_SYSTEMEFFECT_STATE) override {return S_OK;} 106 | 107 | // IAudioProcessingObjectNotifications 108 | STDMETHOD(GetApoNotificationRegistrationInfo)(_Out_writes_(*count) APO_NOTIFICATION_DESCRIPTOR** apoNotifications, _Out_ DWORD* count) override; 109 | STDMETHOD_(void, HandleNotification)(_In_ APO_NOTIFICATION* apoNotification) override; 110 | 111 | public: 112 | UINT64 m_auxiliaryInputId = 0; 113 | static const CRegAPOProperties<1> sm_RegProperties; // registration properties 114 | BOOL m_initializedForEffectsDiscovery = FALSE; 115 | GUID m_audioSignalProcessingMode = GUID_NULL; 116 | 117 | CComPtr m_spCaptureDevice; 118 | CComPtr m_spLoopbackDevice; 119 | 120 | float m_captureEndpointMasterVolume = 0; 121 | float m_loopbackEndpointMasterVolume = 0; 122 | 123 | private: 124 | wil::com_ptr_nothrow m_apoLoggingService; 125 | }; 126 | #pragma AVRT_VTABLES_END 127 | 128 | OBJECT_ENTRY_AUTO(__uuidof(AecApoMFX), CAecApoMFX) 129 | 130 | 131 | -------------------------------------------------------------------------------- /Samples/Audio/sysvad/APO/AecApo/AecApo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/audio/084223378b19c4aa210db61a10917621aeae8828/Samples/Audio/sysvad/APO/AecApo/AecApo.png -------------------------------------------------------------------------------- /Samples/Audio/sysvad/APO/AecApo/AecApo.vcxproj.Filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx;* 6 | {5f4ff11d-7a0b-4f75-9d79-744ae028cc53} 7 | 8 | 9 | h;hpp;hxx;hm;inl;inc;xsd 10 | {bd103b81-05b2-440e-84e7-0723d7fe4109} 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 | {a57b6b78-38ae-4348-ade3-0200e81a3dd7} 15 | 16 | 17 | idl 18 | {c6318700-1bce-4812-92f1-160881e4c976} 19 | 20 | 21 | 22 | 23 | Header Files 24 | 25 | 26 | Header Files 27 | 28 | 29 | 30 | 31 | Resource Files 32 | 33 | 34 | Source Files 35 | 36 | 37 | Resource Files 38 | 39 | 40 | Source Files 41 | 42 | 43 | 44 | 45 | 46 | Source Files 47 | 48 | 49 | Source Files 50 | 51 | 52 | 53 | 54 | Resource Files 55 | 56 | 57 | 58 | 59 | IDL Files 60 | 61 | 62 | 63 | 64 | 65 | -------------------------------------------------------------------------------- /Samples/Audio/sysvad/APO/AecApo/AecApoDll.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // AecApoDll.cpp -- Copyright (c) Microsoft Corporation. All rights reserved. 3 | // 4 | // Author: 5 | // 6 | // Description: 7 | // 8 | // AecApoDll.cpp : Implementation of DLL Exports. 9 | 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | 16 | #include "resource.h" 17 | #include "AecApoDll.h" 18 | #include 19 | 20 | #include 21 | 22 | 23 | //------------------------------------------------------------------------- 24 | // Array of APO_REG_PROPERTIES structures implemented in this module. 25 | // Each new APO implementation will be added to this array. 26 | // 27 | APO_REG_PROPERTIES const *gCoreAPOs[] = 28 | { 29 | &CAecApoMFX::sm_RegProperties.m_Properties 30 | }; 31 | 32 | // {secret} 33 | class CAecApoDllModule : public CAtlDllModuleT< CAecApoDllModule > 34 | { 35 | public : 36 | DECLARE_LIBID(LIBID_AecApoDlllib) 37 | DECLARE_REGISTRY_APPID_RESOURCEID(IDR_AECAPODLL, "{1314DF8C-99BA-4E06-8ABD-CB38614EDFF7}") 38 | 39 | }; 40 | 41 | // {secret} 42 | CAecApoDllModule _AtlModule; 43 | 44 | 45 | // {secret} 46 | extern "C" BOOL WINAPI DllMain(HINSTANCE /* hInstance */, DWORD dwReason, LPVOID lpReserved) 47 | { 48 | if (DLL_PROCESS_ATTACH == dwReason) 49 | { 50 | } 51 | // do necessary cleanup only if the DLL is being unloaded dynamically 52 | else if ((DLL_PROCESS_DETACH == dwReason) && (NULL == lpReserved)) 53 | { 54 | } 55 | 56 | return _AtlModule.DllMain(dwReason, lpReserved); 57 | } 58 | 59 | 60 | // {secret} 61 | STDAPI DllCanUnloadNow(void) 62 | { 63 | return _AtlModule.DllCanUnloadNow(); 64 | } 65 | 66 | 67 | // {secret} 68 | STDAPI DllGetClassObject(_In_ REFCLSID rclsid, _In_ REFIID riid, _Outptr_ LPVOID FAR* ppv) 69 | { 70 | return _AtlModule.DllGetClassObject(rclsid, riid, ppv); 71 | } 72 | -------------------------------------------------------------------------------- /Samples/Audio/sysvad/APO/AecApo/AecApoDll.def: -------------------------------------------------------------------------------- 1 | 2 | EXPORTS 3 | DllCanUnloadNow PRIVATE 4 | DllGetClassObject PRIVATE -------------------------------------------------------------------------------- /Samples/Audio/sysvad/APO/AecApo/AecApoDll.idl: -------------------------------------------------------------------------------- 1 | // 2 | // AecAPODll.idl -- Copyright (c) Microsoft Corporation. All rights reserved. 3 | // 4 | // Author: 5 | // 6 | // Description: 7 | // 8 | // AecAPODll.idl : Definition of COM interfaces and coclasses for the DLL. 9 | 10 | import "oaidl.idl"; 11 | import "ocidl.idl"; 12 | import "audioenginebaseapo.idl"; 13 | 14 | //------------------------------------------------------------------------- 15 | // AecApoDlllib 16 | // 17 | [ 18 | uuid(6D07D481-D230-493D-A521-3FBBB4619E2E), 19 | version(1.0) 20 | ] 21 | library AecApoDlllib 22 | { 23 | importlib("stdole2.tlb"); 24 | 25 | // for Aec APO - MFX 26 | [ 27 | uuid(325B7F6F-ED6C-40CE-814C-00D91FED053F) 28 | ] 29 | coclass AecApoMFX 30 | { 31 | [default] interface IAudioProcessingObject; 32 | interface IAudioProcessingObjectRT; 33 | interface IAudioProcessingObjectConfiguration; 34 | interface IAudioSystemEffects; 35 | // KK add to this 36 | }; 37 | 38 | 39 | } 40 | -------------------------------------------------------------------------------- /Samples/Audio/sysvad/APO/AecApo/AecApoDll.rc: -------------------------------------------------------------------------------- 1 | #if 0 2 | Copyright (c) Microsoft Corporation. All Rights Reserved 3 | #endif 4 | 5 | #include "resource.h" 6 | #include "winres.h" 7 | #include 8 | #define VER_FILETYPE VFT_DLL 9 | #define VER_FILESUBTYPE VFT_UNKNOWN 10 | #define VER_FILEDESCRIPTION_STR "AEC APO" 11 | #define VER_INTERNALNAME_STR "AecApo" 12 | #define VER_ORIGINALFILENAME_STR "AecApo.Dll" 13 | #include 14 | 15 | IDR_AECAPODLL REGISTRY "AecApoDll.rgs" 16 | IDR_AECAPOMFX REGISTRY "AecApoMFX.rgs" 17 | 18 | // ICON 19 | IDI_EFFECT_ICON RCDATA "AecApo.png" 20 | 21 | -------------------------------------------------------------------------------- /Samples/Audio/sysvad/APO/AecApo/AecApoDll.rgs: -------------------------------------------------------------------------------- 1 | HKCR 2 | { 3 | NoRemove AppID 4 | { 5 | '%APPID%' = s 'AecApoDll' 6 | 'AecApoDll.DLL' 7 | { 8 | val AppID = s '%APPID%' 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Samples/Audio/sysvad/APO/AecApo/AecApoMfx.rgs: -------------------------------------------------------------------------------- 1 | HKCR 2 | { 3 | NoRemove CLSID 4 | { 5 | ForceRemove {325B7F6F-ED6C-40CE-814C-00D91FED053F} = s 'AecApoMFX Class' 6 | { 7 | InprocServer32 = s '%MODULE%' 8 | { 9 | val ThreadingModel = s 'Both' 10 | } 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Samples/Audio/sysvad/APO/AecApo/Resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Visual C++ generated include file. 3 | // Used by AecApoDll.rc 4 | // 5 | #define IDS_PROJNAME 100 6 | #define IDR_AECAPODLL 101 7 | #define IDR_AECAPOMFX 110 8 | #define IDI_EFFECT_ICON 200 9 | 10 | // Next default values for new objects 11 | // 12 | #ifdef APSTUDIO_INVOKED 13 | #ifndef APSTUDIO_READONLY_SYMBOLS 14 | #define _APS_NEXT_RESOURCE_VALUE 201 15 | #define _APS_NEXT_COMMAND_VALUE 32768 16 | #define _APS_NEXT_CONTROL_VALUE 201 17 | #define _APS_NEXT_SYMED_VALUE 132 18 | #endif 19 | #endif 20 | -------------------------------------------------------------------------------- /Samples/Audio/sysvad/APO/AecApo/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /Samples/Audio/sysvad/APO/DelayAPO/Delay.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Delay.cpp -- Copyright (c) Microsoft Corporation. All rights reserved. 3 | // 4 | // Description: 5 | // 6 | // Implementation of ProcessDelay 7 | // 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | #include 15 | #include 16 | #include 17 | 18 | #include 19 | 20 | #include "DelayAPO.h" 21 | 22 | #pragma AVRT_CODE_BEGIN 23 | void WriteSilence( 24 | _Out_writes_(u32FrameCount * u32SamplesPerFrame) 25 | FLOAT32 *pf32Frames, 26 | UINT32 u32FrameCount, 27 | UINT32 u32SamplesPerFrame ) 28 | { 29 | ZeroMemory(pf32Frames, sizeof(FLOAT32) * u32FrameCount * u32SamplesPerFrame); 30 | } 31 | #pragma AVRT_CODE_END 32 | 33 | #pragma AVRT_CODE_BEGIN 34 | void CopyFrames( 35 | _Out_writes_(u32FrameCount * u32SamplesPerFrame) 36 | FLOAT32 *pf32OutFrames, 37 | _In_reads_(u32FrameCount * u32SamplesPerFrame) 38 | const FLOAT32 *pf32InFrames, 39 | UINT32 u32FrameCount, 40 | UINT32 u32SamplesPerFrame ) 41 | { 42 | CopyMemory(pf32OutFrames, pf32InFrames, sizeof(FLOAT32) * u32FrameCount * u32SamplesPerFrame); 43 | } 44 | #pragma AVRT_CODE_END 45 | 46 | #pragma AVRT_CODE_BEGIN 47 | void ProcessDelay( 48 | _Out_writes_(u32ValidFrameCount * u32SamplesPerFrame) 49 | FLOAT32 *pf32OutputFrames, 50 | _In_reads_(u32ValidFrameCount * u32SamplesPerFrame) 51 | const FLOAT32 *pf32InputFrames, 52 | UINT32 u32ValidFrameCount, 53 | UINT32 u32SamplesPerFrame, 54 | _Inout_updates_(u32DelayFrames * u32SamplesPerFrame) 55 | FLOAT32 *pf32DelayBuffer, 56 | UINT32 u32DelayFrames, 57 | _Inout_ 58 | UINT32 *pu32DelayIndex ) 59 | { 60 | ASSERT_REALTIME(); 61 | ATLASSERT( IS_VALID_TYPED_READ_POINTER(pf32InputFrames) ); 62 | ATLASSERT( IS_VALID_TYPED_READ_POINTER(pf32OutputFrames) ); 63 | 64 | if (u32DelayFrames == 0) 65 | { 66 | CopyFrames( pf32OutputFrames, 67 | pf32InputFrames, 68 | u32ValidFrameCount, 69 | u32SamplesPerFrame ); 70 | } 71 | else 72 | { 73 | 74 | // Invariants: 75 | // 0 <= (*pu32DelayIndex) < u32DelayFrames 76 | // pf32OutputFrames[0 ... u32ValidFrameCount * u32SamplesPerFrame - 1] is writable 77 | // pf32InputFrames[0 ... u32ValidFrameCount * u32SamplesPerFrame - 1] is readable 78 | while (u32ValidFrameCount > 0) 79 | { 80 | // copy either the rest of the input/output buffer, 81 | // or the rest of the delay buffer, 82 | // whichever is smaller 83 | UINT32 framesToCopy = min(u32ValidFrameCount, u32DelayFrames - (*pu32DelayIndex)); 84 | 85 | // delay => output 86 | #pragma prefast(suppress: __WARNING_POTENTIAL_BUFFER_OVERFLOW_HIGH_PRIORITY, "this copy to pf32OutputFrames is in-range") 87 | CopyFrames( pf32OutputFrames, 88 | &pf32DelayBuffer[(*pu32DelayIndex) * u32SamplesPerFrame], 89 | framesToCopy, 90 | u32SamplesPerFrame ); 91 | 92 | // input => delay 93 | CopyFrames( &pf32DelayBuffer[(*pu32DelayIndex) * u32SamplesPerFrame], 94 | pf32InputFrames, 95 | framesToCopy, 96 | u32SamplesPerFrame ); 97 | 98 | pf32OutputFrames += framesToCopy * u32SamplesPerFrame; 99 | pf32InputFrames += framesToCopy * u32SamplesPerFrame; 100 | u32ValidFrameCount -= framesToCopy; 101 | 102 | *pu32DelayIndex += framesToCopy; 103 | if (*pu32DelayIndex == u32DelayFrames) 104 | { 105 | *pu32DelayIndex = 0; 106 | } 107 | } 108 | 109 | } 110 | } 111 | #pragma AVRT_CODE_END 112 | 113 | -------------------------------------------------------------------------------- /Samples/Audio/sysvad/APO/DelayAPO/DelayAPO.vcxproj.Filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx;* 6 | {5f4ff11d-7a0b-4f75-9d79-744ae028cc53} 7 | 8 | 9 | h;hpp;hxx;hm;inl;inc;xsd 10 | {bd103b81-05b2-440e-84e7-0723d7fe4109} 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 | {a57b6b78-38ae-4348-ade3-0200e81a3dd7} 15 | 16 | 17 | idl 18 | {c6318700-1bce-4812-92f1-160881e4c976} 19 | 20 | 21 | 22 | 23 | IDL Files 24 | 25 | 26 | IDL Files 27 | 28 | 29 | 30 | 31 | Header Files 32 | 33 | 34 | Header Files 35 | 36 | 37 | 38 | 39 | Resource Files 40 | 41 | 42 | Source Files 43 | 44 | 45 | 46 | 47 | 48 | Source Files 49 | 50 | 51 | Source Files 52 | 53 | 54 | Source Files 55 | 56 | 57 | Source Files 58 | 59 | 60 | 61 | 62 | Resource Files 63 | 64 | 65 | 66 | 67 | 68 | -------------------------------------------------------------------------------- /Samples/Audio/sysvad/APO/DelayAPO/DelayAPODll.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // DelayAPODll.cpp -- Copyright (c) Microsoft Corporation. All rights reserved. 3 | // 4 | // Author: 5 | // 6 | // Description: 7 | // 8 | // DelayAPODll.cpp : Implementation of DLL Exports. 9 | 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | 16 | #include "resource.h" 17 | #include "DelayAPODll.h" 18 | #include 19 | 20 | #include 21 | 22 | //------------------------------------------------------------------------- 23 | // Array of APO_REG_PROPERTIES structures implemented in this module. 24 | // Each new APO implementation will be added to this array. 25 | // 26 | APO_REG_PROPERTIES const *gCoreAPOs[] = 27 | { 28 | &CDelayAPOMFX::sm_RegProperties.m_Properties, 29 | &CDelayAPOSFX::sm_RegProperties.m_Properties 30 | }; 31 | 32 | // {secret} 33 | class CDelayAPODllModule : public CAtlDllModuleT< CDelayAPODllModule > 34 | { 35 | public : 36 | DECLARE_LIBID(LIBID_DelayAPODlllib) 37 | DECLARE_REGISTRY_APPID_RESOURCEID(IDR_DELAYAPODLL, "{0A21D954-674A-4C09-806E-DB4FBE8F199C}") 38 | }; 39 | 40 | // {secret} 41 | CDelayAPODllModule _AtlModule; 42 | 43 | 44 | // {secret} 45 | extern "C" BOOL WINAPI DllMain(HINSTANCE /* hInstance */, DWORD dwReason, LPVOID lpReserved) 46 | { 47 | if (DLL_PROCESS_ATTACH == dwReason) 48 | { 49 | } 50 | // do necessary cleanup only if the DLL is being unloaded dynamically 51 | else if ((DLL_PROCESS_DETACH == dwReason) && (NULL == lpReserved)) 52 | { 53 | } 54 | 55 | return _AtlModule.DllMain(dwReason, lpReserved); 56 | } 57 | 58 | 59 | // {secret} 60 | STDAPI DllCanUnloadNow(void) 61 | { 62 | return _AtlModule.DllCanUnloadNow(); 63 | } 64 | 65 | 66 | // {secret} 67 | STDAPI DllGetClassObject(_In_ REFCLSID rclsid, _In_ REFIID riid, _Outptr_ LPVOID FAR* ppv) 68 | { 69 | return _AtlModule.DllGetClassObject(rclsid, riid, ppv); 70 | } 71 | -------------------------------------------------------------------------------- /Samples/Audio/sysvad/APO/DelayAPO/DelayAPODll.def: -------------------------------------------------------------------------------- 1 | 2 | EXPORTS 3 | DllCanUnloadNow PRIVATE 4 | DllGetClassObject PRIVATE -------------------------------------------------------------------------------- /Samples/Audio/sysvad/APO/DelayAPO/DelayAPODll.idl: -------------------------------------------------------------------------------- 1 | // 2 | // DelayAPODll.idl -- Copyright (c) Microsoft Corporation. All rights reserved. 3 | // 4 | // Author: 5 | // 6 | // Description: 7 | // 8 | // DelayAPODll.idl : Definition of COM interfaces and coclasses for the DLL. 9 | 10 | import "oaidl.idl"; 11 | import "ocidl.idl"; 12 | import "DelayAPOInterface.idl"; 13 | 14 | //------------------------------------------------------------------------- 15 | // DelayAPODlllib 16 | // 17 | [ 18 | uuid(8009693f-5bc2-42bb-86bf-82cc651f127f), 19 | version(1.0) 20 | ] 21 | library DelayAPODlllib 22 | { 23 | importlib("stdole2.tlb"); 24 | 25 | // for Delay APO - MFX 26 | [ 27 | uuid(b6c7032b-1f17-4cc6-bcdb-fd96deabc8a9) 28 | ] 29 | coclass DelayAPOMFX 30 | { 31 | interface IAudioProcessingObject; 32 | interface IAudioProcessingObjectRT; 33 | interface IAudioProcessingObjectConfiguration; 34 | interface IMMNotificationClient; 35 | interface IAudioSystemEffects; 36 | [default] interface IDelayAPOMFX; 37 | }; 38 | 39 | // for Delay APO - SFX 40 | [ 41 | uuid(77802b45-a5a0-455a-8204-3dba30eee7b4) 42 | ] 43 | coclass DelayAPOSFX 44 | { 45 | interface IAudioProcessingObject; 46 | interface IAudioProcessingObjectRT; 47 | interface IAudioProcessingObjectConfiguration; 48 | interface IMMNotificationClient; 49 | interface IAudioSystemEffects; 50 | [default] interface IDelayAPOSFX; 51 | }; 52 | 53 | 54 | } 55 | -------------------------------------------------------------------------------- /Samples/Audio/sysvad/APO/DelayAPO/DelayAPODll.rc: -------------------------------------------------------------------------------- 1 | #if 0 2 | Copyright (c) Microsoft Corporation. All Rights Reserved 3 | #endif 4 | 5 | #include "resource.h" 6 | #include "winres.h" 7 | #include 8 | #define VER_FILETYPE VFT_DLL 9 | #define VER_FILESUBTYPE VFT_UNKNOWN 10 | #define VER_FILEDESCRIPTION_STR "Delay APO" 11 | #define VER_INTERNALNAME_STR "DelayAPO" 12 | #define VER_ORIGINALFILENAME_STR "DelayAPO.Dll" 13 | #include 14 | 15 | IDR_DELAYAPODLL REGISTRY "DelayAPODll.rgs" 16 | IDR_DELAYAPOMFX REGISTRY "DelayAPOMFX.rgs" 17 | IDR_DELAYAPOSFX REGISTRY "DelayAPOSFX.rgs" 18 | 19 | // ICON 20 | IDI_EFFECT_ICON RCDATA "DelayAPO.png" 21 | 22 | #if 0 23 | 1 TYPELIB "DelayAPODll.tlb" 24 | #endif 25 | -------------------------------------------------------------------------------- /Samples/Audio/sysvad/APO/DelayAPO/DelayAPODll.rgs: -------------------------------------------------------------------------------- 1 | HKCR 2 | { 3 | NoRemove AppID 4 | { 5 | '%APPID%' = s 'DelayAPODll' 6 | 'DelayAPODll.DLL' 7 | { 8 | val AppID = s '%APPID%' 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Samples/Audio/sysvad/APO/DelayAPO/DelayAPOInterface.idl: -------------------------------------------------------------------------------- 1 | // 2 | // DelayAPOInterface.idl -- Copyright (c) Microsoft Corporation. All rights reserved. 3 | // 4 | // Description: 5 | // 6 | // The interface and type definitions for Delay APO functionality. 7 | // 8 | import "oaidl.idl"; 9 | import "ocidl.idl"; 10 | import "audioenginebaseapo.idl"; 11 | 12 | [ 13 | object, 14 | uuid(4c0531b4-f2ca-4eae-80cd-020266923bc1), 15 | pointer_default(unique) 16 | ] 17 | interface IDelayAPOMFX : IUnknown 18 | { 19 | }; 20 | 21 | [ 22 | object, 23 | uuid(6269b338-5162-4f14-a94d-8422ee93ec13), 24 | pointer_default(unique) 25 | ] 26 | interface IDelayAPOSFX : IUnknown 27 | { 28 | }; 29 | 30 | -------------------------------------------------------------------------------- /Samples/Audio/sysvad/APO/DelayAPO/DelayAPOMFX.rgs: -------------------------------------------------------------------------------- 1 | HKCR 2 | { 3 | NoRemove CLSID 4 | { 5 | ForceRemove {b6c7032b-1f17-4cc6-bcdb-fd96deabc8a9} = s 'DelayAPOMFX Class' 6 | { 7 | InprocServer32 = s '%MODULE%' 8 | { 9 | val ThreadingModel = s 'Both' 10 | } 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Samples/Audio/sysvad/APO/DelayAPO/DelayAPOSFX.rgs: -------------------------------------------------------------------------------- 1 | HKCR 2 | { 3 | NoRemove CLSID 4 | { 5 | ForceRemove {77802b45-a5a0-455a-8204-3dba30eee7b4} = s 'DelayAPOSFX Class' 6 | { 7 | InprocServer32 = s '%MODULE%' 8 | { 9 | val ThreadingModel = s 'Both' 10 | } 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Samples/Audio/sysvad/APO/DelayAPO/Resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Visual C++ generated include file. 3 | // Used by DelayAPODll.rc 4 | // 5 | #define IDS_PROJNAME 100 6 | #define IDR_DELAYAPODLL 101 7 | #define IDR_DELAYAPOMFX 110 8 | #define IDR_DELAYAPOSFX 111 9 | #define IDI_EFFECT_ICON 200 10 | 11 | // Next default values for new objects 12 | // 13 | #ifdef APSTUDIO_INVOKED 14 | #ifndef APSTUDIO_READONLY_SYMBOLS 15 | #define _APS_NEXT_RESOURCE_VALUE 201 16 | #define _APS_NEXT_COMMAND_VALUE 32768 17 | #define _APS_NEXT_CONTROL_VALUE 201 18 | #define _APS_NEXT_SYMED_VALUE 132 19 | #endif 20 | #endif 21 | -------------------------------------------------------------------------------- /Samples/Audio/sysvad/APO/DelayAPO/delayapo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/audio/084223378b19c4aa210db61a10917621aeae8828/Samples/Audio/sysvad/APO/DelayAPO/delayapo.png -------------------------------------------------------------------------------- /Samples/Audio/sysvad/APO/DelayAPO/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /Samples/Audio/sysvad/APO/Inc/CustomPropKeys.h: -------------------------------------------------------------------------------- 1 | // Microsoft Windows 2 | // Copyright (C) Microsoft Corporation. All rights reserved. 3 | // 4 | #pragma once 5 | 6 | // header files for imported files 7 | #include "propidl.h" 8 | 9 | #ifdef DEFINE_PROPERTYKEY 10 | #undef DEFINE_PROPERTYKEY 11 | #endif 12 | 13 | #ifdef INITGUID 14 | #define DEFINE_PROPERTYKEY(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8, pid) EXTERN_C const PROPERTYKEY name = { { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } }, pid } 15 | #else 16 | #define DEFINE_PROPERTYKEY(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8, pid) EXTERN_C const PROPERTYKEY name 17 | #endif // INITGUID 18 | 19 | // ---------------------------------------------------------------------- 20 | // 21 | // PKEY_Endpoint_Enable_Channel_Swap_SFX: When value is 0x00000001, Channel Swap local effect is enabled 22 | // {A44531EF-5377-4944-AE15-53789A9629C7},2 23 | // vartype = VT_UI4 24 | DEFINE_PROPERTYKEY(PKEY_Endpoint_Enable_Channel_Swap_SFX, 0xa44531ef, 0x5377, 0x4944, 0xae, 0x15, 0x53, 0x78, 0x9a, 0x96, 0x29, 0xc7, 2); 25 | 26 | // PKEY_Endpoint_Enable_Channel_Swap_MFX: When value is 0x00000001, Channel Swap global effect is enabled 27 | // {A44531EF-5377-4944-AE15-53789A9629C7},3 28 | // vartype = VT_UI4 29 | DEFINE_PROPERTYKEY(PKEY_Endpoint_Enable_Channel_Swap_MFX, 0xa44531ef, 0x5377, 0x4944, 0xae, 0x15, 0x53, 0x78, 0x9a, 0x96, 0x29, 0xc7, 3); 30 | 31 | // PKEY_Endpoint_Enable_Delay_SFX: When value is 0x00000001, Delay local effect is enabled 32 | // {A44531EF-5377-4944-AE15-53789A9629C7},4 33 | // vartype = VT_UI4 34 | DEFINE_PROPERTYKEY(PKEY_Endpoint_Enable_Delay_SFX, 0xa44531ef, 0x5377, 0x4944, 0xae, 0x15, 0x53, 0x78, 0x9a, 0x96, 0x29, 0xc7, 4); 35 | 36 | // PKEY_Endpoint_Enable_Delay_MFX: When value is 0x00000001, Delay global effect is enabled 37 | // {A44531EF-5377-4944-AE15-53789A9629C7},5 38 | // vartype = VT_UI4 39 | DEFINE_PROPERTYKEY(PKEY_Endpoint_Enable_Delay_MFX, 0xa44531ef, 0x5377, 0x4944, 0xae, 0x15, 0x53, 0x78, 0x9a, 0x96, 0x29, 0xc7, 5); 40 | -------------------------------------------------------------------------------- /Samples/Audio/sysvad/APO/KWSApo/KWSApo.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // KWSApo.cpp -- Copyright (c) Microsoft Corporation. All rights reserved. 3 | // 4 | // Description: 5 | // 6 | // Implementation of ProcessBuffer 7 | // 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | #include 15 | #include 16 | #include 17 | 18 | #include 19 | 20 | #include "KWSApo.h" 21 | 22 | #pragma AVRT_CODE_BEGIN 23 | void WriteSilence( 24 | _Out_writes_(u32FrameCount * u32SamplesPerFrame) 25 | FLOAT32 *pf32Frames, 26 | UINT32 u32FrameCount, 27 | UINT32 u32SamplesPerFrame ) 28 | { 29 | ZeroMemory(pf32Frames, sizeof(FLOAT32) * u32FrameCount * u32SamplesPerFrame); 30 | } 31 | #pragma AVRT_CODE_END 32 | 33 | #pragma AVRT_CODE_BEGIN 34 | void ProcessBuffer( 35 | FLOAT32 *pf32OutputFrames, 36 | const FLOAT32 *pf32InputFrames, 37 | UINT32 u32ValidFrameCount, 38 | INTERLEAVED_AUDIO_FORMAT_INFORMATION *formatInfo) 39 | { 40 | UINT32 totalChannelCount = (formatInfo->PrimaryChannelCount + formatInfo->InterleavedChannelCount); 41 | 42 | ASSERT_REALTIME(); 43 | ATLASSERT( IS_VALID_TYPED_READ_POINTER(pf32InputFrames) ); 44 | ATLASSERT( IS_VALID_TYPED_WRITE_POINTER(pf32OutputFrames) ); 45 | 46 | // loop through samples 47 | while (u32ValidFrameCount--) 48 | { 49 | // copy over the Primary channel data 50 | for (UINT32 i = formatInfo->PrimaryChannelStartPosition; i < (formatInfo->PrimaryChannelStartPosition + formatInfo->PrimaryChannelCount); i++) 51 | { 52 | *pf32OutputFrames = *(pf32InputFrames + i); 53 | pf32OutputFrames++; 54 | } 55 | 56 | // step forward to the next frame, ignoring interleaved data 57 | pf32InputFrames += (totalChannelCount); 58 | } 59 | } 60 | 61 | #pragma AVRT_CODE_END 62 | 63 | -------------------------------------------------------------------------------- /Samples/Audio/sysvad/APO/KWSApo/KWSApo.h: -------------------------------------------------------------------------------- 1 | // 2 | // KWSApo.h -- Copyright (c) Microsoft Corporation. All rights reserved. 3 | // 4 | // Description: 5 | // 6 | // Declaration of the CKWSApoMFX class. 7 | // 8 | 9 | #pragma once 10 | 11 | #include 12 | #include 13 | #include 14 | #include 15 | 16 | #include 17 | #include 18 | 19 | #include 20 | 21 | #include 22 | 23 | _Analysis_mode_(_Analysis_code_type_user_driver_) 24 | 25 | #pragma AVRT_VTABLES_BEGIN 26 | // KWS APO class - MFX 27 | class CKWSApoMFX : 28 | public CComObjectRootEx, 29 | public CComCoClass, 30 | public CBaseAudioProcessingObject, 31 | public IMMNotificationClient, 32 | public IAudioSystemEffects3, 33 | public IAudioProcessingObjectNotifications, 34 | public IKWSApoMFX 35 | { 36 | public: 37 | // constructor 38 | CKWSApoMFX() 39 | : CBaseAudioProcessingObject(sm_RegProperties) 40 | { 41 | } 42 | 43 | virtual ~CKWSApoMFX(); // destructor 44 | 45 | DECLARE_REGISTRY_RESOURCEID(IDR_KWSAPOMFX) 46 | 47 | BEGIN_COM_MAP(CKWSApoMFX) 48 | COM_INTERFACE_ENTRY(IKWSApoMFX) 49 | COM_INTERFACE_ENTRY(IAudioSystemEffects) 50 | COM_INTERFACE_ENTRY(IAudioSystemEffects2) 51 | COM_INTERFACE_ENTRY(IAudioSystemEffects3) 52 | COM_INTERFACE_ENTRY(IAudioProcessingObjectNotifications) 53 | COM_INTERFACE_ENTRY(IMMNotificationClient) 54 | COM_INTERFACE_ENTRY(IAudioProcessingObjectRT) 55 | COM_INTERFACE_ENTRY(IAudioProcessingObject) 56 | COM_INTERFACE_ENTRY(IAudioProcessingObjectConfiguration) 57 | END_COM_MAP() 58 | 59 | DECLARE_PROTECT_FINAL_CONSTRUCT() 60 | 61 | public: 62 | STDMETHOD_(void, APOProcess)(UINT32 u32NumInputConnections, 63 | APO_CONNECTION_PROPERTY** ppInputConnections, UINT32 u32NumOutputConnections, 64 | APO_CONNECTION_PROPERTY** ppOutputConnections); 65 | 66 | STDMETHOD(GetLatency)(HNSTIME* pTime); 67 | 68 | STDMETHOD(LockForProcess)(UINT32 u32NumInputConnections, 69 | APO_CONNECTION_DESCRIPTOR** ppInputConnections, 70 | UINT32 u32NumOutputConnections, APO_CONNECTION_DESCRIPTOR** ppOutputConnections); 71 | 72 | STDMETHOD(Initialize)(UINT32 cbDataSize, BYTE* pbyData); 73 | 74 | // IAudioSystemEffects2 75 | STDMETHOD(GetEffectsList)(_Outptr_result_buffer_maybenull_(*pcEffects) LPGUID *ppEffectsIds, _Out_ UINT *pcEffects, _In_ HANDLE Event); 76 | 77 | // IAudioProcessingObject 78 | STDMETHOD(IsInputFormatSupported)(IAudioMediaType *pOutputFormat, IAudioMediaType *pRequestedInputFormat, IAudioMediaType **ppSupportedInputFormat); 79 | STDMETHOD(IsOutputFormatSupported)(IAudioMediaType *pInputFormat, IAudioMediaType *pRequestedOutputFormat, IAudioMediaType **ppSupportedOutputFormat); 80 | STDMETHOD(GetInputChannelCount)(UINT32 *pu32ChannelCount); 81 | 82 | // IMMNotificationClient 83 | STDMETHODIMP OnDeviceStateChanged(LPCWSTR pwstrDeviceId, DWORD dwNewState) 84 | { 85 | UNREFERENCED_PARAMETER(pwstrDeviceId); 86 | UNREFERENCED_PARAMETER(dwNewState); 87 | return S_OK; 88 | } 89 | STDMETHODIMP OnDeviceAdded(LPCWSTR pwstrDeviceId) 90 | { 91 | UNREFERENCED_PARAMETER(pwstrDeviceId); 92 | return S_OK; 93 | } 94 | STDMETHODIMP OnDeviceRemoved(LPCWSTR pwstrDeviceId) 95 | { 96 | UNREFERENCED_PARAMETER(pwstrDeviceId); 97 | return S_OK; 98 | } 99 | STDMETHODIMP OnDefaultDeviceChanged(EDataFlow flow, ERole role, LPCWSTR pwstrDefaultDeviceId) 100 | { 101 | UNREFERENCED_PARAMETER(flow); 102 | UNREFERENCED_PARAMETER(role); 103 | UNREFERENCED_PARAMETER(pwstrDefaultDeviceId); 104 | return S_OK; 105 | } 106 | STDMETHODIMP OnPropertyValueChanged(LPCWSTR pwstrDeviceId, const PROPERTYKEY key) 107 | { 108 | UNREFERENCED_PARAMETER(pwstrDeviceId); 109 | UNREFERENCED_PARAMETER(key); 110 | return S_OK; 111 | } 112 | 113 | // IAudioSystemEffects3 114 | STDMETHOD(GetControllableSystemEffectsList)(_Outptr_result_buffer_maybenull_(*numEffects) AUDIO_SYSTEMEFFECT** effects, _Out_ UINT* numEffects, _In_opt_ HANDLE event) override; 115 | STDMETHODIMP SetAudioSystemEffectState(GUID, AUDIO_SYSTEMEFFECT_STATE) override {return S_OK;} 116 | 117 | // IAudioProcessingObjectNotifications 118 | STDMETHODIMP GetApoNotificationRegistrationInfo(_Out_writes_(*count) APO_NOTIFICATION_DESCRIPTOR** apoNotifications, _Out_ DWORD* count) override 119 | { 120 | UNREFERENCED_PARAMETER(apoNotifications); 121 | UNREFERENCED_PARAMETER(count); 122 | return S_OK; 123 | } 124 | 125 | STDMETHODIMP_(void) HandleNotification(_In_ APO_NOTIFICATION* apoNotification) override 126 | { 127 | UNREFERENCED_PARAMETER(apoNotification); 128 | } 129 | 130 | public: 131 | CComPtr m_spAPOSystemEffectsProperties; 132 | CComPtr m_spEnumerator; 133 | static const CRegAPOProperties<1> sm_RegProperties; // registration properties 134 | INTERLEAVED_AUDIO_FORMAT_INFORMATION m_FormatInfo; 135 | 136 | private: 137 | BOOL m_bRegisteredEndpointNotificationCallback = FALSE; 138 | wil::com_ptr_nothrow m_apoLoggingService; 139 | }; 140 | #pragma AVRT_VTABLES_END 141 | 142 | OBJECT_ENTRY_AUTO(__uuidof(KWSApoMFX), CKWSApoMFX) 143 | 144 | // 145 | // Declaration of the ProcessBuffer routine. 146 | // 147 | void ProcessBuffer( 148 | FLOAT32 *pf32OutputFrames, 149 | const FLOAT32 *pf32InputFrames, 150 | UINT32 u32ValidFrameCount, 151 | INTERLEAVED_AUDIO_FORMAT_INFORMATION *formatInfo); 152 | 153 | // 154 | // Convenience methods 155 | // 156 | 157 | void WriteSilence( 158 | _Out_writes_(u32FrameCount * u32SamplesPerFrame) 159 | FLOAT32 *pf32Frames, 160 | UINT32 u32FrameCount, 161 | UINT32 u32SamplesPerFrame ); 162 | 163 | -------------------------------------------------------------------------------- /Samples/Audio/sysvad/APO/KWSApo/KWSApo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/audio/084223378b19c4aa210db61a10917621aeae8828/Samples/Audio/sysvad/APO/KWSApo/KWSApo.png -------------------------------------------------------------------------------- /Samples/Audio/sysvad/APO/KWSApo/KWSApo.vcxproj.Filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx;* 6 | {5f4ff11d-7a0b-4f75-9d79-744ae028cc53} 7 | 8 | 9 | h;hpp;hxx;hm;inl;inc;xsd 10 | {bd103b81-05b2-440e-84e7-0723d7fe4109} 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 | {a57b6b78-38ae-4348-ade3-0200e81a3dd7} 15 | 16 | 17 | idl 18 | {c6318700-1bce-4812-92f1-160881e4c976} 19 | 20 | 21 | 22 | 23 | IDL Files 24 | 25 | 26 | IDL Files 27 | 28 | 29 | 30 | 31 | Header Files 32 | 33 | 34 | Header Files 35 | 36 | 37 | 38 | 39 | Resource Files 40 | 41 | 42 | Source Files 43 | 44 | 45 | 46 | 47 | 48 | Source Files 49 | 50 | 51 | Source Files 52 | 53 | 54 | Source Files 55 | 56 | 57 | 58 | 59 | Resource Files 60 | 61 | 62 | 63 | 64 | 65 | -------------------------------------------------------------------------------- /Samples/Audio/sysvad/APO/KWSApo/KWSApoDll.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // KWSApoDll.cpp -- Copyright (c) Microsoft Corporation. All rights reserved. 3 | // 4 | // Author: 5 | // 6 | // Description: 7 | // 8 | // KWSApoDll.cpp : Implementation of DLL Exports. 9 | 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | 16 | #include "resource.h" 17 | #include "KWSApoDll.h" 18 | #include 19 | 20 | #include 21 | 22 | 23 | //------------------------------------------------------------------------- 24 | // Array of APO_REG_PROPERTIES structures implemented in this module. 25 | // Each new APO implementation will be added to this array. 26 | // 27 | APO_REG_PROPERTIES const *gCoreAPOs[] = 28 | { 29 | &CKWSApoMFX::sm_RegProperties.m_Properties 30 | }; 31 | 32 | // {secret} 33 | class CKWSApoDllModule : public CAtlDllModuleT< CKWSApoDllModule > 34 | { 35 | public : 36 | DECLARE_LIBID(LIBID_KWSApoDlllib) 37 | DECLARE_REGISTRY_APPID_RESOURCEID(IDR_KWSAPODLL, "{0A21D954-674A-4C09-806E-DB4FBE8F199C}") 38 | 39 | }; 40 | 41 | // {secret} 42 | CKWSApoDllModule _AtlModule; 43 | 44 | 45 | // {secret} 46 | extern "C" BOOL WINAPI DllMain(HINSTANCE /* hInstance */, DWORD dwReason, LPVOID lpReserved) 47 | { 48 | if (DLL_PROCESS_ATTACH == dwReason) 49 | { 50 | } 51 | // do necessary cleanup only if the DLL is being unloaded dynamically 52 | else if ((DLL_PROCESS_DETACH == dwReason) && (NULL == lpReserved)) 53 | { 54 | } 55 | 56 | return _AtlModule.DllMain(dwReason, lpReserved); 57 | } 58 | 59 | 60 | // {secret} 61 | STDAPI DllCanUnloadNow(void) 62 | { 63 | return _AtlModule.DllCanUnloadNow(); 64 | } 65 | 66 | 67 | // {secret} 68 | STDAPI DllGetClassObject(_In_ REFCLSID rclsid, _In_ REFIID riid, _Outptr_ LPVOID FAR* ppv) 69 | { 70 | return _AtlModule.DllGetClassObject(rclsid, riid, ppv); 71 | } 72 | -------------------------------------------------------------------------------- /Samples/Audio/sysvad/APO/KWSApo/KWSApoDll.def: -------------------------------------------------------------------------------- 1 | 2 | EXPORTS 3 | DllCanUnloadNow PRIVATE 4 | DllGetClassObject PRIVATE -------------------------------------------------------------------------------- /Samples/Audio/sysvad/APO/KWSApo/KWSApoDll.idl: -------------------------------------------------------------------------------- 1 | // 2 | // KWSAPODll.idl -- Copyright (c) Microsoft Corporation. All rights reserved. 3 | // 4 | // Author: 5 | // 6 | // Description: 7 | // 8 | // KWSAPODll.idl : Definition of COM interfaces and coclasses for the DLL. 9 | 10 | import "oaidl.idl"; 11 | import "ocidl.idl"; 12 | import "KWSApoInterface.idl"; 13 | 14 | //------------------------------------------------------------------------- 15 | // KWSApoDlllib 16 | // 17 | [ 18 | uuid(E928E566-CBA7-4181-9B8B-8822E2BD28AB), 19 | version(1.0) 20 | ] 21 | library KWSApoDlllib 22 | { 23 | importlib("stdole2.tlb"); 24 | 25 | // for KWS APO - MFX 26 | [ 27 | uuid(9D89F614-F9D6-40DD-9F21-5E69FA3981ED) 28 | ] 29 | coclass KWSApoMFX 30 | { 31 | interface IAudioProcessingObject; 32 | interface IAudioProcessingObjectRT; 33 | interface IAudioProcessingObjectConfiguration; 34 | interface IMMNotificationClient; 35 | interface IAudioSystemEffects; 36 | [default] interface IKWSApoMFX; 37 | }; 38 | 39 | 40 | } 41 | -------------------------------------------------------------------------------- /Samples/Audio/sysvad/APO/KWSApo/KWSApoDll.rc: -------------------------------------------------------------------------------- 1 | #if 0 2 | Copyright (c) Microsoft Corporation. All Rights Reserved 3 | #endif 4 | 5 | #include "resource.h" 6 | #include "winres.h" 7 | #include 8 | #define VER_FILETYPE VFT_DLL 9 | #define VER_FILESUBTYPE VFT_UNKNOWN 10 | #define VER_FILEDESCRIPTION_STR "KWS APO" 11 | #define VER_INTERNALNAME_STR "KWSApo" 12 | #define VER_ORIGINALFILENAME_STR "KWSApo.Dll" 13 | #include 14 | 15 | IDR_KWSAPODLL REGISTRY "KWSApoDll.rgs" 16 | IDR_KWSAPOMFX REGISTRY "KWSApoMFX.rgs" 17 | 18 | // ICON 19 | IDI_EFFECT_ICON RCDATA "KWSApo.png" 20 | 21 | -------------------------------------------------------------------------------- /Samples/Audio/sysvad/APO/KWSApo/KWSApoDll.rgs: -------------------------------------------------------------------------------- 1 | HKCR 2 | { 3 | NoRemove AppID 4 | { 5 | '%APPID%' = s 'KWSApoDll' 6 | 'KWSApoDll.DLL' 7 | { 8 | val AppID = s '%APPID%' 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Samples/Audio/sysvad/APO/KWSApo/KWSApoInterface.idl: -------------------------------------------------------------------------------- 1 | // 2 | // KWSApoInterface.idl -- Copyright (c) Microsoft Corporation. All rights reserved. 3 | // 4 | // Description: 5 | // 6 | // The interface and type definitions for KWS APO functionality. 7 | // 8 | import "oaidl.idl"; 9 | import "ocidl.idl"; 10 | import "audioenginebaseapo.idl"; 11 | 12 | 13 | [ 14 | object, 15 | uuid(CF5C2AA7-68A8-4FD1-B86F-EBC008AD1B6F), 16 | pointer_default(unique) 17 | ] 18 | interface IKWSApoMFX : IUnknown 19 | { 20 | }; 21 | 22 | -------------------------------------------------------------------------------- /Samples/Audio/sysvad/APO/KWSApo/KWSApoMfx.rgs: -------------------------------------------------------------------------------- 1 | HKCR 2 | { 3 | NoRemove CLSID 4 | { 5 | ForceRemove {9D89F614-F9D6-40DD-9F21-5E69FA3981ED} = s 'KWSApoMFX Class' 6 | { 7 | InprocServer32 = s '%MODULE%' 8 | { 9 | val ThreadingModel = s 'Both' 10 | } 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Samples/Audio/sysvad/APO/KWSApo/Resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Visual C++ generated include file. 3 | // Used by KWSApoDll.rc 4 | // 5 | #define IDS_PROJNAME 100 6 | #define IDR_KWSAPODLL 101 7 | #define IDR_KWSAPOMFX 110 8 | #define IDI_EFFECT_ICON 200 9 | 10 | // Next default values for new objects 11 | // 12 | #ifdef APSTUDIO_INVOKED 13 | #ifndef APSTUDIO_READONLY_SYMBOLS 14 | #define _APS_NEXT_RESOURCE_VALUE 201 15 | #define _APS_NEXT_COMMAND_VALUE 32768 16 | #define _APS_NEXT_CONTROL_VALUE 201 17 | #define _APS_NEXT_SYMED_VALUE 132 18 | #endif 19 | #endif 20 | -------------------------------------------------------------------------------- /Samples/Audio/sysvad/APO/KWSApo/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /Samples/Audio/sysvad/APO/SwapAPO/Resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Visual C++ generated include file. 3 | // Used by SwapAPODll.rc 4 | // 5 | #define IDS_PROJNAME 100 6 | #define IDR_SWAPAPODLL 101 7 | #define IDR_SWAPAPOMFX 110 8 | #define IDR_SWAPAPOSFX 111 9 | #define IDI_EFFECT_ICON 200 10 | 11 | // Next default values for new objects 12 | // 13 | #ifdef APSTUDIO_INVOKED 14 | #ifndef APSTUDIO_READONLY_SYMBOLS 15 | #define _APS_NEXT_RESOURCE_VALUE 201 16 | #define _APS_NEXT_COMMAND_VALUE 32768 17 | #define _APS_NEXT_CONTROL_VALUE 201 18 | #define _APS_NEXT_SYMED_VALUE 132 19 | #endif 20 | #endif 21 | -------------------------------------------------------------------------------- /Samples/Audio/sysvad/APO/SwapAPO/SwapAPO.vcxproj.Filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx;* 6 | {296F0C2A-85AF-4624-97D4-6D3251998382} 7 | 8 | 9 | h;hpp;hxx;hm;inl;inc;xsd 10 | {655A91B5-15BB-4151-B3B5-8185B5FA1ABB} 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 | {A9DFA5D3-3035-416E-BBD8-8D0745973136} 15 | 16 | 17 | idl 18 | {6d66b527-51f6-480e-a9d1-813fa5081a43} 19 | 20 | 21 | 22 | 23 | IDL Files 24 | 25 | 26 | IDL Files 27 | 28 | 29 | 30 | 31 | Header Files 32 | 33 | 34 | Header Files 35 | 36 | 37 | 38 | 39 | Resource Files 40 | 41 | 42 | Source Files 43 | 44 | 45 | 46 | 47 | 48 | Source Files 49 | 50 | 51 | Source Files 52 | 53 | 54 | Source Files 55 | 56 | 57 | Source Files 58 | 59 | 60 | 61 | 62 | Resource Files 63 | 64 | 65 | 66 | 67 | 68 | -------------------------------------------------------------------------------- /Samples/Audio/sysvad/APO/SwapAPO/SwapAPODll.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // SwapAPODll.cpp -- Copyright (c) Microsoft Corporation. All rights reserved. 3 | // 4 | // Author: 5 | // 6 | // Description: 7 | // 8 | // SwapAPODll.cpp : Implementation of DLL Exports. 9 | 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | 16 | #include "resource.h" 17 | #include "SwapAPODll.h" 18 | #include 19 | 20 | #include 21 | 22 | //------------------------------------------------------------------------- 23 | // Array of APO_REG_PROPERTIES structures implemented in this module. 24 | // Each new APO implementation will be added to this array. 25 | // 26 | APO_REG_PROPERTIES const *gCoreAPOs[] = 27 | { 28 | &CSwapAPOMFX::sm_RegProperties.m_Properties, 29 | &CSwapAPOSFX::sm_RegProperties.m_Properties 30 | }; 31 | 32 | // {secret} 33 | class CSwapAPODllModule : public CAtlDllModuleT< CSwapAPODllModule > 34 | { 35 | public : 36 | DECLARE_LIBID(LIBID_SwapAPODlllib) 37 | DECLARE_REGISTRY_APPID_RESOURCEID(IDR_SWAPAPODLL, "{0A21D954-674A-4C09-806E-DB4FBE8F199C}") 38 | }; 39 | 40 | // {secret} 41 | CSwapAPODllModule _AtlModule; 42 | 43 | 44 | // {secret} 45 | extern "C" BOOL WINAPI DllMain(HINSTANCE /* hInstance */, DWORD dwReason, LPVOID lpReserved) 46 | { 47 | if (DLL_PROCESS_ATTACH == dwReason) 48 | { 49 | } 50 | // do necessary cleanup only if the DLL is being unloaded dynamically 51 | else if ((DLL_PROCESS_DETACH == dwReason) && (NULL == lpReserved)) 52 | { 53 | } 54 | 55 | return _AtlModule.DllMain(dwReason, lpReserved); 56 | } 57 | 58 | 59 | // {secret} 60 | __control_entrypoint(DllExport) 61 | STDAPI DllCanUnloadNow(void) 62 | { 63 | return _AtlModule.DllCanUnloadNow(); 64 | } 65 | 66 | 67 | // {secret} 68 | _Check_return_ 69 | STDAPI DllGetClassObject(_In_ REFCLSID rclsid, _In_ REFIID riid, _Outptr_ LPVOID FAR* ppv) 70 | { 71 | return _AtlModule.DllGetClassObject(rclsid, riid, ppv); 72 | } -------------------------------------------------------------------------------- /Samples/Audio/sysvad/APO/SwapAPO/SwapAPODll.def: -------------------------------------------------------------------------------- 1 | 2 | EXPORTS 3 | DllCanUnloadNow PRIVATE 4 | DllGetClassObject PRIVATE -------------------------------------------------------------------------------- /Samples/Audio/sysvad/APO/SwapAPO/SwapAPODll.idl: -------------------------------------------------------------------------------- 1 | // 2 | // SwapAPODll.idl -- Copyright (c) Microsoft Corporation. All rights reserved. 3 | // 4 | // Author: 5 | // 6 | // Description: 7 | // 8 | // SwapAPODll.idl : Definition of COM interfaces and coclasses for the DLL. 9 | 10 | import "oaidl.idl"; 11 | import "ocidl.idl"; 12 | import "SwapAPOInterface.idl"; 13 | 14 | //------------------------------------------------------------------------- 15 | // SwapAPODlllib 16 | // 17 | [ 18 | uuid(7092F0B2-D28D-4095-95A7-6C37A97432A2), 19 | version(1.0) 20 | ] 21 | library SwapAPODlllib 22 | { 23 | importlib("stdole2.tlb"); 24 | 25 | // for Swap APO - MFX 26 | [ 27 | uuid(06687E71-F043-403A-BF49-CB591BA6E103) 28 | ] 29 | coclass SwapAPOMFX 30 | { 31 | interface IAudioProcessingObject; 32 | interface IAudioProcessingObjectRT; 33 | interface IAudioProcessingObjectConfiguration; 34 | interface IMMNotificationClient; 35 | interface IAudioSystemEffects; 36 | [default] interface ISwapAPOMFX; 37 | }; 38 | 39 | // for Swap APO - SFX 40 | [ 41 | uuid(B48DEA3F-D962-425a-8D9A-9A5BB37A9904) 42 | ] 43 | coclass SwapAPOSFX 44 | { 45 | interface IAudioProcessingObject; 46 | interface IAudioProcessingObjectRT; 47 | interface IAudioProcessingObjectConfiguration; 48 | interface IMMNotificationClient; 49 | interface IAudioSystemEffects; 50 | [default] interface ISwapAPOSFX; 51 | }; 52 | 53 | 54 | } 55 | -------------------------------------------------------------------------------- /Samples/Audio/sysvad/APO/SwapAPO/SwapAPODll.rc: -------------------------------------------------------------------------------- 1 | #if 0 2 | Copyright (c) Microsoft Corporation. All Rights Reserved 3 | #endif 4 | 5 | #include "resource.h" 6 | #include "winres.h" 7 | #include 8 | #define VER_FILETYPE VFT_DLL 9 | #define VER_FILESUBTYPE VFT_UNKNOWN 10 | #define VER_FILEDESCRIPTION_STR "Swap APO" 11 | #define VER_INTERNALNAME_STR "SwapAPO" 12 | #define VER_ORIGINALFILENAME_STR "SwapAPO.Dll" 13 | #include 14 | 15 | IDR_SWAPAPODLL REGISTRY "SwapAPODll.rgs" 16 | IDR_SWAPAPOMFX REGISTRY "SwapAPOMFX.rgs" 17 | IDR_SWAPAPOSFX REGISTRY "SwapAPOSFX.rgs" 18 | 19 | // ICON 20 | IDI_EFFECT_ICON RCDATA "SwapAPO.png" 21 | 22 | #if 0 23 | 1 TYPELIB "SwapAPODll.tlb" 24 | #endif 25 | -------------------------------------------------------------------------------- /Samples/Audio/sysvad/APO/SwapAPO/SwapAPODll.rgs: -------------------------------------------------------------------------------- 1 | HKCR 2 | { 3 | NoRemove AppID 4 | { 5 | '%APPID%' = s 'SwapAPODll' 6 | 'SwapAPODll.DLL' 7 | { 8 | val AppID = s '%APPID%' 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Samples/Audio/sysvad/APO/SwapAPO/SwapAPOInterface.idl: -------------------------------------------------------------------------------- 1 | // 2 | // SwapAPO.idl -- Copyright (c) Microsoft Corporation. All rights reserved. 3 | // 4 | // Description: 5 | // 6 | // The interface and type definitions for Swap APO functionality. 7 | // 8 | import "oaidl.idl"; 9 | import "ocidl.idl"; 10 | import "audioenginebaseapo.idl"; 11 | 12 | // This is the SwapAPO interface. 13 | [ 14 | object, 15 | uuid(3865B91A-096E-4ACA-BF56-B17D49C77406), 16 | pointer_default(unique) 17 | ] 18 | interface ISwapAPOMFX : IUnknown 19 | { 20 | }; 21 | 22 | // This is the SwapAPO interface. 23 | [ 24 | object, 25 | uuid(658A4077-B277-4d14-97E1-0356044D8110), 26 | pointer_default(unique) 27 | ] 28 | interface ISwapAPOSFX : IUnknown 29 | { 30 | }; 31 | -------------------------------------------------------------------------------- /Samples/Audio/sysvad/APO/SwapAPO/SwapAPOMFX.rgs: -------------------------------------------------------------------------------- 1 | HKCR 2 | { 3 | NoRemove CLSID 4 | { 5 | ForceRemove {06687E71-F043-403A-BF49-CB591BA6E103} = s 'SwapAPOMFX Class' 6 | { 7 | InprocServer32 = s '%MODULE%' 8 | { 9 | val ThreadingModel = s 'Both' 10 | } 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Samples/Audio/sysvad/APO/SwapAPO/SwapAPOSFX.rgs: -------------------------------------------------------------------------------- 1 | HKCR 2 | { 3 | NoRemove CLSID 4 | { 5 | ForceRemove {B48DEA3F-D962-425a-8D9A-9A5BB37A9904} = s 'SwapAPOSFX Class' 6 | { 7 | InprocServer32 = s '%MODULE%' 8 | { 9 | val ThreadingModel = s 'Both' 10 | } 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Samples/Audio/sysvad/APO/SwapAPO/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /Samples/Audio/sysvad/APO/SwapAPO/swap.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Swap.cpp -- Copyright (c) Microsoft Corporation. All rights reserved. 3 | // 4 | // Description: 5 | // 6 | // Implementation of SwapSamples 7 | // 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | #include 15 | #include 16 | #include 17 | 18 | #include 19 | 20 | #include "SwapAPO.h" 21 | 22 | #pragma AVRT_CODE_BEGIN 23 | void WriteSilence( 24 | _Out_writes_(u32FrameCount * u32SamplesPerFrame) 25 | FLOAT32 *pf32Frames, 26 | UINT32 u32FrameCount, 27 | UINT32 u32SamplesPerFrame ) 28 | { 29 | ZeroMemory(pf32Frames, sizeof(FLOAT32) * u32FrameCount * u32SamplesPerFrame); 30 | } 31 | #pragma AVRT_CODE_END 32 | 33 | #pragma AVRT_CODE_BEGIN 34 | void CopyFrames( 35 | _Out_writes_(u32FrameCount * u32SamplesPerFrame) 36 | FLOAT32 *pf32OutFrames, 37 | _In_reads_(u32FrameCount * u32SamplesPerFrame) 38 | const FLOAT32 *pf32InFrames, 39 | UINT32 u32FrameCount, 40 | UINT32 u32SamplesPerFrame ) 41 | { 42 | CopyMemory(pf32OutFrames, pf32InFrames, sizeof(FLOAT32) * u32FrameCount * u32SamplesPerFrame); 43 | } 44 | #pragma AVRT_CODE_END 45 | 46 | #pragma AVRT_CODE_BEGIN 47 | void ProcessSwap( 48 | FLOAT32 *pf32OutputFrames, 49 | const FLOAT32 *pf32InputFrames, 50 | UINT32 u32ValidFrameCount, 51 | UINT32 u32SamplesPerFrame ) 52 | { 53 | UINT32 u32SampleIndex; 54 | FLOAT32 fSwap32; 55 | 56 | ASSERT_REALTIME(); 57 | ATLASSERT( IS_VALID_TYPED_READ_POINTER(pf32InputFrames) ); 58 | ATLASSERT( IS_VALID_TYPED_WRITE_POINTER(pf32OutputFrames) ); 59 | 60 | // loop through samples 61 | while (u32ValidFrameCount--) 62 | { 63 | for (u32SampleIndex=0; u32SampleIndex+1Size) 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 | -------------------------------------------------------------------------------- /Samples/Audio/sysvad/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 | POOL_FLAGS poolFlags, 42 | ULONG tag 43 | ) 44 | { 45 | PVOID result = ExAllocatePool2(poolFlags, iSize, tag); 46 | 47 | return result; 48 | } 49 | 50 | 51 | /***************************************************************************** 52 | * ::new() 53 | ***************************************************************************** 54 | * New function for creating objects with a specified allocation tag. 55 | */ 56 | PVOID operator new 57 | ( 58 | size_t iSize, 59 | POOL_FLAGS poolFlags 60 | ) 61 | { 62 | PVOID result = ExAllocatePool2(poolFlags, iSize, SYSVAD_POOLTAG); 63 | 64 | return result; 65 | } 66 | 67 | 68 | /***************************************************************************** 69 | * ::delete() 70 | ***************************************************************************** 71 | * Delete with tag function. 72 | */ 73 | void __cdecl operator delete 74 | ( 75 | PVOID pVoid, 76 | ULONG tag 77 | ) 78 | { 79 | if (pVoid) 80 | { 81 | ExFreePoolWithTag(pVoid, tag); 82 | } 83 | } 84 | 85 | 86 | /***************************************************************************** 87 | * ::delete() 88 | ***************************************************************************** 89 | * Sized Delete function. 90 | */ 91 | void __cdecl operator delete 92 | ( 93 | _Pre_maybenull_ __drv_freesMem(Mem) PVOID pVoid, 94 | _In_ size_t cbSize 95 | ) 96 | { 97 | UNREFERENCED_PARAMETER(cbSize); 98 | 99 | if (pVoid) 100 | { 101 | ExFreePoolWithTag(pVoid, SYSVAD_POOLTAG); 102 | } 103 | } 104 | 105 | 106 | /***************************************************************************** 107 | * ::delete() 108 | ***************************************************************************** 109 | * Sized Array Delete function. 110 | */ 111 | void __cdecl operator delete[] 112 | ( 113 | _Pre_maybenull_ __drv_freesMem(Mem) PVOID pVoid, 114 | _In_ size_t cbSize 115 | ) 116 | { 117 | UNREFERENCED_PARAMETER(cbSize); 118 | 119 | if (pVoid) 120 | { 121 | ExFreePoolWithTag(pVoid, SYSVAD_POOLTAG); 122 | } 123 | } 124 | 125 | 126 | /***************************************************************************** 127 | * ::delete() 128 | ***************************************************************************** 129 | * Array Delete function. 130 | */ 131 | void __cdecl operator delete[] 132 | ( 133 | _Pre_maybenull_ __drv_freesMem(Mem) PVOID pVoid 134 | ) 135 | { 136 | if (pVoid) 137 | { 138 | ExFreePoolWithTag(pVoid, SYSVAD_POOLTAG); 139 | } 140 | } 141 | #endif//_NEW_DELETE_OPERATORS_ 142 | -------------------------------------------------------------------------------- /Samples/Audio/sysvad/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 | POOL_FLAGS poolFlags, 33 | ULONG tag 34 | ); 35 | 36 | 37 | /***************************************************************************** 38 | * ::new() 39 | ***************************************************************************** 40 | * New function for creating objects with a specified pool type. 41 | */ 42 | PVOID operator new 43 | ( 44 | size_t iSize, 45 | POOL_FLAGS poolFlags 46 | ); 47 | 48 | 49 | /***************************************************************************** 50 | * ::delete() 51 | ***************************************************************************** 52 | * Delete with tag function. 53 | */ 54 | void __cdecl operator delete 55 | ( 56 | PVOID pVoid, 57 | ULONG tag 58 | ); 59 | 60 | 61 | /***************************************************************************** 62 | * ::delete() 63 | ***************************************************************************** 64 | * Sized Delete function. 65 | */ 66 | void __cdecl operator delete 67 | ( 68 | _Pre_maybenull_ __drv_freesMem(Mem) PVOID pVoid, 69 | _In_ size_t cbSize 70 | ); 71 | 72 | 73 | /***************************************************************************** 74 | * ::delete() 75 | ***************************************************************************** 76 | * Basic Delete function. 77 | */ 78 | void __cdecl operator delete 79 | ( 80 | PVOID pVoid 81 | ); 82 | 83 | 84 | /***************************************************************************** 85 | * ::delete() 86 | ***************************************************************************** 87 | * Sized Array Delete function. 88 | */ 89 | void __cdecl operator delete[] 90 | ( 91 | _Pre_maybenull_ __drv_freesMem(Mem) PVOID pVoid, 92 | _In_ size_t cbSize 93 | ); 94 | 95 | 96 | /***************************************************************************** 97 | * ::delete() 98 | ***************************************************************************** 99 | * Array Delete function. 100 | */ 101 | void __cdecl operator delete[] 102 | ( 103 | _Pre_maybenull_ __drv_freesMem(Mem) PVOID pVoid 104 | ); 105 | 106 | #endif//_NEW_DELETE_OPERATORS_ 107 | 108 | -------------------------------------------------------------------------------- /Samples/Audio/sysvad/EndpointsCommon/a2dphpminipairs.h: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) Microsoft Corporation All Rights Reserved 4 | 5 | Module Name: 6 | 7 | a2dphpminipairs.h 8 | 9 | Abstract: 10 | 11 | A2DP Sideband Audio endpoint filter definitions. 12 | 13 | --*/ 14 | 15 | #ifndef _SYSVAD_A2DPHPMINIPAIRS_H_ 16 | #define _SYSVAD_A2DPHPMINIPAIRS_H_ 17 | 18 | #include "a2dphpspeakertopo.h" 19 | #include "a2dphpspeakertoptable.h" 20 | #include "a2dphpspeakerwavtable.h" 21 | 22 | NTSTATUS 23 | CreateMiniportWaveRTSYSVAD 24 | ( 25 | _Out_ PUNKNOWN *, 26 | _In_ REFCLSID, 27 | _In_opt_ PUNKNOWN, 28 | _In_ POOL_FLAGS, 29 | _In_ PUNKNOWN, 30 | _In_opt_ PVOID, 31 | _In_ PENDPOINT_MINIPAIR 32 | ); 33 | 34 | NTSTATUS 35 | CreateMiniportTopologySYSVAD 36 | ( 37 | _Out_ PUNKNOWN *, 38 | _In_ REFCLSID, 39 | _In_opt_ PUNKNOWN, 40 | _In_ POOL_FLAGS, 41 | _In_ PUNKNOWN, 42 | _In_opt_ PVOID, 43 | _In_ PENDPOINT_MINIPAIR 44 | ); 45 | 46 | /* 47 | * A2DP Headphone speaker miniports. 48 | * 49 | ********************************************************************************************** 50 | * Topology/Wave bridge connection for A2DP Headphone Speaker * 51 | * * 52 | * +---------------------------------+ +-------+ * 53 | * | Wave | | Topo | * 54 | * | | | | * 55 | * | +---------------------+ | | | * 56 | * | | | | | | * 57 | * System --->|0-----|1 HW Audio Engine 3|---2|---> Loopback | | * 58 | * | | Node | | | | * 59 | * Offload --->|1-----|2 0|---3|===============>|0---->1|---> Line Out * 60 | * | +---------------------+ | | | * 61 | * | | | | * 62 | * +---------------------------------+ +-------+ * 63 | * * 64 | **********************************************************************************************/ 65 | 66 | static 67 | PHYSICALCONNECTIONTABLE A2dpHpSpeakerTopologyPhysicalConnections[] = 68 | { 69 | { 70 | KSPIN_TOPO_WAVEOUT_SOURCE, // TopologyIn 71 | KSPIN_WAVE_RENDER_SOURCE, // WaveOut 72 | CONNECTIONTYPE_WAVE_OUTPUT 73 | } 74 | }; 75 | 76 | // A subdevice is created for each HFP device using the reference string in the form of: 77 | // - 78 | // where Base_Reference_String is one of the following template names 79 | #define A2DPHP_SPEAKER_TOPO_NAME L"TopologyA2dpHpSpeaker" 80 | #define A2DPHP_SPEAKER_WAVE_NAME L"WaveA2dpHpSpeaker" 81 | // And Hashcode is 8-character long hexadecimal value 82 | 83 | // A reference string max length is being set to a value to accommodate them both 84 | #define A2DPHP_INTERFACE_REFSTRING_MAX_LENGTH 100 85 | 86 | static 87 | ENDPOINT_MINIPAIR A2dpHpSpeakerMiniports = 88 | { 89 | eA2dpHpSpeakerDevice, 90 | NULL, // Will be generated based on A2DPHP_SPEAKER_TOPO_NAME and made unique for each side band interface 91 | A2DPHP_SPEAKER_TOPO_NAME, // template name matches with KSNAME_TopologyBthHfpSpeaker in the inf's [Strings] section 92 | CreateMiniportTopologySYSVAD, 93 | &A2dpHpSpeakerTopoMiniportFilterDescriptor, 94 | 0, NULL, // Interface properties 95 | NULL, // Will be generated based on A2DPHP_SPEAKER_WAVE_NAME and made unique for each side band interface 96 | A2DPHP_SPEAKER_WAVE_NAME, // template name matches with KSNAME_WaveBthHfpSpeaker in the inf's [Strings] section 97 | CreateMiniportWaveRTSYSVAD, 98 | &A2dpHpSpeakerWaveMiniportFilterDescriptor, 99 | 0, NULL, // Interface properties 100 | 1, 101 | A2dpHpSpeakerPinDeviceFormatsAndModes, 102 | SIZEOF_ARRAY(A2dpHpSpeakerPinDeviceFormatsAndModes), 103 | A2dpHpSpeakerTopologyPhysicalConnections, 104 | SIZEOF_ARRAY(A2dpHpSpeakerTopologyPhysicalConnections), 105 | ENDPOINT_OFFLOAD_SUPPORTED 106 | }; 107 | 108 | //============================================================================= 109 | // 110 | // Render miniport pairs. 111 | // 112 | static 113 | PENDPOINT_MINIPAIR g_A2dpHpRenderEndpoints[] = 114 | { 115 | &A2dpHpSpeakerMiniports 116 | }; 117 | 118 | #define g_cA2dpHpRenderEndpoints (SIZEOF_ARRAY(g_A2dpHpRenderEndpoints)) 119 | 120 | // If the count of Render endpoints changes, update formula below 121 | C_ASSERT(g_cA2dpHpRenderEndpoints == 1); 122 | 123 | //============================================================================= 124 | // 125 | // Total miniports = # endpoints (topology + wave) 126 | // 127 | // 128 | // Allow 5 A2DP Headphone Endpoints. 129 | // 130 | #define MAX_A2DPHS_DEVICES (5) 131 | #define g_MaxA2dpHpMiniports ((g_cA2dpHpRenderEndpoints) * 2 * MAX_A2DPHS_DEVICES) 132 | 133 | // g_MaxA2dpHpMiniports is used when calculating the MaxObjects inside AddDevice. 134 | C_ASSERT(g_MaxA2dpHpMiniports == 10); 135 | 136 | #endif // _SYSVAD_A2DPHPMINIPAIRS_H_ 137 | 138 | -------------------------------------------------------------------------------- /Samples/Audio/sysvad/EndpointsCommon/a2dphpminwavert.cpp: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) Microsoft Corporation All Rights Reserved 4 | 5 | Module Name: 6 | 7 | a2dphpminwavert.cpp 8 | 9 | Abstract: 10 | 11 | Implementation of wavert miniport. 12 | 13 | --*/ 14 | #ifdef SYSVAD_A2DP_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_A2dpHpAudioEffectsDiscoveryEffectsList 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_A2dpHpAudioEffectsDiscoveryEffectsList]")); 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_A2dpHpWaveFilter 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 | } 181 | else if (IsEqualGUIDAligned(*PropertyRequest->PropertyItem->Set, KSPROPSETID_AudioEffectsDiscovery)) 182 | { 183 | switch(PropertyRequest->PropertyItem->Id) 184 | { 185 | case KSPROPERTY_AUDIOEFFECTSDISCOVERY_EFFECTSLIST: 186 | ntStatus = waveRt->PropertyHandler_A2dpHpAudioEffectsDiscoveryEffectsList(PropertyRequest); 187 | break; 188 | } 189 | } 190 | 191 | waveRt->Release(); 192 | 193 | return ntStatus; 194 | } // PropertyHandler_A2dpHpWaveFilter 195 | 196 | #pragma code_seg("PAGE") 197 | #endif // SYSVAD_A2DP_SIDEBAND 198 | 199 | 200 | 201 | -------------------------------------------------------------------------------- /Samples/Audio/sysvad/EndpointsCommon/a2dphpspeakertopo.cpp: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) Microsoft Corporation All Rights Reserved 4 | 5 | Module Name: 6 | 7 | a2dphpspeakertopo.cpp 8 | 9 | Abstract: 10 | 11 | Implementation of topology miniport for the A2DP Headphone speaker (external). 12 | 13 | --*/ 14 | #ifdef SYSVAD_A2DP_SIDEBAND 15 | 16 | #pragma warning (disable : 4127) 17 | 18 | #include 19 | #include "simple.h" 20 | #include "mintopo.h" 21 | #include "a2dphptopo.h" 22 | #include "a2dphpspeakertopo.h" 23 | #include "a2dphpspeakertoptable.h" 24 | 25 | //============================================================================= 26 | #pragma code_seg("PAGE") 27 | NTSTATUS 28 | PropertyHandler_A2dpHpSpeakerTopoFilter 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_A2dpHpSpeakerTopoFilter]")); 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 | if (IsEqualGUIDAligned(*PropertyRequest->PropertyItem->Set, KSPROPSETID_Jack)) 60 | { 61 | switch(PropertyRequest->PropertyItem->Id) 62 | { 63 | case KSPROPERTY_JACK_DESCRIPTION: 64 | ntStatus = PropertyHandler_A2dpHpJackDescription( 65 | PropertyRequest, 66 | ARRAYSIZE(A2dpHpSpeakerJackDescriptions), 67 | A2dpHpSpeakerJackDescriptions); 68 | break; 69 | 70 | case KSPROPERTY_JACK_DESCRIPTION2: 71 | ntStatus = PropertyHandler_A2dpHpJackDescription2( 72 | PropertyRequest, 73 | ARRAYSIZE(A2dpHpSpeakerJackDescriptions), 74 | A2dpHpSpeakerJackDescriptions); 75 | break; 76 | 77 | case KSPROPERTY_JACK_CONTAINERID: 78 | ntStatus = PropertyHandler_A2dpHpJackContainerId( 79 | PropertyRequest, 80 | ARRAYSIZE(A2dpHpSpeakerJackDescriptions), 81 | A2dpHpSpeakerJackDescriptions); 82 | break; 83 | } 84 | } 85 | else if (IsEqualGUIDAligned(*PropertyRequest->PropertyItem->Set, KSPROPSETID_BtAudio)) 86 | { 87 | switch (PropertyRequest->PropertyItem->Id) 88 | { 89 | case KSPROPERTY_ONESHOT_RECONNECT: 90 | ntStatus = PropertyHandler_A2dpHpOneShotReconnect(PropertyRequest); 91 | break; 92 | 93 | case KSPROPERTY_ONESHOT_DISCONNECT: 94 | ntStatus = PropertyHandler_A2dpHpOneShotDisconnect(PropertyRequest); 95 | break; 96 | } 97 | } 98 | 99 | return ntStatus; 100 | } // PropertyHandler_A2dpHpSpeakerTopoFilter 101 | 102 | //============================================================================= 103 | #pragma code_seg() 104 | NTSTATUS 105 | PropertyHandler_A2dpHpSpeakerTopoFilterEvent 106 | ( 107 | _In_ PPCEVENT_REQUEST EventRequest 108 | ) 109 | { 110 | ASSERT(EventRequest); 111 | 112 | DPF_ENTER(("[PropertyHandler_A2dpHpSpeakerTopoFilterEvent]")); 113 | 114 | return PropertyHandler_A2dpHpTopoNodeEvent(EventRequest); 115 | } 116 | 117 | #pragma code_seg() 118 | #endif // SYSVAD_A2DP_SIDEBAND 119 | 120 | 121 | -------------------------------------------------------------------------------- /Samples/Audio/sysvad/EndpointsCommon/a2dphpspeakertopo.h: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) Microsoft Corporation All Rights Reserved 4 | 5 | Module Name: 6 | 7 | a2dphpspeakertopo.h 8 | 9 | Abstract: 10 | 11 | Declaration of topology miniport for the A2DP Headphone speaker (external). 12 | 13 | --*/ 14 | 15 | #ifndef _SYSVAD_A2DPHPSPEAKERTOPO_H_ 16 | #define _SYSVAD_A2DPHPSPEAKERTOPO_H_ 17 | 18 | // Function declarations. 19 | NTSTATUS 20 | PropertyHandler_A2dpHpSpeakerTopoFilter( 21 | _In_ PPCPROPERTY_REQUEST PropertyRequest 22 | ); 23 | 24 | NTSTATUS 25 | PropertyHandler_A2dpHpSpeakerTopoFilterEvent( 26 | _In_ PPCEVENT_REQUEST EventRequest 27 | ); 28 | 29 | #endif // _SYSVAD_A2DPHPSPEAKERTOPO_H_ 30 | 31 | -------------------------------------------------------------------------------- /Samples/Audio/sysvad/EndpointsCommon/a2dphptopo.h: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) Microsoft Corporation All Rights Reserved 4 | 5 | Module Name: 6 | 7 | a2dphptopo.h 8 | 9 | Abstract: 10 | 11 | Declaration of topology miniport for the mic (external: A2DP headphone). 12 | 13 | --*/ 14 | 15 | #ifndef _SYSVAD_A2DPHPTOPO_H_ 16 | #define _SYSVAD_A2DPHPTOPO_H_ 17 | 18 | NTSTATUS 19 | PropertyHandler_A2dpHpVolumeLevel_BasicSupport( 20 | _In_ PPCPROPERTY_REQUEST PropertyRequest 21 | ); 22 | 23 | NTSTATUS 24 | PropertyHandler_A2dpHpMicVolumeLevel( 25 | _In_ PPCPROPERTY_REQUEST PropertyRequest 26 | ); 27 | 28 | NTSTATUS 29 | PropertyHandler_A2dpHpMute_BasicSupport( 30 | _In_ PPCPROPERTY_REQUEST PropertyRequest 31 | ); 32 | 33 | NTSTATUS 34 | PropertyHandler_A2dpHpMicMute( 35 | _In_ PPCPROPERTY_REQUEST PropertyRequest 36 | ); 37 | 38 | NTSTATUS 39 | PropertyHandler_A2dpHpJackDescription( 40 | _In_ PPCPROPERTY_REQUEST PropertyRequest, 41 | _In_ ULONG cJackDescriptions, 42 | _In_reads_(cJackDescriptions) PKSJACK_DESCRIPTION * JackDescriptions 43 | ); 44 | 45 | NTSTATUS 46 | PropertyHandler_A2dpHpJackDescription2( 47 | _In_ PPCPROPERTY_REQUEST PropertyRequest, 48 | _In_ ULONG cJackDescriptions, 49 | _In_reads_(cJackDescriptions) PKSJACK_DESCRIPTION * JackDescriptions 50 | ); 51 | 52 | NTSTATUS 53 | PropertyHandler_A2dpHpJackContainerId( 54 | _In_ PPCPROPERTY_REQUEST PropertyRequest, 55 | _In_ ULONG cJackDescriptions, 56 | _In_reads_(cJackDescriptions) PKSJACK_DESCRIPTION * JackDescriptions 57 | ); 58 | 59 | NTSTATUS 60 | PropertyHandler_A2dpHpTopoNodeEvent( 61 | _In_ PPCEVENT_REQUEST EventRequest 62 | ); 63 | 64 | NTSTATUS 65 | PropertyHandler_A2dpHpOneShotReconnect( 66 | _In_ PPCPROPERTY_REQUEST PropertyRequest 67 | ); 68 | 69 | NTSTATUS 70 | PropertyHandler_A2dpHpOneShotDisconnect( 71 | _In_ PPCPROPERTY_REQUEST PropertyRequest 72 | ); 73 | 74 | #endif // _SYSVAD_A2DPHPTOPO_H_ 75 | 76 | -------------------------------------------------------------------------------- /Samples/Audio/sysvad/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 | -------------------------------------------------------------------------------- /Samples/Audio/sysvad/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 | -------------------------------------------------------------------------------- /Samples/Audio/sysvad/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 | -------------------------------------------------------------------------------- /Samples/Audio/sysvad/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 | -------------------------------------------------------------------------------- /Samples/Audio/sysvad/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 | #pragma code_seg() 30 | class CMicArrayMiniportTopology : 31 | public CMiniportTopologySYSVAD, 32 | public IMiniportTopology, 33 | public CUnknown 34 | { 35 | public: 36 | DECLARE_STD_UNKNOWN(); 37 | CMicArrayMiniportTopology 38 | ( 39 | _In_opt_ PUNKNOWN UnknownOuter, 40 | _In_ PCFILTER_DESCRIPTOR *FilterDesc, 41 | _In_ USHORT DeviceMaxChannels, 42 | _In_ eDeviceType DeviceType 43 | ) 44 | : CUnknown(UnknownOuter), 45 | CMiniportTopologySYSVAD(FilterDesc, DeviceMaxChannels), 46 | m_DeviceType(DeviceType) 47 | { 48 | ASSERT(m_DeviceType == eMicArrayDevice1 || 49 | m_DeviceType == eMicArrayDevice2 || 50 | m_DeviceType == eMicArrayDevice3); 51 | } 52 | 53 | ~CMicArrayMiniportTopology(); 54 | 55 | IMP_IMiniportTopology; 56 | 57 | NTSTATUS PropertyHandlerMicArrayGeometry 58 | ( 59 | _In_ PPCPROPERTY_REQUEST PropertyRequest 60 | ); 61 | 62 | NTSTATUS PropertyHandlerMicProperties 63 | ( 64 | _In_ PPCPROPERTY_REQUEST PropertyRequest 65 | ); 66 | 67 | NTSTATUS PropertyHandlerJackDescription 68 | ( 69 | _In_ PPCPROPERTY_REQUEST PropertyRequest 70 | ); 71 | 72 | NTSTATUS PropertyHandlerJackDescription2 73 | ( 74 | _In_ PPCPROPERTY_REQUEST PropertyRequest 75 | ); 76 | 77 | protected: 78 | eDeviceType m_DeviceType; 79 | 80 | protected: 81 | bool IsFront() 82 | { 83 | return m_DeviceType == eMicArrayDevice1; 84 | } 85 | 86 | bool IsBack() 87 | { 88 | return m_DeviceType == eMicArrayDevice2; 89 | } 90 | 91 | bool IsCombined() 92 | { 93 | return m_DeviceType == eMicArrayDevice3; 94 | } 95 | }; 96 | 97 | typedef CMicArrayMiniportTopology *PCMicArrayMiniportTopology; 98 | 99 | 100 | NTSTATUS 101 | CreateMicArrayMiniportTopology( 102 | _Out_ PUNKNOWN * Unknown, 103 | _In_ REFCLSID, 104 | _In_opt_ PUNKNOWN UnknownOuter, 105 | _In_ POOL_FLAGS PoolFlags, 106 | _In_ PUNKNOWN UnknownAdapter, 107 | _In_opt_ PVOID DeviceContext, 108 | _In_ PENDPOINT_MINIPAIR MiniportPair 109 | ); 110 | 111 | NTSTATUS PropertyHandler_MicArrayTopoFilter(_In_ PPCPROPERTY_REQUEST PropertyRequest); 112 | NTSTATUS PropertyHandler_MicArrayTopology(_In_ PPCPROPERTY_REQUEST PropertyRequest); 113 | 114 | #endif // _SYSVAD_MICARRAYTOPO_H_ 115 | 116 | -------------------------------------------------------------------------------- /Samples/Audio/sysvad/EndpointsCommon/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /Samples/Audio/sysvad/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 | // loopback top-point attribute definitions. 183 | static 184 | KSATTRIBUTE PinLoopbackTapPointAttribute = 185 | { 186 | sizeof(KSATTRIBUTE), 187 | 0, 188 | STATICGUIDOF(KSATTRIBUTEID_AUDIOLOOPBACK_TAPPOINT), 189 | }; 190 | 191 | static 192 | PKSATTRIBUTE PinLoopbackDataRangeAttributes[] = 193 | { 194 | &PinLoopbackTapPointAttribute, 195 | }; 196 | 197 | static 198 | KSATTRIBUTE_LIST PinLoopbackDataRangeAttributeList = 199 | { 200 | ARRAYSIZE(PinLoopbackDataRangeAttributes), 201 | PinLoopbackDataRangeAttributes, 202 | }; 203 | 204 | #endif // _SYSVAD_SIMPLE_H_ 205 | 206 | -------------------------------------------------------------------------------- /Samples/Audio/sysvad/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 | -------------------------------------------------------------------------------- /Samples/Audio/sysvad/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 | &KSPROPSETID_AudioResourceManagement, 137 | KSPROPERTY_AUDIORESOURCEMANAGEMENT_RESOURCEGROUP, 138 | KSPROPERTY_TYPE_SET, 139 | PropertyHandler_SpeakerHpTopoFilter 140 | } 141 | }; 142 | 143 | static PCEVENT_ITEM SpeakerHpJackInfoChangeEvent[] = 144 | { 145 | { 146 | &KSEVENTSETID_PinCapsChange, // Something changed 147 | KSEVENT_PINCAPS_JACKINFOCHANGE, // Jack Info Changes 148 | KSEVENT_TYPE_ENABLE | KSEVENT_TYPE_BASICSUPPORT, 149 | CMiniportTopology_EventHandler_JackState 150 | } 151 | }; 152 | 153 | DEFINE_PCAUTOMATION_TABLE_PROP_EVENT(AutomationSpeakerHpTopoFilter, PropertiesSpeakerHpTopoFilter, SpeakerHpJackInfoChangeEvent); 154 | 155 | //============================================================================= 156 | static 157 | PCFILTER_DESCRIPTOR SpeakerHpTopoMiniportFilterDescriptor = 158 | { 159 | 0, // Version 160 | &AutomationSpeakerHpTopoFilter, // AutomationTable 161 | sizeof(PCPIN_DESCRIPTOR), // PinSize 162 | SIZEOF_ARRAY(SpeakerHpTopoMiniportPins), // PinCount 163 | SpeakerHpTopoMiniportPins, // Pins 164 | sizeof(PCNODE_DESCRIPTOR), // NodeSize 165 | 0, // NodeCount 166 | NULL, // Nodes 167 | SIZEOF_ARRAY(SpeakerHpTopoMiniportConnections), // ConnectionCount 168 | SpeakerHpTopoMiniportConnections, // Connections 169 | 0, // CategoryCount 170 | NULL // Categories 171 | }; 172 | 173 | #endif // _SYSVAD_SPEAKERHPTOPTABLE_H_ 174 | 175 | 176 | -------------------------------------------------------------------------------- /Samples/Audio/sysvad/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 | // PropertyRequest 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 | else if (PropertyRequest->PropertyItem->Id == KSPROPERTY_JACK_DESCRIPTION3) 79 | { 80 | ntStatus = pMiniport->PropertyHandlerJackDescription3( 81 | PropertyRequest, 82 | ARRAYSIZE(SpeakerJackDescriptions), 83 | SpeakerJackDescriptions, 84 | 42 // jack config id 85 | ); 86 | } 87 | } 88 | else if (IsEqualGUIDAligned(*PropertyRequest->PropertyItem->Set, KSPROPSETID_AudioResourceManagement)) 89 | { 90 | if (PropertyRequest->PropertyItem->Id == KSPROPERTY_AUDIORESOURCEMANAGEMENT_RESOURCEGROUP) 91 | { 92 | ntStatus = pMiniport->PropertyHandlerAudioResourceGroup(PropertyRequest); 93 | } 94 | } 95 | else if (IsEqualGUIDAligned(*PropertyRequest->PropertyItem->Set, KSPROPSETID_AudioPosture)) 96 | { 97 | if (PropertyRequest->PropertyItem->Id == KSPROPERTY_AUDIOPOSTURE_ORIENTATION) 98 | { 99 | ntStatus = pMiniport->PropertyHandlerAudioPostureOrientation( 100 | PropertyRequest, 101 | ARRAYSIZE(SpeakerAudioPostureInfoPointers), 102 | SpeakerAudioPostureInfoPointers 103 | ); 104 | } 105 | } 106 | 107 | return ntStatus; 108 | } // PropertyHandler_SpeakerTopoFilter 109 | 110 | #pragma code_seg() 111 | 112 | -------------------------------------------------------------------------------- /Samples/Audio/sysvad/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 | -------------------------------------------------------------------------------- /Samples/Audio/sysvad/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 | static SYSVAD_AUDIOPOSTURE_INFO SpeakerAudioPostureInfo = { TRUE }; 108 | 109 | // Only support property for the physical bridge pin. 110 | static 111 | PSYSVAD_AUDIOPOSTURE_INFO SpeakerAudioPostureInfoPointers[] 112 | { 113 | NULL, 114 | &SpeakerAudioPostureInfo 115 | }; 116 | 117 | //============================================================================= 118 | static 119 | PCCONNECTION_DESCRIPTOR SpeakerTopoMiniportConnections[] = 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 PropertiesSpeakerTopoFilter[] = 129 | { 130 | { 131 | &KSPROPSETID_Jack, 132 | KSPROPERTY_JACK_DESCRIPTION, 133 | KSPROPERTY_TYPE_GET | 134 | KSPROPERTY_TYPE_BASICSUPPORT, 135 | PropertyHandler_SpeakerTopoFilter 136 | }, 137 | { 138 | &KSPROPSETID_Jack, 139 | KSPROPERTY_JACK_DESCRIPTION2, 140 | KSPROPERTY_TYPE_GET | 141 | KSPROPERTY_TYPE_BASICSUPPORT, 142 | PropertyHandler_SpeakerTopoFilter 143 | }, 144 | { 145 | &KSPROPSETID_Jack, 146 | KSPROPERTY_JACK_DESCRIPTION3, 147 | KSPROPERTY_TYPE_GET | 148 | KSPROPERTY_TYPE_BASICSUPPORT, 149 | PropertyHandler_SpeakerTopoFilter 150 | }, 151 | { 152 | &KSPROPSETID_AudioResourceManagement, 153 | KSPROPERTY_AUDIORESOURCEMANAGEMENT_RESOURCEGROUP, 154 | KSPROPERTY_TYPE_SET, 155 | PropertyHandler_SpeakerTopoFilter 156 | } 157 | ,{ 158 | &KSPROPSETID_AudioPosture, 159 | KSPROPERTY_AUDIOPOSTURE_ORIENTATION, 160 | KSPROPERTY_TYPE_SET | 161 | KSPROPERTY_TYPE_BASICSUPPORT, 162 | PropertyHandler_SpeakerTopoFilter 163 | } 164 | }; 165 | 166 | DEFINE_PCAUTOMATION_TABLE_PROP(AutomationSpeakerTopoFilter, PropertiesSpeakerTopoFilter); 167 | 168 | //============================================================================= 169 | static 170 | PCFILTER_DESCRIPTOR SpeakerTopoMiniportFilterDescriptor = 171 | { 172 | 0, // Version 173 | &AutomationSpeakerTopoFilter, // AutomationTable 174 | sizeof(PCPIN_DESCRIPTOR), // PinSize 175 | SIZEOF_ARRAY(SpeakerTopoMiniportPins), // PinCount 176 | SpeakerTopoMiniportPins, // Pins 177 | sizeof(PCNODE_DESCRIPTOR), // NodeSize 178 | 0, // NodeCount 179 | NULL, // Nodes 180 | SIZEOF_ARRAY(SpeakerTopoMiniportConnections), // ConnectionCount 181 | SpeakerTopoMiniportConnections, // Connections 182 | 0, // CategoryCount 183 | NULL // Categories 184 | }; 185 | 186 | #endif // _SYSVAD_SPEAKERTOPTABLE_H_ 187 | 188 | -------------------------------------------------------------------------------- /Samples/Audio/sysvad/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 | -------------------------------------------------------------------------------- /Samples/Audio/sysvad/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 | -------------------------------------------------------------------------------- /Samples/Audio/sysvad/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 | if (IsEqualGUIDAligned(*PropertyRequest->PropertyItem->Set, KSPROPSETID_Jack)) 60 | { 61 | switch(PropertyRequest->PropertyItem->Id) 62 | { 63 | case KSPROPERTY_JACK_DESCRIPTION: 64 | ntStatus = PropertyHandler_UsbHsJackDescription( 65 | PropertyRequest, 66 | ARRAYSIZE(UsbHsSpeakerJackDescriptions), 67 | UsbHsSpeakerJackDescriptions); 68 | break; 69 | 70 | case KSPROPERTY_JACK_DESCRIPTION2: 71 | ntStatus = PropertyHandler_UsbHsJackDescription2( 72 | PropertyRequest, 73 | ARRAYSIZE(UsbHsSpeakerJackDescriptions), 74 | UsbHsSpeakerJackDescriptions); 75 | break; 76 | 77 | case KSPROPERTY_JACK_CONTAINERID: 78 | ntStatus = PropertyHandler_UsbHsJackContainerId( 79 | PropertyRequest, 80 | ARRAYSIZE(UsbHsSpeakerJackDescriptions), 81 | UsbHsSpeakerJackDescriptions); 82 | break; 83 | } 84 | } 85 | 86 | return ntStatus; 87 | } // PropertyHandler_UsbHsSpeakerTopoFilter 88 | 89 | //============================================================================= 90 | #pragma code_seg() 91 | NTSTATUS 92 | PropertyHandler_UsbHsSpeakerTopoFilterEvent 93 | ( 94 | _In_ PPCEVENT_REQUEST EventRequest 95 | ) 96 | { 97 | ASSERT(EventRequest); 98 | 99 | DPF_ENTER(("[PropertyHandler_UsbHsSpeakerTopoFilterEvent]")); 100 | 101 | return PropertyHandler_UsbHsTopoNodeEvent(EventRequest); 102 | } 103 | 104 | #pragma code_seg() 105 | #endif // SYSVAD_USB_SIDEBAND 106 | 107 | 108 | -------------------------------------------------------------------------------- /Samples/Audio/sysvad/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 | -------------------------------------------------------------------------------- /Samples/Audio/sysvad/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 | -------------------------------------------------------------------------------- /Samples/Audio/sysvad/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 | -------------------------------------------------------------------------------- /Samples/Audio/sysvad/KeywordDetectorAdapter/KeywordDetectorContosoAdapter.def: -------------------------------------------------------------------------------- 1 | LIBRARY 2 | 3 | EXPORTS 4 | DllGetActivationFactory PRIVATE 5 | DllGetClassObject PRIVATE 6 | DllCanUnloadNow PRIVATE 7 | -------------------------------------------------------------------------------- /Samples/Audio/sysvad/KeywordDetectorAdapter/KeywordDetectorContosoAdapter.idl: -------------------------------------------------------------------------------- 1 | import "oaidl.idl"; 2 | import "ocidl.idl"; 3 | 4 | import "KeywordDetectorOemAdapter.idl"; 5 | import "EventDetectorOemAdapter.idl"; 6 | 7 | [uuid(9D3E6826-CB8E-4D86-8B14-89F0D7EFCD01), version(1.0)] 8 | library KeywordDetectorContosoAdapterLib 9 | { 10 | // The class's uuid (i.e. the COM CLSID) must match that of the pattern 11 | // type GUID returned by the audio driver 12 | [uuid(6F7DBCC1-202E-498D-99C5-61C36C4EB2DC), version(1.0)] 13 | coclass KeywordDetectorContosoAdapter 14 | { 15 | [default] interface IKeywordDetectorOemAdapter; 16 | } 17 | 18 | // The class's uuid (i.e. the COM CLSID) must match that of the pattern 19 | // type GUID returned by the audio driver 20 | // 0x207f3d0c, 0x5c79, 0x496f, 0xa9, 0x4c, 0xd3, 0xd2, 0x93, 0x4d, 0xbf, 0xa9 21 | [uuid(207F3D0C-5C79-496F-A94C-D3D2934DBFA9), version(1.0)] 22 | coclass EventDetectorContosoAdapter 23 | { 24 | [default] interface IKeywordDetectorOemAdapter; 25 | } 26 | }; 27 | 28 | -------------------------------------------------------------------------------- /Samples/Audio/sysvad/KeywordDetectorAdapter/KeywordDetectorContosoAdapter.rc: -------------------------------------------------------------------------------- 1 | #if 0 2 | Copyright (c) Microsoft Corporation. All Rights Reserved 3 | #endif 4 | 5 | #include "winres.h" 6 | #include 7 | #define VER_FILETYPE VFT_DLL 8 | #define VER_FILESUBTYPE VFT_UNKNOWN 9 | #define VER_FILEDESCRIPTION_STR "Contoso keyword detector adapter" 10 | #define VER_INTERNALNAME_STR "KeywordDetectorContosoAdapter" 11 | #define VER_ORIGINALFILENAME_STR "KeywordDetectorContosoAdapter.dll" 12 | #include 13 |  -------------------------------------------------------------------------------- /Samples/Audio/sysvad/KeywordDetectorAdapter/KeywordDetectorContosoAdapter.vcxproj.Filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx;* 6 | {75C3E63D-04EA-4EB3-B9F1-505497C51F71} 7 | 8 | 9 | h;hpp;hxx;hm;inl;inc;xsd 10 | {5E8F8D4C-2886-4109-9E78-CE5EA6DB4AC4} 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 | {75D3016A-4ED8-4FAF-9817-394BE1112534} 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | Source Files 23 | 24 | 25 | Source Files 26 | 27 | 28 | Source Files 29 | 30 | 31 | 32 | 33 | Resource Files 34 | 35 | 36 | 37 | 38 | Header Files 39 | 40 | 41 | Header Files 42 | 43 | 44 | 45 | 46 | 47 | Source Files 48 | 49 | 50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /Samples/Audio/sysvad/KeywordDetectorAdapter/dllmain.cpp: -------------------------------------------------------------------------------- 1 | // dllmain.cpp : Defines the entry point for the DLL application. 2 | #include "stdafx.h" 3 | #include 4 | 5 | using namespace Microsoft::WRL; 6 | 7 | #if !defined(__WRL_CLASSIC_COM__) 8 | STDAPI DllGetActivationFactory(_In_ HSTRING activatibleClassId, _COM_Outptr_ IActivationFactory** factory) 9 | { 10 | return Module::GetModule().GetActivationFactory(activatibleClassId, factory); 11 | } 12 | #endif 13 | 14 | #if !defined(__WRL_WINRT_STRICT__) 15 | _Check_return_ 16 | STDAPI DllGetClassObject(_In_ REFCLSID rclsid, _In_ REFIID riid, _Outptr_ LPVOID FAR* ppv) 17 | { 18 | return Module::GetModule().GetClassObject(rclsid, riid, ppv); 19 | } 20 | #endif 21 | 22 | __control_entrypoint(DllExport) 23 | STDAPI DllCanUnloadNow() 24 | { 25 | return Module::GetModule().Terminate() ? S_OK : S_FALSE; 26 | } 27 | 28 | STDAPI_(BOOL) DllMain(_In_ HINSTANCE hinst, DWORD reason, _In_opt_ void*) 29 | { 30 | if (reason == DLL_PROCESS_ATTACH) 31 | { 32 | DisableThreadLibraryCalls(hinst); 33 | } 34 | return TRUE; 35 | } 36 | -------------------------------------------------------------------------------- /Samples/Audio/sysvad/KeywordDetectorAdapter/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /Samples/Audio/sysvad/KeywordDetectorAdapter/stdafx.cpp: -------------------------------------------------------------------------------- 1 | // stdafx.cpp : source file that includes just the standard includes 2 | // KeywordDetectorContosoAdapter.pch will be the pre-compiled header 3 | // stdafx.obj will contain the pre-compiled type information 4 | 5 | #include "stdafx.h" 6 | 7 | // TODO: reference any additional headers you need in STDAFX.H 8 | // and not in this file 9 | -------------------------------------------------------------------------------- /Samples/Audio/sysvad/KeywordDetectorAdapter/stdafx.h: -------------------------------------------------------------------------------- 1 | // stdafx.h : include file for standard system include files, 2 | // or project specific include files that are used frequently, but 3 | // are changed infrequently 4 | // 5 | 6 | #pragma once 7 | 8 | #include "targetver.h" 9 | 10 | //#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers 11 | // Windows Header Files: 12 | #include 13 | 14 | 15 | 16 | // TODO: reference additional headers your program requires here 17 | -------------------------------------------------------------------------------- /Samples/Audio/sysvad/KeywordDetectorAdapter/targetver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // Including SDKDDKVer.h defines the highest available Windows platform. 4 | 5 | // If you wish to build your application for a previous Windows platform, include WinSDKVer.h and 6 | // set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. 7 | 8 | #include 9 | -------------------------------------------------------------------------------- /Samples/Audio/sysvad/Package/package.VcxProj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | ARM64 7 | 8 | 9 | Release 10 | ARM64 11 | 12 | 13 | Debug 14 | x64 15 | 16 | 17 | Release 18 | x64 19 | 20 | 21 | 22 | 23 | {E0F02048-78A4-4FE8-B863-66E6CB6A2C37} 24 | 25 | 26 | {691F1D0F-CA50-46CD-8BBA-A59E9E8EB601} 27 | 28 | 29 | {8851AB85-70B3-4798-A149-BA366DF9EC25} 30 | 31 | 32 | {47358AD6-A48A-465B-965F-0A66F8BDFE23} 33 | 34 | 35 | {83A1B9B0-3CB7-4249-ADEC-C336B0EDDE76} 36 | 37 | 38 | {E4DF0EEE-D35B-47F2-A9B1-41EA97C465FF} 39 | 40 | 41 | 42 | WindowsKernelModeDriver10.0 43 | Utility 44 | Package 45 | true 46 | Debug 47 | 48 | 49 | 50 | {830B14D5-0E32-4F9E-AEFA-4C9F6FC13C2A} 51 | {E9D167E6-E633-4284-8F02-FF86DF3B6D7F} 52 | $(MSBuildProjectName) 53 | 54 | 55 | Windows10 56 | true 57 | 58 | 59 | Windows10 60 | true 61 | 62 | 63 | Windows10 64 | false 65 | 66 | 67 | Windows10 68 | false 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | DbgengKernelDebugger 80 | False 81 | None 82 | 83 | 84 | 85 | 86 | 87 | %PathToInf% 88 | False 89 | False 90 | True 91 | 92 | 133563 93 | 94 | 95 | 96 | sha256 97 | 98 | 99 | 100 | 101 | sha256 102 | 103 | 104 | 105 | 106 | sha256 107 | 108 | 109 | 110 | 111 | sha256 112 | 113 | 114 | 115 | 116 | 117 | 118 | -------------------------------------------------------------------------------- /Samples/Audio/sysvad/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 | -------------------------------------------------------------------------------- /Samples/Audio/sysvad/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 | -------------------------------------------------------------------------------- /Samples/Audio/sysvad/TabletAudioSample/ComponentizedApoSample.inx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/audio/084223378b19c4aa210db61a10917621aeae8828/Samples/Audio/sysvad/TabletAudioSample/ComponentizedApoSample.inx -------------------------------------------------------------------------------- /Samples/Audio/sysvad/TabletAudioSample/ComponentizedAudioSample.inx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/audio/084223378b19c4aa210db61a10917621aeae8828/Samples/Audio/sysvad/TabletAudioSample/ComponentizedAudioSample.inx -------------------------------------------------------------------------------- /Samples/Audio/sysvad/TabletAudioSample/ComponentizedAudioSampleExtension.inx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/audio/084223378b19c4aa210db61a10917621aeae8828/Samples/Audio/sysvad/TabletAudioSample/ComponentizedAudioSampleExtension.inx -------------------------------------------------------------------------------- /Samples/Audio/sysvad/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 | -------------------------------------------------------------------------------- /Samples/Audio/sysvad/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 | #pragma code_seg() 30 | class CHdmiMiniportTopology : 31 | public CMiniportTopologySYSVAD, 32 | public IMiniportTopology, 33 | public CUnknown 34 | { 35 | public: 36 | DECLARE_STD_UNKNOWN(); 37 | CHdmiMiniportTopology 38 | ( 39 | _In_opt_ PUNKNOWN UnknownOuter, 40 | _In_ PCFILTER_DESCRIPTOR *FilterDesc, 41 | _In_ USHORT DeviceMaxChannels 42 | ) 43 | : CUnknown(UnknownOuter), 44 | CMiniportTopologySYSVAD(FilterDesc, DeviceMaxChannels) 45 | {} 46 | 47 | ~CHdmiMiniportTopology(); 48 | 49 | IMP_IMiniportTopology; 50 | 51 | NTSTATUS PropertyHandlerJackSinkInfo 52 | ( 53 | _In_ PPCPROPERTY_REQUEST PropertyRequest 54 | ); 55 | 56 | NTSTATUS PropertyHandlerJackDescription 57 | ( 58 | _In_ PPCPROPERTY_REQUEST PropertyRequest 59 | ); 60 | 61 | NTSTATUS PropertyHandlerJackDescription2 62 | ( 63 | _In_ PPCPROPERTY_REQUEST PropertyRequest 64 | ); 65 | }; 66 | 67 | typedef CHdmiMiniportTopology *PCHdmiMiniportTopology; 68 | 69 | 70 | NTSTATUS 71 | CreateHdmiMiniportTopology( 72 | _Out_ PUNKNOWN * Unknown, 73 | _In_ REFCLSID, 74 | _In_opt_ PUNKNOWN UnknownOuter, 75 | _In_ POOL_FLAGS PoolFlags, 76 | _In_ PUNKNOWN UnknownAdapter, 77 | _In_opt_ PVOID DeviceContext, 78 | _In_ PENDPOINT_MINIPAIR MiniportPair 79 | ); 80 | 81 | NTSTATUS PropertyHandler_HdmiTopoFilter(_In_ PPCPROPERTY_REQUEST PropertyRequest); 82 | 83 | #endif // _SYSVAD_HDMITOPO_H_ 84 | 85 | -------------------------------------------------------------------------------- /Samples/Audio/sysvad/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 | -------------------------------------------------------------------------------- /Samples/Audio/sysvad/TabletAudioSample/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /Samples/Audio/sysvad/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 | -------------------------------------------------------------------------------- /Samples/Audio/sysvad/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 | -------------------------------------------------------------------------------- /Samples/Audio/sysvad/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 | -------------------------------------------------------------------------------- /Samples/Audio/sysvad/ToneGenerator.h: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) Microsoft Corporation All Rights Reserved 4 | 5 | Module Name: 6 | 7 | ToneGenerator.h 8 | 9 | Abstract: 10 | 11 | Declaration of SYSVAD sine wave generator. 12 | 13 | 14 | --*/ 15 | #ifndef _SYSVAD_TONEGENERATOR_H 16 | #define _SYSVAD_TONEGENERATOR_H 17 | 18 | #define _USE_MATH_DEFINES 19 | #include 20 | #include 21 | 22 | class ToneGenerator 23 | { 24 | public: 25 | DWORD m_Frequency; 26 | WORD m_ChannelCount; 27 | WORD m_BitsPerSample; 28 | DWORD m_SamplesPerSecond; 29 | double m_Theta; 30 | double m_SampleIncrement; 31 | bool m_Mute; 32 | BYTE* m_PartialFrame; 33 | DWORD m_PartialFrameBytes; 34 | DWORD m_FrameSize; 35 | double m_ToneAmplitude; 36 | double m_ToneDCOffset; 37 | 38 | public: 39 | ToneGenerator(); 40 | ~ToneGenerator(); 41 | 42 | NTSTATUS 43 | Init 44 | ( 45 | _In_ DWORD ToneFrequency, 46 | _In_ double ToneAmplitude, 47 | _In_ double ToneDCOffset, 48 | _In_ double ToneInitialPhase, 49 | _In_ PWAVEFORMATEXTENSIBLE WfExt 50 | ); 51 | 52 | VOID 53 | GenerateSine 54 | ( 55 | _Out_writes_bytes_(BufferLength) BYTE *Buffer, 56 | _In_ size_t BufferLength 57 | ); 58 | 59 | VOID 60 | SetMute 61 | ( 62 | _In_ bool Value 63 | ) 64 | { 65 | m_Mute = Value; 66 | } 67 | 68 | private: 69 | VOID InitNewFrame 70 | ( 71 | _Out_writes_bytes_(FrameSize) BYTE* Frame, 72 | _In_ DWORD FrameSize 73 | ); 74 | }; 75 | 76 | #endif // _SYSVAD_TONEGENERATOR_H 77 | 78 | -------------------------------------------------------------------------------- /Samples/Audio/sysvad/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_ -------------------------------------------------------------------------------- /Samples/Audio/sysvad/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 | -------------------------------------------------------------------------------- /Samples/Audio/sysvad/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 | -------------------------------------------------------------------------------- /Samples/Audio/sysvad/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 | -------------------------------------------------------------------------------- /Samples/Audio/sysvad/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 | -------------------------------------------------------------------------------- /Samples/Audio/sysvad/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 | PSAVEWORKER_PARAM m_pWorkItems; 102 | 103 | BOOL m_fWriteDisabled; 104 | 105 | BOOL m_bInitialized; 106 | 107 | public: 108 | CSaveData(); 109 | ~CSaveData(); 110 | 111 | NTSTATUS InitializeWorkItems 112 | ( 113 | _In_ PDEVICE_OBJECT DeviceObject 114 | ); 115 | void DestroyWorkItems 116 | ( 117 | void 118 | ); 119 | void Disable 120 | ( 121 | _In_ BOOL fDisable 122 | ); 123 | 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 | -------------------------------------------------------------------------------- /USBPowerSettings/USBAudioPowerSettings.cmd: -------------------------------------------------------------------------------- 1 | @rem Copyright (c) Microsoft Corporation. All rights reserved. 2 | @echo off 3 | setlocal 4 | 5 | set script=%~dp0USBAudioPowerSettings.ps1 6 | 7 | rem look out for WOW64 file system redirection 8 | set powershell="%windir%\system32\WindowsPowerShell\v1.0\PowerShell.exe" 9 | if not "%PROCESSOR_ARCHITEW6432%" == "" ( 10 | set powershell="%windir%\sysnative\WindowsPowerShell\v1.0\PowerShell.exe" 11 | ) 12 | 13 | rem pass arguments we received to the PowerShell script 14 | set command= ^ 15 | Start-Process powershell.exe ^ 16 | -Verb RunAs ^ 17 | -ArgumentList ^ 18 | '-NoProfile -NoExit -ExecutionPolicy Bypass -File "%script%" %*' 19 | 20 | call %powershell% -NoExit -NoProfile -Command "& { %command% }" 21 | --------------------------------------------------------------------------------