mfplat: Make functionality of GetMediaTypeHandler more clear.
[wine.git] / dlls / xaudio2_7 / xaudio_private.h
blob46d842bf4c1f956062d568dbf2d91aa9297444da
1 /*
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
20 #include "windef.h"
21 #include "wine/list.h"
23 #include "xaudio2.h"
24 #include "xapo.h"
26 #include <FAudio.h>
27 #include <FAPO.h>
29 #include <pthread.h>
31 #if XAUDIO2_VER == 0
32 #define COMPAT_E_INVALID_CALL E_INVALIDARG
33 #define COMPAT_E_DEVICE_INVALIDATED XAUDIO20_E_DEVICE_INVALIDATED
34 #else
35 #define COMPAT_E_INVALID_CALL XAUDIO2_E_INVALID_CALL
36 #define COMPAT_E_DEVICE_INVALIDATED XAUDIO2_E_DEVICE_INVALIDATED
37 #endif
39 typedef struct _XA2XAPOImpl {
40 IXAPO *xapo;
41 IXAPOParameters *xapo_params;
43 LONG ref;
45 FAPO FAPO_vtbl;
46 } XA2XAPOImpl;
48 typedef struct _XA2XAPOFXImpl {
49 IXAPO IXAPO_iface;
50 IXAPOParameters IXAPOParameters_iface;
52 FAPO *fapo;
53 } XA2XAPOFXImpl;
55 typedef struct _XA2VoiceImpl {
56 IXAudio2SourceVoice IXAudio2SourceVoice_iface;
57 #if XAUDIO2_VER == 0
58 IXAudio20SourceVoice IXAudio20SourceVoice_iface;
59 #elif XAUDIO2_VER <= 3
60 IXAudio23SourceVoice IXAudio23SourceVoice_iface;
61 #elif XAUDIO2_VER <= 7
62 IXAudio27SourceVoice IXAudio27SourceVoice_iface;
63 #endif
65 IXAudio2SubmixVoice IXAudio2SubmixVoice_iface;
66 #if XAUDIO2_VER == 0
67 IXAudio20SubmixVoice IXAudio20SubmixVoice_iface;
68 #elif XAUDIO2_VER <= 3
69 IXAudio23SubmixVoice IXAudio23SubmixVoice_iface;
70 #elif XAUDIO2_VER <= 7
71 IXAudio27SubmixVoice IXAudio27SubmixVoice_iface;
72 #endif
74 IXAudio2MasteringVoice IXAudio2MasteringVoice_iface;
75 #if XAUDIO2_VER == 0
76 IXAudio20MasteringVoice IXAudio20MasteringVoice_iface;
77 #elif XAUDIO2_VER <= 3
78 IXAudio23MasteringVoice IXAudio23MasteringVoice_iface;
79 #elif XAUDIO2_VER <= 7
80 IXAudio27MasteringVoice IXAudio27MasteringVoice_iface;
81 #endif
83 FAudioVoiceCallback FAudioVoiceCallback_vtbl;
84 FAudioEffectChain *effect_chain;
86 BOOL in_use;
88 CRITICAL_SECTION lock;
90 IXAudio2VoiceCallback *cb;
92 FAudioVoice *faudio_voice;
94 struct {
95 FAudioEngineCallEXT proc;
96 FAudio *faudio;
97 float *stream;
98 } engine_params;
100 HANDLE engine_thread;
101 pthread_cond_t engine_done, engine_ready;
102 pthread_mutex_t engine_lock;
104 struct list entry;
105 } XA2VoiceImpl;
107 typedef struct _IXAudio2Impl {
108 IXAudio2 IXAudio2_iface;
110 #if XAUDIO2_VER == 0
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;
118 #endif
120 CRITICAL_SECTION lock;
122 struct list voices;
124 FAudio *faudio;
126 FAudioEngineCallback FAudioEngineCallback_vtbl;
128 XA2VoiceImpl mst;
130 DWORD last_query_glitches;
132 UINT32 ncbs;
133 IXAudio2EngineCallback **cbs;
134 } IXAudio2Impl;
136 #if XAUDIO2_VER == 0
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;
157 #endif
159 #if XAUDIO2_VER == 0
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;
167 #endif
169 /* xaudio_dll.c */
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;
175 /* xapo.c */
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;