setupapi: Set LastError on success in SetupInstallFromInfSectionW.
[wine.git] / dlls / xaudio2_7 / xaudio_private.h
blob5d3814fb9efc0df7bf71e27bf592869e6e529dfa
1 /*
2 * Copyright (c) 2015 Andrew Eikum for CodeWeavers
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 #include "windef.h"
20 #include "winbase.h"
21 #include "winuser.h"
22 #include "wine/list.h"
24 #include "mmsystem.h"
25 #include "xaudio2.h"
26 #include "xaudio2fx.h"
27 #include "xapo.h"
28 #include "devpkey.h"
29 #include "mmdeviceapi.h"
30 #include "audioclient.h"
32 #include <AL/al.h>
33 #include <AL/alc.h>
34 #include <AL/alext.h>
36 typedef struct _XA2Buffer {
37 XAUDIO2_BUFFER xa2buffer;
38 DWORD offs_bytes;
39 UINT32 latest_al_buf, looped, loop_end_bytes, play_end_bytes, cur_end_bytes;
40 } XA2Buffer;
42 typedef struct _IXAudio2Impl IXAudio2Impl;
44 typedef struct _XA2SourceImpl {
45 IXAudio2SourceVoice IXAudio2SourceVoice_iface;
47 #if XAUDIO2_VER == 0
48 IXAudio20SourceVoice IXAudio20SourceVoice_iface;
49 #elif XAUDIO2_VER <= 3
50 IXAudio23SourceVoice IXAudio23SourceVoice_iface;
51 #elif XAUDIO2_VER <= 7
52 IXAudio27SourceVoice IXAudio27SourceVoice_iface;
53 #endif
55 IXAudio2Impl *xa2;
57 BOOL in_use;
59 CRITICAL_SECTION lock;
61 WAVEFORMATEX *fmt;
62 ALenum al_fmt;
63 UINT32 submit_blocksize;
65 IXAudio2VoiceCallback *cb;
67 DWORD nsends;
68 XAUDIO2_SEND_DESCRIPTOR *sends;
70 BOOL running;
72 UINT64 played_frames;
74 XA2Buffer buffers[XAUDIO2_MAX_QUEUED_BUFFERS];
75 UINT32 first_buf, cur_buf, nbufs, in_al_bytes;
77 UINT32 scratch_bytes, convert_bytes;
78 BYTE *scratch_buf, *convert_buf;
80 ALuint al_src;
81 /* most cases will only need about 4 AL buffers, but some corner cases
82 * could require up to MAX_QUEUED_BUFFERS */
83 ALuint al_bufs[XAUDIO2_MAX_QUEUED_BUFFERS];
84 DWORD first_al_buf, al_bufs_used, abandoned_albufs;
86 struct list entry;
87 } XA2SourceImpl;
89 typedef struct _XA2SubmixImpl {
90 IXAudio2SubmixVoice IXAudio2SubmixVoice_iface;
92 #if XAUDIO2_VER == 0
93 IXAudio20SubmixVoice IXAudio20SubmixVoice_iface;
94 #elif XAUDIO2_VER <= 3
95 IXAudio23SubmixVoice IXAudio23SubmixVoice_iface;
96 #elif XAUDIO2_VER <= 7
97 IXAudio27SubmixVoice IXAudio27SubmixVoice_iface;
98 #endif
100 BOOL in_use;
102 XAUDIO2_VOICE_DETAILS details;
104 CRITICAL_SECTION lock;
106 struct list entry;
107 } XA2SubmixImpl;
109 struct _IXAudio2Impl {
110 IXAudio2 IXAudio2_iface;
111 IXAudio2MasteringVoice IXAudio2MasteringVoice_iface;
113 #if XAUDIO2_VER == 0
114 IXAudio20 IXAudio20_iface;
115 #elif XAUDIO2_VER <= 2
116 IXAudio22 IXAudio22_iface;
117 #elif XAUDIO2_VER <= 7
118 IXAudio27 IXAudio27_iface;
119 #endif
121 #if XAUDIO2_VER == 0
122 IXAudio20MasteringVoice IXAudio20MasteringVoice_iface;
123 #elif XAUDIO2_VER <= 3
124 IXAudio23MasteringVoice IXAudio23MasteringVoice_iface;
125 #elif XAUDIO2_VER <= 7
126 IXAudio27MasteringVoice IXAudio27MasteringVoice_iface;
127 #endif
129 LONG ref;
131 CRITICAL_SECTION lock;
133 HANDLE engine, mmevt;
134 BOOL stop_engine;
136 struct list source_voices;
137 struct list submix_voices;
139 IMMDeviceEnumerator *devenum;
141 WCHAR **devids;
142 UINT32 ndevs;
144 UINT32 last_query_glitches;
146 IAudioClient *aclient;
147 IAudioRenderClient *render;
149 UINT32 period_frames;
151 WAVEFORMATEXTENSIBLE fmt;
153 ALCdevice *al_device;
154 ALCcontext *al_ctx;
156 UINT32 ncbs;
157 IXAudio2EngineCallback **cbs;
159 BOOL running;
162 #if XAUDIO2_VER == 0
163 extern const IXAudio20SourceVoiceVtbl XAudio20SourceVoice_Vtbl DECLSPEC_HIDDEN;
164 extern const IXAudio20SubmixVoiceVtbl XAudio20SubmixVoice_Vtbl DECLSPEC_HIDDEN;
165 extern const IXAudio20MasteringVoiceVtbl XAudio20MasteringVoice_Vtbl DECLSPEC_HIDDEN;
166 #elif XAUDIO2_VER <= 3
167 extern const IXAudio23SourceVoiceVtbl XAudio23SourceVoice_Vtbl DECLSPEC_HIDDEN;
168 extern const IXAudio23SubmixVoiceVtbl XAudio23SubmixVoice_Vtbl DECLSPEC_HIDDEN;
169 extern const IXAudio23MasteringVoiceVtbl XAudio23MasteringVoice_Vtbl DECLSPEC_HIDDEN;
170 #elif XAUDIO2_VER <= 7
171 extern const IXAudio27SourceVoiceVtbl XAudio27SourceVoice_Vtbl DECLSPEC_HIDDEN;
172 extern const IXAudio27SubmixVoiceVtbl XAudio27SubmixVoice_Vtbl DECLSPEC_HIDDEN;
173 extern const IXAudio27MasteringVoiceVtbl XAudio27MasteringVoice_Vtbl DECLSPEC_HIDDEN;
174 #endif
176 #if XAUDIO2_VER == 0
177 extern const IXAudio20Vtbl XAudio20_Vtbl DECLSPEC_HIDDEN;
178 #elif XAUDIO2_VER <= 2
179 extern const IXAudio22Vtbl XAudio22_Vtbl DECLSPEC_HIDDEN;
180 #elif XAUDIO2_VER <= 7
181 extern const IXAudio27Vtbl XAudio27_Vtbl DECLSPEC_HIDDEN;
182 #endif
184 extern HRESULT make_xapo_factory(REFCLSID clsid, REFIID riid, void **ppv) DECLSPEC_HIDDEN;
185 extern HRESULT xaudio2_initialize(IXAudio2Impl *This, UINT32 flags, XAUDIO2_PROCESSOR proc) DECLSPEC_HIDDEN;