2 * Copyright (c) 2015 Andrew Eikum for CodeWeavers
3 * Copyright (c) 2018 Ethan Lee for CodeWeavers
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #include "wine/list.h"
32 #define COMPAT_E_INVALID_CALL E_INVALIDARG
33 #define COMPAT_E_DEVICE_INVALIDATED XAUDIO20_E_DEVICE_INVALIDATED
35 #define COMPAT_E_INVALID_CALL XAUDIO2_E_INVALID_CALL
36 #define COMPAT_E_DEVICE_INVALIDATED XAUDIO2_E_DEVICE_INVALIDATED
39 typedef struct _XA2XAPOImpl
{
41 IXAPOParameters
*xapo_params
;
48 typedef struct _XA2XAPOFXImpl
{
50 IXAPOParameters IXAPOParameters_iface
;
55 typedef struct _XA2VoiceImpl
{
56 IXAudio2SourceVoice IXAudio2SourceVoice_iface
;
58 IXAudio20SourceVoice IXAudio20SourceVoice_iface
;
59 #elif XAUDIO2_VER <= 3
60 IXAudio23SourceVoice IXAudio23SourceVoice_iface
;
61 #elif XAUDIO2_VER <= 7
62 IXAudio27SourceVoice IXAudio27SourceVoice_iface
;
65 IXAudio2SubmixVoice IXAudio2SubmixVoice_iface
;
67 IXAudio20SubmixVoice IXAudio20SubmixVoice_iface
;
68 #elif XAUDIO2_VER <= 3
69 IXAudio23SubmixVoice IXAudio23SubmixVoice_iface
;
70 #elif XAUDIO2_VER <= 7
71 IXAudio27SubmixVoice IXAudio27SubmixVoice_iface
;
74 IXAudio2MasteringVoice IXAudio2MasteringVoice_iface
;
76 IXAudio20MasteringVoice IXAudio20MasteringVoice_iface
;
77 #elif XAUDIO2_VER <= 3
78 IXAudio23MasteringVoice IXAudio23MasteringVoice_iface
;
79 #elif XAUDIO2_VER <= 7
80 IXAudio27MasteringVoice IXAudio27MasteringVoice_iface
;
83 FAudioVoiceCallback FAudioVoiceCallback_vtbl
;
84 FAudioEffectChain
*effect_chain
;
88 CRITICAL_SECTION lock
;
90 IXAudio2VoiceCallback
*cb
;
92 FAudioVoice
*faudio_voice
;
95 FAudioEngineCallEXT proc
;
100 HANDLE engine_thread
;
101 pthread_cond_t engine_done
, engine_ready
;
102 pthread_mutex_t engine_lock
;
107 typedef struct _IXAudio2Impl
{
108 IXAudio2 IXAudio2_iface
;
111 IXAudio20 IXAudio20_iface
;
112 #elif XAUDIO2_VER <= 2
113 IXAudio22 IXAudio22_iface
;
114 #elif XAUDIO2_VER <= 3
115 IXAudio23 IXAudio23_iface
;
116 #elif XAUDIO2_VER <= 7
117 IXAudio27 IXAudio27_iface
;
120 CRITICAL_SECTION lock
;
126 FAudioEngineCallback FAudioEngineCallback_vtbl
;
130 DWORD last_query_glitches
;
133 IXAudio2EngineCallback
**cbs
;
137 extern const IXAudio20SourceVoiceVtbl XAudio20SourceVoice_Vtbl DECLSPEC_HIDDEN
;
138 extern const IXAudio20SubmixVoiceVtbl XAudio20SubmixVoice_Vtbl DECLSPEC_HIDDEN
;
139 extern const IXAudio20MasteringVoiceVtbl XAudio20MasteringVoice_Vtbl DECLSPEC_HIDDEN
;
140 extern XA2VoiceImpl
*impl_from_IXAudio20SourceVoice(IXAudio20SourceVoice
*iface
) DECLSPEC_HIDDEN
;
141 extern XA2VoiceImpl
*impl_from_IXAudio20SubmixVoice(IXAudio20SubmixVoice
*iface
) DECLSPEC_HIDDEN
;
142 extern XA2VoiceImpl
*impl_from_IXAudio20MasteringVoice(IXAudio20MasteringVoice
*iface
) DECLSPEC_HIDDEN
;
143 #elif XAUDIO2_VER <= 3
144 extern const IXAudio23SourceVoiceVtbl XAudio23SourceVoice_Vtbl DECLSPEC_HIDDEN
;
145 extern const IXAudio23SubmixVoiceVtbl XAudio23SubmixVoice_Vtbl DECLSPEC_HIDDEN
;
146 extern const IXAudio23MasteringVoiceVtbl XAudio23MasteringVoice_Vtbl DECLSPEC_HIDDEN
;
147 extern XA2VoiceImpl
*impl_from_IXAudio23SourceVoice(IXAudio23SourceVoice
*iface
) DECLSPEC_HIDDEN
;
148 extern XA2VoiceImpl
*impl_from_IXAudio23SubmixVoice(IXAudio23SubmixVoice
*iface
) DECLSPEC_HIDDEN
;
149 extern XA2VoiceImpl
*impl_from_IXAudio23MasteringVoice(IXAudio23MasteringVoice
*iface
) DECLSPEC_HIDDEN
;
150 #elif XAUDIO2_VER <= 7
151 extern const IXAudio27SourceVoiceVtbl XAudio27SourceVoice_Vtbl DECLSPEC_HIDDEN
;
152 extern const IXAudio27SubmixVoiceVtbl XAudio27SubmixVoice_Vtbl DECLSPEC_HIDDEN
;
153 extern const IXAudio27MasteringVoiceVtbl XAudio27MasteringVoice_Vtbl DECLSPEC_HIDDEN
;
154 extern XA2VoiceImpl
*impl_from_IXAudio27SourceVoice(IXAudio27SourceVoice
*iface
) DECLSPEC_HIDDEN
;
155 extern XA2VoiceImpl
*impl_from_IXAudio27SubmixVoice(IXAudio27SubmixVoice
*iface
) DECLSPEC_HIDDEN
;
156 extern XA2VoiceImpl
*impl_from_IXAudio27MasteringVoice(IXAudio27MasteringVoice
*iface
) DECLSPEC_HIDDEN
;
160 extern const IXAudio20Vtbl XAudio20_Vtbl DECLSPEC_HIDDEN
;
161 #elif XAUDIO2_VER <= 2
162 extern const IXAudio22Vtbl XAudio22_Vtbl DECLSPEC_HIDDEN
;
163 #elif XAUDIO2_VER <= 3
164 extern const IXAudio23Vtbl XAudio23_Vtbl DECLSPEC_HIDDEN
;
165 #elif XAUDIO2_VER <= 7
166 extern const IXAudio27Vtbl XAudio27_Vtbl DECLSPEC_HIDDEN
;
170 extern HRESULT
xaudio2_initialize(IXAudio2Impl
*This
, UINT32 flags
, XAUDIO2_PROCESSOR proc
) DECLSPEC_HIDDEN
;
171 extern FAudioEffectChain
*wrap_effect_chain(const XAUDIO2_EFFECT_CHAIN
*pEffectChain
) DECLSPEC_HIDDEN
;
172 extern void engine_cb(FAudioEngineCallEXT proc
, FAudio
*faudio
, float *stream
, void *user
) DECLSPEC_HIDDEN
;
173 extern DWORD WINAPI
engine_thread(void *user
) DECLSPEC_HIDDEN
;
176 extern HRESULT
make_xapo_factory(REFCLSID clsid
, REFIID riid
, void **ppv
) DECLSPEC_HIDDEN
;
178 /* xaudio_allocator.c */
179 extern void* XAudio_Internal_Malloc(size_t size
) DECLSPEC_HIDDEN
;
180 extern void XAudio_Internal_Free(void* ptr
) DECLSPEC_HIDDEN
;
181 extern void* XAudio_Internal_Realloc(void* ptr
, size_t size
) DECLSPEC_HIDDEN
;