xaudio2: Use the preprocessor to modify definitions in xaudio2.idl and xaudio2fx.idl.
Instead of including the IDLs directly, define a local IDL that #includes them, with XAUDIO2_VER defined, and include that generated header. Get rid of compat.c, and use XAUDIO2_VER to modify the code in the other source files. Build the tests for both xaudio2_7 and xaudio2_8 using PARENTSRC, and use XAUDIO2_VER to select between them. This mirrors the approach taken for d3dcompiler, and makes it easier to test more xaudio2 versions in the future.
This commit is contained in:
parent
c80285ffb1
commit
14c44d0b0a
28 changed files with 568 additions and 4349 deletions
1
configure
vendored
1
configure
vendored
|
@ -22028,6 +22028,7 @@ wine_fn_config_makefile dlls/xaudio2_6 enable_xaudio2_6
|
|||
wine_fn_config_makefile dlls/xaudio2_7 enable_xaudio2_7
|
||||
wine_fn_config_makefile dlls/xaudio2_7/tests enable_tests
|
||||
wine_fn_config_makefile dlls/xaudio2_8 enable_xaudio2_8
|
||||
wine_fn_config_makefile dlls/xaudio2_8/tests enable_tests
|
||||
wine_fn_config_makefile dlls/xaudio2_9 enable_xaudio2_9
|
||||
wine_fn_config_makefile dlls/xinput1_1 enable_xinput1_1
|
||||
wine_fn_config_makefile dlls/xinput1_2 enable_xinput1_2
|
||||
|
|
|
@ -3265,6 +3265,7 @@ WINE_CONFIG_MAKEFILE(dlls/xaudio2_6)
|
|||
WINE_CONFIG_MAKEFILE(dlls/xaudio2_7)
|
||||
WINE_CONFIG_MAKEFILE(dlls/xaudio2_7/tests)
|
||||
WINE_CONFIG_MAKEFILE(dlls/xaudio2_8)
|
||||
WINE_CONFIG_MAKEFILE(dlls/xaudio2_8/tests)
|
||||
WINE_CONFIG_MAKEFILE(dlls/xaudio2_9)
|
||||
WINE_CONFIG_MAKEFILE(dlls/xinput1_1)
|
||||
WINE_CONFIG_MAKEFILE(dlls/xinput1_2)
|
||||
|
|
|
@ -10,3 +10,5 @@ C_SRCS = \
|
|||
xaudio_allocator.c
|
||||
|
||||
RC_SRCS = version.rc
|
||||
|
||||
IDL_SRCS = xaudio_classes.idl
|
||||
|
|
|
@ -8,3 +8,5 @@ C_SRCS = \
|
|||
xapo.c \
|
||||
xapofx.c \
|
||||
xaudio_allocator.c
|
||||
|
||||
IDL_SRCS = xaudio_classes.idl
|
||||
|
|
|
@ -10,3 +10,5 @@ C_SRCS = \
|
|||
xaudio_allocator.c
|
||||
|
||||
RC_SRCS = version.rc
|
||||
|
||||
IDL_SRCS = xaudio_classes.idl
|
||||
|
|
|
@ -8,3 +8,5 @@ C_SRCS = \
|
|||
xapo.c \
|
||||
xapofx.c \
|
||||
xaudio_allocator.c
|
||||
|
||||
IDL_SRCS = xaudio_classes.idl
|
||||
|
|
|
@ -8,3 +8,5 @@ C_SRCS = \
|
|||
xapo.c \
|
||||
xapofx.c \
|
||||
xaudio_allocator.c
|
||||
|
||||
IDL_SRCS = xaudio_classes.idl
|
||||
|
|
|
@ -5,7 +5,6 @@ EXTRAINCL = $(FAUDIO_PE_CFLAGS)
|
|||
PARENTSRC = ../xaudio2_7
|
||||
|
||||
C_SRCS = \
|
||||
compat.c \
|
||||
xapo.c \
|
||||
xaudio_allocator.c \
|
||||
xaudio_dll.c
|
||||
|
|
|
@ -5,7 +5,6 @@ EXTRAINCL = $(FAUDIO_PE_CFLAGS)
|
|||
PARENTSRC = ../xaudio2_7
|
||||
|
||||
C_SRCS = \
|
||||
compat.c \
|
||||
xapo.c \
|
||||
xaudio_allocator.c \
|
||||
xaudio_dll.c
|
||||
|
|
|
@ -5,7 +5,6 @@ EXTRAINCL = $(FAUDIO_PE_CFLAGS)
|
|||
PARENTSRC = ../xaudio2_7
|
||||
|
||||
C_SRCS = \
|
||||
compat.c \
|
||||
xapo.c \
|
||||
xaudio_allocator.c \
|
||||
xaudio_dll.c
|
||||
|
|
|
@ -5,7 +5,6 @@ EXTRAINCL = $(FAUDIO_PE_CFLAGS)
|
|||
PARENTSRC = ../xaudio2_7
|
||||
|
||||
C_SRCS = \
|
||||
compat.c \
|
||||
xapo.c \
|
||||
xaudio_allocator.c \
|
||||
xaudio_dll.c
|
||||
|
|
|
@ -5,7 +5,6 @@ EXTRAINCL = $(FAUDIO_PE_CFLAGS)
|
|||
PARENTSRC = ../xaudio2_7
|
||||
|
||||
C_SRCS = \
|
||||
compat.c \
|
||||
xapo.c \
|
||||
xaudio_allocator.c \
|
||||
xaudio_dll.c
|
||||
|
|
|
@ -5,7 +5,6 @@ EXTRAINCL = $(FAUDIO_PE_CFLAGS)
|
|||
PARENTSRC = ../xaudio2_7
|
||||
|
||||
C_SRCS = \
|
||||
compat.c \
|
||||
xapo.c \
|
||||
xaudio_allocator.c \
|
||||
xaudio_dll.c
|
||||
|
|
|
@ -5,7 +5,6 @@ EXTRAINCL = $(FAUDIO_PE_CFLAGS)
|
|||
PARENTSRC = ../xaudio2_7
|
||||
|
||||
C_SRCS = \
|
||||
compat.c \
|
||||
xapo.c \
|
||||
xaudio_allocator.c \
|
||||
xaudio_dll.c
|
||||
|
|
|
@ -4,7 +4,6 @@ IMPORTS = $(FAUDIO_PE_LIBS) advapi32 ole32 user32 uuid
|
|||
EXTRAINCL = $(FAUDIO_PE_CFLAGS)
|
||||
|
||||
C_SRCS = \
|
||||
compat.c \
|
||||
x3daudio.c \
|
||||
xapo.c \
|
||||
xapofx.c \
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,5 +1,8 @@
|
|||
TESTDLL = xaudio2_7.dll
|
||||
IMPORTS = ole32
|
||||
EXTRADEFS = -DXAUDIO2_VER=7
|
||||
|
||||
C_SRCS = \
|
||||
xaudio2.c
|
||||
|
||||
IDL_SRCS = xaudio_classes.idl
|
||||
|
|
|
@ -18,42 +18,87 @@
|
|||
|
||||
#include <windows.h>
|
||||
#include <math.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#define COBJMACROS
|
||||
#include "wine/test.h"
|
||||
#include "initguid.h"
|
||||
#include "xaudio2.h"
|
||||
#include "xaudio2fx.h"
|
||||
/* Don't include xaudio2.h directly; it's generated from an IDL with ifdefs and
|
||||
* hence is frozen at version 2.7. Instead include that IDL in a local IDL and
|
||||
* include the generated header.
|
||||
*
|
||||
* Because shared sources are compiled from the C file in the xaudio2_7
|
||||
* directory, we need to use angle brackets here to prevent the compiler from
|
||||
* picking up xaudio_classes.h from that directory for other versions. */
|
||||
#include <xaudio_classes.h>
|
||||
#include "xapo.h"
|
||||
#include "xapofx.h"
|
||||
#include "mmsystem.h"
|
||||
#include "ks.h"
|
||||
#include "ksmedia.h"
|
||||
|
||||
static BOOL xaudio27;
|
||||
static const GUID IID_IXAudio27 = {0x8bcf1f58, 0x9fe7, 0x4583, {0x8a, 0xc6, 0xe2, 0xad, 0xc4, 0x65, 0xc8, 0xbb}};
|
||||
static const GUID IID_IXAudio28 = {0x2b02e3cf, 0x2e0b, 0x4ec3, {0xbe, 0x45, 0x1b, 0x2a, 0x3f, 0xe7, 0x21, 0x0d}};
|
||||
|
||||
static HRESULT (WINAPI *pXAudio2Create)(IXAudio2 **, UINT32, XAUDIO2_PROCESSOR) = NULL;
|
||||
static HRESULT (WINAPI *pCreateAudioVolumeMeter)(IUnknown**) = NULL;
|
||||
static const GUID CLSID_AudioVolumeMeter20 = {0xc0c56f46, 0x29b1, 0x44e9, {0x99, 0x39, 0xa3, 0x2c, 0xe8, 0x68, 0x67, 0xe2}};
|
||||
static const GUID CLSID_AudioVolumeMeter21 = {0xc1e3f122, 0xa2ea, 0x442c, {0x85, 0x4f, 0x20, 0xd9, 0x8f, 0x83, 0x57, 0xa1}};
|
||||
static const GUID CLSID_AudioVolumeMeter22 = {0xf5ca7b34, 0x8055, 0x42c0, {0xb8, 0x36, 0x21, 0x61, 0x29, 0xeb, 0x7e, 0x30}};
|
||||
static const GUID CLSID_AudioVolumeMeter23 = {0xe180344b, 0xac83, 0x4483, {0x95, 0x9e, 0x18, 0xa5, 0xc5, 0x6a, 0x5e, 0x19}};
|
||||
static const GUID CLSID_AudioVolumeMeter24 = {0xc7338b95, 0x52b8, 0x4542, {0xaa, 0x79, 0x42, 0xeb, 0x01, 0x6c, 0x8c, 0x1c}};
|
||||
static const GUID CLSID_AudioVolumeMeter25 = {0x2139e6da, 0xc341, 0x4774, {0x9a, 0xc3, 0xb4, 0xe0, 0x26, 0x34, 0x7f, 0x64}};
|
||||
static const GUID CLSID_AudioVolumeMeter26 = {0xe48c5a3f, 0x93ef, 0x43bb, {0xa0, 0x92, 0x2c, 0x7c, 0xeb, 0x94, 0x6f, 0x27}};
|
||||
static const GUID CLSID_AudioVolumeMeter27 = {0xcac1105f, 0x619b, 0x4d04, {0x83, 0x1a, 0x44, 0xe1, 0xcb, 0xf1, 0x2d, 0x57}};
|
||||
static const GUID CLSID_AudioReverb20 = {0x6f6ea3a9, 0x2cf5, 0x41cf, {0x91, 0xc1, 0x21, 0x70, 0xb1, 0x54, 0x00, 0x63}};
|
||||
static const GUID CLSID_AudioReverb21 = {0xf4769300, 0xb949, 0x4df9, {0xb3, 0x33, 0x00, 0xd3, 0x39, 0x32, 0xe9, 0xa6}};
|
||||
static const GUID CLSID_AudioReverb22 = {0x629cf0de, 0x3ecc, 0x41e7, {0x99, 0x26, 0xf7, 0xe4, 0x3e, 0xeb, 0xec, 0x51}};
|
||||
static const GUID CLSID_AudioReverb23 = {0x9cab402c, 0x1d37, 0x44b4, {0x88, 0x6d, 0xfa, 0x4f, 0x36, 0x17, 0x0a, 0x4c}};
|
||||
static const GUID CLSID_AudioReverb24 = {0x8bb7778b, 0x645b, 0x4475, {0x9a, 0x73, 0x1d, 0xe3, 0x17, 0x0b, 0xd3, 0xaf}};
|
||||
static const GUID CLSID_AudioReverb25 = {0xd06df0d0, 0x8518, 0x441e, {0x82, 0x2f, 0x54, 0x51, 0xd5, 0xc5, 0x95, 0xb8}};
|
||||
static const GUID CLSID_AudioReverb26 = {0xcecec95a, 0xd894, 0x491a, {0xbe, 0xe3, 0x5e, 0x10, 0x6f, 0xb5, 0x9f, 0x2d}};
|
||||
static const GUID CLSID_AudioReverb27 = {0x6a93130e, 0x1d53, 0x41d1, {0xa9, 0xcf, 0xe7, 0x58, 0x80, 0x0b, 0xb1, 0x79}};
|
||||
|
||||
#define XA2CALL_0(method) if(xaudio27) hr = IXAudio27_##method((IXAudio27*)xa); else hr = IXAudio2_##method(xa);
|
||||
#define XA2CALL_0V(method) if(xaudio27) IXAudio27_##method((IXAudio27*)xa); else IXAudio2_##method(xa);
|
||||
#define XA2CALL_V(method, ...) if(xaudio27) IXAudio27_##method((IXAudio27*)xa, __VA_ARGS__); else IXAudio2_##method(xa, __VA_ARGS__);
|
||||
#define XA2CALL(method, ...) if(xaudio27) hr = IXAudio27_##method((IXAudio27*)xa, __VA_ARGS__); else hr = IXAudio2_##method(xa, __VA_ARGS__);
|
||||
static const bool xaudio27 = (XAUDIO2_VER <= 7);
|
||||
|
||||
static IXAudio2 *create_xaudio2(void)
|
||||
{
|
||||
IXAudio2 *audio;
|
||||
HRESULT hr;
|
||||
|
||||
#if XAUDIO2_VER <= 7
|
||||
hr = CoCreateInstance(&CLSID_XAudio2, NULL, CLSCTX_INPROC_SERVER, &IID_IXAudio2, (void **)&audio);
|
||||
if (hr == REGDB_E_CLASSNOTREG)
|
||||
{
|
||||
win_skip("XAudio 2.7 is not available\n");
|
||||
return NULL;
|
||||
}
|
||||
ok(hr == S_OK, "Got hr %#lx.\n", hr);
|
||||
|
||||
hr = IXAudio2_Initialize(audio, 0, XAUDIO2_ANY_PROCESSOR);
|
||||
ok(hr == S_OK, "Got hr %#lx.\n", hr);
|
||||
#else
|
||||
hr = XAudio2Create(&audio, 0, XAUDIO2_DEFAULT_PROCESSOR);
|
||||
ok(hr == S_OK, "Got hr %#lx.\n", hr);
|
||||
#endif
|
||||
|
||||
return audio;
|
||||
}
|
||||
|
||||
static HRESULT create_mastering_voice(IXAudio2 *audio, unsigned int channel_count, IXAudio2MasteringVoice **voice)
|
||||
{
|
||||
if (xaudio27)
|
||||
return IXAudio27_CreateMasteringVoice((IXAudio27*)audio, voice, channel_count, 44100, 0, 0, NULL);
|
||||
else
|
||||
return IXAudio2_CreateMasteringVoice(audio, voice, channel_count, 44100, 0, NULL, NULL, AudioCategory_GameEffects);
|
||||
#if XAUDIO2_VER <= 7
|
||||
return IXAudio2_CreateMasteringVoice(audio, voice, channel_count, 44100, 0, 0, NULL);
|
||||
#else
|
||||
return IXAudio2_CreateMasteringVoice(audio, voice, channel_count, 44100, 0, NULL, NULL, AudioCategory_GameEffects);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void get_voice_state(IXAudio2SourceVoice *voice, XAUDIO2_VOICE_STATE *state)
|
||||
{
|
||||
if (xaudio27)
|
||||
IXAudio27SourceVoice_GetState((IXAudio27SourceVoice*)voice, state);
|
||||
else
|
||||
IXAudio2SourceVoice_GetState(voice, state, 0);
|
||||
#if XAUDIO2_VER <= 7
|
||||
IXAudio2SourceVoice_GetState(voice, state);
|
||||
#else
|
||||
IXAudio2SourceVoice_GetState(voice, state, 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void fill_buf(float *buf, WAVEFORMATEX *fmt, DWORD hz, DWORD len_frames)
|
||||
|
@ -191,16 +236,17 @@ static void test_simple_streaming(IXAudio2 *xa)
|
|||
IUnknown *vumeter;
|
||||
WAVEFORMATEX fmt;
|
||||
XAUDIO2_BUFFER buf, buf2;
|
||||
XAUDIO2_VOICE_DETAILS details;
|
||||
XAUDIO2_VOICE_STATE state;
|
||||
XAUDIO2_EFFECT_DESCRIPTOR effect;
|
||||
XAUDIO2_EFFECT_CHAIN chain;
|
||||
DWORD chmask;
|
||||
IXAPO *xapo;
|
||||
|
||||
memset(&ecb_state, 0, sizeof(ecb_state));
|
||||
memset(&src1_state, 0, sizeof(src1_state));
|
||||
memset(&src2_state, 0, sizeof(src2_state));
|
||||
|
||||
XA2CALL_0V(StopEngine);
|
||||
IXAudio2_StopEngine(xa);
|
||||
|
||||
/* Tests show in native XA2.8, ECB is called from a mixer thread, but VCBs
|
||||
* may be called from other threads in any order. So we can't rely on any
|
||||
|
@ -208,17 +254,20 @@ static void test_simple_streaming(IXAudio2 *xa)
|
|||
*
|
||||
* XA2.7 does all mixing from a single thread, so call sequence can be
|
||||
* tested. */
|
||||
XA2CALL(RegisterForCallbacks, &ecb);
|
||||
hr = IXAudio2_RegisterForCallbacks(xa, &ecb);
|
||||
ok(hr == S_OK, "RegisterForCallbacks failed: %08lx\n", hr);
|
||||
|
||||
hr = create_mastering_voice(xa, 2, &master);
|
||||
ok(hr == S_OK, "CreateMasteringVoice failed: %08lx\n", hr);
|
||||
|
||||
if(!xaudio27){
|
||||
chmask = 0xdeadbeef;
|
||||
#if XAUDIO2_VER >= 8
|
||||
{
|
||||
DWORD chmask = 0xdeadbeef;
|
||||
|
||||
IXAudio2MasteringVoice_GetChannelMask(master, &chmask);
|
||||
ok(chmask == (SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT), "Got unexpected channel mask: 0x%lx\n", chmask);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* create first source voice */
|
||||
fmt.wFormatTag = WAVE_FORMAT_IEEE_FLOAT;
|
||||
|
@ -229,23 +278,16 @@ static void test_simple_streaming(IXAudio2 *xa)
|
|||
fmt.nAvgBytesPerSec = fmt.nSamplesPerSec * fmt.nBlockAlign;
|
||||
fmt.cbSize = 0;
|
||||
|
||||
XA2CALL(CreateSourceVoice, &src, &fmt, 0, 1.f, &vcb1, NULL, NULL);
|
||||
hr = IXAudio2_CreateSourceVoice(xa, &src, &fmt, 0, 1.f, &vcb1, NULL, NULL);
|
||||
ok(hr == S_OK, "CreateSourceVoice failed: %08lx\n", hr);
|
||||
|
||||
if(xaudio27){
|
||||
XAUDIO27_VOICE_DETAILS details;
|
||||
IXAudio27SourceVoice_GetVoiceDetails((IXAudio27SourceVoice*)src, &details);
|
||||
ok(details.CreationFlags == 0, "Got wrong flags: 0x%x\n", details.CreationFlags);
|
||||
ok(details.InputChannels == 2, "Got wrong channel count: 0x%x\n", details.InputChannels);
|
||||
ok(details.InputSampleRate == 44100, "Got wrong sample rate: 0x%x\n", details.InputSampleRate);
|
||||
}else{
|
||||
XAUDIO2_VOICE_DETAILS details;
|
||||
IXAudio2SourceVoice_GetVoiceDetails(src, &details);
|
||||
ok(details.CreationFlags == 0, "Got wrong creation flags: 0x%x\n", details.CreationFlags);
|
||||
ok(details.ActiveFlags == 0, "Got wrong active flags: 0x%x\n", details.CreationFlags);
|
||||
ok(details.InputChannels == 2, "Got wrong channel count: 0x%x\n", details.InputChannels);
|
||||
ok(details.InputSampleRate == 44100, "Got wrong sample rate: 0x%x\n", details.InputSampleRate);
|
||||
}
|
||||
IXAudio2SourceVoice_GetVoiceDetails(src, &details);
|
||||
ok(details.CreationFlags == 0, "Got wrong creation flags: 0x%x\n", details.CreationFlags);
|
||||
#if XAUDIO2_VER >= 8
|
||||
ok(details.ActiveFlags == 0, "Got wrong active flags: 0x%x\n", details.ActiveFlags);
|
||||
#endif
|
||||
ok(details.InputChannels == 2, "Got wrong channel count: 0x%x\n", details.InputChannels);
|
||||
ok(details.InputSampleRate == 44100, "Got wrong sample rate: 0x%x\n", details.InputSampleRate);
|
||||
|
||||
memset(&buf, 0, sizeof(buf));
|
||||
buf.AudioBytes = 22050 * fmt.nBlockAlign;
|
||||
|
@ -259,23 +301,16 @@ static void test_simple_streaming(IXAudio2 *xa)
|
|||
ok(hr == S_OK, "Start failed: %08lx\n", hr);
|
||||
|
||||
/* create second source voice */
|
||||
XA2CALL(CreateSourceVoice, &src2, &fmt, 0, 1.f, &vcb2, NULL, NULL);
|
||||
hr = IXAudio2_CreateSourceVoice(xa, &src2, &fmt, 0, 1.f, &vcb2, NULL, NULL);
|
||||
ok(hr == S_OK, "CreateSourceVoice failed: %08lx\n", hr);
|
||||
|
||||
if(xaudio27){
|
||||
XAUDIO27_VOICE_DETAILS details;
|
||||
IXAudio27SourceVoice_GetVoiceDetails((IXAudio27SourceVoice*)src2, &details);
|
||||
ok(details.CreationFlags == 0, "Got wrong flags: 0x%x\n", details.CreationFlags);
|
||||
ok(details.InputChannels == 2, "Got wrong channel count: 0x%x\n", details.InputChannels);
|
||||
ok(details.InputSampleRate == 44100, "Got wrong sample rate: 0x%x\n", details.InputSampleRate);
|
||||
}else{
|
||||
XAUDIO2_VOICE_DETAILS details;
|
||||
IXAudio2SourceVoice_GetVoiceDetails(src2, &details);
|
||||
ok(details.CreationFlags == 0, "Got wrong creation flags: 0x%x\n", details.CreationFlags);
|
||||
ok(details.ActiveFlags == 0, "Got wrong active flags: 0x%x\n", details.CreationFlags);
|
||||
ok(details.InputChannels == 2, "Got wrong channel count: 0x%x\n", details.InputChannels);
|
||||
ok(details.InputSampleRate == 44100, "Got wrong sample rate: 0x%x\n", details.InputSampleRate);
|
||||
}
|
||||
IXAudio2SourceVoice_GetVoiceDetails(src2, &details);
|
||||
ok(details.CreationFlags == 0, "Got wrong creation flags: 0x%x\n", details.CreationFlags);
|
||||
#if XAUDIO2_VER >= 8
|
||||
ok(details.ActiveFlags == 0, "Got wrong active flags: 0x%x\n", details.ActiveFlags);
|
||||
#endif
|
||||
ok(details.InputChannels == 2, "Got wrong channel count: 0x%x\n", details.InputChannels);
|
||||
ok(details.InputSampleRate == 44100, "Got wrong sample rate: 0x%x\n", details.InputSampleRate);
|
||||
|
||||
memset(&buf2, 0, sizeof(buf2));
|
||||
buf2.AudioBytes = 22050 * fmt.nBlockAlign;
|
||||
|
@ -288,32 +323,21 @@ static void test_simple_streaming(IXAudio2 *xa)
|
|||
hr = IXAudio2SourceVoice_Start(src2, 0, XAUDIO2_COMMIT_NOW);
|
||||
ok(hr == S_OK, "Start failed: %08lx\n", hr);
|
||||
|
||||
XA2CALL_0(StartEngine);
|
||||
hr = IXAudio2_StartEngine(xa);
|
||||
ok(hr == S_OK, "StartEngine failed: %08lx\n", hr);
|
||||
|
||||
/* hook up volume meter */
|
||||
if(xaudio27){
|
||||
IXAPO *xapo;
|
||||
#if XAUDIO2_VER <= 7
|
||||
hr = CoCreateInstance(&CLSID_AudioVolumeMeter, NULL,
|
||||
CLSCTX_INPROC_SERVER, &IID_IUnknown, (void **)&vumeter);
|
||||
#else
|
||||
hr = CreateAudioVolumeMeter(&vumeter);
|
||||
#endif
|
||||
ok(hr == S_OK, "Got hr %#lx.\n", hr);
|
||||
|
||||
hr = CoCreateInstance(&CLSID_AudioVolumeMeter27, NULL,
|
||||
CLSCTX_INPROC_SERVER, &IID_IUnknown, (void**)&vumeter);
|
||||
ok(hr == S_OK, "CoCreateInstance(AudioVolumeMeter) failed: %08lx\n", hr);
|
||||
|
||||
hr = IUnknown_QueryInterface(vumeter, &IID_IXAPO27, (void**)&xapo);
|
||||
ok(hr == S_OK, "Couldn't get IXAPO27 interface: %08lx\n", hr);
|
||||
if(SUCCEEDED(hr))
|
||||
IXAPO_Release(xapo);
|
||||
}else{
|
||||
IXAPO *xapo;
|
||||
|
||||
hr = pCreateAudioVolumeMeter(&vumeter);
|
||||
ok(hr == S_OK, "CreateAudioVolumeMeter failed: %08lx\n", hr);
|
||||
|
||||
hr = IUnknown_QueryInterface(vumeter, &IID_IXAPO, (void**)&xapo);
|
||||
ok(hr == S_OK, "Couldn't get IXAPO interface: %08lx\n", hr);
|
||||
if(SUCCEEDED(hr))
|
||||
IXAPO_Release(xapo);
|
||||
}
|
||||
hr = IUnknown_QueryInterface(vumeter, &IID_IXAPO27, (void **)&xapo);
|
||||
ok(hr == S_OK, "Got hr %#lx.\n", hr);
|
||||
IXAPO_Release(xapo);
|
||||
|
||||
effect.InitialState = TRUE;
|
||||
effect.OutputChannels = 2;
|
||||
|
@ -339,16 +363,11 @@ static void test_simple_streaming(IXAudio2 *xa)
|
|||
HeapFree(GetProcessHeap(), 0, (void*)buf.pAudioData);
|
||||
HeapFree(GetProcessHeap(), 0, (void*)buf2.pAudioData);
|
||||
|
||||
if(xaudio27){
|
||||
IXAudio27SourceVoice_DestroyVoice((IXAudio27SourceVoice*)src);
|
||||
IXAudio27SourceVoice_DestroyVoice((IXAudio27SourceVoice*)src2);
|
||||
}else{
|
||||
IXAudio2SourceVoice_DestroyVoice(src);
|
||||
IXAudio2SourceVoice_DestroyVoice(src2);
|
||||
}
|
||||
IXAudio2SourceVoice_DestroyVoice(src);
|
||||
IXAudio2SourceVoice_DestroyVoice(src2);
|
||||
IXAudio2MasteringVoice_DestroyVoice(master);
|
||||
|
||||
XA2CALL_V(UnregisterForCallbacks, &ecb);
|
||||
IXAudio2_UnregisterForCallbacks(xa, &ecb);
|
||||
}
|
||||
|
||||
static void WINAPI vcb_buf_OnVoiceProcessingPassStart(IXAudio2VoiceCallback *This,
|
||||
|
@ -487,7 +506,7 @@ static void test_buffer_callbacks(IXAudio2 *xa)
|
|||
obs_calls = 0;
|
||||
obe_calls = 0;
|
||||
|
||||
XA2CALL_0V(StopEngine);
|
||||
IXAudio2_StopEngine(xa);
|
||||
|
||||
hr = create_mastering_voice(xa, 2, &master);
|
||||
ok(hr == S_OK, "CreateMasteringVoice failed: %08lx\n", hr);
|
||||
|
@ -501,7 +520,7 @@ static void test_buffer_callbacks(IXAudio2 *xa)
|
|||
fmt.nAvgBytesPerSec = fmt.nSamplesPerSec * fmt.nBlockAlign;
|
||||
fmt.cbSize = 0;
|
||||
|
||||
XA2CALL(CreateSourceVoice, &src, &fmt, 0, 1.f, &vcb_buf, NULL, NULL);
|
||||
hr = IXAudio2_CreateSourceVoice(xa, &src, &fmt, 0, 1.f, &vcb_buf, NULL, NULL);
|
||||
ok(hr == S_OK, "CreateSourceVoice failed: %08lx\n", hr);
|
||||
|
||||
memset(&buf, 0, sizeof(buf));
|
||||
|
@ -523,16 +542,14 @@ static void test_buffer_callbacks(IXAudio2 *xa)
|
|||
ok(hr == S_OK, "Start failed: %08lx\n", hr);
|
||||
|
||||
|
||||
XA2CALL_0(StartEngine);
|
||||
hr = IXAudio2_StartEngine(xa);
|
||||
ok(hr == S_OK, "StartEngine failed: %08lx\n", hr);
|
||||
|
||||
if(xaudio27){
|
||||
hr = IXAudio27SourceVoice_SetSourceSampleRate((IXAudio27SourceVoice*)src, 48000);
|
||||
hr = IXAudio2SourceVoice_SetSourceSampleRate(src, 48000);
|
||||
if (xaudio27)
|
||||
ok(hr == S_OK, "SetSourceSampleRate failed: %08lx\n", hr);
|
||||
}else{
|
||||
hr = IXAudio2SourceVoice_SetSourceSampleRate(src, 48000);
|
||||
else
|
||||
ok(hr == XAUDIO2_E_INVALID_CALL, "SetSourceSampleRate should have failed: %08lx\n", hr);
|
||||
}
|
||||
|
||||
while(1){
|
||||
get_voice_state(src, &state);
|
||||
|
@ -543,14 +560,10 @@ static void test_buffer_callbacks(IXAudio2 *xa)
|
|||
|
||||
ok(state.SamplesPlayed == 4410 * 5, "Got wrong samples played\n");
|
||||
|
||||
if(xaudio27)
|
||||
IXAudio27SourceVoice_DestroyVoice((IXAudio27SourceVoice*)src);
|
||||
else
|
||||
IXAudio2SourceVoice_DestroyVoice(src);
|
||||
|
||||
IXAudio2SourceVoice_DestroyVoice(src);
|
||||
|
||||
/* test OnStreamEnd callback */
|
||||
XA2CALL(CreateSourceVoice, &src, &fmt, 0, 1.f, &loop_buf, NULL, NULL);
|
||||
hr = IXAudio2_CreateSourceVoice(xa, &src, &fmt, 0, 1.f, &loop_buf, NULL, NULL);
|
||||
ok(hr == S_OK, "CreateSourceVoice failed: %08lx\n", hr);
|
||||
|
||||
buf.Flags = XAUDIO2_END_OF_STREAM;
|
||||
|
@ -573,12 +586,7 @@ static void test_buffer_callbacks(IXAudio2 *xa)
|
|||
get_voice_state(src, &state);
|
||||
ok(state.SamplesPlayed == 0, "Got wrong samples played\n");
|
||||
|
||||
if(xaudio27)
|
||||
IXAudio27SourceVoice_DestroyVoice((IXAudio27SourceVoice*)src);
|
||||
else
|
||||
IXAudio2SourceVoice_DestroyVoice(src);
|
||||
|
||||
|
||||
IXAudio2SourceVoice_DestroyVoice(src);
|
||||
IXAudio2MasteringVoice_DestroyVoice(master);
|
||||
|
||||
HeapFree(GetProcessHeap(), 0, (void*)buf.pAudioData);
|
||||
|
@ -598,12 +606,8 @@ static UINT32 play_to_completion(IXAudio2SourceVoice *src, UINT32 max_samples)
|
|||
get_voice_state(src, &state);
|
||||
if(state.BuffersQueued == 0)
|
||||
break;
|
||||
if(state.SamplesPlayed >= max_samples){
|
||||
if(xaudio27)
|
||||
IXAudio27SourceVoice_ExitLoop((IXAudio27SourceVoice*)src, XAUDIO2_COMMIT_NOW);
|
||||
else
|
||||
IXAudio2SourceVoice_ExitLoop(src, XAUDIO2_COMMIT_NOW);
|
||||
}
|
||||
if (state.SamplesPlayed >= max_samples)
|
||||
IXAudio2SourceVoice_ExitLoop(src, XAUDIO2_COMMIT_NOW);
|
||||
Sleep(100);
|
||||
}
|
||||
|
||||
|
@ -622,7 +626,7 @@ static void test_looping(IXAudio2 *xa)
|
|||
XAUDIO2_BUFFER buf;
|
||||
UINT32 played, running_total = 0;
|
||||
|
||||
XA2CALL_0V(StopEngine);
|
||||
IXAudio2_StopEngine(xa);
|
||||
|
||||
hr = create_mastering_voice(xa, 2, &master);
|
||||
ok(hr == S_OK, "CreateMasteringVoice failed: %08lx\n", hr);
|
||||
|
@ -636,7 +640,7 @@ static void test_looping(IXAudio2 *xa)
|
|||
fmt.nAvgBytesPerSec = fmt.nSamplesPerSec * fmt.nBlockAlign;
|
||||
fmt.cbSize = 0;
|
||||
|
||||
XA2CALL(CreateSourceVoice, &src, &fmt, 0, 1.f, &loop_buf, NULL, NULL);
|
||||
hr = IXAudio2_CreateSourceVoice(xa, &src, &fmt, 0, 1.f, &loop_buf, NULL, NULL);
|
||||
ok(hr == S_OK, "CreateSourceVoice failed: %08lx\n", hr);
|
||||
|
||||
memset(&buf, 0, sizeof(buf));
|
||||
|
@ -645,7 +649,7 @@ static void test_looping(IXAudio2 *xa)
|
|||
buf.pAudioData = HeapAlloc(GetProcessHeap(), 0, buf.AudioBytes);
|
||||
fill_buf((float*)buf.pAudioData, &fmt, 440, 44100);
|
||||
|
||||
XA2CALL_0(StartEngine);
|
||||
hr = IXAudio2_StartEngine(xa);
|
||||
ok(hr == S_OK, "StartEngine failed: %08lx\n", hr);
|
||||
|
||||
/* play from middle to end */
|
||||
|
@ -789,10 +793,7 @@ static void test_looping(IXAudio2 *xa)
|
|||
ok(nloopends == (played - running_total) / 88200 + 1, "Got wrong OnLoopEnd calls: %u\n", nloopends);
|
||||
running_total = played;
|
||||
|
||||
if(xaudio27)
|
||||
IXAudio27SourceVoice_DestroyVoice((IXAudio27SourceVoice*)src);
|
||||
else
|
||||
IXAudio2SourceVoice_DestroyVoice(src);
|
||||
IXAudio2SourceVoice_DestroyVoice(src);
|
||||
IXAudio2MasteringVoice_DestroyVoice(master);
|
||||
HeapFree(GetProcessHeap(), 0, (void*)buf.pAudioData);
|
||||
}
|
||||
|
@ -801,30 +802,24 @@ static void test_submix(IXAudio2 *xa)
|
|||
{
|
||||
HRESULT hr;
|
||||
IXAudio2MasteringVoice *master;
|
||||
XAUDIO2_VOICE_DETAILS details;
|
||||
IXAudio2SubmixVoice *sub;
|
||||
|
||||
XA2CALL_0V(StopEngine);
|
||||
IXAudio2_StopEngine(xa);
|
||||
|
||||
hr = create_mastering_voice(xa, 2, &master);
|
||||
ok(hr == S_OK, "CreateMasteringVoice failed: %08lx\n", hr);
|
||||
|
||||
XA2CALL(CreateSubmixVoice, &sub, 2, 44100, 0, 0, NULL, NULL);
|
||||
hr = IXAudio2_CreateSubmixVoice(xa, &sub, 2, 44100, 0, 0, NULL, NULL);
|
||||
ok(hr == S_OK, "CreateSubmixVoice failed: %08lx\n", hr);
|
||||
|
||||
if(xaudio27){
|
||||
XAUDIO27_VOICE_DETAILS details;
|
||||
IXAudio27SubmixVoice_GetVoiceDetails((IXAudio27SubmixVoice*)sub, &details);
|
||||
ok(details.CreationFlags == 0, "Got wrong flags: 0x%x\n", details.CreationFlags);
|
||||
ok(details.InputChannels == 2, "Got wrong channel count: 0x%x\n", details.InputChannels);
|
||||
ok(details.InputSampleRate == 44100, "Got wrong sample rate: 0x%x\n", details.InputSampleRate);
|
||||
}else{
|
||||
XAUDIO2_VOICE_DETAILS details;
|
||||
IXAudio2SubmixVoice_GetVoiceDetails(sub, &details);
|
||||
ok(details.CreationFlags == 0, "Got wrong creation flags: 0x%x\n", details.CreationFlags);
|
||||
ok(details.ActiveFlags == 0, "Got wrong active flags: 0x%x\n", details.CreationFlags);
|
||||
ok(details.InputChannels == 2, "Got wrong channel count: 0x%x\n", details.InputChannels);
|
||||
ok(details.InputSampleRate == 44100, "Got wrong sample rate: 0x%x\n", details.InputSampleRate);
|
||||
}
|
||||
IXAudio2SubmixVoice_GetVoiceDetails(sub, &details);
|
||||
ok(details.CreationFlags == 0, "Got wrong creation flags: 0x%x\n", details.CreationFlags);
|
||||
#if XAUDIO2_VER >= 8
|
||||
ok(details.ActiveFlags == 0, "Got wrong active flags: 0x%x\n", details.ActiveFlags);
|
||||
#endif
|
||||
ok(details.InputChannels == 2, "Got wrong channel count: 0x%x\n", details.InputChannels);
|
||||
ok(details.InputSampleRate == 44100, "Got wrong sample rate: 0x%x\n", details.InputSampleRate);
|
||||
|
||||
IXAudio2SubmixVoice_DestroyVoice(sub);
|
||||
IXAudio2MasteringVoice_DestroyVoice(master);
|
||||
|
@ -839,7 +834,7 @@ static void test_flush(IXAudio2 *xa)
|
|||
XAUDIO2_BUFFER buf;
|
||||
XAUDIO2_VOICE_STATE state;
|
||||
|
||||
XA2CALL_0V(StopEngine);
|
||||
IXAudio2_StopEngine(xa);
|
||||
|
||||
hr = create_mastering_voice(xa, 2, &master);
|
||||
ok(hr == S_OK, "CreateMasteringVoice failed: %08lx\n", hr);
|
||||
|
@ -852,7 +847,7 @@ static void test_flush(IXAudio2 *xa)
|
|||
fmt.nAvgBytesPerSec = fmt.nSamplesPerSec * fmt.nBlockAlign;
|
||||
fmt.cbSize = 0;
|
||||
|
||||
XA2CALL(CreateSourceVoice, &src, &fmt, 0, 1.f, NULL, NULL, NULL);
|
||||
hr = IXAudio2_CreateSourceVoice(xa, &src, &fmt, 0, 1.f, NULL, NULL, NULL);
|
||||
ok(hr == S_OK, "CreateSourceVoice failed: %08lx\n", hr);
|
||||
|
||||
memset(&buf, 0, sizeof(buf));
|
||||
|
@ -866,7 +861,7 @@ static void test_flush(IXAudio2 *xa)
|
|||
hr = IXAudio2SourceVoice_Start(src, 0, XAUDIO2_COMMIT_NOW);
|
||||
ok(hr == S_OK, "Start failed: %08lx\n", hr);
|
||||
|
||||
XA2CALL_0(StartEngine);
|
||||
hr = IXAudio2_StartEngine(xa);
|
||||
ok(hr == S_OK, "StartEngine failed: %08lx\n", hr);
|
||||
|
||||
while(1){
|
||||
|
@ -890,30 +885,25 @@ static void test_flush(IXAudio2 *xa)
|
|||
hr = IXAudio2SourceVoice_SubmitSourceBuffer(src, &buf, NULL);
|
||||
ok(hr == S_OK, "SubmitSourceBuffer failed: %08lx\n", hr);
|
||||
|
||||
if(xaudio27){
|
||||
IXAudio27SourceVoice_DestroyVoice((IXAudio27SourceVoice*)src);
|
||||
}else{
|
||||
IXAudio2SourceVoice_DestroyVoice(src);
|
||||
}
|
||||
IXAudio2SourceVoice_DestroyVoice(src);
|
||||
IXAudio2MasteringVoice_DestroyVoice(master);
|
||||
|
||||
HeapFree(GetProcessHeap(), 0, (void*)buf.pAudioData);
|
||||
}
|
||||
|
||||
static UINT32 test_DeviceDetails(IXAudio27 *xa)
|
||||
static void test_DeviceDetails(IXAudio2 *xa)
|
||||
{
|
||||
#if XAUDIO2_VER <= 7
|
||||
HRESULT hr;
|
||||
XAUDIO2_DEVICE_DETAILS dd;
|
||||
UINT32 count, i;
|
||||
|
||||
hr = IXAudio27_GetDeviceCount(xa, &count);
|
||||
hr = IXAudio2_GetDeviceCount(xa, &count);
|
||||
ok(hr == S_OK, "GetDeviceCount failed: %08lx\n", hr);
|
||||
|
||||
if(count == 0)
|
||||
return 0;
|
||||
ok(count > 0, "Got %u devices.\n", count);
|
||||
|
||||
for(i = 0; i < count; ++i){
|
||||
hr = IXAudio27_GetDeviceDetails(xa, i, &dd);
|
||||
hr = IXAudio2_GetDeviceDetails(xa, i, &dd);
|
||||
ok(hr == S_OK, "GetDeviceDetails failed: %08lx\n", hr);
|
||||
|
||||
if(i == 0)
|
||||
|
@ -924,8 +914,7 @@ static UINT32 test_DeviceDetails(IXAudio27 *xa)
|
|||
ok(IsEqualGUID(&dd.OutputFormat.SubFormat, &KSDATAFORMAT_SUBTYPE_PCM),
|
||||
"got format %s\n", debugstr_guid(&dd.OutputFormat.SubFormat));
|
||||
}
|
||||
|
||||
return count;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void test_xapo_creation_legacy(const char *module, unsigned int version)
|
||||
|
@ -1159,10 +1148,10 @@ static void test_setchannelvolumes(IXAudio2 *xa)
|
|||
fmt_8ch.nAvgBytesPerSec = fmt_8ch.nSamplesPerSec * fmt_8ch.nBlockAlign;
|
||||
fmt_8ch.cbSize = 0;
|
||||
|
||||
XA2CALL(CreateSourceVoice, &src_2ch, &fmt_2ch, 0, 1.f, NULL, NULL, NULL);
|
||||
hr = IXAudio2_CreateSourceVoice(xa, &src_2ch, &fmt_2ch, 0, 1.f, NULL, NULL, NULL);
|
||||
ok(hr == S_OK, "CreateSourceVoice failed: %08lx\n", hr);
|
||||
|
||||
XA2CALL(CreateSourceVoice, &src_8ch, &fmt_8ch, 0, 1.f, NULL, NULL, NULL);
|
||||
hr = IXAudio2_CreateSourceVoice(xa, &src_8ch, &fmt_8ch, 0, 1.f, NULL, NULL, NULL);
|
||||
ok(hr == S_OK, "CreateSourceVoice failed: %08lx\n", hr);
|
||||
|
||||
hr = IXAudio2SourceVoice_SetChannelVolumes(src_2ch, 2, volumes, XAUDIO2_COMMIT_NOW);
|
||||
|
@ -1188,14 +1177,8 @@ static void test_setchannelvolumes(IXAudio2 *xa)
|
|||
ok(hr == XAUDIO2_E_INVALID_CALL, "SetChannelVolumes should have failed: %08lx\n", hr);
|
||||
}
|
||||
|
||||
if(xaudio27){
|
||||
IXAudio27SourceVoice_DestroyVoice((IXAudio27SourceVoice*)src_2ch);
|
||||
IXAudio27SourceVoice_DestroyVoice((IXAudio27SourceVoice*)src_8ch);
|
||||
}else{
|
||||
IXAudio2SourceVoice_DestroyVoice(src_2ch);
|
||||
IXAudio2SourceVoice_DestroyVoice(src_8ch);
|
||||
}
|
||||
|
||||
IXAudio2SourceVoice_DestroyVoice(src_2ch);
|
||||
IXAudio2SourceVoice_DestroyVoice(src_8ch);
|
||||
IXAudio2MasteringVoice_DestroyVoice(master);
|
||||
}
|
||||
|
||||
|
@ -1215,76 +1198,40 @@ static UINT32 check_has_devices(IXAudio2 *xa)
|
|||
|
||||
START_TEST(xaudio2)
|
||||
{
|
||||
IXAudio2 *audio, *audio2;
|
||||
HRESULT hr;
|
||||
IXAudio27 *xa27 = NULL;
|
||||
IXAudio2 *xa = NULL;
|
||||
HANDLE xa28dll;
|
||||
UINT32 has_devices;
|
||||
ULONG rc;
|
||||
ULONG ref;
|
||||
|
||||
CoInitialize(NULL);
|
||||
|
||||
xa28dll = LoadLibraryA("xaudio2_8.dll");
|
||||
if(xa28dll){
|
||||
pXAudio2Create = (void*)GetProcAddress(xa28dll, "XAudio2Create");
|
||||
pCreateAudioVolumeMeter = (void*)GetProcAddress(xa28dll, "CreateAudioVolumeMeter");
|
||||
}
|
||||
|
||||
test_xapo_creation();
|
||||
|
||||
/* XAudio 2.7 (Jun 2010 DirectX) */
|
||||
hr = CoCreateInstance(&CLSID_XAudio27, NULL, CLSCTX_INPROC_SERVER,
|
||||
&IID_IXAudio27, (void**)&xa27);
|
||||
if(hr == S_OK){
|
||||
xaudio27 = TRUE;
|
||||
if (!(audio = create_xaudio2()))
|
||||
return;
|
||||
|
||||
hr = IXAudio27_QueryInterface(xa27, &IID_IXAudio28, (void**) &xa);
|
||||
ok(hr != S_OK, "QueryInterface with IID_IXAudio28 on IXAudio27 object returned success. Expected to fail\n");
|
||||
hr = IXAudio2_QueryInterface(audio, &IID_IXAudio27, (void **)&audio2);
|
||||
ok(hr == (xaudio27 ? S_OK : E_NOINTERFACE), "Got hr %#lx.\n", hr);
|
||||
if (hr == S_OK)
|
||||
IXAudio2_Release(audio2);
|
||||
hr = IXAudio2_QueryInterface(audio, &IID_IXAudio28, (void **)&audio2);
|
||||
todo_wine_if (!xaudio27)
|
||||
ok(hr == (xaudio27 ? E_NOINTERFACE : S_OK), "Got hr %#lx.\n", hr);
|
||||
if (hr == S_OK)
|
||||
IXAudio2_Release(audio2);
|
||||
|
||||
hr = IXAudio27_Initialize(xa27, 0, XAUDIO2_ANY_PROCESSOR);
|
||||
ok(hr == S_OK, "Initialize failed: %08lx\n", hr);
|
||||
if (check_has_devices(audio))
|
||||
{
|
||||
test_DeviceDetails(audio);
|
||||
test_simple_streaming(audio);
|
||||
test_buffer_callbacks(audio);
|
||||
test_looping(audio);
|
||||
test_submix(audio);
|
||||
test_flush(audio);
|
||||
test_setchannelvolumes(audio);
|
||||
}
|
||||
|
||||
has_devices = test_DeviceDetails(xa27);
|
||||
if(has_devices){
|
||||
test_simple_streaming((IXAudio2*)xa27);
|
||||
test_buffer_callbacks((IXAudio2*)xa27);
|
||||
test_looping((IXAudio2*)xa27);
|
||||
test_submix((IXAudio2*)xa27);
|
||||
test_flush((IXAudio2*)xa27);
|
||||
test_setchannelvolumes((IXAudio2*)xa27);
|
||||
}else
|
||||
skip("No audio devices available\n");
|
||||
|
||||
rc = IXAudio27_Release(xa27);
|
||||
ok(rc == 0, "IXAudio2.7 object should have been released, got refcount %lu\n", rc);
|
||||
}else
|
||||
win_skip("XAudio 2.7 not available\n");
|
||||
|
||||
/* XAudio 2.8 (Win8+) */
|
||||
if(pXAudio2Create){
|
||||
xaudio27 = FALSE;
|
||||
|
||||
hr = pXAudio2Create(&xa, 0, XAUDIO2_DEFAULT_PROCESSOR);
|
||||
ok(hr == S_OK, "XAudio2Create failed: %08lx\n", hr);
|
||||
|
||||
hr = IXAudio2_QueryInterface(xa, &IID_IXAudio27, (void**)&xa27);
|
||||
ok(hr == E_NOINTERFACE, "XA28 object should support IXAudio27, gave: %08lx\n", hr);
|
||||
|
||||
has_devices = check_has_devices(xa);
|
||||
if(has_devices){
|
||||
test_simple_streaming(xa);
|
||||
test_buffer_callbacks(xa);
|
||||
test_looping(xa);
|
||||
test_submix(xa);
|
||||
test_flush(xa);
|
||||
test_setchannelvolumes(xa);
|
||||
}else
|
||||
skip("No audio devices available\n");
|
||||
|
||||
rc = IXAudio2_Release(xa);
|
||||
ok(rc == 0, "IXAudio2 object should have been released, got refcount %lu\n", rc);
|
||||
}else
|
||||
win_skip("XAudio 2.8 not available\n");
|
||||
ref = IXAudio2_Release(audio);
|
||||
ok(!ref, "Got unexpected refcount %lu.\n", ref);
|
||||
|
||||
CoUninitialize();
|
||||
}
|
||||
|
|
24
dlls/xaudio2_7/tests/xaudio_classes.idl
Normal file
24
dlls/xaudio2_7/tests/xaudio_classes.idl
Normal file
|
@ -0,0 +1,24 @@
|
|||
/*
|
||||
* COM Classes for xaudio
|
||||
*
|
||||
* Copyright 2015 Guillaume Charifi
|
||||
*
|
||||
* 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 header
|
||||
|
||||
#include "xaudio2.idl"
|
||||
#include "xaudio2fx.idl"
|
|
@ -24,7 +24,6 @@
|
|||
#define COBJMACROS
|
||||
|
||||
#include "xaudio_private.h"
|
||||
#include "xaudio2fx.h"
|
||||
#include "xapofx.h"
|
||||
|
||||
#include "wine/debug.h"
|
||||
|
@ -366,11 +365,11 @@ static HRESULT WINAPI xapocf_CreateInstance(IClassFactory *iface, IUnknown *pOut
|
|||
return CLASS_E_NOAGGREGATION;
|
||||
|
||||
#if XAUDIO2_VER < 8 && !defined(XAPOFX1_VER)
|
||||
if (IsEqualGUID(This->class, &CLSID_AudioVolumeMeter27))
|
||||
if (IsEqualGUID(This->class, &CLSID_AudioVolumeMeter))
|
||||
{
|
||||
hr = volume_meter_create(&object);
|
||||
}
|
||||
else if (IsEqualGUID(This->class, &CLSID_AudioReverb27))
|
||||
else if (IsEqualGUID(This->class, &CLSID_AudioReverb))
|
||||
{
|
||||
hr = reverb_create(&object);
|
||||
}
|
||||
|
|
|
@ -18,188 +18,8 @@
|
|||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#pragma makedep header
|
||||
#pragma makedep register
|
||||
|
||||
#if XAUDIO2_VER == 7
|
||||
[
|
||||
helpstring("XAudio2 Class"),
|
||||
threading(both),
|
||||
uuid(5a508685-a254-4fba-9b82-9a24b00306af)
|
||||
]
|
||||
coclass XAudio27 { interface IXAudio27; }
|
||||
|
||||
[
|
||||
helpstring("XAudio2 Volume Meter Class"),
|
||||
threading(both),
|
||||
uuid(cac1105f-619b-4d04-831a-44e1cbf12d57)
|
||||
]
|
||||
coclass AudioVolumeMeter { interface IUnknown; }
|
||||
|
||||
[
|
||||
helpstring("XAudio2 Reverb Class"),
|
||||
threading(both),
|
||||
uuid(6a93130e-1d53-41d1-a9cf-e758800bb179)
|
||||
]
|
||||
coclass AudioReverb { interface IUnknown; }
|
||||
#endif /* XAUDIO2_VER == 7 */
|
||||
|
||||
#if XAUDIO2_VER == 6
|
||||
[
|
||||
helpstring("XAudio2.6 Class"),
|
||||
threading(both),
|
||||
uuid(3eda9b49-2085-498b-9bb2-39a6778493de)
|
||||
]
|
||||
coclass XAudio26 { interface IXAudio27; }
|
||||
|
||||
[
|
||||
helpstring("XAudio2.6 AudioReverb Class"),
|
||||
threading(both),
|
||||
uuid(cecec95a-d894-491a-bee3-5e106fb59f2d)
|
||||
]
|
||||
coclass AudioReverb26 { interface IXAPO; }
|
||||
|
||||
[
|
||||
helpstring("XAudio2.6 AudioVolumeMeter Class"),
|
||||
threading(both),
|
||||
uuid(e48c5a3f-93ef-43bb-a092-2c7ceb946f27)
|
||||
]
|
||||
coclass AudioVolumeMeter26 { interface IXAPO; }
|
||||
#endif /* XAUDIO2_VER == 6 */
|
||||
|
||||
#if XAUDIO2_VER == 5
|
||||
[
|
||||
helpstring("XAudio2.5 Class"),
|
||||
threading(both),
|
||||
uuid(4c9b6dde-6809-46e6-a278-9b6a97588670)
|
||||
]
|
||||
coclass XAudio25 { interface IXAudio27; }
|
||||
|
||||
[
|
||||
helpstring("XAudio2.5 AudioReverb Class"),
|
||||
threading(both),
|
||||
uuid(d06df0d0-8518-441e-822f-5451d5c595b8)
|
||||
]
|
||||
coclass AudioReverb25 { interface IXAPO; }
|
||||
|
||||
[
|
||||
helpstring("XAudio2.5 AudioVolumeMeter Class"),
|
||||
threading(both),
|
||||
uuid(2139e6da-c341-4774-9ac3-b4e026347f64)
|
||||
]
|
||||
coclass AudioVolumeMeter25 { interface IXAPO; }
|
||||
#endif /* XAUDIO2_VER == 5 */
|
||||
|
||||
#if XAUDIO2_VER == 4
|
||||
[
|
||||
helpstring("XAudio2.4 Class"),
|
||||
threading(both),
|
||||
uuid(03219e78-5bc3-44d1-b92e-f63d89cc6526)
|
||||
]
|
||||
coclass XAudio24 { interface IXAudio27; }
|
||||
|
||||
[
|
||||
helpstring("XAudio2.4 AudioReverb Class"),
|
||||
threading(both),
|
||||
uuid(8bb7778b-645b-4475-9a73-1de3170bd3af)
|
||||
]
|
||||
coclass AudioReverb24 { interface IXAPO; }
|
||||
|
||||
[
|
||||
helpstring("XAudio2.4 AudioVolumeMeter Class"),
|
||||
threading(both),
|
||||
uuid(c7338b95-52b8-4542-aa79-42eb016c8c1c)
|
||||
]
|
||||
coclass AudioVolumeMeter24 { interface IXAPO; }
|
||||
#endif /* XAUDIO2_VER == 4 */
|
||||
|
||||
#if XAUDIO2_VER == 3
|
||||
[
|
||||
helpstring("XAudio2.3 Class"),
|
||||
threading(both),
|
||||
uuid(4c5e637a-16c7-4de3-9c46-5ed22181962d)
|
||||
]
|
||||
coclass XAudio23 { interface IXAudio27; }
|
||||
|
||||
[
|
||||
helpstring("XAudio2.3 AudioReverb Class"),
|
||||
threading(both),
|
||||
uuid(9cab402c-1d37-44b4-886d-fa4f36170a4c)
|
||||
]
|
||||
coclass AudioReverb23 { interface IXAPO; }
|
||||
|
||||
[
|
||||
helpstring("XAudio2.3 AudioVolumeMeter Class"),
|
||||
threading(both),
|
||||
uuid(e180344b-ac83-4483-959e-18a5c56a5e19)
|
||||
]
|
||||
coclass AudioVolumeMeter23 { interface IXAPO; }
|
||||
#endif /* XAUDIO2_VER == 3 */
|
||||
|
||||
#if XAUDIO2_VER == 2
|
||||
[
|
||||
helpstring("XAudio2.2 Class"),
|
||||
threading(both),
|
||||
uuid(b802058a-464a-42db-bc10-b650d6f2586a)
|
||||
]
|
||||
coclass XAudio22 { interface IXAudio22; }
|
||||
|
||||
[
|
||||
helpstring("XAudio2.2 AudioReverb Class"),
|
||||
threading(both),
|
||||
uuid(629cf0de-3ecc-41e7-9926-f7e43eebec51)
|
||||
]
|
||||
coclass AudioReverb22 { interface IXAPO; }
|
||||
|
||||
[
|
||||
helpstring("XAudio2.2 AudioVolumeMeter Class"),
|
||||
threading(both),
|
||||
uuid(f5ca7b34-8055-42c0-b836-216129eb7e30)
|
||||
]
|
||||
coclass AudioVolumeMeter22 { interface IXAPO; }
|
||||
#endif /* XAUDIO2_VER == 2 */
|
||||
|
||||
#if XAUDIO2_VER == 1
|
||||
[
|
||||
helpstring("XAudio2.1 Class"),
|
||||
threading(both),
|
||||
uuid(e21a7345-eb21-468e-be50-804db97cf708)
|
||||
]
|
||||
coclass XAudio21 { interface IXAudio22; }
|
||||
|
||||
[
|
||||
helpstring("XAudio2.1 AudioReverb Class"),
|
||||
threading(both),
|
||||
uuid(f4769300-b949-4df9-b333-00d33932e9a6)
|
||||
]
|
||||
coclass AudioReverb21 { interface IXAPO; }
|
||||
|
||||
[
|
||||
helpstring("XAudio2.1 AudioVolumeMeter Class"),
|
||||
threading(both),
|
||||
uuid(c1e3f122-a2ea-442c-854f-20d98f8357a1)
|
||||
]
|
||||
coclass AudioVolumeMeter21 { interface IXAPO; }
|
||||
#endif /* XAUDIO2_VER == 1 */
|
||||
|
||||
#if XAUDIO2_VER == 0
|
||||
[
|
||||
helpstring("XAudio2.0 Class"),
|
||||
threading(both),
|
||||
uuid(fac23f48-31f5-45a8-b49b-5225d61401aa)
|
||||
]
|
||||
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; }
|
||||
#endif /* XAUDIO2_VER == 0 */
|
||||
#include "xaudio2.idl"
|
||||
#include "xaudio2fx.idl"
|
||||
|
|
|
@ -29,7 +29,6 @@
|
|||
|
||||
#include "initguid.h"
|
||||
#include "xaudio_private.h"
|
||||
#include "xaudio2fx.h"
|
||||
#if XAUDIO2_VER >= 8
|
||||
#include "xapofx.h"
|
||||
#endif
|
||||
|
@ -346,6 +345,16 @@ static FAudioVoiceSends *wrap_voice_sends(const XAUDIO2_VOICE_SENDS *sends)
|
|||
if(!sends)
|
||||
return NULL;
|
||||
|
||||
#if XAUDIO2_VER <= 3
|
||||
ret = heap_alloc(sizeof(*ret) + sends->OutputCount * sizeof(FAudioSendDescriptor));
|
||||
ret->SendCount = sends->OutputCount;
|
||||
ret->pSends = (FAudioSendDescriptor*)(ret + 1);
|
||||
for(i = 0; i < sends->OutputCount; ++i){
|
||||
XA2VoiceImpl *voice = impl_from_IXAudio2Voice(sends->pOutputVoices[i]);
|
||||
ret->pSends[i].pOutputVoice = voice->faudio_voice;
|
||||
ret->pSends[i].Flags = 0;
|
||||
}
|
||||
#else
|
||||
ret = heap_alloc(sizeof(*ret) + sends->SendCount * sizeof(FAudioSendDescriptor));
|
||||
ret->SendCount = sends->SendCount;
|
||||
ret->pSends = (FAudioSendDescriptor*)(ret + 1);
|
||||
|
@ -354,6 +363,7 @@ static FAudioVoiceSends *wrap_voice_sends(const XAUDIO2_VOICE_SENDS *sends)
|
|||
ret->pSends[i].pOutputVoice = voice->faudio_voice;
|
||||
ret->pSends[i].Flags = sends->pSends[i].Flags;
|
||||
}
|
||||
#endif
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -377,11 +387,11 @@ static void FAUDIOCALL XA2VCB_OnVoiceProcessingPassStart(FAudioVoiceCallback *if
|
|||
XA2VoiceImpl *This = impl_from_FAudioVoiceCallback(iface);
|
||||
TRACE("%p\n", This);
|
||||
if(This->cb)
|
||||
#if XAUDIO2_VER == 0
|
||||
IXAudio20VoiceCallback_OnVoiceProcessingPassStart((IXAudio20VoiceCallback*)This->cb);
|
||||
#else
|
||||
IXAudio2VoiceCallback_OnVoiceProcessingPassStart(This->cb, BytesRequired);
|
||||
IXAudio2VoiceCallback_OnVoiceProcessingPassStart(This->cb
|
||||
#if XAUDIO2_VER > 0
|
||||
, BytesRequired
|
||||
#endif
|
||||
);
|
||||
}
|
||||
|
||||
static void FAUDIOCALL XA2VCB_OnVoiceProcessingPassEnd(FAudioVoiceCallback *iface)
|
||||
|
@ -497,6 +507,21 @@ static inline void destroy_voice(XA2VoiceImpl *This)
|
|||
This->in_use = FALSE;
|
||||
}
|
||||
|
||||
static void get_voice_details(XA2VoiceImpl *voice, XAUDIO2_VOICE_DETAILS *details)
|
||||
{
|
||||
FAudioVoiceDetails faudio_details;
|
||||
|
||||
TRACE("%p, %p\n", voice, details);
|
||||
|
||||
FAudioVoice_GetVoiceDetails(voice->faudio_voice, &faudio_details);
|
||||
details->CreationFlags = faudio_details.CreationFlags;
|
||||
#if XAUDIO2_VER >= 8
|
||||
details->ActiveFlags = faudio_details.ActiveFlags;
|
||||
#endif
|
||||
details->InputChannels = faudio_details.InputChannels;
|
||||
details->InputSampleRate = faudio_details.InputSampleRate;
|
||||
}
|
||||
|
||||
/* Source Voices */
|
||||
|
||||
static inline XA2VoiceImpl *impl_from_IXAudio2SourceVoice(IXAudio2SourceVoice *iface)
|
||||
|
@ -504,12 +529,11 @@ static inline XA2VoiceImpl *impl_from_IXAudio2SourceVoice(IXAudio2SourceVoice *i
|
|||
return CONTAINING_RECORD(iface, XA2VoiceImpl, IXAudio2SourceVoice_iface);
|
||||
}
|
||||
|
||||
static void WINAPI XA2SRC_GetVoiceDetails(IXAudio2SourceVoice *iface,
|
||||
XAUDIO2_VOICE_DETAILS *pVoiceDetails)
|
||||
static void WINAPI XA2SRC_GetVoiceDetails(IXAudio2SourceVoice *iface, XAUDIO2_VOICE_DETAILS *details)
|
||||
{
|
||||
XA2VoiceImpl *This = impl_from_IXAudio2SourceVoice(iface);
|
||||
TRACE("%p, %p\n", This, pVoiceDetails);
|
||||
FAudioVoice_GetVoiceDetails(This->faudio_voice, (FAudioVoiceDetails *)pVoiceDetails);
|
||||
XA2VoiceImpl *voice = impl_from_IXAudio2SourceVoice(iface);
|
||||
|
||||
get_voice_details(voice, details);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI XA2SRC_SetOutputVoices(IXAudio2SourceVoice *iface,
|
||||
|
@ -608,6 +632,7 @@ static void WINAPI XA2SRC_GetFilterParameters(IXAudio2SourceVoice *iface,
|
|||
FAudioVoice_GetFilterParameters(This->faudio_voice, (FAudioFilterParameters *)pParameters);
|
||||
}
|
||||
|
||||
#if XAUDIO2_VER >= 4
|
||||
static HRESULT WINAPI XA2SRC_SetOutputFilterParameters(IXAudio2SourceVoice *iface,
|
||||
IXAudio2Voice *pDestinationVoice,
|
||||
const XAUDIO2_FILTER_PARAMETERS *pParameters, UINT32 OperationSet)
|
||||
|
@ -633,6 +658,7 @@ static void WINAPI XA2SRC_GetOutputFilterParameters(IXAudio2SourceVoice *iface,
|
|||
FAudioVoice_GetOutputFilterParameters(This->faudio_voice,
|
||||
dst ? dst->faudio_voice : NULL, (FAudioFilterParameters *)pParameters);
|
||||
}
|
||||
#endif
|
||||
|
||||
static HRESULT WINAPI XA2SRC_SetVolume(IXAudio2SourceVoice *iface, float Volume,
|
||||
UINT32 OperationSet)
|
||||
|
@ -682,7 +708,12 @@ static HRESULT WINAPI XA2SRC_SetOutputMatrix(IXAudio2SourceVoice *iface,
|
|||
SourceChannels, DestinationChannels, pLevelMatrix, OperationSet);
|
||||
}
|
||||
|
||||
static void WINAPI XA2SRC_GetOutputMatrix(IXAudio2SourceVoice *iface,
|
||||
#if XAUDIO2_VER == 0
|
||||
static HRESULT
|
||||
#else
|
||||
static void
|
||||
#endif
|
||||
WINAPI XA2SRC_GetOutputMatrix(IXAudio2SourceVoice *iface,
|
||||
IXAudio2Voice *pDestinationVoice, UINT32 SourceChannels,
|
||||
UINT32 DestinationChannels, float *pLevelMatrix)
|
||||
{
|
||||
|
@ -694,6 +725,9 @@ static void WINAPI XA2SRC_GetOutputMatrix(IXAudio2SourceVoice *iface,
|
|||
|
||||
FAudioVoice_GetOutputMatrix(This->faudio_voice, dst ? dst->faudio_voice : NULL,
|
||||
SourceChannels, DestinationChannels, pLevelMatrix);
|
||||
#if XAUDIO2_VER == 0
|
||||
return S_OK;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void WINAPI XA2SRC_DestroyVoice(IXAudio2SourceVoice *iface)
|
||||
|
@ -766,10 +800,16 @@ static HRESULT WINAPI XA2SRC_ExitLoop(IXAudio2SourceVoice *iface, UINT32 Operati
|
|||
return FAudioSourceVoice_ExitLoop(This->faudio_voice, OperationSet);
|
||||
}
|
||||
|
||||
static void WINAPI XA2SRC_GetState(IXAudio2SourceVoice *iface,
|
||||
XAUDIO2_VOICE_STATE *pVoiceState, UINT32 Flags)
|
||||
#if XAUDIO2_VER >= 8
|
||||
static void WINAPI XA2SRC_GetState(IXAudio2SourceVoice *iface, XAUDIO2_VOICE_STATE *pVoiceState, UINT32 Flags)
|
||||
#else
|
||||
static void WINAPI XA2SRC_GetState(IXAudio2SourceVoice *iface, XAUDIO2_VOICE_STATE *pVoiceState)
|
||||
#endif
|
||||
{
|
||||
XA2VoiceImpl *This = impl_from_IXAudio2SourceVoice(iface);
|
||||
#if XAUDIO2_VER < 8
|
||||
UINT32 Flags = 0;
|
||||
#endif
|
||||
|
||||
TRACE("%p, %p, 0x%x\n", This, pVoiceState, Flags);
|
||||
|
||||
|
@ -795,6 +835,7 @@ static void WINAPI XA2SRC_GetFrequencyRatio(IXAudio2SourceVoice *iface, float *p
|
|||
return FAudioSourceVoice_GetFrequencyRatio(This->faudio_voice, pRatio);
|
||||
}
|
||||
|
||||
#if XAUDIO2_VER >= 4
|
||||
static HRESULT WINAPI XA2SRC_SetSourceSampleRate(
|
||||
IXAudio2SourceVoice *iface,
|
||||
UINT32 NewSourceSampleRate)
|
||||
|
@ -805,6 +846,7 @@ static HRESULT WINAPI XA2SRC_SetSourceSampleRate(
|
|||
|
||||
return FAudioSourceVoice_SetSourceSampleRate(This->faudio_voice, NewSourceSampleRate);
|
||||
}
|
||||
#endif
|
||||
|
||||
static const IXAudio2SourceVoiceVtbl XAudio2SourceVoice_Vtbl = {
|
||||
XA2SRC_GetVoiceDetails,
|
||||
|
@ -817,8 +859,10 @@ static const IXAudio2SourceVoiceVtbl XAudio2SourceVoice_Vtbl = {
|
|||
XA2SRC_GetEffectParameters,
|
||||
XA2SRC_SetFilterParameters,
|
||||
XA2SRC_GetFilterParameters,
|
||||
#if XAUDIO2_VER >= 4
|
||||
XA2SRC_SetOutputFilterParameters,
|
||||
XA2SRC_GetOutputFilterParameters,
|
||||
#endif
|
||||
XA2SRC_SetVolume,
|
||||
XA2SRC_GetVolume,
|
||||
XA2SRC_SetChannelVolumes,
|
||||
|
@ -835,7 +879,9 @@ static const IXAudio2SourceVoiceVtbl XAudio2SourceVoice_Vtbl = {
|
|||
XA2SRC_GetState,
|
||||
XA2SRC_SetFrequencyRatio,
|
||||
XA2SRC_GetFrequencyRatio,
|
||||
#if XAUDIO2_VER >= 4
|
||||
XA2SRC_SetSourceSampleRate
|
||||
#endif
|
||||
};
|
||||
|
||||
/* Submix Voices */
|
||||
|
@ -845,12 +891,11 @@ static inline XA2VoiceImpl *impl_from_IXAudio2SubmixVoice(IXAudio2SubmixVoice *i
|
|||
return CONTAINING_RECORD(iface, XA2VoiceImpl, IXAudio2SubmixVoice_iface);
|
||||
}
|
||||
|
||||
static void WINAPI XA2SUB_GetVoiceDetails(IXAudio2SubmixVoice *iface,
|
||||
XAUDIO2_VOICE_DETAILS *pVoiceDetails)
|
||||
static void WINAPI XA2SUB_GetVoiceDetails(IXAudio2SubmixVoice *iface, XAUDIO2_VOICE_DETAILS *details)
|
||||
{
|
||||
XA2VoiceImpl *This = impl_from_IXAudio2SubmixVoice(iface);
|
||||
TRACE("%p, %p\n", This, pVoiceDetails);
|
||||
FAudioVoice_GetVoiceDetails(This->faudio_voice, (FAudioVoiceDetails *)pVoiceDetails);
|
||||
XA2VoiceImpl *voice = impl_from_IXAudio2SubmixVoice(iface);
|
||||
|
||||
get_voice_details(voice, details);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI XA2SUB_SetOutputVoices(IXAudio2SubmixVoice *iface,
|
||||
|
@ -949,6 +994,7 @@ static void WINAPI XA2SUB_GetFilterParameters(IXAudio2SubmixVoice *iface,
|
|||
FAudioVoice_GetFilterParameters(This->faudio_voice, (FAudioFilterParameters *)pParameters);
|
||||
}
|
||||
|
||||
#if XAUDIO2_VER >= 4
|
||||
static HRESULT WINAPI XA2SUB_SetOutputFilterParameters(IXAudio2SubmixVoice *iface,
|
||||
IXAudio2Voice *pDestinationVoice,
|
||||
const XAUDIO2_FILTER_PARAMETERS *pParameters, UINT32 OperationSet)
|
||||
|
@ -974,6 +1020,7 @@ static void WINAPI XA2SUB_GetOutputFilterParameters(IXAudio2SubmixVoice *iface,
|
|||
FAudioVoice_GetOutputFilterParameters(This->faudio_voice,
|
||||
dst ? dst->faudio_voice : NULL, (FAudioFilterParameters *)pParameters);
|
||||
}
|
||||
#endif
|
||||
|
||||
static HRESULT WINAPI XA2SUB_SetVolume(IXAudio2SubmixVoice *iface, float Volume,
|
||||
UINT32 OperationSet)
|
||||
|
@ -1023,7 +1070,12 @@ static HRESULT WINAPI XA2SUB_SetOutputMatrix(IXAudio2SubmixVoice *iface,
|
|||
SourceChannels, DestinationChannels, pLevelMatrix, OperationSet);
|
||||
}
|
||||
|
||||
static void WINAPI XA2SUB_GetOutputMatrix(IXAudio2SubmixVoice *iface,
|
||||
#if XAUDIO2_VER == 0
|
||||
static HRESULT
|
||||
#else
|
||||
static void
|
||||
#endif
|
||||
WINAPI XA2SUB_GetOutputMatrix(IXAudio2SubmixVoice *iface,
|
||||
IXAudio2Voice *pDestinationVoice, UINT32 SourceChannels,
|
||||
UINT32 DestinationChannels, float *pLevelMatrix)
|
||||
{
|
||||
|
@ -1035,6 +1087,9 @@ static void WINAPI XA2SUB_GetOutputMatrix(IXAudio2SubmixVoice *iface,
|
|||
|
||||
FAudioVoice_GetOutputMatrix(This->faudio_voice, dst ? dst->faudio_voice : NULL,
|
||||
SourceChannels, DestinationChannels, pLevelMatrix);
|
||||
#if XAUDIO2_VER == 0
|
||||
return S_OK;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void WINAPI XA2SUB_DestroyVoice(IXAudio2SubmixVoice *iface)
|
||||
|
@ -1061,8 +1116,10 @@ static const struct IXAudio2SubmixVoiceVtbl XAudio2SubmixVoice_Vtbl = {
|
|||
XA2SUB_GetEffectParameters,
|
||||
XA2SUB_SetFilterParameters,
|
||||
XA2SUB_GetFilterParameters,
|
||||
#if XAUDIO2_VER >= 4
|
||||
XA2SUB_SetOutputFilterParameters,
|
||||
XA2SUB_GetOutputFilterParameters,
|
||||
#endif
|
||||
XA2SUB_SetVolume,
|
||||
XA2SUB_GetVolume,
|
||||
XA2SUB_SetChannelVolumes,
|
||||
|
@ -1079,12 +1136,11 @@ static inline XA2VoiceImpl *impl_from_IXAudio2MasteringVoice(IXAudio2MasteringVo
|
|||
return CONTAINING_RECORD(iface, XA2VoiceImpl, IXAudio2MasteringVoice_iface);
|
||||
}
|
||||
|
||||
static void WINAPI XA2M_GetVoiceDetails(IXAudio2MasteringVoice *iface,
|
||||
XAUDIO2_VOICE_DETAILS *pVoiceDetails)
|
||||
static void WINAPI XA2M_GetVoiceDetails(IXAudio2MasteringVoice *iface, XAUDIO2_VOICE_DETAILS *details)
|
||||
{
|
||||
XA2VoiceImpl *This = impl_from_IXAudio2MasteringVoice(iface);
|
||||
TRACE("%p, %p\n", This, pVoiceDetails);
|
||||
FAudioVoice_GetVoiceDetails(This->faudio_voice, (FAudioVoiceDetails *)pVoiceDetails);
|
||||
XA2VoiceImpl *voice = impl_from_IXAudio2MasteringVoice(iface);
|
||||
|
||||
get_voice_details(voice, details);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI XA2M_SetOutputVoices(IXAudio2MasteringVoice *iface,
|
||||
|
@ -1183,6 +1239,7 @@ static void WINAPI XA2M_GetFilterParameters(IXAudio2MasteringVoice *iface,
|
|||
FAudioVoice_GetFilterParameters(This->faudio_voice, (FAudioFilterParameters *)pParameters);
|
||||
}
|
||||
|
||||
#if XAUDIO2_VER >= 4
|
||||
static HRESULT WINAPI XA2M_SetOutputFilterParameters(IXAudio2MasteringVoice *iface,
|
||||
IXAudio2Voice *pDestinationVoice,
|
||||
const XAUDIO2_FILTER_PARAMETERS *pParameters, UINT32 OperationSet)
|
||||
|
@ -1208,6 +1265,7 @@ static void WINAPI XA2M_GetOutputFilterParameters(IXAudio2MasteringVoice *iface,
|
|||
FAudioVoice_GetOutputFilterParameters(This->faudio_voice,
|
||||
dst ? dst->faudio_voice : NULL, (FAudioFilterParameters *)pParameters);
|
||||
}
|
||||
#endif
|
||||
|
||||
static HRESULT WINAPI XA2M_SetVolume(IXAudio2MasteringVoice *iface, float Volume,
|
||||
UINT32 OperationSet)
|
||||
|
@ -1257,7 +1315,12 @@ static HRESULT WINAPI XA2M_SetOutputMatrix(IXAudio2MasteringVoice *iface,
|
|||
SourceChannels, DestinationChannels, pLevelMatrix, OperationSet);
|
||||
}
|
||||
|
||||
static void WINAPI XA2M_GetOutputMatrix(IXAudio2MasteringVoice *iface,
|
||||
#if XAUDIO2_VER == 0
|
||||
static HRESULT
|
||||
#else
|
||||
static void
|
||||
#endif
|
||||
WINAPI XA2M_GetOutputMatrix(IXAudio2MasteringVoice *iface,
|
||||
IXAudio2Voice *pDestinationVoice, UINT32 SourceChannels,
|
||||
UINT32 DestinationChannels, float *pLevelMatrix)
|
||||
{
|
||||
|
@ -1269,6 +1332,9 @@ static void WINAPI XA2M_GetOutputMatrix(IXAudio2MasteringVoice *iface,
|
|||
|
||||
FAudioVoice_GetOutputMatrix(This->faudio_voice, dst ? dst->faudio_voice : NULL,
|
||||
SourceChannels, DestinationChannels, pLevelMatrix);
|
||||
#if XAUDIO2_VER == 0
|
||||
return S_OK;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void WINAPI XA2M_DestroyVoice(IXAudio2MasteringVoice *iface)
|
||||
|
@ -1284,6 +1350,7 @@ static void WINAPI XA2M_DestroyVoice(IXAudio2MasteringVoice *iface)
|
|||
LeaveCriticalSection(&This->lock);
|
||||
}
|
||||
|
||||
#if XAUDIO2_VER >= 8
|
||||
static void WINAPI XA2M_GetChannelMask(IXAudio2MasteringVoice *iface,
|
||||
DWORD *pChannelMask)
|
||||
{
|
||||
|
@ -1293,6 +1360,7 @@ static void WINAPI XA2M_GetChannelMask(IXAudio2MasteringVoice *iface,
|
|||
|
||||
FAudioMasteringVoice_GetChannelMask(This->faudio_voice, (uint32_t *)pChannelMask);
|
||||
}
|
||||
#endif
|
||||
|
||||
static const struct IXAudio2MasteringVoiceVtbl XAudio2MasteringVoice_Vtbl = {
|
||||
XA2M_GetVoiceDetails,
|
||||
|
@ -1305,8 +1373,10 @@ static const struct IXAudio2MasteringVoiceVtbl XAudio2MasteringVoice_Vtbl = {
|
|||
XA2M_GetEffectParameters,
|
||||
XA2M_SetFilterParameters,
|
||||
XA2M_GetFilterParameters,
|
||||
#if XAUDIO2_VER >= 4
|
||||
XA2M_SetOutputFilterParameters,
|
||||
XA2M_GetOutputFilterParameters,
|
||||
#endif
|
||||
XA2M_SetVolume,
|
||||
XA2M_GetVolume,
|
||||
XA2M_SetChannelVolumes,
|
||||
|
@ -1314,7 +1384,9 @@ static const struct IXAudio2MasteringVoiceVtbl XAudio2MasteringVoice_Vtbl = {
|
|||
XA2M_SetOutputMatrix,
|
||||
XA2M_GetOutputMatrix,
|
||||
XA2M_DestroyVoice,
|
||||
#if XAUDIO2_VER >= 8
|
||||
XA2M_GetChannelMask
|
||||
#endif
|
||||
};
|
||||
|
||||
/* More Common Voice Functions */
|
||||
|
@ -1327,28 +1399,6 @@ static XA2VoiceImpl *impl_from_IXAudio2Voice(IXAudio2Voice *iface)
|
|||
return impl_from_IXAudio2MasteringVoice((IXAudio2MasteringVoice*)iface);
|
||||
if(iface->lpVtbl == (void*)&XAudio2SubmixVoice_Vtbl)
|
||||
return impl_from_IXAudio2SubmixVoice((IXAudio2SubmixVoice*)iface);
|
||||
#if XAUDIO2_VER == 0
|
||||
if(iface->lpVtbl == (void*)&XAudio20SourceVoice_Vtbl)
|
||||
return impl_from_IXAudio20SourceVoice((IXAudio20SourceVoice*)iface);
|
||||
if(iface->lpVtbl == (void*)&XAudio20SubmixVoice_Vtbl)
|
||||
return impl_from_IXAudio20SubmixVoice((IXAudio20SubmixVoice*)iface);
|
||||
if(iface->lpVtbl == (void*)&XAudio20MasteringVoice_Vtbl)
|
||||
return impl_from_IXAudio20MasteringVoice((IXAudio20MasteringVoice*)iface);
|
||||
#elif XAUDIO2_VER <= 3
|
||||
if(iface->lpVtbl == (void*)&XAudio23SourceVoice_Vtbl)
|
||||
return impl_from_IXAudio23SourceVoice((IXAudio23SourceVoice*)iface);
|
||||
if(iface->lpVtbl == (void*)&XAudio23SubmixVoice_Vtbl)
|
||||
return impl_from_IXAudio23SubmixVoice((IXAudio23SubmixVoice*)iface);
|
||||
if(iface->lpVtbl == (void*)&XAudio23MasteringVoice_Vtbl)
|
||||
return impl_from_IXAudio23MasteringVoice((IXAudio23MasteringVoice*)iface);
|
||||
#elif XAUDIO2_VER <= 7
|
||||
if(iface->lpVtbl == (void*)&XAudio27SourceVoice_Vtbl)
|
||||
return impl_from_IXAudio27SourceVoice((IXAudio27SourceVoice*)iface);
|
||||
if(iface->lpVtbl == (void*)&XAudio27SubmixVoice_Vtbl)
|
||||
return impl_from_IXAudio27SubmixVoice((IXAudio27SubmixVoice*)iface);
|
||||
if(iface->lpVtbl == (void*)&XAudio27MasteringVoice_Vtbl)
|
||||
return impl_from_IXAudio27MasteringVoice((IXAudio27MasteringVoice*)iface);
|
||||
#endif
|
||||
ERR("invalid IXAudio2Voice pointer: %p\n", iface);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -1368,25 +1418,9 @@ static HRESULT WINAPI IXAudio2Impl_QueryInterface(IXAudio2 *iface, REFIID riid,
|
|||
TRACE("(%p)->(%s, %p)\n", This, debugstr_guid(riid), ppvObject);
|
||||
|
||||
if(IsEqualGUID(riid, &IID_IUnknown) ||
|
||||
#if XAUDIO2_VER == 8
|
||||
IsEqualGUID(riid, &IID_IXAudio28) ||
|
||||
#endif
|
||||
IsEqualGUID(riid, &IID_IXAudio2))
|
||||
*ppvObject = &This->IXAudio2_iface;
|
||||
else if(IsEqualGUID(riid, &IID_IXAudio27)){
|
||||
/* all xaudio versions before 28 share an IID */
|
||||
#if XAUDIO2_VER == 0
|
||||
*ppvObject = &This->IXAudio20_iface;
|
||||
#elif XAUDIO2_VER <= 2
|
||||
*ppvObject = &This->IXAudio22_iface;
|
||||
#elif XAUDIO2_VER <= 3
|
||||
*ppvObject = &This->IXAudio23_iface;
|
||||
#elif XAUDIO2_VER <= 7
|
||||
*ppvObject = &This->IXAudio27_iface;
|
||||
#else
|
||||
*ppvObject = NULL;
|
||||
#endif
|
||||
}else
|
||||
else
|
||||
*ppvObject = NULL;
|
||||
|
||||
if(*ppvObject){
|
||||
|
@ -1433,6 +1467,36 @@ static ULONG WINAPI IXAudio2Impl_Release(IXAudio2 *iface)
|
|||
return ref;
|
||||
}
|
||||
|
||||
#if XAUDIO2_VER <= 7
|
||||
static HRESULT WINAPI IXAudio2Impl_GetDeviceCount(IXAudio2 *iface, UINT32 *count)
|
||||
{
|
||||
IXAudio2Impl *audio = impl_from_IXAudio2(iface);
|
||||
|
||||
TRACE("%p, %p\n", audio, count);
|
||||
|
||||
return FAudio_GetDeviceCount(audio->faudio, count);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI IXAudio2Impl_GetDeviceDetails(IXAudio2 *iface, UINT32 index,
|
||||
XAUDIO2_DEVICE_DETAILS *details)
|
||||
{
|
||||
IXAudio2Impl *audio = impl_from_IXAudio2(iface);
|
||||
|
||||
TRACE("%p, %u, %p\n", audio, index, details);
|
||||
|
||||
return FAudio_GetDeviceDetails(audio->faudio, index, (FAudioDeviceDetails *)details);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI IXAudio2Impl_Initialize(IXAudio2 *iface, UINT32 flags, XAUDIO2_PROCESSOR processor)
|
||||
{
|
||||
IXAudio2Impl *audio = impl_from_IXAudio2(iface);
|
||||
|
||||
TRACE("%p, %#x, %#x\n", audio, flags, processor);
|
||||
|
||||
return xaudio2_initialize(audio, flags, processor);
|
||||
}
|
||||
#endif
|
||||
|
||||
static HRESULT WINAPI IXAudio2Impl_RegisterForCallbacks(IXAudio2 *iface,
|
||||
IXAudio2EngineCallback *pCallback)
|
||||
{
|
||||
|
@ -1501,23 +1565,7 @@ static inline XA2VoiceImpl *create_voice(IXAudio2Impl *This)
|
|||
list_add_head(&This->voices, &voice->entry);
|
||||
|
||||
voice->IXAudio2SourceVoice_iface.lpVtbl = &XAudio2SourceVoice_Vtbl;
|
||||
#if XAUDIO2_VER == 0
|
||||
voice->IXAudio20SourceVoice_iface.lpVtbl = &XAudio20SourceVoice_Vtbl;
|
||||
#elif XAUDIO2_VER <= 3
|
||||
voice->IXAudio23SourceVoice_iface.lpVtbl = &XAudio23SourceVoice_Vtbl;
|
||||
#elif XAUDIO2_VER <= 7
|
||||
voice->IXAudio27SourceVoice_iface.lpVtbl = &XAudio27SourceVoice_Vtbl;
|
||||
#endif
|
||||
|
||||
voice->IXAudio2SubmixVoice_iface.lpVtbl = &XAudio2SubmixVoice_Vtbl;
|
||||
#if XAUDIO2_VER == 0
|
||||
voice->IXAudio20SubmixVoice_iface.lpVtbl = &XAudio20SubmixVoice_Vtbl;
|
||||
#elif XAUDIO2_VER <= 3
|
||||
voice->IXAudio23SubmixVoice_iface.lpVtbl = &XAudio23SubmixVoice_Vtbl;
|
||||
#elif XAUDIO2_VER <= 7
|
||||
voice->IXAudio27SubmixVoice_iface.lpVtbl = &XAudio27SubmixVoice_Vtbl;
|
||||
#endif
|
||||
|
||||
voice->FAudioVoiceCallback_vtbl = FAudioVoiceCallback_Vtbl;
|
||||
|
||||
InitializeCriticalSection(&voice->lock);
|
||||
|
@ -1574,15 +1622,7 @@ static HRESULT WINAPI IXAudio2Impl_CreateSourceVoice(IXAudio2 *iface,
|
|||
|
||||
LeaveCriticalSection(&src->lock);
|
||||
|
||||
#if XAUDIO2_VER == 0
|
||||
*ppSourceVoice = (IXAudio2SourceVoice*)&src->IXAudio20SourceVoice_iface;
|
||||
#elif XAUDIO2_VER <= 3
|
||||
*ppSourceVoice = (IXAudio2SourceVoice*)&src->IXAudio23SourceVoice_iface;
|
||||
#elif XAUDIO2_VER <= 7
|
||||
*ppSourceVoice = (IXAudio2SourceVoice*)&src->IXAudio27SourceVoice_iface;
|
||||
#else
|
||||
*ppSourceVoice = &src->IXAudio2SourceVoice_iface;
|
||||
#endif
|
||||
|
||||
TRACE("Created source voice: %p\n", src);
|
||||
|
||||
|
@ -1635,15 +1675,7 @@ static HRESULT WINAPI IXAudio2Impl_CreateSubmixVoice(IXAudio2 *iface,
|
|||
|
||||
LeaveCriticalSection(&sub->lock);
|
||||
|
||||
#if XAUDIO2_VER == 0
|
||||
*ppSubmixVoice = (IXAudio2SubmixVoice*)&sub->IXAudio20SubmixVoice_iface;
|
||||
#elif XAUDIO2_VER <= 3
|
||||
*ppSubmixVoice = (IXAudio2SubmixVoice*)&sub->IXAudio23SubmixVoice_iface;
|
||||
#elif XAUDIO2_VER <= 7
|
||||
*ppSubmixVoice = (IXAudio2SubmixVoice*)&sub->IXAudio27SubmixVoice_iface;
|
||||
#else
|
||||
*ppSubmixVoice = &sub->IXAudio2SubmixVoice_iface;
|
||||
#endif
|
||||
|
||||
TRACE("Created submix voice: %p\n", sub);
|
||||
|
||||
|
@ -1652,23 +1684,25 @@ static HRESULT WINAPI IXAudio2Impl_CreateSubmixVoice(IXAudio2 *iface,
|
|||
|
||||
static HRESULT WINAPI IXAudio2Impl_CreateMasteringVoice(IXAudio2 *iface,
|
||||
IXAudio2MasteringVoice **ppMasteringVoice, UINT32 inputChannels,
|
||||
UINT32 inputSampleRate, UINT32 flags, const WCHAR *deviceId,
|
||||
const XAUDIO2_EFFECT_CHAIN *pEffectChain,
|
||||
AUDIO_STREAM_CATEGORY streamCategory)
|
||||
UINT32 inputSampleRate, UINT32 flags,
|
||||
#if XAUDIO2_VER >= 8
|
||||
const WCHAR *deviceId,
|
||||
#else
|
||||
UINT32 index,
|
||||
#endif
|
||||
const XAUDIO2_EFFECT_CHAIN *pEffectChain
|
||||
#if XAUDIO2_VER >= 8
|
||||
, AUDIO_STREAM_CATEGORY streamCategory
|
||||
#endif
|
||||
)
|
||||
{
|
||||
IXAudio2Impl *This = impl_from_IXAudio2(iface);
|
||||
|
||||
TRACE("(%p)->(%p, %u, %u, 0x%x, %s, %p, 0x%x)\n", This,
|
||||
ppMasteringVoice, inputChannels, inputSampleRate, flags,
|
||||
wine_dbgstr_w(deviceId), pEffectChain, streamCategory);
|
||||
TRACE("(%p)->(%p, %u, %u, 0x%x, %p)\n", This,
|
||||
ppMasteringVoice, inputChannels, inputSampleRate, flags, pEffectChain);
|
||||
|
||||
EnterCriticalSection(&This->lock);
|
||||
|
||||
/* Note that we don't have paths for each XAUDIO2_VER here.
|
||||
* All versions < 8 have a very different CreateMasteringVoice, so we
|
||||
* implement those separately in compat.c.
|
||||
* -flibit
|
||||
*/
|
||||
*ppMasteringVoice = &This->mst.IXAudio2MasteringVoice_iface;
|
||||
|
||||
EnterCriticalSection(&This->mst.lock);
|
||||
|
@ -1683,9 +1717,18 @@ static HRESULT WINAPI IXAudio2Impl_CreateMasteringVoice(IXAudio2 *iface,
|
|||
|
||||
This->mst.effect_chain = wrap_effect_chain(pEffectChain);
|
||||
|
||||
#if XAUDIO2_VER >= 8
|
||||
TRACE("device id %s, category %#x\n", debugstr_w(deviceId), streamCategory);
|
||||
|
||||
FAudio_CreateMasteringVoice8(This->faudio, &This->mst.faudio_voice, inputChannels,
|
||||
inputSampleRate, flags, NULL /* TODO: (uint16_t*)deviceId */,
|
||||
This->mst.effect_chain, (FAudioStreamCategory)streamCategory);
|
||||
#else
|
||||
TRACE("device index %u\n", index);
|
||||
|
||||
FAudio_CreateMasteringVoice(This->faudio, &This->mst.faudio_voice, inputChannels,
|
||||
inputSampleRate, flags, index, This->mst.effect_chain);
|
||||
#endif
|
||||
|
||||
This->mst.in_use = TRUE;
|
||||
|
||||
|
@ -1722,14 +1765,38 @@ static HRESULT WINAPI IXAudio2Impl_CommitChanges(IXAudio2 *iface,
|
|||
return FAudio_CommitOperationSet(This->faudio, operationSet);
|
||||
}
|
||||
|
||||
static void WINAPI IXAudio2Impl_GetPerformanceData(IXAudio2 *iface,
|
||||
XAUDIO2_PERFORMANCE_DATA *pPerfData)
|
||||
static void WINAPI IXAudio2Impl_GetPerformanceData(IXAudio2 *iface, XAUDIO2_PERFORMANCE_DATA *data)
|
||||
{
|
||||
IXAudio2Impl *This = impl_from_IXAudio2(iface);
|
||||
IXAudio2Impl *audio = impl_from_IXAudio2(iface);
|
||||
FAudioPerformanceData faudio_data;
|
||||
|
||||
TRACE("(%p)->(%p)\n", This, pPerfData);
|
||||
TRACE("(%p)->(%p)\n", audio, data);
|
||||
|
||||
FAudio_GetPerformanceData(This->faudio, (FAudioPerformanceData *)pPerfData);
|
||||
FAudio_GetPerformanceData(audio->faudio, &faudio_data);
|
||||
|
||||
data->AudioCyclesSinceLastQuery = faudio_data.AudioCyclesSinceLastQuery;
|
||||
data->TotalCyclesSinceLastQuery = faudio_data.TotalCyclesSinceLastQuery;
|
||||
data->MinimumCyclesPerQuantum = faudio_data.MinimumCyclesPerQuantum;
|
||||
data->MaximumCyclesPerQuantum = faudio_data.MaximumCyclesPerQuantum;
|
||||
data->MemoryUsageInBytes = faudio_data.MemoryUsageInBytes;
|
||||
data->CurrentLatencyInSamples = faudio_data.CurrentLatencyInSamples;
|
||||
#if XAUDIO2_VER == 0
|
||||
data->GlitchesSinceLastQuery = faudio_data.GlitchesSinceEngineStarted - audio->last_query_glitches;
|
||||
audio->last_query_glitches = faudio_data.GlitchesSinceEngineStarted;
|
||||
#else
|
||||
data->GlitchesSinceEngineStarted = faudio_data.GlitchesSinceEngineStarted;
|
||||
#endif
|
||||
data->ActiveSourceVoiceCount = faudio_data.ActiveSourceVoiceCount;
|
||||
data->TotalSourceVoiceCount = faudio_data.TotalSourceVoiceCount;
|
||||
data->ActiveSubmixVoiceCount = faudio_data.ActiveSubmixVoiceCount;
|
||||
#if XAUDIO2_VER <= 2
|
||||
data->TotalSubmixVoiceCount = faudio_data.ActiveSubmixVoiceCount;
|
||||
#else
|
||||
data->ActiveResamplerCount = faudio_data.ActiveResamplerCount;
|
||||
data->ActiveMatrixMixCount = faudio_data.ActiveMatrixMixCount;
|
||||
#endif
|
||||
data->ActiveXmaSourceVoices = faudio_data.ActiveXmaSourceVoices;
|
||||
data->ActiveXmaStreams = faudio_data.ActiveXmaStreams;
|
||||
}
|
||||
|
||||
static void WINAPI IXAudio2Impl_SetDebugConfiguration(IXAudio2 *iface,
|
||||
|
@ -1743,12 +1810,16 @@ static void WINAPI IXAudio2Impl_SetDebugConfiguration(IXAudio2 *iface,
|
|||
FAudio_SetDebugConfiguration(This->faudio, (FAudioDebugConfiguration *)pDebugConfiguration, pReserved);
|
||||
}
|
||||
|
||||
/* XAudio2 2.8 */
|
||||
static const IXAudio2Vtbl XAudio2_Vtbl =
|
||||
{
|
||||
IXAudio2Impl_QueryInterface,
|
||||
IXAudio2Impl_AddRef,
|
||||
IXAudio2Impl_Release,
|
||||
#if XAUDIO2_VER <= 7
|
||||
IXAudio2Impl_GetDeviceCount,
|
||||
IXAudio2Impl_GetDeviceDetails,
|
||||
IXAudio2Impl_Initialize,
|
||||
#endif
|
||||
IXAudio2Impl_RegisterForCallbacks,
|
||||
IXAudio2Impl_UnregisterForCallbacks,
|
||||
IXAudio2Impl_CreateSourceVoice,
|
||||
|
@ -1825,27 +1896,8 @@ static HRESULT WINAPI XAudio2CF_CreateInstance(IClassFactory *iface, IUnknown *p
|
|||
return E_OUTOFMEMORY;
|
||||
|
||||
object->IXAudio2_iface.lpVtbl = &XAudio2_Vtbl;
|
||||
|
||||
#if XAUDIO2_VER == 0
|
||||
object->IXAudio20_iface.lpVtbl = &XAudio20_Vtbl;
|
||||
#elif XAUDIO2_VER <= 2
|
||||
object->IXAudio22_iface.lpVtbl = &XAudio22_Vtbl;
|
||||
#elif XAUDIO2_VER <= 3
|
||||
object->IXAudio23_iface.lpVtbl = &XAudio23_Vtbl;
|
||||
#elif XAUDIO2_VER <= 7
|
||||
object->IXAudio27_iface.lpVtbl = &XAudio27_Vtbl;
|
||||
#endif
|
||||
|
||||
object->mst.IXAudio2MasteringVoice_iface.lpVtbl = &XAudio2MasteringVoice_Vtbl;
|
||||
|
||||
#if XAUDIO2_VER == 0
|
||||
object->mst.IXAudio20MasteringVoice_iface.lpVtbl = &XAudio20MasteringVoice_Vtbl;
|
||||
#elif XAUDIO2_VER <= 3
|
||||
object->mst.IXAudio23MasteringVoice_iface.lpVtbl = &XAudio23MasteringVoice_Vtbl;
|
||||
#elif XAUDIO2_VER <= 7
|
||||
object->mst.IXAudio27MasteringVoice_iface.lpVtbl = &XAudio27MasteringVoice_Vtbl;
|
||||
#endif
|
||||
|
||||
object->FAudioEngineCallback_vtbl = FAudioEngineCallback_Vtbl;
|
||||
|
||||
list_init(&object->voices);
|
||||
|
@ -1914,44 +1966,23 @@ HRESULT xaudio2_initialize(IXAudio2Impl *This, UINT32 flags, XAUDIO2_PROCESSOR p
|
|||
return FAudio_Initialize(This->faudio, flags, FAUDIO_DEFAULT_PROCESSOR);
|
||||
}
|
||||
|
||||
#if XAUDIO2_VER <= 7
|
||||
HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, void **ppv)
|
||||
{
|
||||
TRACE("(%s, %s, %p)\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv);
|
||||
|
||||
if(IsEqualGUID(rclsid, &CLSID_XAudio20) ||
|
||||
IsEqualGUID(rclsid, &CLSID_XAudio21) ||
|
||||
IsEqualGUID(rclsid, &CLSID_XAudio22) ||
|
||||
IsEqualGUID(rclsid, &CLSID_XAudio23) ||
|
||||
IsEqualGUID(rclsid, &CLSID_XAudio24) ||
|
||||
IsEqualGUID(rclsid, &CLSID_XAudio25) ||
|
||||
IsEqualGUID(rclsid, &CLSID_XAudio26) ||
|
||||
IsEqualGUID(rclsid, &CLSID_XAudio27))
|
||||
if (IsEqualGUID(rclsid, &CLSID_XAudio2))
|
||||
return make_xaudio2_factory(riid, ppv);
|
||||
|
||||
if(IsEqualGUID(rclsid, &CLSID_AudioVolumeMeter20) ||
|
||||
IsEqualGUID(rclsid, &CLSID_AudioVolumeMeter21) ||
|
||||
IsEqualGUID(rclsid, &CLSID_AudioVolumeMeter22) ||
|
||||
IsEqualGUID(rclsid, &CLSID_AudioVolumeMeter23) ||
|
||||
IsEqualGUID(rclsid, &CLSID_AudioVolumeMeter24) ||
|
||||
IsEqualGUID(rclsid, &CLSID_AudioVolumeMeter25) ||
|
||||
IsEqualGUID(rclsid, &CLSID_AudioVolumeMeter26) ||
|
||||
IsEqualGUID(rclsid, &CLSID_AudioVolumeMeter27))
|
||||
return make_xapo_factory(&CLSID_AudioVolumeMeter27, riid, ppv);
|
||||
if (IsEqualGUID(rclsid, &CLSID_AudioVolumeMeter))
|
||||
return make_xapo_factory(&CLSID_AudioVolumeMeter, riid, ppv);
|
||||
|
||||
if(IsEqualGUID(rclsid, &CLSID_AudioReverb20) ||
|
||||
IsEqualGUID(rclsid, &CLSID_AudioReverb21) ||
|
||||
IsEqualGUID(rclsid, &CLSID_AudioReverb22) ||
|
||||
IsEqualGUID(rclsid, &CLSID_AudioReverb23) ||
|
||||
IsEqualGUID(rclsid, &CLSID_AudioReverb24) ||
|
||||
IsEqualGUID(rclsid, &CLSID_AudioReverb25) ||
|
||||
IsEqualGUID(rclsid, &CLSID_AudioReverb26) ||
|
||||
IsEqualGUID(rclsid, &CLSID_AudioReverb27))
|
||||
return make_xapo_factory(&CLSID_AudioReverb27, riid, ppv);
|
||||
if (IsEqualGUID(rclsid, &CLSID_AudioReverb))
|
||||
return make_xapo_factory(&CLSID_AudioReverb, riid, ppv);
|
||||
|
||||
return CLASS_E_CLASSNOTAVAILABLE;
|
||||
}
|
||||
|
||||
#if XAUDIO2_VER >= 8
|
||||
#else
|
||||
HRESULT WINAPI XAudio2Create(IXAudio2 **ppxa2, UINT32 flags, XAUDIO2_PROCESSOR proc)
|
||||
{
|
||||
HRESULT hr;
|
||||
|
|
|
@ -20,7 +20,14 @@
|
|||
#include "windef.h"
|
||||
#include "wine/list.h"
|
||||
|
||||
#include "xaudio2.h"
|
||||
/* Don't include xaudio2.h directly; it's generated from an IDL with ifdefs and
|
||||
* hence is frozen at version 2.7. Instead include that IDL in a local IDL and
|
||||
* include the generated header.
|
||||
*
|
||||
* Because shared sources are compiled from the C file in the xaudio2_7
|
||||
* directory, we need to use angle brackets here to prevent the compiler from
|
||||
* picking up xaudio_classes.h from that directory for other versions. */
|
||||
#include <xaudio_classes.h>
|
||||
#include "xapo.h"
|
||||
|
||||
#include <FAudio.h>
|
||||
|
@ -52,31 +59,10 @@ typedef struct _XA2XAPOFXImpl {
|
|||
|
||||
typedef struct _XA2VoiceImpl {
|
||||
IXAudio2SourceVoice IXAudio2SourceVoice_iface;
|
||||
#if XAUDIO2_VER == 0
|
||||
IXAudio20SourceVoice IXAudio20SourceVoice_iface;
|
||||
#elif XAUDIO2_VER <= 3
|
||||
IXAudio23SourceVoice IXAudio23SourceVoice_iface;
|
||||
#elif XAUDIO2_VER <= 7
|
||||
IXAudio27SourceVoice IXAudio27SourceVoice_iface;
|
||||
#endif
|
||||
|
||||
IXAudio2SubmixVoice IXAudio2SubmixVoice_iface;
|
||||
#if XAUDIO2_VER == 0
|
||||
IXAudio20SubmixVoice IXAudio20SubmixVoice_iface;
|
||||
#elif XAUDIO2_VER <= 3
|
||||
IXAudio23SubmixVoice IXAudio23SubmixVoice_iface;
|
||||
#elif XAUDIO2_VER <= 7
|
||||
IXAudio27SubmixVoice IXAudio27SubmixVoice_iface;
|
||||
#endif
|
||||
|
||||
IXAudio2MasteringVoice IXAudio2MasteringVoice_iface;
|
||||
#if XAUDIO2_VER == 0
|
||||
IXAudio20MasteringVoice IXAudio20MasteringVoice_iface;
|
||||
#elif XAUDIO2_VER <= 3
|
||||
IXAudio23MasteringVoice IXAudio23MasteringVoice_iface;
|
||||
#elif XAUDIO2_VER <= 7
|
||||
IXAudio27MasteringVoice IXAudio27MasteringVoice_iface;
|
||||
#endif
|
||||
|
||||
FAudioVoiceCallback FAudioVoiceCallback_vtbl;
|
||||
FAudioEffectChain *effect_chain;
|
||||
|
@ -101,16 +87,6 @@ typedef struct _XA2VoiceImpl {
|
|||
typedef struct _IXAudio2Impl {
|
||||
IXAudio2 IXAudio2_iface;
|
||||
|
||||
#if XAUDIO2_VER == 0
|
||||
IXAudio20 IXAudio20_iface;
|
||||
#elif XAUDIO2_VER <= 2
|
||||
IXAudio22 IXAudio22_iface;
|
||||
#elif XAUDIO2_VER <= 3
|
||||
IXAudio23 IXAudio23_iface;
|
||||
#elif XAUDIO2_VER <= 7
|
||||
IXAudio27 IXAudio27_iface;
|
||||
#endif
|
||||
|
||||
CRITICAL_SECTION lock;
|
||||
|
||||
struct list voices;
|
||||
|
@ -127,39 +103,6 @@ typedef struct _IXAudio2Impl {
|
|||
IXAudio2EngineCallback **cbs;
|
||||
} IXAudio2Impl;
|
||||
|
||||
#if XAUDIO2_VER == 0
|
||||
extern const IXAudio20SourceVoiceVtbl XAudio20SourceVoice_Vtbl DECLSPEC_HIDDEN;
|
||||
extern const IXAudio20SubmixVoiceVtbl XAudio20SubmixVoice_Vtbl DECLSPEC_HIDDEN;
|
||||
extern const IXAudio20MasteringVoiceVtbl XAudio20MasteringVoice_Vtbl DECLSPEC_HIDDEN;
|
||||
extern XA2VoiceImpl *impl_from_IXAudio20SourceVoice(IXAudio20SourceVoice *iface) DECLSPEC_HIDDEN;
|
||||
extern XA2VoiceImpl *impl_from_IXAudio20SubmixVoice(IXAudio20SubmixVoice *iface) DECLSPEC_HIDDEN;
|
||||
extern XA2VoiceImpl *impl_from_IXAudio20MasteringVoice(IXAudio20MasteringVoice *iface) DECLSPEC_HIDDEN;
|
||||
#elif XAUDIO2_VER <= 3
|
||||
extern const IXAudio23SourceVoiceVtbl XAudio23SourceVoice_Vtbl DECLSPEC_HIDDEN;
|
||||
extern const IXAudio23SubmixVoiceVtbl XAudio23SubmixVoice_Vtbl DECLSPEC_HIDDEN;
|
||||
extern const IXAudio23MasteringVoiceVtbl XAudio23MasteringVoice_Vtbl DECLSPEC_HIDDEN;
|
||||
extern XA2VoiceImpl *impl_from_IXAudio23SourceVoice(IXAudio23SourceVoice *iface) DECLSPEC_HIDDEN;
|
||||
extern XA2VoiceImpl *impl_from_IXAudio23SubmixVoice(IXAudio23SubmixVoice *iface) DECLSPEC_HIDDEN;
|
||||
extern XA2VoiceImpl *impl_from_IXAudio23MasteringVoice(IXAudio23MasteringVoice *iface) DECLSPEC_HIDDEN;
|
||||
#elif XAUDIO2_VER <= 7
|
||||
extern const IXAudio27SourceVoiceVtbl XAudio27SourceVoice_Vtbl DECLSPEC_HIDDEN;
|
||||
extern const IXAudio27SubmixVoiceVtbl XAudio27SubmixVoice_Vtbl DECLSPEC_HIDDEN;
|
||||
extern const IXAudio27MasteringVoiceVtbl XAudio27MasteringVoice_Vtbl DECLSPEC_HIDDEN;
|
||||
extern XA2VoiceImpl *impl_from_IXAudio27SourceVoice(IXAudio27SourceVoice *iface) DECLSPEC_HIDDEN;
|
||||
extern XA2VoiceImpl *impl_from_IXAudio27SubmixVoice(IXAudio27SubmixVoice *iface) DECLSPEC_HIDDEN;
|
||||
extern XA2VoiceImpl *impl_from_IXAudio27MasteringVoice(IXAudio27MasteringVoice *iface) DECLSPEC_HIDDEN;
|
||||
#endif
|
||||
|
||||
#if XAUDIO2_VER == 0
|
||||
extern const IXAudio20Vtbl XAudio20_Vtbl DECLSPEC_HIDDEN;
|
||||
#elif XAUDIO2_VER <= 2
|
||||
extern const IXAudio22Vtbl XAudio22_Vtbl DECLSPEC_HIDDEN;
|
||||
#elif XAUDIO2_VER <= 3
|
||||
extern const IXAudio23Vtbl XAudio23_Vtbl DECLSPEC_HIDDEN;
|
||||
#elif XAUDIO2_VER <= 7
|
||||
extern const IXAudio27Vtbl XAudio27_Vtbl DECLSPEC_HIDDEN;
|
||||
#endif
|
||||
|
||||
/* xaudio_dll.c */
|
||||
extern HRESULT xaudio2_initialize(IXAudio2Impl *This, UINT32 flags, XAUDIO2_PROCESSOR proc) DECLSPEC_HIDDEN;
|
||||
extern FAudioEffectChain *wrap_effect_chain(const XAUDIO2_EFFECT_CHAIN *pEffectChain) DECLSPEC_HIDDEN;
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
EXTRADEFS = -DXAUDIO2_VER=8
|
||||
MODULE = xaudio2_8.dll
|
||||
IMPORTLIB = xaudio2_8
|
||||
IMPORTS = $(FAUDIO_PE_LIBS) advapi32 ole32 user32 uuid
|
||||
EXTRAINCL = $(FAUDIO_PE_CFLAGS)
|
||||
PARENTSRC = ../xaudio2_7
|
||||
|
||||
C_SRCS = \
|
||||
compat.c \
|
||||
x3daudio.c \
|
||||
xapo.c \
|
||||
xapofx.c \
|
||||
|
|
9
dlls/xaudio2_8/tests/Makefile.in
Normal file
9
dlls/xaudio2_8/tests/Makefile.in
Normal file
|
@ -0,0 +1,9 @@
|
|||
TESTDLL = xaudio2_8.dll
|
||||
IMPORTS = ole32 xaudio2_8
|
||||
EXTRADEFS = -DXAUDIO2_VER=8
|
||||
PARENTSRC = ../../xaudio2_7/tests
|
||||
|
||||
C_SRCS = \
|
||||
xaudio2.c
|
||||
|
||||
IDL_SRCS = xaudio_classes.idl
|
|
@ -5,7 +5,6 @@ EXTRAINCL = $(FAUDIO_PE_CFLAGS)
|
|||
PARENTSRC = ../xaudio2_7
|
||||
|
||||
C_SRCS = \
|
||||
compat.c \
|
||||
x3daudio.c \
|
||||
xapo.c \
|
||||
xapofx.c \
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -18,114 +18,58 @@
|
|||
|
||||
import "unknwn.idl";
|
||||
|
||||
#ifndef XAUDIO2_VER
|
||||
#define XAUDIO2_VER 9
|
||||
#endif
|
||||
|
||||
#if XAUDIO2_VER < 8
|
||||
[
|
||||
threading(both),
|
||||
#if XAUDIO2_VER == 0
|
||||
uuid(c0c56f46-29b1-44e9-9939-a32ce86867e2)
|
||||
]
|
||||
coclass AudioVolumeMeter20 {
|
||||
interface IUnknown;
|
||||
}
|
||||
|
||||
[
|
||||
#elif XAUDIO2_VER == 1
|
||||
uuid(c1e3f122-a2ea-442c-854f-20d98f8357a1)
|
||||
]
|
||||
coclass AudioVolumeMeter21 {
|
||||
interface IUnknown;
|
||||
}
|
||||
|
||||
[
|
||||
#elif XAUDIO2_VER == 2
|
||||
uuid(f5ca7b34-8055-42c0-b836-216129eb7e30)
|
||||
]
|
||||
coclass AudioVolumeMeter22 {
|
||||
interface IUnknown;
|
||||
}
|
||||
|
||||
[
|
||||
#elif XAUDIO2_VER == 3
|
||||
uuid(e180344b-ac83-4483-959e-18a5c56a5e19)
|
||||
]
|
||||
coclass AudioVolumeMeter23 {
|
||||
interface IUnknown;
|
||||
}
|
||||
|
||||
[
|
||||
#elif XAUDIO2_VER == 4
|
||||
uuid(c7338b95-52b8-4542-aa79-42eb016c8c1c)
|
||||
]
|
||||
coclass AudioVolumeMeter24 {
|
||||
interface IUnknown;
|
||||
}
|
||||
|
||||
[
|
||||
#elif XAUDIO2_VER == 5
|
||||
uuid(2139e6da-c341-4774-9ac3-b4e026347f64)
|
||||
]
|
||||
coclass AudioVolumeMeter25 {
|
||||
interface IUnknown;
|
||||
}
|
||||
|
||||
[
|
||||
#elif XAUDIO2_VER == 6
|
||||
uuid(e48c5a3f-93ef-43bb-a092-2c7ceb946f27)
|
||||
]
|
||||
coclass AudioVolumeMeter26 {
|
||||
interface IUnknown;
|
||||
}
|
||||
|
||||
[
|
||||
#else
|
||||
uuid(cac1105f-619b-4d04-831a-44e1cbf12d57)
|
||||
#endif
|
||||
]
|
||||
coclass AudioVolumeMeter27 {
|
||||
interface IUnknown;
|
||||
}
|
||||
coclass AudioVolumeMeter {}
|
||||
|
||||
[
|
||||
threading(both),
|
||||
#if XAUDIO2_VER == 0
|
||||
uuid(6f6ea3a9-2cf5-41cf-91c1-2170b1540063)
|
||||
]
|
||||
coclass AudioReverb20 {
|
||||
interface IUnknown;
|
||||
}
|
||||
|
||||
[
|
||||
#elif XAUDIO2_VER == 1
|
||||
uuid(f4769300-b949-4df9-b333-00d33932e9a6)
|
||||
]
|
||||
coclass AudioReverb21 {
|
||||
interface IUnknown;
|
||||
}
|
||||
|
||||
[
|
||||
#elif XAUDIO2_VER == 2
|
||||
uuid(629cf0de-3ecc-41e7-9926-f7e43eebec51)
|
||||
]
|
||||
coclass AudioReverb22 {
|
||||
interface IUnknown;
|
||||
}
|
||||
|
||||
[
|
||||
#elif XAUDIO2_VER == 3
|
||||
uuid(9cab402c-1d37-44b4-886d-fa4f36170a4c)
|
||||
]
|
||||
coclass AudioReverb23 {
|
||||
interface IUnknown;
|
||||
}
|
||||
|
||||
[
|
||||
#elif XAUDIO2_VER == 4
|
||||
uuid(8bb7778b-645b-4475-9a73-1de3170bd3af)
|
||||
]
|
||||
coclass AudioReverb24 {
|
||||
interface IUnknown;
|
||||
}
|
||||
|
||||
[
|
||||
#elif XAUDIO2_VER == 5
|
||||
uuid(d06df0d0-8518-441e-822f-5451d5c595b8)
|
||||
]
|
||||
coclass AudioReverb25 {
|
||||
interface IUnknown;
|
||||
}
|
||||
|
||||
[
|
||||
#elif XAUDIO2_VER == 6
|
||||
uuid(cecec95a-d894-491a-bee3-5e106fb59f2d)
|
||||
]
|
||||
coclass AudioReverb26 {
|
||||
interface IUnknown;
|
||||
}
|
||||
|
||||
[
|
||||
#else
|
||||
uuid(6a93130e-1d53-41d1-a9cf-e758800bb179)
|
||||
#endif
|
||||
]
|
||||
coclass AudioReverb27 {
|
||||
interface IUnknown;
|
||||
}
|
||||
coclass AudioReverb {}
|
||||
|
||||
#else
|
||||
|
||||
HRESULT __stdcall CreateAudioReverb(IUnknown **out);
|
||||
HRESULT __stdcall CreateAudioVolumeMeter(IUnknown **out);
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Reference in a new issue