wine/dlls/xaudio2_7/xaudio_private.h
Zebediah Figura 14c44d0b0a 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.
2023-06-07 22:48:27 +02:00

119 lines
3.4 KiB
C

/*
* Copyright (c) 2015 Andrew Eikum for CodeWeavers
* Copyright (c) 2018 Ethan Lee 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 "windef.h"
#include "wine/list.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>
#include <FAPO.h>
#if XAUDIO2_VER == 0
#define COMPAT_E_INVALID_CALL E_INVALIDARG
#define COMPAT_E_DEVICE_INVALIDATED XAUDIO20_E_DEVICE_INVALIDATED
#else
#define COMPAT_E_INVALID_CALL XAUDIO2_E_INVALID_CALL
#define COMPAT_E_DEVICE_INVALIDATED XAUDIO2_E_DEVICE_INVALIDATED
#endif
typedef struct _XA2XAPOImpl {
IXAPO *xapo;
IXAPOParameters *xapo_params;
LONG ref;
FAPO FAPO_vtbl;
} XA2XAPOImpl;
typedef struct _XA2XAPOFXImpl {
IXAPO IXAPO_iface;
IXAPOParameters IXAPOParameters_iface;
FAPO *fapo;
} XA2XAPOFXImpl;
typedef struct _XA2VoiceImpl {
IXAudio2SourceVoice IXAudio2SourceVoice_iface;
IXAudio2SubmixVoice IXAudio2SubmixVoice_iface;
IXAudio2MasteringVoice IXAudio2MasteringVoice_iface;
FAudioVoiceCallback FAudioVoiceCallback_vtbl;
FAudioEffectChain *effect_chain;
BOOL in_use;
CRITICAL_SECTION lock;
IXAudio2VoiceCallback *cb;
FAudioVoice *faudio_voice;
struct {
FAudioEngineCallEXT proc;
FAudio *faudio;
float *stream;
} engine_params;
struct list entry;
} XA2VoiceImpl;
typedef struct _IXAudio2Impl {
IXAudio2 IXAudio2_iface;
CRITICAL_SECTION lock;
struct list voices;
FAudio *faudio;
FAudioEngineCallback FAudioEngineCallback_vtbl;
XA2VoiceImpl mst;
DWORD last_query_glitches;
UINT32 ncbs;
IXAudio2EngineCallback **cbs;
} IXAudio2Impl;
/* 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;
extern void engine_cb(FAudioEngineCallEXT proc, FAudio *faudio, float *stream, void *user) DECLSPEC_HIDDEN;
extern DWORD WINAPI engine_thread(void *user) DECLSPEC_HIDDEN;
/* xapo.c */
extern HRESULT make_xapo_factory(REFCLSID clsid, REFIID riid, void **ppv) DECLSPEC_HIDDEN;
/* xaudio_allocator.c */
extern void* XAudio_Internal_Malloc(size_t size) DECLSPEC_HIDDEN;
extern void XAudio_Internal_Free(void* ptr) DECLSPEC_HIDDEN;
extern void* XAudio_Internal_Realloc(void* ptr, size_t size) DECLSPEC_HIDDEN;