Skip to content
Snippets Groups Projects
Commit 4185cc7a authored by Andrew Eikum's avatar Andrew Eikum Committed by Alexandre Julliard
Browse files

xaudio2_0: Add compatibility implementation and forward to xaudio2_7.

parent 76aa675d
No related branches found
No related tags found
No related merge requests found
......@@ -1377,6 +1377,7 @@ enable_xapofx1_2
enable_xapofx1_3
enable_xapofx1_4
enable_xapofx1_5
enable_xaudio2_0
enable_xaudio2_1
enable_xaudio2_2
enable_xaudio2_3
......@@ -17949,6 +17950,7 @@ wine_fn_config_dll xapofx1_2 enable_xapofx1_2
wine_fn_config_dll xapofx1_3 enable_xapofx1_3
wine_fn_config_dll xapofx1_4 enable_xapofx1_4
wine_fn_config_dll xapofx1_5 enable_xapofx1_5
wine_fn_config_dll xaudio2_0 enable_xaudio2_0 clean
wine_fn_config_dll xaudio2_1 enable_xaudio2_1 clean
wine_fn_config_dll xaudio2_2 enable_xaudio2_2 clean
wine_fn_config_dll xaudio2_3 enable_xaudio2_3 clean
......
......@@ -3463,6 +3463,7 @@ WINE_CONFIG_DLL(xapofx1_2)
WINE_CONFIG_DLL(xapofx1_3)
WINE_CONFIG_DLL(xapofx1_4)
WINE_CONFIG_DLL(xapofx1_5)
WINE_CONFIG_DLL(xaudio2_0,,[clean])
WINE_CONFIG_DLL(xaudio2_1,,[clean])
WINE_CONFIG_DLL(xaudio2_2,,[clean])
WINE_CONFIG_DLL(xaudio2_3,,[clean])
......
MODULE = xaudio2_0.dll
IMPORTS = ole32
C_SRCS = \
xaudio_dll.c
IDL_SRCS = xaudio_classes.idl
@ stdcall -private DllCanUnloadNow()
@ stdcall -private DllGetClassObject(ptr ptr ptr) xaudio2_7.DllGetClassObject
@ stdcall -private DllRegisterServer()
@ stdcall -private DllUnregisterServer()
/*
* COM Classes for xaudio
*
* Copyright 2015 Andrew Eikum for CodeWeavers
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#pragma makedep register
[
helpstring("XAudio2.0 Class"),
threading(both),
uuid(e21a7345-eb21-468e-be50-804db97cf708)
]
coclass XAudio20 { interface IXAudio20; }
[
helpstring("XAudio2.0 AudioReverb Class"),
threading(both),
uuid(6f6ea3a9-2cf5-41cf-91c1-2170b1540063)
]
coclass AudioReverb20 { interface IXAPO; }
[
helpstring("XAudio2.0 AudioVolumeMeter Class"),
threading(both),
uuid(c0c56f46-29b1-44e9-9939-a32ce86867e2)
]
coclass AudioVolumeMeter20 { interface IXAPO; }
/*
* Copyright (c) 2015 Andrew Eikum for CodeWeavers
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "objbase.h"
#include "rpcproxy.h"
static HINSTANCE instance;
BOOL WINAPI DllMain(HINSTANCE hinstance, DWORD reason, LPVOID reserved)
{
switch (reason)
{
case DLL_PROCESS_ATTACH:
instance = hinstance;
DisableThreadLibraryCalls(hinstance);
break;
}
return TRUE;
}
HRESULT WINAPI DllCanUnloadNow(void)
{
return S_FALSE;
}
HRESULT WINAPI DllRegisterServer(void)
{
return __wine_register_resources(instance);
}
HRESULT WINAPI DllUnregisterServer(void)
{
return __wine_unregister_resources(instance);
}
This diff is collapsed.
This diff is collapsed.
......@@ -42,6 +42,7 @@ typedef struct _XA2Buffer {
typedef struct _IXAudio2Impl IXAudio2Impl;
typedef struct _XA2SourceImpl {
IXAudio20SourceVoice IXAudio20SourceVoice_iface;
IXAudio23SourceVoice IXAudio23SourceVoice_iface;
IXAudio27SourceVoice IXAudio27SourceVoice_iface;
IXAudio2SourceVoice IXAudio2SourceVoice_iface;
......@@ -81,6 +82,7 @@ typedef struct _XA2SourceImpl {
} XA2SourceImpl;
typedef struct _XA2SubmixImpl {
IXAudio20SubmixVoice IXAudio20SubmixVoice_iface;
IXAudio23SubmixVoice IXAudio23SubmixVoice_iface;
IXAudio2SubmixVoice IXAudio2SubmixVoice_iface;
......@@ -92,9 +94,11 @@ typedef struct _XA2SubmixImpl {
} XA2SubmixImpl;
struct _IXAudio2Impl {
IXAudio20 IXAudio20_iface;
IXAudio22 IXAudio22_iface;
IXAudio27 IXAudio27_iface;
IXAudio2 IXAudio2_iface;
IXAudio20MasteringVoice IXAudio20MasteringVoice_iface;
IXAudio23MasteringVoice IXAudio23MasteringVoice_iface;
IXAudio2MasteringVoice IXAudio2MasteringVoice_iface;
......@@ -115,6 +119,8 @@ struct _IXAudio2Impl {
WCHAR **devids;
UINT32 ndevs;
UINT32 last_query_glitches;
IAudioClient *aclient;
IAudioRenderClient *render;
......@@ -139,3 +145,8 @@ extern const IXAudio23SubmixVoiceVtbl XAudio23SubmixVoice_Vtbl DECLSPEC_HIDDEN;
extern const IXAudio23MasteringVoiceVtbl XAudio23MasteringVoice_Vtbl DECLSPEC_HIDDEN;
extern const IXAudio22Vtbl XAudio22_Vtbl DECLSPEC_HIDDEN;
extern const IXAudio20Vtbl XAudio20_Vtbl DECLSPEC_HIDDEN;
extern const IXAudio20SourceVoiceVtbl XAudio20SourceVoice_Vtbl DECLSPEC_HIDDEN;
extern const IXAudio20SubmixVoiceVtbl XAudio20SubmixVoice_Vtbl DECLSPEC_HIDDEN;
extern const IXAudio20MasteringVoiceVtbl XAudio20MasteringVoice_Vtbl DECLSPEC_HIDDEN;
......@@ -60,6 +60,22 @@ typedef struct XAPO_REGISTRATION_PROPERTIES
UINT32 MaxOutputBufferCount;
} XAPO_REGISTRATION_PROPERTIES;
typedef struct XAPO20_REGISTRATION_PROPERTIES
{
CLSID clsid;
WCHAR FriendlyName[XAPO_REGISTRATION_STRING_LENGTH];
WCHAR CopyrightInfo[XAPO_REGISTRATION_STRING_LENGTH];
UINT32 MajorVersion;
UINT32 MinorVersion;
UINT32 Flags;
UINT32 MinInputBufferCount;
UINT32 MaxInputBufferCount;
UINT32 MinOutputBufferCount;
UINT32 MaxOutputBufferCount;
UINT32 InterfaceCount;
IID InterfaceArray[1];
} XAPO20_REGISTRATION_PROPERTIES;
typedef struct XAPO_LOCKFORPROCESS_BUFFER_PARAMETERS {
const WAVEFORMATEX *pFormat;
UINT32 MaxFrameCount;
......
......@@ -30,6 +30,13 @@ coclass XAudio2 {
interface IUnknown;
}
[
uuid(fac23f48-31f5-45a8-b49b-5225d61401aa)
]
coclass XAudio20 {
interface IUnknown;
}
[
uuid(e21a7345-eb21-468e-be50-804db97cf708)
]
......@@ -180,6 +187,23 @@ typedef struct XAUDIO22_PERFORMANCE_DATA
UINT32 ActiveXmaStreams;
} XAUDIO22_PERFORMANCE_DATA;
typedef struct XAUDIO20_PERFORMANCE_DATA
{
UINT64 AudioCyclesSinceLastQuery;
UINT64 TotalCyclesSinceLastQuery;
UINT32 MinimumCyclesPerQuantum;
UINT32 MaximumCyclesPerQuantum;
UINT32 MemoryUsageInBytes;
UINT32 CurrentLatencyInSamples;
UINT32 GlitchesSinceLastQuery;
UINT32 ActiveSourceVoiceCount;
UINT32 TotalSourceVoiceCount;
UINT32 ActiveSubmixVoiceCount;
UINT32 TotalSubmixVoiceCount;
UINT32 ActiveXmaSourceVoices;
UINT32 ActiveXmaStreams;
} XAUDIO20_PERFORMANCE_DATA;
typedef enum XAUDIO2_DEVICE_ROLE
{
NotDefaultDevice = 0x0,
......@@ -251,12 +275,14 @@ const float XAUDIO2_DEFAULT_FREQ_RATIO = 2.0;
const float XAUDIO2_MAX_FILTER_ONEOVERQ = 1.5;
const float XAUDIO2_MAX_FILTER_FREQUENCY = 1.0;
const UINT32 XAUDIO2_MAX_LOOP_COUNT = 254;
const UINT32 XAUDIO20_MAX_LOOP_COUNT = 0x100000; /* xaudio 2.0 */
const UINT32 XAUDIO2_COMMIT_NOW = 0;
const UINT32 XAUDIO2_COMMIT_ALL = 0;
const UINT32 XAUDIO2_INVALID_OPSET = 0xffffffff;
const UINT32 XAUDIO2_NO_LOOP_REGION = 0;
const UINT32 XAUDIO2_LOOP_INFINITE = 255;
const UINT32 XAUDIO20_LOOP_INFINITE = ((UINT)-1); /* xaudio 2.0 */
const UINT32 XAUDIO2_DEFAULT_CHANNELS = 0;
const UINT32 XAUDIO2_DEFAULT_SAMPLERATE = 0;
......@@ -288,6 +314,81 @@ typedef struct XAUDIO2_FILTER_PARAMETERS
float OneOverQ;
} XAUDIO2_FILTER_PARAMETERS;
/* XAudio 2.0's IXAudio2Voice */
/* XAudio2 2.0's IXAudio2Voice interface. Actually called
* IXAudio2Voice in the Mar 2008 DX SDK */
[
object,
local
]
interface IXAudio20Voice
{
void GetVoiceDetails([out] XAUDIO2_VOICE_DETAILS* pVoiceDetails);
HRESULT SetOutputVoices([in] const XAUDIO23_VOICE_SENDS* pSendList);
HRESULT SetEffectChain([in] const XAUDIO2_EFFECT_CHAIN* pEffectChain);
HRESULT EnableEffect(
[in] UINT32 EffectIndex,
[in, defaultvalue(XAUDIO2_COMMIT_NOW)] UINT32 OperationSet);
HRESULT DisableEffect(
[in] UINT32 EffectIndex,
[in, defaultvalue(XAUDIO2_COMMIT_NOW)] UINT32 OperationSet);
void GetEffectState(
[in] UINT32 EffectIndex,
[out] BOOL* pEnabled);
HRESULT SetEffectParameters(
[in] UINT32 EffectIndex,
[in] const void* pParameters,
[in] UINT32 ParametersByteSize,
[in, defaultvalue(XAUDIO2_COMMIT_NOW)] UINT32 OperationSet);
HRESULT GetEffectParameters(
[in] UINT32 EffectIndex,
[out] void* pParameters,
[in] UINT32 ParametersByteSize);
HRESULT SetFilterParameters(
[in] const XAUDIO2_FILTER_PARAMETERS* pParameters,
[in, defaultvalue(XAUDIO2_COMMIT_NOW)] UINT32 OperationSet);
void GetFilterParameters([out] XAUDIO2_FILTER_PARAMETERS* pParameters);
HRESULT SetVolume(
[in] float Volume,
[in, defaultvalue(XAUDIO2_COMMIT_NOW)] UINT32 OperationSet);
void GetVolume([out] float* pVolume);
HRESULT SetChannelVolumes(
[in] UINT32 Channels,
[in, size_is(Channels)] const float* pVolumes,
[in, defaultvalue(XAUDIO2_COMMIT_NOW)] UINT32 OperationSet);
void GetChannelVolumes(
[in] UINT32 Channels,
[out, size_is(Channels)] float* pVolumes);
HRESULT SetOutputMatrix(
[in] IXAudio2Voice* pDestinationVoice,
[in] UINT32 SourceChannels,
[in] UINT32 DestinationChannels,
[in, size_is(SourceChannels * DestinationChannels)] const float* pLevelMatrix,
[in, defaultvalue(XAUDIO2_COMMIT_NOW)] UINT32 OperationSet);
HRESULT GetOutputMatrix(
[in] IXAudio2Voice* pDestinationVoice,
[in] UINT32 SourceChannels,
[in] UINT32 DestinationChannels,
[out, size_is(SourceChannels * DestinationChannels)] float* pLevelMatrix);
void DestroyVoice();
}
/* XAudio 2.3's IXAudio2Voice */
/* XAudio2 2.3's IXAudio2Voice interface. Actually called
* IXAudio2Voice in the Nov 2008 DX SDK */
......@@ -362,6 +463,7 @@ interface IXAudio23Voice
void DestroyVoice();
}
[
object,
local
......@@ -469,6 +571,40 @@ typedef struct XAUDIO2_VOICE_STATE
UINT64 SamplesPlayed;
} XAUDIO2_VOICE_STATE;
[
local
]
/* XAudio2 2.0's IXAudio2SourceVoice interface. Actually called
* IXAudio2SourceVoice in the Mar 2008 DX SDK */
interface IXAudio20SourceVoice : IXAudio20Voice
{
HRESULT Start(
[in, defaultvalue(0)] UINT32 Flags,
[in, defaultvalue(XAUDIO2_COMMIT_NOW)] UINT32 OperationSet);
HRESULT Stop(
[in, defaultvalue(0)] UINT32 Flags,
[in, defaultvalue(XAUDIO2_COMMIT_NOW)] UINT32 OperationSet);
HRESULT SubmitSourceBuffer(
[in] const XAUDIO2_BUFFER* pBuffer,
[in, defaultvalue(NULL)] const XAUDIO2_BUFFER_WMA* pBufferWMA);
HRESULT FlushSourceBuffers();
HRESULT Discontinuity();
HRESULT ExitLoop([in, defaultvalue(XAUDIO2_COMMIT_NOW)] UINT32 OperationSet);
void GetState([out] XAUDIO2_VOICE_STATE* pVoiceState);
HRESULT SetFrequencyRatio(
[in] float Ratio,
[in, defaultvalue(XAUDIO2_COMMIT_NOW)] UINT32 OperationSet);
void GetFrequencyRatio([out] float* pRatio);
}
[
local
]
......@@ -574,6 +710,15 @@ interface IXAudio2SourceVoice : IXAudio2Voice
HRESULT SetSourceSampleRate([in] UINT32 NewSourceSampleRate);
}
[
local
]
/* XAudio2 2.0's IXAudio2SubmixVoice interface. Actually called
* IXAudio2SubmixVoice in the Mar 2008 DX SDK */
interface IXAudio20SubmixVoice : IXAudio20Voice
{
}
[
local
]
......@@ -590,6 +735,15 @@ interface IXAudio2SubmixVoice : IXAudio2Voice
{
}
[
local
]
/* XAudio2 2.0's IXAudio2MasteringVoice interface. Actually called
* IXAudio2MasteringVoice in the Mar 2008 DX SDK */
interface IXAudio20MasteringVoice : IXAudio20Voice
{
}
[
local
]
......@@ -608,6 +762,29 @@ interface IXAudio2MasteringVoice : IXAudio2Voice
void GetChannelMask([out] DWORD *pChannelMask);
}
[
object,
local
]
interface IXAudio20VoiceCallback
{
void OnVoiceProcessingPassStart();
void OnVoiceProcessingPassEnd();
void OnStreamEnd();
void OnBufferStart([in] void* pBufferContext);
void OnBufferEnd([in] void* pBufferContext);
void OnLoopEnd([in] void* pBufferContext);
void OnVoiceError(
[in] void* pBuffercontext,
[in] HRESULT Error);
}
[
object,
local
......@@ -641,6 +818,67 @@ typedef struct XAUDIO2_DEBUG_CONFIGURATION
BOOL LogTiming;
} XAUDIO2_DEBUG_CONFIGURATION;
[
object,
uuid(8bcf1f58-9fe7-4583-8ac6-e2adc465c8bb), /* all versions before 28 share IID_IXAudio */
]
/* XAudio2 2.0's IXAudio2 interface. Actually called IXAudio2 in the Mar 2008
* DX SDK */
interface IXAudio20 : IUnknown
{
HRESULT GetDeviceCount([out] UINT32* pCount);
HRESULT GetDeviceDetails(
[in] UINT32 Index,
[out] XAUDIO2_DEVICE_DETAILS* pDeviceDetails);
HRESULT Initialize(
[in, defaultvalue(0)] UINT32 Flags,
[in, defaultvalue(XAUDIO2_DEFAULT_PROCESSOR)] XAUDIO2_PROCESSOR XAudio2Processor);
HRESULT RegisterForCallbacks([in] IXAudio2EngineCallback* pCallback);
void UnregisterForCallbacks([in] IXAudio2EngineCallback* pCallback);
HRESULT CreateSourceVoice(
[out] IXAudio2SourceVoice** ppSourceVoice,
[in] const WAVEFORMATEX* pSourceFormat,
[in, defaultvalue(0)] UINT32 Flags,
[in, defaultvalue(XAUDIO2_DEFAULT_FREQ_RATIO)] float MaxFrequencyRatio,
[in, defaultvalue(NULL)] IXAudio2VoiceCallback* pCallback,
[in, defaultvalue(NULL)] const XAUDIO2_VOICE_SENDS* pSendList,
[in, defaultvalue(NULL)] const XAUDIO2_EFFECT_CHAIN* pEffectChain);
HRESULT CreateSubmixVoice(
[out] IXAudio2SubmixVoice** ppSubmixVoice,
[in] UINT32 InputChannels,
[in] UINT32 InputSampleRate,
[in, defaultvalue(0)] UINT32 Flags,
[in, defaultvalue(0)] UINT32 ProcessingStage,
[in, defaultvalue(NULL)] const XAUDIO2_VOICE_SENDS* pSendList,
[in, defaultvalue(NULL)] const XAUDIO2_EFFECT_CHAIN* pEffectChain);
HRESULT CreateMasteringVoice(
[out] IXAudio2MasteringVoice** ppMasteringVoice,
[in, defaultvalue(XAUDIO2_DEFAULT_CHANNELS)] UINT32 InputChannels,
[in, defaultvalue(XAUDIO2_DEFAULT_SAMPLERATE)] UINT32 InputSampleRate,
[in, defaultvalue(0)] UINT32 Flags,
[in, defaultvalue(0)] UINT32 DeviceIndex,
[in, defaultvalue(NULL)] const XAUDIO2_EFFECT_CHAIN* pEffectChain);
HRESULT StartEngine();
void StopEngine();
HRESULT CommitChanges([in] UINT32 OperationSet);
void GetPerformanceData([out] XAUDIO20_PERFORMANCE_DATA* pPerfData);
[local] void SetDebugConfiguration(
[in] const XAUDIO2_DEBUG_CONFIGURATION* pDebugConfiguration,
[in, defaultvalue(NULL)] void* pReserved);
}
[
object,
uuid(8bcf1f58-9fe7-4583-8ac6-e2adc465c8bb), /* all versions before 28 share IID_IXAudio */
......@@ -836,6 +1074,11 @@ const HRESULT XAUDIO2_E_XMA_DECODER_ERROR = 0x88960002;
const HRESULT XAUDIO2_E_XAPO_CREATION_FAILED = 0x88960003;
const HRESULT XAUDIO2_E_DEVICE_INVALIDATED = 0x88960004;
/* xaudio 2.0 error codes */
const HRESULT XAUDIO20_E_XMA_DECODER_ERROR = 0x88960001;
const HRESULT XAUDIO20_E_XAPO_CREATION_FAILED = 0x88960002;
const HRESULT XAUDIO20_E_DEVICE_INVALIDATED = 0x88960003;
cpp_quote("#ifdef XAUDIO2_HELPER_FUNCTIONS")
cpp_quote("#define _USE_MATH_DEFINES")
cpp_quote("#include <math.h>")
......
......@@ -25,6 +25,13 @@ coclass AudioVolumeMeter {
interface IUnknown;
}
[
uuid(c0c56f46-29b1-44e9-9939-a32ce86867e2)
]
coclass AudioVolumeMeter20 {
interface IUnknown;
}
[
uuid(c1e3f122-a2ea-442c-854f-20d98f8357a1)
]
......@@ -74,6 +81,13 @@ coclass AudioReverb {
interface IUnknown;
}
[
uuid(6f6ea3a9-2cf5-41cf-91c1-2170b1540063)
]
coclass AudioReverb20 {
interface IUnknown;
}
[
uuid(f4769300-b949-4df9-b333-00d33932e9a6)
]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment