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
22 #include "wine/list.h"
26 #include "xaudio2fx.h"
29 #include "mmdeviceapi.h"
30 #include "audioclient.h"
36 typedef struct _XA2Buffer
{
37 XAUDIO2_BUFFER xa2buffer
;
39 UINT32 latest_al_buf
, looped
, loop_end_bytes
, play_end_bytes
, cur_end_bytes
;
42 typedef struct _IXAudio2Impl IXAudio2Impl
;
44 typedef struct _XA2SourceImpl
{
45 IXAudio20SourceVoice IXAudio20SourceVoice_iface
;
46 IXAudio23SourceVoice IXAudio23SourceVoice_iface
;
47 IXAudio27SourceVoice IXAudio27SourceVoice_iface
;
48 IXAudio2SourceVoice IXAudio2SourceVoice_iface
;
54 CRITICAL_SECTION lock
;
58 UINT32 submit_blocksize
;
60 IXAudio2VoiceCallback
*cb
;
63 XAUDIO2_SEND_DESCRIPTOR
*sends
;
69 XA2Buffer buffers
[XAUDIO2_MAX_QUEUED_BUFFERS
];
70 UINT32 first_buf
, cur_buf
, nbufs
, in_al_bytes
;
72 UINT32 scratch_bytes
, convert_bytes
;
73 BYTE
*scratch_buf
, *convert_buf
;
76 /* most cases will only need about 4 AL buffers, but some corner cases
77 * could require up to MAX_QUEUED_BUFFERS */
78 ALuint al_bufs
[XAUDIO2_MAX_QUEUED_BUFFERS
];
79 DWORD first_al_buf
, al_bufs_used
;
84 typedef struct _XA2SubmixImpl
{
85 IXAudio20SubmixVoice IXAudio20SubmixVoice_iface
;
86 IXAudio23SubmixVoice IXAudio23SubmixVoice_iface
;
87 IXAudio2SubmixVoice IXAudio2SubmixVoice_iface
;
91 CRITICAL_SECTION lock
;
96 struct _IXAudio2Impl
{
97 IXAudio20 IXAudio20_iface
;
98 IXAudio22 IXAudio22_iface
;
99 IXAudio27 IXAudio27_iface
;
100 IXAudio2 IXAudio2_iface
;
101 IXAudio20MasteringVoice IXAudio20MasteringVoice_iface
;
102 IXAudio23MasteringVoice IXAudio23MasteringVoice_iface
;
103 IXAudio2MasteringVoice IXAudio2MasteringVoice_iface
;
107 CRITICAL_SECTION lock
;
109 HANDLE engine
, mmevt
;
114 struct list source_voices
;
115 struct list submix_voices
;
117 IMMDeviceEnumerator
*devenum
;
122 UINT32 last_query_glitches
;
124 IAudioClient
*aclient
;
125 IAudioRenderClient
*render
;
127 UINT32 period_frames
;
129 WAVEFORMATEXTENSIBLE fmt
;
131 ALCdevice
*al_device
;
135 IXAudio2EngineCallback
**cbs
;
140 extern const IXAudio27SourceVoiceVtbl XAudio27SourceVoice_Vtbl DECLSPEC_HIDDEN
;
141 extern const IXAudio27Vtbl XAudio27_Vtbl DECLSPEC_HIDDEN
;
143 extern const IXAudio23SourceVoiceVtbl XAudio23SourceVoice_Vtbl DECLSPEC_HIDDEN
;
144 extern const IXAudio23SubmixVoiceVtbl XAudio23SubmixVoice_Vtbl DECLSPEC_HIDDEN
;
145 extern const IXAudio23MasteringVoiceVtbl XAudio23MasteringVoice_Vtbl DECLSPEC_HIDDEN
;
147 extern const IXAudio22Vtbl XAudio22_Vtbl DECLSPEC_HIDDEN
;
149 extern const IXAudio20Vtbl XAudio20_Vtbl DECLSPEC_HIDDEN
;
150 extern const IXAudio20SourceVoiceVtbl XAudio20SourceVoice_Vtbl DECLSPEC_HIDDEN
;
151 extern const IXAudio20SubmixVoiceVtbl XAudio20SubmixVoice_Vtbl DECLSPEC_HIDDEN
;
152 extern const IXAudio20MasteringVoiceVtbl XAudio20MasteringVoice_Vtbl DECLSPEC_HIDDEN
;