summaryrefslogtreecommitdiff
path: root/audio/sysvad/APO
diff options
context:
space:
mode:
authorDaniel Rugerio <[email protected]>2019-06-28 16:08:54 -0700
committerAdonais Romero González <[email protected]>2019-06-28 16:08:54 -0700
commit8ffcdad009e4d410f92fabc4e322a76a0be3a69d (patch)
tree378b2d98a4210c61e2bc34f5b8959e87e4be5c6c /audio/sysvad/APO
parent75b2290f2a4ece68739d07135d352cdfec3a9e89 (diff)
Update audio samples (#387)
* Update SysVAD public sample. * Add WaveTest public sample.
Diffstat (limited to 'audio/sysvad/APO')
-rw-r--r--audio/sysvad/APO/DelayAPO/DelayAPO.h5
-rw-r--r--audio/sysvad/APO/DelayAPO/DelayAPO.vcxproj106
-rw-r--r--audio/sysvad/APO/DelayAPO/DelayAPODll.cpp2
-rw-r--r--audio/sysvad/APO/DelayAPO/DelayAPODll.def2
-rw-r--r--audio/sysvad/APO/DelayAPO/DelayAPOMFX.cpp141
-rw-r--r--audio/sysvad/APO/DelayAPO/makefile34
-rw-r--r--audio/sysvad/APO/DelayAPO/sources12
-rw-r--r--audio/sysvad/APO/KWSApo/KWSApo.cpp62
-rw-r--r--audio/sysvad/APO/KWSApo/KWSApo.h134
-rw-r--r--audio/sysvad/APO/KWSApo/KWSApo.pngbin0 -> 1191 bytes
-rw-r--r--audio/sysvad/APO/KWSApo/KWSApo.vcxproj355
-rw-r--r--audio/sysvad/APO/KWSApo/KWSApo.vcxproj.Filters42
-rw-r--r--audio/sysvad/APO/KWSApo/KWSApoDll.cpp71
-rw-r--r--audio/sysvad/APO/KWSApo/KWSApoDll.def4
-rw-r--r--audio/sysvad/APO/KWSApo/KWSApoDll.idl40
-rw-r--r--audio/sysvad/APO/KWSApo/KWSApoDll.rc20
-rw-r--r--audio/sysvad/APO/KWSApo/KWSApoDll.rgs11
-rw-r--r--audio/sysvad/APO/KWSApo/KWSApoEfx.cpp599
-rw-r--r--audio/sysvad/APO/KWSApo/KWSApoEfx.rgs13
-rw-r--r--audio/sysvad/APO/KWSApo/KWSApoInterface.idl21
-rw-r--r--audio/sysvad/APO/KWSApo/Resource.h19
-rw-r--r--audio/sysvad/APO/SwapAPO/SwapAPO.h5
-rw-r--r--audio/sysvad/APO/SwapAPO/SwapAPO.vcxproj32
-rw-r--r--audio/sysvad/APO/SwapAPO/SwapAPODll.cpp2
-rw-r--r--audio/sysvad/APO/SwapAPO/SwapAPODll.def2
-rw-r--r--audio/sysvad/APO/SwapAPO/makefile36
-rw-r--r--audio/sysvad/APO/SwapAPO/sources13
-rw-r--r--audio/sysvad/APO/SwapAPO/swapapomfx.cpp141
28 files changed, 1683 insertions, 241 deletions
diff --git a/audio/sysvad/APO/DelayAPO/DelayAPO.h b/audio/sysvad/APO/DelayAPO/DelayAPO.h
index e59fccf7..65ee98e5 100644
--- a/audio/sysvad/APO/DelayAPO/DelayAPO.h
+++ b/audio/sysvad/APO/DelayAPO/DelayAPO.h
@@ -136,6 +136,11 @@ public:
STDMETHODIMP GetFormat(UINT nFormat, IAudioMediaType** ppFormat);
STDMETHODIMP GetFormatRepresentation(UINT nFormat, _Outptr_ LPWSTR* ppwstrFormatRep);
+ // IAudioProcessingObject
+ STDMETHODIMP IsOutputFormatSupported(IAudioMediaType *pOppositeFormat, IAudioMediaType *pRequestedOutputFormat, IAudioMediaType **ppSupportedOutputFormat);
+
+ STDMETHODIMP CheckCustomFormats(IAudioMediaType *pRequestedFormat);
+
public:
LONG m_fEnableDelayMFX;
GUID m_AudioProcessingMode;
diff --git a/audio/sysvad/APO/DelayAPO/DelayAPO.vcxproj b/audio/sysvad/APO/DelayAPO/DelayAPO.vcxproj
index 5fc4b06a..ecdaf321 100644
--- a/audio/sysvad/APO/DelayAPO/DelayAPO.vcxproj
+++ b/audio/sysvad/APO/DelayAPO/DelayAPO.vcxproj
@@ -1,10 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
- <ProjectConfiguration Include="Debug|ARM">
- <Configuration>Debug</Configuration>
- <Platform>ARM</Platform>
- </ProjectConfiguration>
<ProjectConfiguration Include="Debug|ARM64">
<Configuration>Debug</Configuration>
<Platform>ARM64</Platform>
@@ -13,10 +9,6 @@
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
- <ProjectConfiguration Include="Release|ARM">
- <Configuration>Release</Configuration>
- <Platform>ARM</Platform>
- </ProjectConfiguration>
<ProjectConfiguration Include="Release|ARM64">
<Configuration>Release</Configuration>
<Platform>ARM64</Platform>
@@ -89,15 +81,6 @@
<PlatformToolset>WindowsApplicationForDrivers10.0</PlatformToolset>
<ConfigurationType>DynamicLibrary</ConfigurationType>
</PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'" Label="Configuration">
- <TargetVersion>Windows10</TargetVersion>
- <UseDebugLibraries>False</UseDebugLibraries>
- <DriverTargetPlatform>Universal</DriverTargetPlatform>
- <EmbedManifest>false</EmbedManifest>
- <DriverType />
- <PlatformToolset>WindowsApplicationForDrivers10.0</PlatformToolset>
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- </PropertyGroup>
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<TargetVersion>Windows10</TargetVersion>
<UseDebugLibraries>True</UseDebugLibraries>
@@ -107,15 +90,6 @@
<PlatformToolset>WindowsApplicationForDrivers10.0</PlatformToolset>
<ConfigurationType>DynamicLibrary</ConfigurationType>
</PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'" Label="Configuration">
- <TargetVersion>Windows10</TargetVersion>
- <UseDebugLibraries>True</UseDebugLibraries>
- <DriverTargetPlatform>Universal</DriverTargetPlatform>
- <EmbedManifest>false</EmbedManifest>
- <DriverType />
- <PlatformToolset>WindowsApplicationForDrivers10.0</PlatformToolset>
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- </PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<PropertyGroup>
<OutDir>$(IntDir)</OutDir>
@@ -135,15 +109,9 @@
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
</ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
- </ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
</ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
- </ImportGroup>
<ItemGroup Label="WrappedTaskItems" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<TargetName>DelayAPO</TargetName>
@@ -160,15 +128,9 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<TargetName>DelayAPO</TargetName>
</PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">
- <TargetName>DelayAPO</TargetName>
- </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<TargetName>DelayAPO</TargetName>
</PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">
- <TargetName>DelayAPO</TargetName>
- </PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Link>
<EntryPointSymbol Condition="'$(Platform)'=='win32'">_DllMainCRTStartup@12</EntryPointSymbol>
@@ -199,24 +161,12 @@
<EntryPointSymbol Condition="'$(Platform)'!='win32'">_DllMainCRTStartup</EntryPointSymbol>
</Link>
</ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">
- <Link>
- <EntryPointSymbol Condition="'$(Platform)'=='win32'">_DllMainCRTStartup@12</EntryPointSymbol>
- <EntryPointSymbol Condition="'$(Platform)'!='win32'">_DllMainCRTStartup</EntryPointSymbol>
- </Link>
- </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Link>
<EntryPointSymbol Condition="'$(Platform)'=='win32'">_DllMainCRTStartup@12</EntryPointSymbol>
<EntryPointSymbol Condition="'$(Platform)'!='win32'">_DllMainCRTStartup</EntryPointSymbol>
</Link>
</ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">
- <Link>
- <EntryPointSymbol Condition="'$(Platform)'=='win32'">_DllMainCRTStartup@12</EntryPointSymbol>
- <EntryPointSymbol Condition="'$(Platform)'!='win32'">_DllMainCRTStartup</EntryPointSymbol>
- </Link>
- </ItemDefinitionGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<UseOfAtl>Dynamic</UseOfAtl>
</PropertyGroup>
@@ -232,15 +182,9 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<UseOfAtl>Dynamic</UseOfAtl>
</PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">
- <UseOfAtl>Dynamic</UseOfAtl>
- </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<UseOfAtl>Dynamic</UseOfAtl>
</PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">
- <UseOfAtl>Dynamic</UseOfAtl>
- </PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<TreatWarningAsError>true</TreatWarningAsError>
@@ -363,31 +307,6 @@
<AdditionalOptions>/ignore:4217,4049 %(AdditionalOptions)</AdditionalOptions>
</Link>
</ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">
- <ClCompile>
- <TreatWarningAsError>true</TreatWarningAsError>
- <WarningLevel>Level4</WarningLevel>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_WINDLL;_USRDLL;UNICODE;_UNICODE</PreprocessorDefinitions>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(DDK_INC_PATH);..\inc;..\..\;.</AdditionalIncludeDirectories>
- <ExceptionHandling>
- </ExceptionHandling>
- <RuntimeLibrary>
- </RuntimeLibrary>
- </ClCompile>
- <Midl>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_WINDLL;_USRDLL;UNICODE;_UNICODE</PreprocessorDefinitions>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(DDK_INC_PATH);..\inc;..\..\</AdditionalIncludeDirectories>
- </Midl>
- <ResourceCompile>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_WINDLL;_USRDLL;UNICODE;_UNICODE</PreprocessorDefinitions>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(DDK_INC_PATH);..\inc;..\..\</AdditionalIncludeDirectories>
- </ResourceCompile>
- <Link>
- <AdditionalDependencies>%(AdditionalDependencies);Kernel32.lib;ole32.lib;oleaut32.lib;advapi32.lib;user32.lib;uuid.lib;AudioBaseProcessingObjectV140.lib;audiomediatypecrt.lib;AudioEng.lib</AdditionalDependencies>
- <ModuleDefinitionFile>DelayAPODll.def</ModuleDefinitionFile>
- <AdditionalOptions>/ignore:4217,4049 %(AdditionalOptions)</AdditionalOptions>
- </Link>
- </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<TreatWarningAsError>true</TreatWarningAsError>
@@ -412,31 +331,6 @@
<AdditionalOptions>/ignore:4217,4049 %(AdditionalOptions)</AdditionalOptions>
</Link>
</ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">
- <ClCompile>
- <TreatWarningAsError>true</TreatWarningAsError>
- <WarningLevel>Level4</WarningLevel>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_WINDLL;_USRDLL;UNICODE;_UNICODE</PreprocessorDefinitions>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(DDK_INC_PATH);..\inc;..\..\;.</AdditionalIncludeDirectories>
- <ExceptionHandling>
- </ExceptionHandling>
- <RuntimeLibrary>
- </RuntimeLibrary>
- </ClCompile>
- <Midl>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_WINDLL;_USRDLL;UNICODE;_UNICODE</PreprocessorDefinitions>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(DDK_INC_PATH);..\inc;..\..\</AdditionalIncludeDirectories>
- </Midl>
- <ResourceCompile>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_WINDLL;_USRDLL;UNICODE;_UNICODE</PreprocessorDefinitions>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(DDK_INC_PATH);..\inc;..\..\</AdditionalIncludeDirectories>
- </ResourceCompile>
- <Link>
- <AdditionalDependencies>%(AdditionalDependencies);Kernel32.lib;ole32.lib;oleaut32.lib;advapi32.lib;user32.lib;uuid.lib;AudioBaseProcessingObjectV140.lib;audiomediatypecrt.lib;AudioEng.lib</AdditionalDependencies>
- <ModuleDefinitionFile>DelayAPODll.def</ModuleDefinitionFile>
- <AdditionalOptions>/ignore:4217,4049 %(AdditionalOptions)</AdditionalOptions>
- </Link>
- </ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="Delay.cpp" />
<ClCompile Include="DelayAPODll.cpp" />
diff --git a/audio/sysvad/APO/DelayAPO/DelayAPODll.cpp b/audio/sysvad/APO/DelayAPO/DelayAPODll.cpp
index fe49a000..9b24637a 100644
--- a/audio/sysvad/APO/DelayAPO/DelayAPODll.cpp
+++ b/audio/sysvad/APO/DelayAPO/DelayAPODll.cpp
@@ -67,4 +67,4 @@ STDAPI DllCanUnloadNow(void)
STDAPI DllGetClassObject(_In_ REFCLSID rclsid,_In_ REFIID riid, _Outptr_ LPVOID* ppv)
{
return _AtlModule.DllGetClassObject(rclsid, riid, ppv);
-}
+} \ No newline at end of file
diff --git a/audio/sysvad/APO/DelayAPO/DelayAPODll.def b/audio/sysvad/APO/DelayAPO/DelayAPODll.def
index f4b6fcd9..3f3b0c5a 100644
--- a/audio/sysvad/APO/DelayAPO/DelayAPODll.def
+++ b/audio/sysvad/APO/DelayAPO/DelayAPODll.def
@@ -1,4 +1,4 @@
EXPORTS
DllCanUnloadNow PRIVATE
- DllGetClassObject PRIVATE
+ DllGetClassObject PRIVATE \ No newline at end of file
diff --git a/audio/sysvad/APO/DelayAPO/DelayAPOMFX.cpp b/audio/sysvad/APO/DelayAPO/DelayAPOMFX.cpp
index 5f5ad2c6..8b53b42c 100644
--- a/audio/sysvad/APO/DelayAPO/DelayAPOMFX.cpp
+++ b/audio/sysvad/APO/DelayAPO/DelayAPOMFX.cpp
@@ -905,8 +905,9 @@ DEFINE_GUIDSTRUCT("00000092-0000-0010-8000-00aa00389b71", KSDATAFORMAT_SUBTYPE_A
CUSTOM_FORMAT_ITEM _rgCustomFormats[] =
{
{{ WAVE_FORMAT_EXTENSIBLE, 2, 44100, 176400, 4, 16, sizeof(WAVEFORMATEXTENSIBLE)-sizeof(WAVEFORMATEX), 16, KSAUDIO_SPEAKER_STEREO, KSDATAFORMAT_SUBTYPE_PCM}, L"Custom #1 (really 44.1 KHz, 16-bit, stereo)"},
- {{ WAVE_FORMAT_EXTENSIBLE, 2, 48000, 192000, 4, 16, sizeof(WAVEFORMATEXTENSIBLE)-sizeof(WAVEFORMATEX), 16, KSAUDIO_SPEAKER_STEREO, KSDATAFORMAT_SUBTYPE_PCM}, L"Custom #2 (really 48 KHz, 16-bit, stereo)"},
- {{ WAVE_FORMAT_EXTENSIBLE, 2, 48000, 192000, 4, 16, sizeof(WAVEFORMATEXTENSIBLE)-sizeof(WAVEFORMATEX), 16, KSAUDIO_SPEAKER_STEREO, KSDATAFORMAT_SUBTYPE_AC3}, L"Custom #3 (really 48 KHz AC-3)"}
+ {{ WAVE_FORMAT_EXTENSIBLE, 2, 48000, 192000, 4, 16, sizeof(WAVEFORMATEXTENSIBLE)-sizeof(WAVEFORMATEX), 16, KSAUDIO_SPEAKER_STEREO, KSDATAFORMAT_SUBTYPE_PCM}, L"Custom #2 (really 48 KHz, 16-bit, stereo)"}
+ // The compressed AC3 format has been temporarily removed since the APO is not set up for compressed formats or EFXs yet.
+ // {{ WAVE_FORMAT_EXTENSIBLE, 2, 48000, 192000, 4, 16, sizeof(WAVEFORMATEXTENSIBLE)-sizeof(WAVEFORMATEX), 16, KSAUDIO_SPEAKER_STEREO, KSDATAFORMAT_SUBTYPE_AC3}, L"Custom #3 (really 48 KHz AC-3)"}
};
#define _cCustomFormats (ARRAYSIZE(_rgCustomFormats))
@@ -1029,3 +1030,139 @@ STDMETHODIMP CDelayAPOMFX::GetFormatRepresentation
Exit:
return hr;
}
+
+//-------------------------------------------------------------------------
+// Description:
+//
+// Implementation of IAudioProcessingObject::IsOutputFormatSupported
+//
+// Parameters:
+//
+// pInputFormat - [in] A pointer to an IAudioMediaType interface. This parameter indicates the output format. This parameter must be set to NULL to indicate that the output format can be any type
+// pRequestedOutputFormat - [in] A pointer to an IAudioMediaType interface. This parameter indicates the output format that is to be verified
+// ppSupportedOutputFormat - [in] This parameter indicates the supported output format that is closest to the format to be verified
+//
+// Return values:
+//
+// S_OK Success
+// S_FALSE The format of Input/output format pair is not supported. The ppSupportedOutPutFormat parameter returns a suggested new format
+// APOERR_FORMAT_NOT_SUPPORTED The format is not supported. The value of ppSupportedOutputFormat does not change.
+// E_POINTER Null pointer passed
+//
+// Remarks:
+//
+STDMETHODIMP CDelayAPOMFX::IsOutputFormatSupported
+(
+ IAudioMediaType *pInputFormat,
+ IAudioMediaType *pRequestedOutputFormat,
+ IAudioMediaType **ppSupportedOutputFormat
+)
+{
+ ASSERT_NONREALTIME();
+ bool formatChanged = false;
+ HRESULT hResult;
+ UNCOMPRESSEDAUDIOFORMAT uncompOutputFormat;
+ IAudioMediaType *recommendedFormat = NULL;
+
+ IF_TRUE_ACTION_JUMP((NULL == pRequestedOutputFormat) || (NULL == ppSupportedOutputFormat), hResult = E_POINTER, Exit);
+ *ppSupportedOutputFormat = NULL;
+
+ // Initial comparison to make sure the requested format is valid and consistent with the input
+ // format. Because of the APO flags specified during creation, the samples per frame value will
+ // not be validated.
+ hResult = IsFormatTypeSupported(pInputFormat, pRequestedOutputFormat, &recommendedFormat, true);
+ IF_FAILED_JUMP(hResult, Exit);
+
+ // Check to see if a custom format from the APO was used.
+ if (S_FALSE == hResult)
+ {
+ hResult = CheckCustomFormats(pRequestedOutputFormat);
+
+ // If the output format is changed, make sure we track it for our return code.
+ if (S_FALSE == hResult)
+ {
+ formatChanged = true;
+ }
+ }
+
+ // now retrieve the format that IsFormatTypeSupported decided on, building upon that by adding
+ // our channel count constraint.
+ hResult = recommendedFormat->GetUncompressedAudioFormat(&uncompOutputFormat);
+ IF_FAILED_JUMP(hResult, Exit);
+
+ // If the requested format exactly matched our requirements,
+ // just return it.
+ if (!formatChanged)
+ {
+ *ppSupportedOutputFormat = pRequestedOutputFormat;
+ (*ppSupportedOutputFormat)->AddRef();
+ hResult = S_OK;
+ }
+ else // we're proposing something different, copy it and return S_FALSE
+ {
+ hResult = CreateAudioMediaTypeFromUncompressedAudioFormat(&uncompOutputFormat, ppSupportedOutputFormat);
+ IF_FAILED_JUMP(hResult, Exit);
+ hResult = S_FALSE;
+ }
+
+Exit:
+ if (recommendedFormat)
+ {
+ recommendedFormat->Release();
+ }
+
+ return hResult;
+}
+
+HRESULT CDelayAPOMFX::CheckCustomFormats(IAudioMediaType *pRequestedFormat)
+{
+ HRESULT hResult = S_OK;
+
+ for (int i = 0; i < _cCustomFormats; i++)
+ {
+ hResult = S_OK;
+ const WAVEFORMATEX* waveFormat = pRequestedFormat->GetAudioFormat();
+
+ if (waveFormat->wFormatTag != _rgCustomFormats[i].wfxFmt.Format.wFormatTag)
+ {
+ hResult = S_FALSE;
+ }
+
+ if (waveFormat->nChannels != _rgCustomFormats[i].wfxFmt.Format.nChannels)
+ {
+ hResult = S_FALSE;
+ }
+
+ if (waveFormat->nSamplesPerSec != _rgCustomFormats[i].wfxFmt.Format.nSamplesPerSec)
+ {
+ hResult = S_FALSE;
+ }
+
+ if (waveFormat->nAvgBytesPerSec != _rgCustomFormats[i].wfxFmt.Format.nAvgBytesPerSec)
+ {
+ hResult = S_FALSE;
+ }
+
+ if (waveFormat->nBlockAlign != _rgCustomFormats[i].wfxFmt.Format.nBlockAlign)
+ {
+ hResult = S_FALSE;
+ }
+
+ if (waveFormat->wBitsPerSample != _rgCustomFormats[i].wfxFmt.Format.wBitsPerSample)
+ {
+ hResult = S_FALSE;
+ }
+
+ if (waveFormat->cbSize != _rgCustomFormats[i].wfxFmt.Format.cbSize)
+ {
+ hResult = S_FALSE;
+ }
+
+ if (hResult == S_OK)
+ {
+ break;
+ }
+ }
+
+ return hResult;
+} \ No newline at end of file
diff --git a/audio/sysvad/APO/DelayAPO/makefile b/audio/sysvad/APO/DelayAPO/makefile
deleted file mode 100644
index 593ab379..00000000
--- a/audio/sysvad/APO/DelayAPO/makefile
+++ /dev/null
@@ -1,34 +0,0 @@
-#############################################################################
-#
-# Copyright (c) Microsoft Corporation.
-# All Rights Reserved.
-#
-#############################################################################
-
-## NT BUILD ENVIROMENT
-
-#
-# DO NOT EDIT THIS FILE!!! Edit .\sources. if you want to add a new source
-# file to this component. This file merely indirects to the real make file
-# that is shared by all the components of NT.
-#
-!if defined(IA64)
-!message This sample is not to be built for IA64 targets
-!else
-
-!IF DEFINED(_NT_TARGET_VERSION)
-#! IF $(_NT_TARGET_VERSION)>=0x501
-! IF $(_NT_TARGET_VERSION)>=0x600
-! INCLUDE $(NTMAKEENV)\makefile.def
-! ELSE
-# Only warn once per directory
-! INCLUDE $(NTMAKEENV)\makefile.plt
-! IF "$(BUILD_PASS)"=="PASS1"
-! message BUILDMSG: Warning : Building the sample "$(MAKEDIR)" for downlevel build environments is temporarily disabled in WDK for Beta2.
-! ENDIF
-! ENDIF
-!ELSE
-! INCLUDE $(NTMAKEENV)\makefile.def
-!ENDIF
-
-!endif
diff --git a/audio/sysvad/APO/DelayAPO/sources b/audio/sysvad/APO/DelayAPO/sources
deleted file mode 100644
index 355dc80f..00000000
--- a/audio/sysvad/APO/DelayAPO/sources
+++ /dev/null
@@ -1,12 +0,0 @@
-!include ..\sources.inc
-
-TARGETNAME=DelayAPO
-DLLDEF=DelayAPODll.def
-
-SOURCES=DelayAPOInterface.idl \
- DelayAPOMFX.cpp \
- DelayAPOSFX.cpp \
- Delay.cpp \
- DelayAPODll.idl \
- DelayAPODll.rc \
- DelayAPODll.cpp \
diff --git a/audio/sysvad/APO/KWSApo/KWSApo.cpp b/audio/sysvad/APO/KWSApo/KWSApo.cpp
new file mode 100644
index 00000000..d67eaca0
--- /dev/null
+++ b/audio/sysvad/APO/KWSApo/KWSApo.cpp
@@ -0,0 +1,62 @@
+//
+// KWSApo.cpp -- Copyright (c) Microsoft Corporation. All rights reserved.
+//
+// Description:
+//
+// Implementation of ProcessBuffer
+//
+#include <atlbase.h>
+#include <atlcom.h>
+#include <atlcoll.h>
+#include <atlsync.h>
+#include <mmreg.h>
+
+#include <audioenginebaseapo.h>
+#include <baseaudioprocessingobject.h>
+#include <resource.h>
+
+#include <float.h>
+
+#include "KWSApo.h"
+
+#pragma AVRT_CODE_BEGIN
+void WriteSilence(
+ _Out_writes_(u32FrameCount * u32SamplesPerFrame)
+ FLOAT32 *pf32Frames,
+ UINT32 u32FrameCount,
+ UINT32 u32SamplesPerFrame )
+{
+ ZeroMemory(pf32Frames, sizeof(FLOAT32) * u32FrameCount * u32SamplesPerFrame);
+}
+#pragma AVRT_CODE_END
+
+#pragma AVRT_CODE_BEGIN
+void ProcessBuffer(
+ FLOAT32 *pf32OutputFrames,
+ const FLOAT32 *pf32InputFrames,
+ UINT32 u32ValidFrameCount,
+ INTERLEAVED_AUDIO_FORMAT_INFORMATION *formatInfo)
+{
+ UINT32 totalChannelCount = (formatInfo->PrimaryChannelCount + formatInfo->InterleavedChannelCount);
+
+ ASSERT_REALTIME();
+ ATLASSERT( IS_VALID_TYPED_READ_POINTER(pf32InputFrames) );
+ ATLASSERT( IS_VALID_TYPED_WRITE_POINTER(pf32OutputFrames) );
+
+ // loop through samples
+ while (u32ValidFrameCount--)
+ {
+ // copy over the Primary channel data
+ for (UINT32 i = formatInfo->PrimaryChannelStartPosition; i < (formatInfo->PrimaryChannelStartPosition + formatInfo->PrimaryChannelCount); i++)
+ {
+ *pf32OutputFrames = *(pf32InputFrames + i);
+ pf32OutputFrames++;
+ }
+
+ // step forward to the next frame, ignoring interleaved data
+ pf32InputFrames += (totalChannelCount);
+ }
+}
+
+#pragma AVRT_CODE_END
+
diff --git a/audio/sysvad/APO/KWSApo/KWSApo.h b/audio/sysvad/APO/KWSApo/KWSApo.h
new file mode 100644
index 00000000..38c3434e
--- /dev/null
+++ b/audio/sysvad/APO/KWSApo/KWSApo.h
@@ -0,0 +1,134 @@
+//
+// KWSApo.h -- Copyright (c) Microsoft Corporation. All rights reserved.
+//
+// Description:
+//
+// Declaration of the CKWSApoEFX class.
+//
+
+#pragma once
+
+#include <audioenginebaseapo.h>
+#include <BaseAudioProcessingObject.h>
+#include <KWSApoInterface.h>
+#include <KWSApoDll.h>
+
+#include <commonmacros.h>
+#include <devicetopology.h>
+
+_Analysis_mode_(_Analysis_code_type_user_driver_)
+
+#pragma AVRT_VTABLES_BEGIN
+// KWS APO class - EFX
+class CKWSApoEFX :
+ public CComObjectRootEx<CComMultiThreadModel>,
+ public CComCoClass<CKWSApoEFX, &CLSID_KWSApoEFX>,
+ public CBaseAudioProcessingObject,
+ public IMMNotificationClient,
+ public IAudioSystemEffects2,
+ public IKWSApoEFX
+{
+public:
+ // constructor
+ CKWSApoEFX()
+ : CBaseAudioProcessingObject(sm_RegProperties)
+ {
+ }
+
+ virtual ~CKWSApoEFX(); // destructor
+
+DECLARE_REGISTRY_RESOURCEID(IDR_KWSAPOEFX)
+
+BEGIN_COM_MAP(CKWSApoEFX)
+ COM_INTERFACE_ENTRY(IKWSApoEFX)
+ COM_INTERFACE_ENTRY(IAudioSystemEffects)
+ COM_INTERFACE_ENTRY(IAudioSystemEffects2)
+ COM_INTERFACE_ENTRY(IMMNotificationClient)
+ COM_INTERFACE_ENTRY(IAudioProcessingObjectRT)
+ COM_INTERFACE_ENTRY(IAudioProcessingObject)
+ COM_INTERFACE_ENTRY(IAudioProcessingObjectConfiguration)
+END_COM_MAP()
+
+DECLARE_PROTECT_FINAL_CONSTRUCT()
+
+public:
+ STDMETHOD_(void, APOProcess)(UINT32 u32NumInputConnections,
+ APO_CONNECTION_PROPERTY** ppInputConnections, UINT32 u32NumOutputConnections,
+ APO_CONNECTION_PROPERTY** ppOutputConnections);
+
+ STDMETHOD(GetLatency)(HNSTIME* pTime);
+
+ STDMETHOD(LockForProcess)(UINT32 u32NumInputConnections,
+ APO_CONNECTION_DESCRIPTOR** ppInputConnections,
+ UINT32 u32NumOutputConnections, APO_CONNECTION_DESCRIPTOR** ppOutputConnections);
+
+ STDMETHOD(Initialize)(UINT32 cbDataSize, BYTE* pbyData);
+
+ // IAudioSystemEffects2
+ STDMETHOD(GetEffectsList)(_Outptr_result_buffer_maybenull_(*pcEffects) LPGUID *ppEffectsIds, _Out_ UINT *pcEffects, _In_ HANDLE Event);
+
+ // IAudioProcessingObject
+ STDMETHOD(IsInputFormatSupported)(IAudioMediaType *pOutputFormat, IAudioMediaType *pRequestedInputFormat, IAudioMediaType **ppSupportedInputFormat);
+ STDMETHOD(IsOutputFormatSupported)(IAudioMediaType *pInputFormat, IAudioMediaType *pRequestedOutputFormat, IAudioMediaType **ppSupportedOutputFormat);
+ STDMETHOD(GetInputChannelCount)(UINT32 *pu32ChannelCount);
+
+ // IMMNotificationClient
+ STDMETHODIMP OnDeviceStateChanged(LPCWSTR pwstrDeviceId, DWORD dwNewState)
+ {
+ UNREFERENCED_PARAMETER(pwstrDeviceId);
+ UNREFERENCED_PARAMETER(dwNewState);
+ return S_OK;
+ }
+ STDMETHODIMP OnDeviceAdded(LPCWSTR pwstrDeviceId)
+ {
+ UNREFERENCED_PARAMETER(pwstrDeviceId);
+ return S_OK;
+ }
+ STDMETHODIMP OnDeviceRemoved(LPCWSTR pwstrDeviceId)
+ {
+ UNREFERENCED_PARAMETER(pwstrDeviceId);
+ return S_OK;
+ }
+ STDMETHODIMP OnDefaultDeviceChanged(EDataFlow flow, ERole role, LPCWSTR pwstrDefaultDeviceId)
+ {
+ UNREFERENCED_PARAMETER(flow);
+ UNREFERENCED_PARAMETER(role);
+ UNREFERENCED_PARAMETER(pwstrDefaultDeviceId);
+ return S_OK;
+ }
+ STDMETHODIMP OnPropertyValueChanged(LPCWSTR pwstrDeviceId, const PROPERTYKEY key)
+ {
+ UNREFERENCED_PARAMETER(pwstrDeviceId);
+ UNREFERENCED_PARAMETER(key);
+ return S_OK;
+ }
+
+public:
+ CComPtr<IPropertyStore> m_spAPOSystemEffectsProperties;
+ CComPtr<IMMDeviceEnumerator> m_spEnumerator;
+ static const CRegAPOProperties<1> sm_RegProperties; // registration properties
+ INTERLEAVED_AUDIO_FORMAT_INFORMATION m_FormatInfo;
+};
+#pragma AVRT_VTABLES_END
+
+OBJECT_ENTRY_AUTO(__uuidof(KWSApoEFX), CKWSApoEFX)
+
+//
+// Declaration of the ProcessBuffer routine.
+//
+void ProcessBuffer(
+ FLOAT32 *pf32OutputFrames,
+ const FLOAT32 *pf32InputFrames,
+ UINT32 u32ValidFrameCount,
+ INTERLEAVED_AUDIO_FORMAT_INFORMATION *formatInfo);
+
+//
+// Convenience methods
+//
+
+void WriteSilence(
+ _Out_writes_(u32FrameCount * u32SamplesPerFrame)
+ FLOAT32 *pf32Frames,
+ UINT32 u32FrameCount,
+ UINT32 u32SamplesPerFrame );
+
diff --git a/audio/sysvad/APO/KWSApo/KWSApo.png b/audio/sysvad/APO/KWSApo/KWSApo.png
new file mode 100644
index 00000000..3a6e102a
--- /dev/null
+++ b/audio/sysvad/APO/KWSApo/KWSApo.png
Binary files differ
diff --git a/audio/sysvad/APO/KWSApo/KWSApo.vcxproj b/audio/sysvad/APO/KWSApo/KWSApo.vcxproj
new file mode 100644
index 00000000..2000bcf4
--- /dev/null
+++ b/audio/sysvad/APO/KWSApo/KWSApo.vcxproj
@@ -0,0 +1,355 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|ARM64">
+ <Configuration>Debug</Configuration>
+ <Platform>ARM64</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|ARM64">
+ <Configuration>Release</Configuration>
+ <Platform>ARM64</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|x64">
+ <Configuration>Debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|x64">
+ <Configuration>Release</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectGuid>{47358AD6-A48A-465B-965F-0A66F8BDFE23}</ProjectGuid>
+ <RootNamespace>$(MSBuildProjectName)</RootNamespace>
+ <SupportsPackaging>false</SupportsPackaging>
+ <RequiresPackageProject>true</RequiresPackageProject>
+ <Configuration Condition="'$(Configuration)' == ''">Debug</Configuration>
+ <Platform Condition="'$(Platform)' == ''">Win32</Platform>
+ <SampleGuid>{D5CCDCB1-348E-414E-BB0F-33C773760034}</SampleGuid>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <TargetVersion>Windows10</TargetVersion>
+ <UseDebugLibraries>False</UseDebugLibraries>
+ <DriverTargetPlatform>Universal</DriverTargetPlatform>
+ <EmbedManifest>false</EmbedManifest>
+ <DriverType />
+ <PlatformToolset>WindowsApplicationForDrivers10.0</PlatformToolset>
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'" Label="Configuration">
+ <TargetVersion>Windows10</TargetVersion>
+ <UseDebugLibraries>False</UseDebugLibraries>
+ <DriverTargetPlatform>Universal</DriverTargetPlatform>
+ <EmbedManifest>false</EmbedManifest>
+ <DriverType />
+ <PlatformToolset>WindowsApplicationForDrivers10.0</PlatformToolset>
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
+ </PropertyGroup>
+ <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <TargetVersion>Windows10</TargetVersion>
+ <UseDebugLibraries>True</UseDebugLibraries>
+ <DriverTargetPlatform>Universal</DriverTargetPlatform>
+ <EmbedManifest>false</EmbedManifest>
+ <DriverType />
+ <PlatformToolset>WindowsApplicationForDrivers10.0</PlatformToolset>
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'" Label="Configuration">
+ <TargetVersion>Windows10</TargetVersion>
+ <UseDebugLibraries>True</UseDebugLibraries>
+ <DriverTargetPlatform>Universal</DriverTargetPlatform>
+ <EmbedManifest>false</EmbedManifest>
+ <DriverType />
+ <PlatformToolset>WindowsApplicationForDrivers10.0</PlatformToolset>
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
+ </PropertyGroup>
+ <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <TargetVersion>Windows10</TargetVersion>
+ <UseDebugLibraries>False</UseDebugLibraries>
+ <DriverTargetPlatform>Universal</DriverTargetPlatform>
+ <EmbedManifest>false</EmbedManifest>
+ <DriverType />
+ <PlatformToolset>WindowsApplicationForDrivers10.0</PlatformToolset>
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
+ </PropertyGroup>
+ <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <TargetVersion>Windows10</TargetVersion>
+ <UseDebugLibraries>True</UseDebugLibraries>
+ <DriverTargetPlatform>Universal</DriverTargetPlatform>
+ <EmbedManifest>false</EmbedManifest>
+ <DriverType />
+ <PlatformToolset>WindowsApplicationForDrivers10.0</PlatformToolset>
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <PropertyGroup>
+ <OutDir>$(IntDir)</OutDir>
+ </PropertyGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
+ </ImportGroup>
+ <ItemGroup Label="WrappedTaskItems" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <TargetName>KWSApo</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">
+ <TargetName>KWSApo</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <TargetName>KWSApo</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">
+ <TargetName>KWSApo</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <TargetName>KWSApo</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <TargetName>KWSApo</TargetName>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <Link>
+ <EntryPointSymbol Condition="'$(Platform)'=='win32'">_DllMainCRTStartup@12</EntryPointSymbol>
+ <EntryPointSymbol Condition="'$(Platform)'!='win32'">_DllMainCRTStartup</EntryPointSymbol>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">
+ <Link>
+ <EntryPointSymbol Condition="'$(Platform)'=='win32'">_DllMainCRTStartup@12</EntryPointSymbol>
+ <EntryPointSymbol Condition="'$(Platform)'!='win32'">_DllMainCRTStartup</EntryPointSymbol>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <Link>
+ <EntryPointSymbol Condition="'$(Platform)'=='win32'">_DllMainCRTStartup@12</EntryPointSymbol>
+ <EntryPointSymbol Condition="'$(Platform)'!='win32'">_DllMainCRTStartup</EntryPointSymbol>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">
+ <Link>
+ <EntryPointSymbol Condition="'$(Platform)'=='win32'">_DllMainCRTStartup@12</EntryPointSymbol>
+ <EntryPointSymbol Condition="'$(Platform)'!='win32'">_DllMainCRTStartup</EntryPointSymbol>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <Link>
+ <EntryPointSymbol Condition="'$(Platform)'=='win32'">_DllMainCRTStartup@12</EntryPointSymbol>
+ <EntryPointSymbol Condition="'$(Platform)'!='win32'">_DllMainCRTStartup</EntryPointSymbol>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <Link>
+ <EntryPointSymbol Condition="'$(Platform)'=='win32'">_DllMainCRTStartup@12</EntryPointSymbol>
+ <EntryPointSymbol Condition="'$(Platform)'!='win32'">_DllMainCRTStartup</EntryPointSymbol>
+ </Link>
+ </ItemDefinitionGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <UseOfAtl>Dynamic</UseOfAtl>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">
+ <UseOfAtl>Dynamic</UseOfAtl>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <UseOfAtl>Dynamic</UseOfAtl>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">
+ <UseOfAtl>Dynamic</UseOfAtl>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <UseOfAtl>Dynamic</UseOfAtl>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <UseOfAtl>Dynamic</UseOfAtl>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <ClCompile>
+ <TreatWarningAsError>true</TreatWarningAsError>
+ <WarningLevel>Level4</WarningLevel>
+ <PreprocessorDefinitions>%(PreprocessorDefinitions);_WINDLL;_USRDLL;UNICODE;_UNICODE</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(DDK_INC_PATH);..\inc;..\..\;.</AdditionalIncludeDirectories>
+ <ExceptionHandling>
+ </ExceptionHandling>
+ <RuntimeLibrary />
+ </ClCompile>
+ <Midl>
+ <PreprocessorDefinitions>%(PreprocessorDefinitions);_WINDLL;_USRDLL;UNICODE;_UNICODE</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(DDK_INC_PATH);..\inc;..\..\</AdditionalIncludeDirectories>
+ </Midl>
+ <ResourceCompile>
+ <PreprocessorDefinitions>%(PreprocessorDefinitions);_WINDLL;_USRDLL;UNICODE;_UNICODE</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(DDK_INC_PATH);..\inc;..\..\</AdditionalIncludeDirectories>
+ </ResourceCompile>
+ <Link>
+ <AdditionalDependencies>%(AdditionalDependencies);Kernel32.lib;ole32.lib;oleaut32.lib;advapi32.lib;user32.lib;uuid.lib;AudioBaseProcessingObjectV140.lib;audiomediatypecrt.lib;AudioEng.lib</AdditionalDependencies>
+ <ModuleDefinitionFile>KWSApoDll.def</ModuleDefinitionFile>
+ <AdditionalOptions>/ignore:4217,4049 %(AdditionalOptions)</AdditionalOptions>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">
+ <ClCompile>
+ <TreatWarningAsError>true</TreatWarningAsError>
+ <WarningLevel>Level4</WarningLevel>
+ <PreprocessorDefinitions>%(PreprocessorDefinitions);_WINDLL;_USRDLL;UNICODE;_UNICODE</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(DDK_INC_PATH);..\inc;..\..\;.</AdditionalIncludeDirectories>
+ <ExceptionHandling>
+ </ExceptionHandling>
+ <RuntimeLibrary>
+ </RuntimeLibrary>
+ </ClCompile>
+ <Midl>
+ <PreprocessorDefinitions>%(PreprocessorDefinitions);_WINDLL;_USRDLL;UNICODE;_UNICODE</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(DDK_INC_PATH);..\inc;..\..\</AdditionalIncludeDirectories>
+ </Midl>
+ <ResourceCompile>
+ <PreprocessorDefinitions>%(PreprocessorDefinitions);_WINDLL;_USRDLL;UNICODE;_UNICODE</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(DDK_INC_PATH);..\inc;..\..\</AdditionalIncludeDirectories>
+ </ResourceCompile>
+ <Link>
+ <AdditionalDependencies>%(AdditionalDependencies);Kernel32.lib;ole32.lib;oleaut32.lib;advapi32.lib;user32.lib;uuid.lib;AudioBaseProcessingObjectV140.lib;audiomediatypecrt.lib;AudioEng.lib</AdditionalDependencies>
+ <ModuleDefinitionFile>KWSApoDll.def</ModuleDefinitionFile>
+ <AdditionalOptions>/ignore:4217,4049 %(AdditionalOptions)</AdditionalOptions>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <ClCompile>
+ <TreatWarningAsError>true</TreatWarningAsError>
+ <WarningLevel>Level4</WarningLevel>
+ <PreprocessorDefinitions>%(PreprocessorDefinitions);_WINDLL;_USRDLL;UNICODE;_UNICODE</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(DDK_INC_PATH);..\inc;..\..\;.</AdditionalIncludeDirectories>
+ <ExceptionHandling>
+ </ExceptionHandling>
+ <RuntimeLibrary />
+ </ClCompile>
+ <Midl>
+ <PreprocessorDefinitions>%(PreprocessorDefinitions);_WINDLL;_USRDLL;UNICODE;_UNICODE</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(DDK_INC_PATH);..\inc;..\..\</AdditionalIncludeDirectories>
+ </Midl>
+ <ResourceCompile>
+ <PreprocessorDefinitions>%(PreprocessorDefinitions);_WINDLL;_USRDLL;UNICODE;_UNICODE</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(DDK_INC_PATH);..\inc;..\..\</AdditionalIncludeDirectories>
+ </ResourceCompile>
+ <Link>
+ <AdditionalDependencies>%(AdditionalDependencies);Kernel32.lib;ole32.lib;oleaut32.lib;advapi32.lib;user32.lib;uuid.lib;AudioBaseProcessingObjectV140.lib;audiomediatypecrt.lib;AudioEng.lib</AdditionalDependencies>
+ <ModuleDefinitionFile>KWSApoDll.def</ModuleDefinitionFile>
+ <AdditionalOptions>/ignore:4217,4049 %(AdditionalOptions)</AdditionalOptions>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">
+ <ClCompile>
+ <TreatWarningAsError>true</TreatWarningAsError>
+ <WarningLevel>Level4</WarningLevel>
+ <PreprocessorDefinitions>%(PreprocessorDefinitions);_WINDLL;_USRDLL;UNICODE;_UNICODE</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(DDK_INC_PATH);..\inc;..\..\;.</AdditionalIncludeDirectories>
+ <ExceptionHandling>
+ </ExceptionHandling>
+ <RuntimeLibrary>
+ </RuntimeLibrary>
+ </ClCompile>
+ <Midl>
+ <PreprocessorDefinitions>%(PreprocessorDefinitions);_WINDLL;_USRDLL;UNICODE;_UNICODE</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(DDK_INC_PATH);..\inc;..\..\</AdditionalIncludeDirectories>
+ </Midl>
+ <ResourceCompile>
+ <PreprocessorDefinitions>%(PreprocessorDefinitions);_WINDLL;_USRDLL;UNICODE;_UNICODE</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(DDK_INC_PATH);..\inc;..\..\</AdditionalIncludeDirectories>
+ </ResourceCompile>
+ <Link>
+ <AdditionalDependencies>%(AdditionalDependencies);Kernel32.lib;ole32.lib;oleaut32.lib;advapi32.lib;user32.lib;uuid.lib;AudioBaseProcessingObjectV140.lib;audiomediatypecrt.lib;AudioEng.lib</AdditionalDependencies>
+ <ModuleDefinitionFile>KWSApoDll.def</ModuleDefinitionFile>
+ <AdditionalOptions>/ignore:4217,4049 %(AdditionalOptions)</AdditionalOptions>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <TreatWarningAsError>true</TreatWarningAsError>
+ <WarningLevel>Level4</WarningLevel>
+ <PreprocessorDefinitions>%(PreprocessorDefinitions);_WINDLL;_USRDLL;UNICODE;_UNICODE</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(DDK_INC_PATH);..\inc;..\..\;.</AdditionalIncludeDirectories>
+ <ExceptionHandling>
+ </ExceptionHandling>
+ <RuntimeLibrary />
+ </ClCompile>
+ <Midl>
+ <PreprocessorDefinitions>%(PreprocessorDefinitions);_WINDLL;_USRDLL;UNICODE;_UNICODE</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(DDK_INC_PATH);..\inc;..\..\</AdditionalIncludeDirectories>
+ </Midl>
+ <ResourceCompile>
+ <PreprocessorDefinitions>%(PreprocessorDefinitions);_WINDLL;_USRDLL;UNICODE;_UNICODE</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(DDK_INC_PATH);..\inc;..\..\</AdditionalIncludeDirectories>
+ </ResourceCompile>
+ <Link>
+ <AdditionalDependencies>%(AdditionalDependencies);Kernel32.lib;ole32.lib;oleaut32.lib;advapi32.lib;user32.lib;uuid.lib;AudioBaseProcessingObjectV140.lib;audiomediatypecrt.lib;AudioEng.lib</AdditionalDependencies>
+ <ModuleDefinitionFile>KWSApoDll.def</ModuleDefinitionFile>
+ <AdditionalOptions>/ignore:4217,4049 %(AdditionalOptions)</AdditionalOptions>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <TreatWarningAsError>true</TreatWarningAsError>
+ <WarningLevel>Level4</WarningLevel>
+ <PreprocessorDefinitions>%(PreprocessorDefinitions);_WINDLL;_USRDLL;UNICODE;_UNICODE</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(DDK_INC_PATH);..\inc;..\..\;.</AdditionalIncludeDirectories>
+ <ExceptionHandling>
+ </ExceptionHandling>
+ <RuntimeLibrary />
+ </ClCompile>
+ <Midl>
+ <PreprocessorDefinitions>%(PreprocessorDefinitions);_WINDLL;_USRDLL;UNICODE;_UNICODE</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(DDK_INC_PATH);..\inc;..\..\</AdditionalIncludeDirectories>
+ </Midl>
+ <ResourceCompile>
+ <PreprocessorDefinitions>%(PreprocessorDefinitions);_WINDLL;_USRDLL;UNICODE;_UNICODE</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(DDK_INC_PATH);..\inc;..\..\</AdditionalIncludeDirectories>
+ </ResourceCompile>
+ <Link>
+ <AdditionalDependencies>%(AdditionalDependencies);Kernel32.lib;ole32.lib;oleaut32.lib;advapi32.lib;user32.lib;uuid.lib;AudioBaseProcessingObjectV140.lib;audiomediatypecrt.lib;AudioEng.lib</AdditionalDependencies>
+ <ModuleDefinitionFile>KWSApoDll.def</ModuleDefinitionFile>
+ <AdditionalOptions>/ignore:4217,4049 %(AdditionalOptions)</AdditionalOptions>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <ClCompile Include="KWSApo.cpp" />
+ <ClCompile Include="KWSApoDll.cpp" />
+ <ClCompile Include="KWSApoEFX.cpp" />
+ <Midl Include="KWSApoDll.idl" />
+ <Midl Include="KWSApoInterface.idl" />
+ <ResourceCompile Include="KWSApoDll.rc" />
+ </ItemGroup>
+ <ItemGroup>
+ <Inf Exclude="@(Inf)" Include="*.inf" />
+ <FilesToPackage Include="$(TargetPath)" Condition="'$(ConfigurationType)'=='Driver' or '$(ConfigurationType)'=='DynamicLibrary'" />
+ </ItemGroup>
+ <ItemGroup>
+ <None Exclude="@(None)" Include="*.txt;*.htm;*.html" />
+ <None Exclude="@(None)" Include="*.ico;*.cur;*.bmp;*.dlg;*.rct;*.gif;*.jpg;*.jpeg;*.wav;*.jpe;*.tiff;*.tif;*.png;*.rc2" />
+ <None Exclude="@(None)" Include="*.def;*.bat;*.hpj;*.asmx" />
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Exclude="@(ClInclude)" Include="*.h;*.hpp;*.hxx;*.hm;*.inl;*.xsd" />
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+</Project>
diff --git a/audio/sysvad/APO/KWSApo/KWSApo.vcxproj.Filters b/audio/sysvad/APO/KWSApo/KWSApo.vcxproj.Filters
new file mode 100644
index 00000000..7ff54ea8
--- /dev/null
+++ b/audio/sysvad/APO/KWSApo/KWSApo.vcxproj.Filters
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="Source Files">
+ <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx;*</Extensions>
+ <UniqueIdentifier>{5f4ff11d-7a0b-4f75-9d79-744ae028cc53}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="Header Files">
+ <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
+ <UniqueIdentifier>{bd103b81-05b2-440e-84e7-0723d7fe4109}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="Resource Files">
+ <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms;man;xml</Extensions>
+ <UniqueIdentifier>{a57b6b78-38ae-4348-ade3-0200e81a3dd7}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="IDL Files">
+ <Extensions>idl</Extensions>
+ <UniqueIdentifier>{c6318700-1bce-4812-92f1-160881e4c976}</UniqueIdentifier>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <Midl Include="KWSApoDll.idl">
+ <Filter>IDL Files</Filter>
+ </Midl>
+ <Midl Include="KWSApoInterface.idl">
+ <Filter>IDL Files</Filter>
+ </Midl>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="*.h;*.hpp;*.hxx;*.hm;*.inl;*.xsd">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="*.rc;*.ico;*.cur;*.bmp;*.dlg;*.rct;*.gif;*.jpg;*.jpeg;*.wav;*.jpe;*.tiff;*.tif;*.png;*.rc2">
+ <Filter>Resource Files</Filter>
+ </None>
+ <None Include="*.cpp;*.def;*.bat;*.hpj;*.asmx">
+ <Filter>Source Files</Filter>
+ </None>
+ </ItemGroup>
+</Project> \ No newline at end of file
diff --git a/audio/sysvad/APO/KWSApo/KWSApoDll.cpp b/audio/sysvad/APO/KWSApo/KWSApoDll.cpp
new file mode 100644
index 00000000..f8cbc95f
--- /dev/null
+++ b/audio/sysvad/APO/KWSApo/KWSApoDll.cpp
@@ -0,0 +1,71 @@
+//
+// KWSApoDll.cpp -- Copyright (c) Microsoft Corporation. All rights reserved.
+//
+// Author:
+//
+// Description:
+//
+// KWSApoDll.cpp : Implementation of DLL Exports.
+
+#include <atlbase.h>
+#include <atlcom.h>
+#include <atlcoll.h>
+#include <atlsync.h>
+#include <mmreg.h>
+
+#include "resource.h"
+#include "KWSApoDll.h"
+#include <KWSApo.h>
+
+#include <KWSApoDll_i.c>
+
+
+//-------------------------------------------------------------------------
+// Array of APO_REG_PROPERTIES structures implemented in this module.
+// Each new APO implementation will be added to this array.
+//
+APO_REG_PROPERTIES const *gCoreAPOs[] =
+{
+ &CKWSApoEFX::sm_RegProperties.m_Properties
+};
+
+// {secret}
+class CKWSApoDllModule : public CAtlDllModuleT< CKWSApoDllModule >
+{
+public :
+ DECLARE_LIBID(LIBID_KWSApoDlllib)
+ DECLARE_REGISTRY_APPID_RESOURCEID(IDR_KWSAPODLL, "{0A21D954-674A-4C09-806E-DB4FBE8F199C}")
+
+};
+
+// {secret}
+CKWSApoDllModule _AtlModule;
+
+
+// {secret}
+extern "C" BOOL WINAPI DllMain(HINSTANCE /* hInstance */, DWORD dwReason, LPVOID lpReserved)
+{
+ if (DLL_PROCESS_ATTACH == dwReason)
+ {
+ }
+ // do necessary cleanup only if the DLL is being unloaded dynamically
+ else if ((DLL_PROCESS_DETACH == dwReason) && (NULL == lpReserved))
+ {
+ }
+
+ return _AtlModule.DllMain(dwReason, lpReserved);
+}
+
+
+// {secret}
+STDAPI DllCanUnloadNow(void)
+{
+ return _AtlModule.DllCanUnloadNow();
+}
+
+
+// {secret}
+STDAPI DllGetClassObject(_In_ REFCLSID rclsid,_In_ REFIID riid, _Outptr_ LPVOID* ppv)
+{
+ return _AtlModule.DllGetClassObject(rclsid, riid, ppv);
+}
diff --git a/audio/sysvad/APO/KWSApo/KWSApoDll.def b/audio/sysvad/APO/KWSApo/KWSApoDll.def
new file mode 100644
index 00000000..3f3b0c5a
--- /dev/null
+++ b/audio/sysvad/APO/KWSApo/KWSApoDll.def
@@ -0,0 +1,4 @@
+
+EXPORTS
+ DllCanUnloadNow PRIVATE
+ DllGetClassObject PRIVATE \ No newline at end of file
diff --git a/audio/sysvad/APO/KWSApo/KWSApoDll.idl b/audio/sysvad/APO/KWSApo/KWSApoDll.idl
new file mode 100644
index 00000000..086643d7
--- /dev/null
+++ b/audio/sysvad/APO/KWSApo/KWSApoDll.idl
@@ -0,0 +1,40 @@
+//
+// KWSAPODll.idl -- Copyright (c) Microsoft Corporation. All rights reserved.
+//
+// Author:
+//
+// Description:
+//
+// KWSAPODll.idl : Definition of COM interfaces and coclasses for the DLL.
+
+import "oaidl.idl";
+import "ocidl.idl";
+import "KWSApoInterface.idl";
+
+//-------------------------------------------------------------------------
+// KWSApoDlllib
+//
+[
+ uuid(E928E566-CBA7-4181-9B8B-8822E2BD28AB),
+ version(1.0)
+]
+library KWSApoDlllib
+{
+ importlib("stdole2.tlb");
+
+ // for KWS APO - EFX
+ [
+ uuid(9D89F614-F9D6-40DD-9F21-5E69FA3981ED)
+ ]
+ coclass KWSApoEFX
+ {
+ interface IAudioProcessingObject;
+ interface IAudioProcessingObjectRT;
+ interface IAudioProcessingObjectConfiguration;
+ interface IMMNotificationClient;
+ interface IAudioSystemEffects;
+ [default] interface IKWSApoEFX;
+ };
+
+
+}
diff --git a/audio/sysvad/APO/KWSApo/KWSApoDll.rc b/audio/sysvad/APO/KWSApo/KWSApoDll.rc
new file mode 100644
index 00000000..9add8452
--- /dev/null
+++ b/audio/sysvad/APO/KWSApo/KWSApoDll.rc
@@ -0,0 +1,20 @@
+#if 0
+Copyright (c) Microsoft Corporation. All Rights Reserved
+#endif
+
+#include "resource.h"
+#include "winres.h"
+#include <ntverp.h>
+#define VER_FILETYPE VFT_DLL
+#define VER_FILESUBTYPE VFT_UNKNOWN
+#define VER_FILEDESCRIPTION_STR "KWS APO"
+#define VER_INTERNALNAME_STR "KWSApo"
+#define VER_ORIGINALFILENAME_STR "KWSApo.Dll"
+#include <Common.ver>
+
+IDR_KWSAPODLL REGISTRY "KWSApoDll.rgs"
+IDR_KWSAPOEFX REGISTRY "KWSApoEFX.rgs"
+
+// ICON
+IDI_EFFECT_ICON RCDATA "KWSApo.png"
+
diff --git a/audio/sysvad/APO/KWSApo/KWSApoDll.rgs b/audio/sysvad/APO/KWSApo/KWSApoDll.rgs
new file mode 100644
index 00000000..b89d2a41
--- /dev/null
+++ b/audio/sysvad/APO/KWSApo/KWSApoDll.rgs
@@ -0,0 +1,11 @@
+HKCR
+{
+ NoRemove AppID
+ {
+ '%APPID%' = s 'KWSApoDll'
+ 'KWSApoDll.DLL'
+ {
+ val AppID = s '%APPID%'
+ }
+ }
+}
diff --git a/audio/sysvad/APO/KWSApo/KWSApoEfx.cpp b/audio/sysvad/APO/KWSApo/KWSApoEfx.cpp
new file mode 100644
index 00000000..5924cd36
--- /dev/null
+++ b/audio/sysvad/APO/KWSApo/KWSApoEfx.cpp
@@ -0,0 +1,599 @@
+//
+// KWSApoEFX.cpp -- Copyright (c) Microsoft Corporation. All rights reserved.
+//
+// Description:
+//
+// Implementation of CKWSApoEFX
+//
+
+#include <atlbase.h>
+#include <atlcom.h>
+#include <atlcoll.h>
+#include <atlsync.h>
+#include <mmreg.h>
+
+#include <initguid.h>
+#include <audioenginebaseapo.h>
+#include <baseaudioprocessingobject.h>
+#include <resource.h>
+
+#include <float.h>
+
+#include "KWSApo.h"
+#include <devicetopology.h>
+#include <CustomPropKeys.h>
+
+// Static declaration of the APO_REG_PROPERTIES structure
+// associated with this APO. The number in <> brackets is the
+// number of IIDs supported by this APO. If more than one, then additional
+// IIDs are added at the end
+#pragma warning (disable : 4815)
+const AVRT_DATA CRegAPOProperties<1> CKWSApoEFX::sm_RegProperties(
+ __uuidof(KWSApoEFX), // clsid of this APO
+ L"CKWSApoEFX", // friendly name of this APO
+ L"Copyright (c) Microsoft Corporation", // copyright info
+ 1, // major version #
+ 0, // minor version #
+ __uuidof(IKWSApoEFX), // iid of primary interface
+ (APO_FLAG) (APO_FLAG_BITSPERSAMPLE_MUST_MATCH | APO_FLAG_FRAMESPERSECOND_MUST_MATCH),
+ DEFAULT_APOREG_MININPUTCONNECTIONS,
+ DEFAULT_APOREG_MAXINPUTCONNECTIONS,
+ DEFAULT_APOREG_MINOUTPUTCONNECTIONS,
+ DEFAULT_APOREG_MAXOUTPUTCONNECTIONS,
+ DEFAULT_APOREG_MAXINSTANCES
+ );
+
+
+#pragma AVRT_CODE_BEGIN
+//-------------------------------------------------------------------------
+// Description:
+//
+// Do the actual processing of data.
+//
+// Parameters:
+//
+// u32NumInputConnections - [in] number of input connections
+// ppInputConnections - [in] pointer to list of input APO_CONNECTION_PROPERTY pointers
+// u32NumOutputConnections - [in] number of output connections
+// ppOutputConnections - [in] pointer to list of output APO_CONNECTION_PROPERTY pointers
+//
+// Return values:
+//
+// void
+//
+// Remarks:
+//
+// This function processes data in a manner dependent on the implementing
+// object. This routine can not fail and can not block, or call any other
+// routine that blocks, or touch pagable memory.
+//
+STDMETHODIMP_(void) CKWSApoEFX::APOProcess(
+ UINT32 u32NumInputConnections,
+ APO_CONNECTION_PROPERTY** ppInputConnections,
+ UINT32 u32NumOutputConnections,
+ APO_CONNECTION_PROPERTY** ppOutputConnections)
+{
+ UNREFERENCED_PARAMETER(u32NumInputConnections);
+ UNREFERENCED_PARAMETER(u32NumOutputConnections);
+
+ FLOAT32 *pf32InputFrames, *pf32OutputFrames;
+
+ ATLASSERT(m_bIsLocked);
+
+ // assert that the number of input and output connectins fits our registration properties
+ ATLASSERT(m_pRegProperties->u32MinInputConnections <= u32NumInputConnections);
+ ATLASSERT(m_pRegProperties->u32MaxInputConnections >= u32NumInputConnections);
+ ATLASSERT(m_pRegProperties->u32MinOutputConnections <= u32NumOutputConnections);
+ ATLASSERT(m_pRegProperties->u32MaxOutputConnections >= u32NumOutputConnections);
+
+ // check APO_BUFFER_FLAGS.
+ switch( ppInputConnections[0]->u32BufferFlags )
+ {
+ case BUFFER_INVALID:
+ {
+ ATLASSERT(false); // invalid flag - should never occur. don't do anything.
+ break;
+ }
+ case BUFFER_VALID:
+ case BUFFER_SILENT:
+ {
+ // get input pointer to connection buffer
+ pf32InputFrames = reinterpret_cast<FLOAT32*>(ppInputConnections[0]->pBuffer);
+ ATLASSERT( IS_VALID_TYPED_READ_POINTER(pf32InputFrames) );
+
+ // get output pointer to connection buffer
+ pf32OutputFrames = reinterpret_cast<FLOAT32*>(ppOutputConnections[0]->pBuffer);
+ ATLASSERT( IS_VALID_TYPED_WRITE_POINTER(pf32OutputFrames) );
+
+ if (BUFFER_SILENT == ppInputConnections[0]->u32BufferFlags)
+ {
+ WriteSilence( pf32OutputFrames,
+ ppInputConnections[0]->u32ValidFrameCount,
+ GetSamplesPerFrame() );
+ }
+ else
+ {
+ ProcessBuffer(pf32OutputFrames, pf32InputFrames,
+ ppInputConnections[0]->u32ValidFrameCount,
+ &m_FormatInfo);
+
+ // we don't try to remember silence
+ ppOutputConnections[0]->u32BufferFlags = BUFFER_VALID;
+ }
+
+ // Set the valid frame count.
+ ppOutputConnections[0]->u32ValidFrameCount = ppInputConnections[0]->u32ValidFrameCount;
+
+ break;
+ }
+ default:
+ {
+ ATLASSERT(false); // invalid flag - should never occur
+ break;
+ }
+ } // switch
+
+} // APOProcess
+#pragma AVRT_CODE_END
+
+//-------------------------------------------------------------------------
+// Description:
+//
+// Parameters:
+//
+// pTime - [out] hundreds-of-nanoseconds
+//
+// Return values:
+//
+// S_OK on success, a failure code on failure
+STDMETHODIMP CKWSApoEFX::GetLatency(HNSTIME* pTime)
+{
+ ASSERT_NONREALTIME();
+ HRESULT hr = S_OK;
+
+ IF_TRUE_ACTION_JUMP(NULL == pTime, hr = E_POINTER, Exit);
+
+ *pTime = 0;
+
+Exit:
+ return hr;
+}
+
+
+//-------------------------------------------------------------------------
+// Description:
+//
+// Verifies that the APO is ready to process and locks its state if so.
+//
+// Parameters:
+//
+// u32NumInputConnections - [in] number of input connections attached to this APO
+// ppInputConnections - [in] connection descriptor of each input connection attached to this APO
+// u32NumOutputConnections - [in] number of output connections attached to this APO
+// ppOutputConnections - [in] connection descriptor of each output connection attached to this APO
+//
+// Return values:
+//
+// S_OK Object is locked and ready to process.
+// E_POINTER Invalid pointer passed to function.
+// APOERR_INVALID_CONNECTION_FORMAT Invalid connection format.
+// APOERR_NUM_CONNECTIONS_INVALID Number of input or output connections is not valid on
+// this APO.
+STDMETHODIMP CKWSApoEFX::LockForProcess(UINT32 u32NumInputConnections,
+ APO_CONNECTION_DESCRIPTOR** ppInputConnections,
+ UINT32 u32NumOutputConnections, APO_CONNECTION_DESCRIPTOR** ppOutputConnections)
+{
+ ASSERT_NONREALTIME();
+ HRESULT hr = S_OK;
+
+ UNCOMPRESSEDAUDIOFORMAT uncompAudioFormat;
+
+ // fill in the samples per frame for the output (since APO_FLAG_SAMPLESPERFRAME_MUST_MATCH is not selected)
+ // There are two potentially different samples per frame values here. The input, which will be interleaved + primary.
+ // And the output, which is just the primary. Because this is used for clearing the zeroing the output buffer, we're going
+ // to fill it in with the output samples per frame. ProcessBuffer has both.
+ hr = ppOutputConnections[0]->pFormat->GetUncompressedAudioFormat(&uncompAudioFormat);
+ IF_FAILED_JUMP(hr, Exit);
+
+ m_u32SamplesPerFrame = uncompAudioFormat.dwSamplesPerFrame;
+
+ hr = CBaseAudioProcessingObject::LockForProcess(u32NumInputConnections,
+ ppInputConnections, u32NumOutputConnections, ppOutputConnections);
+ IF_FAILED_JUMP(hr, Exit);
+
+Exit:
+ return hr;
+}
+
+// The method that this long comment refers to is "Initialize()"
+//-------------------------------------------------------------------------
+// Description:
+//
+// Generic initialization routine for APOs.
+//
+// Parameters:
+//
+// cbDataSize - [in] the size in bytes of the initialization data.
+// pbyData - [in] initialization data specific to this APO
+//
+// Return values:
+//
+// S_OK Successful completion.
+// E_POINTER Invalid pointer passed to this function.
+// E_INVALIDARG Invalid argument
+// AEERR_ALREADY_INITIALIZED APO is already initialized
+//
+// Remarks:
+//
+// This method initializes the APO. The data is variable length and
+// should have the form of:
+//
+// struct MyAPOInitializationData
+// {
+// APOInitBaseStruct APOInit;
+// ... // add additional fields here
+// };
+//
+// If the APO needs no initialization or needs no data to initialize
+// itself, it is valid to pass NULL as the pbyData parameter and 0 as
+// the cbDataSize parameter.
+//
+// As part of designing an APO, decide which parameters should be
+// immutable (set once during initialization) and which mutable (changeable
+// during the lifetime of the APO instance). Immutable parameters must
+// only be specifiable in the Initialize call; mutable parameters must be
+// settable via methods on whichever parameter control interface(s) your
+// APO provides. Mutable values should either be set in the initialize
+// method (if they are required for proper operation of the APO prior to
+// LockForProcess) or default to reasonable values upon initialize and not
+// be required to be set before LockForProcess.
+//
+// Within the mutable parameters, you must also decide which can be changed
+// while the APO is locked for processing and which cannot.
+//
+// All parameters should be considered immutable as a first choice, unless
+// there is a specific scenario which requires them to be mutable; similarly,
+// no mutable parameters should be changeable while the APO is locked, unless
+// a specific scenario requires them to be. Following this guideline will
+// simplify the APO's state diagram and implementation and prevent certain
+// types of bug.
+//
+// If a parameter changes the APOs latency or MaxXXXFrames values, it must be
+// immutable.
+//
+// The default version of this function uses no initialization data, but does verify
+// the passed parameters and set the m_bIsInitialized member to true.
+//
+// Note: This method may not be called from a real-time processing thread.
+//
+
+HRESULT CKWSApoEFX::Initialize(UINT32 cbDataSize, BYTE* pbyData)
+{
+ HRESULT hr = S_OK;
+ CComPtr<IMMDevice> spMyDevice;
+ CComPtr<IDeviceTopology> spMyDeviceTopology;
+ CComPtr<IConnector> spMyConnector;
+ CComPtr<IPart> spPart;
+ UINT myPartId;
+ CComPtr<IKsControl> spKsControl;
+ ULONG cbReturned = 0;
+
+ IF_TRUE_ACTION_JUMP( ((NULL == pbyData) && (0 != cbDataSize)), hr = E_INVALIDARG, Exit);
+ IF_TRUE_ACTION_JUMP( ((NULL != pbyData) && (0 == cbDataSize)), hr = E_INVALIDARG, Exit);
+
+ if (cbDataSize == sizeof(APOInitSystemEffects2))
+ {
+ //
+ // Initialize for mode-specific signal processing
+ //
+ APOInitSystemEffects2* papoSysFxInit2 = (APOInitSystemEffects2*)pbyData;
+ KSP_PIN ksPinProperty;
+
+ // Save reference to the effects property store. This saves effects settings
+ // and is the communication medium between this APO and any associated UI.
+ m_spAPOSystemEffectsProperties = papoSysFxInit2->pAPOSystemEffectsProperties;
+
+ // Windows should pass a valid collection.
+ ATLASSERT(papoSysFxInit2->pDeviceCollection != nullptr);
+ IF_TRUE_ACTION_JUMP(papoSysFxInit2->pDeviceCollection == nullptr, hr = E_INVALIDARG, Exit);
+
+ // Get the IDeviceTopology and IConnector interfaces to communicate with this
+ // APO's counterpart audio driver. This can be used for any proprietary
+ // communication.
+ hr = papoSysFxInit2->pDeviceCollection->Item(papoSysFxInit2->nSoftwareIoDeviceInCollection, &spMyDevice);
+ IF_FAILED_JUMP(hr, Exit);
+
+ hr = spMyDevice->Activate(__uuidof(IKsControl), CLSCTX_ALL, NULL, (void**)&spKsControl);
+ IF_FAILED_JUMP(hr, Exit);
+
+ hr = spMyDevice->Activate(__uuidof(IDeviceTopology), CLSCTX_ALL, NULL, (void**)&spMyDeviceTopology);
+ IF_FAILED_JUMP(hr, Exit);
+
+ hr = spMyDeviceTopology->GetConnector(papoSysFxInit2->nSoftwareIoConnectorIndex, &spMyConnector);
+ IF_FAILED_JUMP(hr, Exit);
+
+ spPart = spMyConnector;
+
+ hr = spPart->GetLocalId(&myPartId);
+ IF_FAILED_JUMP(hr, Exit);
+
+ ::ZeroMemory(&ksPinProperty, sizeof(ksPinProperty));
+ ksPinProperty.Property.Set = KSPROPSETID_InterleavedAudio;
+ ksPinProperty.Property.Id = KSPROPERTY_INTERLEAVEDAUDIO_FORMATINFORMATION;
+ ksPinProperty.Property.Flags = KSPROPERTY_TYPE_GET;
+ ksPinProperty.PinId = myPartId & 0x0000ffff;
+
+ ::ZeroMemory(&m_FormatInfo, sizeof(m_FormatInfo));
+
+ hr = spKsControl->KsProperty(&(ksPinProperty.Property), sizeof(ksPinProperty), &m_FormatInfo, sizeof(m_FormatInfo), &cbReturned);
+ IF_FAILED_JUMP(hr, Exit);
+
+ IF_TRUE_ACTION_JUMP( m_FormatInfo.Size != sizeof(m_FormatInfo), hr = E_INVALIDARG, Exit);
+ }
+ else
+ {
+ // Invalid initialization size
+ hr = E_INVALIDARG;
+ goto Exit;
+ }
+
+ //
+ // Register for notification of registry updates
+ //
+ hr = m_spEnumerator.CoCreateInstance(__uuidof(MMDeviceEnumerator));
+ IF_FAILED_JUMP(hr, Exit);
+
+ hr = m_spEnumerator->RegisterEndpointNotificationCallback(this);
+ IF_FAILED_JUMP(hr, Exit);
+
+ m_bIsInitialized = true;
+
+
+Exit:
+ return hr;
+}
+
+//-------------------------------------------------------------------------
+// Description:
+//
+//
+//
+// Parameters:
+//
+//
+//
+// Return values:
+//
+//
+//
+// Remarks:
+//
+//
+STDMETHODIMP CKWSApoEFX::GetEffectsList(_Outptr_result_buffer_maybenull_(*pcEffects) LPGUID *ppEffectsIds, _Out_ UINT *pcEffects, _In_ HANDLE Event)
+{
+ UNREFERENCED_PARAMETER(Event);
+
+ *ppEffectsIds = NULL;
+ *pcEffects = 0;
+
+ return S_OK;
+}
+
+//-------------------------------------------------------------------------
+// Description:
+//
+//
+//
+// Parameters:
+//
+//
+//
+// Return values:
+//
+//
+//
+// Remarks:
+//
+//
+STDMETHODIMP CKWSApoEFX::IsInputFormatSupported(IAudioMediaType *pOutputFormat, IAudioMediaType *pRequestedInputFormat, IAudioMediaType **ppSupportedInputFormat)
+{
+ ASSERT_NONREALTIME();
+ bool formatChanged = false;
+ HRESULT hResult;
+ UNCOMPRESSEDAUDIOFORMAT uncompInputFormat;
+ IAudioMediaType *recommendedFormat = NULL;
+ UINT totalChannelCount = (m_FormatInfo.PrimaryChannelCount + m_FormatInfo.InterleavedChannelCount);
+
+ IF_TRUE_ACTION_JUMP((NULL == pRequestedInputFormat) || (NULL == ppSupportedInputFormat), hResult = E_POINTER, Exit);
+ *ppSupportedInputFormat = NULL;
+
+ // Initial comparison to make sure the requested format is valid and consistent with the output
+ // format. Because of the APO flags specified during creation, the samples per frame value will
+ // not be validated.
+ hResult = IsFormatTypeSupported( pOutputFormat, pRequestedInputFormat, &recommendedFormat, true );
+ IF_FAILED_JUMP(hResult, Exit);
+
+ // If the input format is changed, make sure we track it for our return code.
+ if (S_FALSE == hResult)
+ {
+ formatChanged = true;
+ }
+
+ // now retrieve the format that IsFormatTypeSupported decided on, building upon that by adding
+ // our channel count constraint.
+ hResult = recommendedFormat->GetUncompressedAudioFormat(&uncompInputFormat);
+ IF_FAILED_JUMP(hResult, Exit);
+
+ // the expected input channel count, for interleaved audio, is the total number of channels
+ // reported in the interleaved format information. Fail any request for a format that doesn't
+ // meet that requirement.
+ if (uncompInputFormat.dwSamplesPerFrame != totalChannelCount)
+ {
+ hResult = APOERR_FORMAT_NOT_SUPPORTED;
+ goto Exit;
+ }
+
+ // If the requested format exactly matched our requirements,
+ // just return it.
+ if(!formatChanged)
+ {
+ *ppSupportedInputFormat = pRequestedInputFormat;
+ (*ppSupportedInputFormat)->AddRef();
+ hResult = S_OK;
+ }
+ else // we're proposing something different than the input, copy it and return S_FALSE;
+ {
+ hResult = CreateAudioMediaTypeFromUncompressedAudioFormat(&uncompInputFormat, ppSupportedInputFormat);
+ IF_FAILED_JUMP(hResult, Exit);
+
+ hResult = S_FALSE;
+ }
+
+Exit:
+
+ if (recommendedFormat)
+ {
+ recommendedFormat->Release();
+ }
+
+ return hResult;
+}
+
+//-------------------------------------------------------------------------
+// Description:
+//
+//
+//
+// Parameters:
+//
+//
+//
+// Return values:
+//
+//
+//
+// Remarks:
+//
+//
+STDMETHODIMP CKWSApoEFX::IsOutputFormatSupported(IAudioMediaType *pInputFormat, IAudioMediaType *pRequestedOutputFormat, IAudioMediaType **ppSupportedOutputFormat)
+{
+ ASSERT_NONREALTIME();
+ bool formatChanged = false;
+ HRESULT hResult;
+ UNCOMPRESSEDAUDIOFORMAT uncompOutputFormat;
+ IAudioMediaType *recommendedFormat = NULL;
+
+ IF_TRUE_ACTION_JUMP((NULL == pRequestedOutputFormat) || (NULL == ppSupportedOutputFormat), hResult = E_POINTER, Exit);
+ *ppSupportedOutputFormat = NULL;
+
+ // Initial comparison to make sure the requested format is valid and consistent with the input
+ // format. Because of the APO flags specified during creation, the samples per frame value will
+ // not be validated.
+ hResult = IsFormatTypeSupported( pInputFormat, pRequestedOutputFormat, &recommendedFormat, true );
+ IF_FAILED_JUMP(hResult, Exit);
+
+ // If the output format is changed, make sure we track it for our return code.
+ if (S_FALSE == hResult)
+ {
+ formatChanged = true;
+ }
+
+ // now retrieve the format that IsFormatTypeSupported decided on, building upon that by adding
+ // our channel count constraint.
+ hResult = recommendedFormat->GetUncompressedAudioFormat(&uncompOutputFormat);
+ IF_FAILED_JUMP(hResult, Exit);
+
+ // The expected output channel count is the number of primary channels in the interleaved data.
+ // We're removing the interleaved data.
+ if (uncompOutputFormat.dwSamplesPerFrame != m_FormatInfo.PrimaryChannelCount)
+ {
+ uncompOutputFormat.dwSamplesPerFrame = m_FormatInfo.PrimaryChannelCount;
+ uncompOutputFormat.dwChannelMask = m_FormatInfo.PrimaryChannelMask;
+ formatChanged = true;
+ }
+
+ // If the requested format exactly matched our requirements,
+ // just return it.
+ if(!formatChanged)
+ {
+ *ppSupportedOutputFormat = pRequestedOutputFormat;
+ (*ppSupportedOutputFormat)->AddRef();
+ hResult = S_OK;
+ }
+ else // we're proposing something different, copy it and return S_FALSE;
+ {
+ hResult = CreateAudioMediaTypeFromUncompressedAudioFormat(&uncompOutputFormat, ppSupportedOutputFormat);
+ IF_FAILED_JUMP(hResult, Exit);
+ hResult = S_FALSE;
+ }
+
+Exit:
+
+ if (recommendedFormat)
+ {
+ recommendedFormat->Release();
+ }
+
+ return hResult;
+}
+
+//-------------------------------------------------------------------------
+// Description:
+//
+//
+//
+// Parameters:
+//
+//
+//
+// Return values:
+//
+//
+//
+// Remarks:
+//
+//
+STDMETHODIMP CKWSApoEFX::GetInputChannelCount(UINT32 *pu32ChannelCount)
+{
+ ASSERT_NONREALTIME();
+ HRESULT hResult = S_OK;
+
+ IF_TRUE_ACTION_JUMP(!m_bIsInitialized, hResult = APOERR_NOT_INITIALIZED, Exit);
+ IF_TRUE_ACTION_JUMP(NULL == pu32ChannelCount, hResult = E_POINTER, Exit);
+
+ // the input channel count is always the sum of the primary and interleaved
+ *pu32ChannelCount = (m_FormatInfo.PrimaryChannelCount + m_FormatInfo.InterleavedChannelCount);
+
+Exit:
+ return hResult;
+} // GetChannelCount
+
+//-------------------------------------------------------------------------
+// Description:
+//
+// Destructor.
+//
+// Parameters:
+//
+// void
+//
+// Return values:
+//
+// void
+//
+// Remarks:
+//
+// This method deletes whatever was allocated.
+//
+// This method may not be called from a real-time processing thread.
+//
+CKWSApoEFX::~CKWSApoEFX(void)
+{
+ //
+ // unregister for callbacks
+ //
+ if (m_bIsInitialized)
+ {
+ m_spEnumerator->UnregisterEndpointNotificationCallback(this);
+ }
+} // ~CKWSApoEFX
diff --git a/audio/sysvad/APO/KWSApo/KWSApoEfx.rgs b/audio/sysvad/APO/KWSApo/KWSApoEfx.rgs
new file mode 100644
index 00000000..dc5bd41a
--- /dev/null
+++ b/audio/sysvad/APO/KWSApo/KWSApoEfx.rgs
@@ -0,0 +1,13 @@
+HKCR
+{
+ NoRemove CLSID
+ {
+ ForceRemove {9D89F614-F9D6-40DD-9F21-5E69FA3981ED} = s 'KWSApoEFX Class'
+ {
+ InprocServer32 = s '%MODULE%'
+ {
+ val ThreadingModel = s 'Both'
+ }
+ }
+ }
+}
diff --git a/audio/sysvad/APO/KWSApo/KWSApoInterface.idl b/audio/sysvad/APO/KWSApo/KWSApoInterface.idl
new file mode 100644
index 00000000..6c0c98ad
--- /dev/null
+++ b/audio/sysvad/APO/KWSApo/KWSApoInterface.idl
@@ -0,0 +1,21 @@
+//
+// KWSApoInterface.idl -- Copyright (c) Microsoft Corporation. All rights reserved.
+//
+// Description:
+//
+// The interface and type definitions for KWS APO functionality.
+//
+import "oaidl.idl";
+import "ocidl.idl";
+import "audioenginebaseapo.idl";
+
+
+[
+ object,
+ uuid(CF5C2AA7-68A8-4FD1-B86F-EBC008AD1B6F),
+ pointer_default(unique)
+]
+interface IKWSApoEFX : IUnknown
+{
+};
+
diff --git a/audio/sysvad/APO/KWSApo/Resource.h b/audio/sysvad/APO/KWSApo/Resource.h
new file mode 100644
index 00000000..df1260e1
--- /dev/null
+++ b/audio/sysvad/APO/KWSApo/Resource.h
@@ -0,0 +1,19 @@
+//{{NO_DEPENDENCIES}}
+// Microsoft Visual C++ generated include file.
+// Used by KWSApoDll.rc
+//
+#define IDS_PROJNAME 100
+#define IDR_KWSAPODLL 101
+#define IDR_KWSAPOEFX 110
+#define IDI_EFFECT_ICON 200
+
+// Next default values for new objects
+//
+#ifdef APSTUDIO_INVOKED
+#ifndef APSTUDIO_READONLY_SYMBOLS
+#define _APS_NEXT_RESOURCE_VALUE 201
+#define _APS_NEXT_COMMAND_VALUE 32768
+#define _APS_NEXT_CONTROL_VALUE 201
+#define _APS_NEXT_SYMED_VALUE 132
+#endif
+#endif
diff --git a/audio/sysvad/APO/SwapAPO/SwapAPO.h b/audio/sysvad/APO/SwapAPO/SwapAPO.h
index fc279460..83702e6f 100644
--- a/audio/sysvad/APO/SwapAPO/SwapAPO.h
+++ b/audio/sysvad/APO/SwapAPO/SwapAPO.h
@@ -129,6 +129,11 @@ public:
STDMETHODIMP GetFormat(UINT nFormat, IAudioMediaType** ppFormat);
STDMETHODIMP GetFormatRepresentation(UINT nFormat, _Outptr_ LPWSTR* ppwstrFormatRep);
+ // IAudioProcessingObject
+ STDMETHODIMP IsOutputFormatSupported(IAudioMediaType *pOppositeFormat, IAudioMediaType *pRequestedOutputFormat, IAudioMediaType **ppSupportedOutputFormat);
+
+ STDMETHODIMP CheckCustomFormats(IAudioMediaType *pRequestedFormat);
+
public:
LONG m_fEnableSwapMFX;
GUID m_AudioProcessingMode;
diff --git a/audio/sysvad/APO/SwapAPO/SwapAPO.vcxproj b/audio/sysvad/APO/SwapAPO/SwapAPO.vcxproj
index 4ab6f2e4..4e680972 100644
--- a/audio/sysvad/APO/SwapAPO/SwapAPO.vcxproj
+++ b/audio/sysvad/APO/SwapAPO/SwapAPO.vcxproj
@@ -1,10 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
- <ProjectConfiguration Include="Debug|ARM">
- <Configuration>Debug</Configuration>
- <Platform>ARM</Platform>
- </ProjectConfiguration>
<ProjectConfiguration Include="Debug|ARM64">
<Configuration>Debug</Configuration>
<Platform>ARM64</Platform>
@@ -13,10 +9,6 @@
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
- <ProjectConfiguration Include="Release|ARM">
- <Configuration>Release</Configuration>
- <Platform>ARM</Platform>
- </ProjectConfiguration>
<ProjectConfiguration Include="Release|ARM64">
<Configuration>Release</Configuration>
<Platform>ARM64</Platform>
@@ -89,15 +81,6 @@
<PlatformToolset>WindowsApplicationForDrivers10.0</PlatformToolset>
<ConfigurationType>DynamicLibrary</ConfigurationType>
</PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'" Label="Configuration">
- <TargetVersion>Windows10</TargetVersion>
- <UseDebugLibraries>False</UseDebugLibraries>
- <DriverTargetPlatform>Universal</DriverTargetPlatform>
- <EmbedManifest>false</EmbedManifest>
- <DriverType />
- <PlatformToolset>WindowsApplicationForDrivers10.0</PlatformToolset>
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- </PropertyGroup>
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<TargetVersion>Windows10</TargetVersion>
<UseDebugLibraries>True</UseDebugLibraries>
@@ -107,15 +90,6 @@
<PlatformToolset>WindowsApplicationForDrivers10.0</PlatformToolset>
<ConfigurationType>DynamicLibrary</ConfigurationType>
</PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'" Label="Configuration">
- <TargetVersion>Windows10</TargetVersion>
- <UseDebugLibraries>True</UseDebugLibraries>
- <DriverTargetPlatform>Universal</DriverTargetPlatform>
- <EmbedManifest>false</EmbedManifest>
- <DriverType />
- <PlatformToolset>WindowsApplicationForDrivers10.0</PlatformToolset>
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- </PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<PropertyGroup>
<OutDir>$(IntDir)</OutDir>
@@ -135,15 +109,9 @@
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
</ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
- </ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
</ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
- </ImportGroup>
<ItemGroup Label="WrappedTaskItems" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<TargetName>SwapAPO</TargetName>
diff --git a/audio/sysvad/APO/SwapAPO/SwapAPODll.cpp b/audio/sysvad/APO/SwapAPO/SwapAPODll.cpp
index 22e810bf..ff7a1cd6 100644
--- a/audio/sysvad/APO/SwapAPO/SwapAPODll.cpp
+++ b/audio/sysvad/APO/SwapAPO/SwapAPODll.cpp
@@ -69,4 +69,4 @@ _Check_return_
STDAPI DllGetClassObject(_In_ REFCLSID rclsid, _In_ REFIID riid, _Outptr_ LPVOID FAR* ppv)
{
return _AtlModule.DllGetClassObject(rclsid, riid, ppv);
-}
+} \ No newline at end of file
diff --git a/audio/sysvad/APO/SwapAPO/SwapAPODll.def b/audio/sysvad/APO/SwapAPO/SwapAPODll.def
index f4b6fcd9..3f3b0c5a 100644
--- a/audio/sysvad/APO/SwapAPO/SwapAPODll.def
+++ b/audio/sysvad/APO/SwapAPO/SwapAPODll.def
@@ -1,4 +1,4 @@
EXPORTS
DllCanUnloadNow PRIVATE
- DllGetClassObject PRIVATE
+ DllGetClassObject PRIVATE \ No newline at end of file
diff --git a/audio/sysvad/APO/SwapAPO/makefile b/audio/sysvad/APO/SwapAPO/makefile
deleted file mode 100644
index c7837f4f..00000000
--- a/audio/sysvad/APO/SwapAPO/makefile
+++ /dev/null
@@ -1,36 +0,0 @@
-#############################################################################
-#
-# Copyright (c) Microsoft Corporation.
-# All Rights Reserved.
-#
-# Makefile for wdm\audio\sysfx\apo
-#
-#############################################################################
-
-## NT BUILD ENVIROMENT
-
-#
-# DO NOT EDIT THIS FILE!!! Edit .\sources. if you want to add a new source
-# file to this component. This file merely indirects to the real make file
-# that is shared by all the components of NT.
-#
-!if defined(IA64)
-!message This sample is not to be built for IA64 targets
-!else
-
-!IF DEFINED(_NT_TARGET_VERSION)
-#! IF $(_NT_TARGET_VERSION)>=0x501
-! IF $(_NT_TARGET_VERSION)>=0x600
-! INCLUDE $(NTMAKEENV)\makefile.def
-! ELSE
-# Only warn once per directory
-! INCLUDE $(NTMAKEENV)\makefile.plt
-! IF "$(BUILD_PASS)"=="PASS1"
-! message BUILDMSG: Warning : Building the sample "$(MAKEDIR)" for downlevel build environments is temporarily disabled in WDK for Beta2.
-! ENDIF
-! ENDIF
-!ELSE
-! INCLUDE $(NTMAKEENV)\makefile.def
-!ENDIF
-
-!endif \ No newline at end of file
diff --git a/audio/sysvad/APO/SwapAPO/sources b/audio/sysvad/APO/SwapAPO/sources
deleted file mode 100644
index 7baf3745..00000000
--- a/audio/sysvad/APO/SwapAPO/sources
+++ /dev/null
@@ -1,13 +0,0 @@
-!include ..\sources.inc
-
-TARGETNAME=SwapAPO
-DLLDEF=SwapAPODll.def
-
-SOURCES=SwapAPOInterface.idl \
- SwapAPOMFX.cpp \
- SwapAPOSFX.cpp \
- Swap.cpp \
- SwapAPODll.idl \
- SwapAPODll.rc \
- SwapAPODll.cpp \
-
diff --git a/audio/sysvad/APO/SwapAPO/swapapomfx.cpp b/audio/sysvad/APO/SwapAPO/swapapomfx.cpp
index b4e6e95a..a6c0d111 100644
--- a/audio/sysvad/APO/SwapAPO/swapapomfx.cpp
+++ b/audio/sysvad/APO/SwapAPO/swapapomfx.cpp
@@ -870,8 +870,9 @@ DEFINE_GUIDSTRUCT("00000092-0000-0010-8000-00aa00389b71", KSDATAFORMAT_SUBTYPE_A
CUSTOM_FORMAT_ITEM _rgCustomFormats[] =
{
{{ WAVE_FORMAT_EXTENSIBLE, 2, 44100, 176400, 4, 16, sizeof(WAVEFORMATEXTENSIBLE)-sizeof(WAVEFORMATEX), 16, KSAUDIO_SPEAKER_STEREO, KSDATAFORMAT_SUBTYPE_PCM}, L"Custom #1 (really 44.1 KHz, 16-bit, stereo)"},
- {{ WAVE_FORMAT_EXTENSIBLE, 2, 48000, 192000, 4, 16, sizeof(WAVEFORMATEXTENSIBLE)-sizeof(WAVEFORMATEX), 16, KSAUDIO_SPEAKER_STEREO, KSDATAFORMAT_SUBTYPE_PCM}, L"Custom #2 (really 48 KHz, 16-bit, stereo)"},
- {{ WAVE_FORMAT_EXTENSIBLE, 2, 48000, 192000, 4, 16, sizeof(WAVEFORMATEXTENSIBLE)-sizeof(WAVEFORMATEX), 16, KSAUDIO_SPEAKER_STEREO, KSDATAFORMAT_SUBTYPE_AC3}, L"Custom #3 (really 48 KHz AC-3)"}
+ {{ WAVE_FORMAT_EXTENSIBLE, 2, 48000, 192000, 4, 16, sizeof(WAVEFORMATEXTENSIBLE)-sizeof(WAVEFORMATEX), 16, KSAUDIO_SPEAKER_STEREO, KSDATAFORMAT_SUBTYPE_PCM}, L"Custom #2 (really 48 KHz, 16-bit, stereo)"}
+ // The compressed AC3 format has been temporarily removed since the APO is not set up for compressed formats or EFXs yet.
+ // {{ WAVE_FORMAT_EXTENSIBLE, 2, 48000, 192000, 4, 16, sizeof(WAVEFORMATEXTENSIBLE)-sizeof(WAVEFORMATEX), 16, KSAUDIO_SPEAKER_STEREO, KSDATAFORMAT_SUBTYPE_AC3}, L"Custom #3 (really 48 KHz AC-3)"}
};
#define _cCustomFormats (ARRAYSIZE(_rgCustomFormats))
@@ -994,3 +995,139 @@ STDMETHODIMP CSwapAPOMFX::GetFormatRepresentation
Exit:
return hr;
}
+
+//-------------------------------------------------------------------------
+// Description:
+//
+// Implementation of IAudioProcessingObject::IsOutputFormatSupported
+//
+// Parameters:
+//
+// pInputFormat - [in] A pointer to an IAudioMediaType interface. This parameter indicates the output format. This parameter must be set to NULL to indicate that the output format can be any type
+// pRequestedOutputFormat - [in] A pointer to an IAudioMediaType interface. This parameter indicates the output format that is to be verified
+// ppSupportedOutputFormat - [in] This parameter indicates the supported output format that is closest to the format to be verified
+//
+// Return values:
+//
+// S_OK Success
+// S_FALSE The format of Input/output format pair is not supported. The ppSupportedOutPutFormat parameter returns a suggested new format
+// APOERR_FORMAT_NOT_SUPPORTED The format is not supported. The value of ppSupportedOutputFormat does not change.
+// E_POINTER Null pointer passed
+//
+// Remarks:
+//
+STDMETHODIMP CSwapAPOMFX::IsOutputFormatSupported
+(
+ IAudioMediaType *pInputFormat,
+ IAudioMediaType *pRequestedOutputFormat,
+ IAudioMediaType **ppSupportedOutputFormat
+)
+{
+ ASSERT_NONREALTIME();
+ bool formatChanged = false;
+ HRESULT hResult;
+ UNCOMPRESSEDAUDIOFORMAT uncompOutputFormat;
+ IAudioMediaType *recommendedFormat = NULL;
+
+ IF_TRUE_ACTION_JUMP((NULL == pRequestedOutputFormat) || (NULL == ppSupportedOutputFormat), hResult = E_POINTER, Exit);
+ *ppSupportedOutputFormat = NULL;
+
+ // Initial comparison to make sure the requested format is valid and consistent with the input
+ // format. Because of the APO flags specified during creation, the samples per frame value will
+ // not be validated.
+ hResult = IsFormatTypeSupported(pInputFormat, pRequestedOutputFormat, &recommendedFormat, true);
+ IF_FAILED_JUMP(hResult, Exit);
+
+ // Check to see if a custom format from the APO was used.
+ if (S_FALSE == hResult)
+ {
+ hResult = CheckCustomFormats(pRequestedOutputFormat);
+
+ // If the output format is changed, make sure we track it for our return code.
+ if (S_FALSE == hResult)
+ {
+ formatChanged = true;
+ }
+ }
+
+ // now retrieve the format that IsFormatTypeSupported decided on, building upon that by adding
+ // our channel count constraint.
+ hResult = recommendedFormat->GetUncompressedAudioFormat(&uncompOutputFormat);
+ IF_FAILED_JUMP(hResult, Exit);
+
+ // If the requested format exactly matched our requirements,
+ // just return it.
+ if (!formatChanged)
+ {
+ *ppSupportedOutputFormat = pRequestedOutputFormat;
+ (*ppSupportedOutputFormat)->AddRef();
+ hResult = S_OK;
+ }
+ else // we're proposing something different, copy it and return S_FALSE
+ {
+ hResult = CreateAudioMediaTypeFromUncompressedAudioFormat(&uncompOutputFormat, ppSupportedOutputFormat);
+ IF_FAILED_JUMP(hResult, Exit);
+ hResult = S_FALSE;
+ }
+
+Exit:
+ if (recommendedFormat)
+ {
+ recommendedFormat->Release();
+ }
+
+ return hResult;
+}
+
+HRESULT CSwapAPOMFX::CheckCustomFormats(IAudioMediaType *pRequestedFormat)
+{
+ HRESULT hResult = S_OK;
+
+ for (int i = 0; i < _cCustomFormats; i++)
+ {
+ hResult = S_OK;
+ const WAVEFORMATEX* waveFormat = pRequestedFormat->GetAudioFormat();
+
+ if (waveFormat->wFormatTag != _rgCustomFormats[i].wfxFmt.Format.wFormatTag)
+ {
+ hResult = S_FALSE;
+ }
+
+ if (waveFormat->nChannels != _rgCustomFormats[i].wfxFmt.Format.nChannels)
+ {
+ hResult = S_FALSE;
+ }
+
+ if (waveFormat->nSamplesPerSec != _rgCustomFormats[i].wfxFmt.Format.nSamplesPerSec)
+ {
+ hResult = S_FALSE;
+ }
+
+ if (waveFormat->nAvgBytesPerSec != _rgCustomFormats[i].wfxFmt.Format.nAvgBytesPerSec)
+ {
+ hResult = S_FALSE;
+ }
+
+ if (waveFormat->nBlockAlign != _rgCustomFormats[i].wfxFmt.Format.nBlockAlign)
+ {
+ hResult = S_FALSE;
+ }
+
+ if (waveFormat->wBitsPerSample != _rgCustomFormats[i].wfxFmt.Format.wBitsPerSample)
+ {
+ hResult = S_FALSE;
+ }
+
+ if (waveFormat->cbSize != _rgCustomFormats[i].wfxFmt.Format.cbSize)
+ {
+ hResult = S_FALSE;
+ }
+
+ if (hResult == S_OK)
+ {
+ break;
+ }
+ }
+
+ return hResult;
+} \ No newline at end of file