2011-04-27 14:12:36 +00:00
|
|
|
/*
|
|
|
|
* Copyright 2011 Andrew Eikum for CodeWeavers
|
2022-03-31 07:21:46 +00:00
|
|
|
* 2022 Huw Davies
|
2011-04-27 14:12:36 +00:00
|
|
|
*
|
|
|
|
* 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
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define COBJMACROS
|
|
|
|
#include <stdarg.h>
|
2023-03-10 02:51:05 +00:00
|
|
|
#include <wchar.h>
|
2011-04-27 14:12:36 +00:00
|
|
|
|
|
|
|
#include "windef.h"
|
|
|
|
#include "winbase.h"
|
2022-03-31 07:21:46 +00:00
|
|
|
#include "winternl.h"
|
2011-04-27 14:12:36 +00:00
|
|
|
#include "winnls.h"
|
|
|
|
#include "winreg.h"
|
|
|
|
|
|
|
|
#include "ole2.h"
|
|
|
|
#include "mmdeviceapi.h"
|
|
|
|
#include "devpkey.h"
|
|
|
|
#include "dshow.h"
|
|
|
|
#include "dsound.h"
|
2011-05-02 13:21:49 +00:00
|
|
|
|
|
|
|
#include "initguid.h"
|
2011-09-23 20:03:59 +00:00
|
|
|
#include "endpointvolume.h"
|
2011-04-27 14:12:36 +00:00
|
|
|
#include "audiopolicy.h"
|
2011-05-02 13:21:49 +00:00
|
|
|
#include "audioclient.h"
|
2011-04-27 14:12:36 +00:00
|
|
|
|
2022-03-31 07:21:46 +00:00
|
|
|
#include "wine/debug.h"
|
|
|
|
#include "wine/list.h"
|
|
|
|
#include "wine/unixlib.h"
|
|
|
|
|
|
|
|
#include "unixlib.h"
|
|
|
|
|
2023-04-11 07:00:25 +00:00
|
|
|
#include "../mmdevapi/mmdevdrv.h"
|
|
|
|
|
2011-04-27 14:12:36 +00:00
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(oss);
|
|
|
|
|
2011-05-02 13:21:49 +00:00
|
|
|
#define NULL_PTR_ERR MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, RPC_X_NULL_REF_POINTER)
|
|
|
|
|
2012-04-03 19:05:20 +00:00
|
|
|
typedef struct _OSSDevice {
|
2022-03-31 07:21:50 +00:00
|
|
|
struct list entry;
|
2012-04-03 19:05:20 +00:00
|
|
|
EDataFlow flow;
|
|
|
|
GUID guid;
|
2022-03-31 07:21:50 +00:00
|
|
|
char devnode[0];
|
2012-04-03 19:05:20 +00:00
|
|
|
} OSSDevice;
|
|
|
|
|
|
|
|
static struct list g_devices = LIST_INIT(g_devices);
|
|
|
|
|
2023-03-10 02:51:05 +00:00
|
|
|
static WCHAR drv_key_devicesW[256];
|
2012-04-03 19:05:20 +00:00
|
|
|
static const WCHAR guidW[] = {'g','u','i','d',0};
|
|
|
|
|
2011-05-02 13:21:49 +00:00
|
|
|
static CRITICAL_SECTION g_sessions_lock;
|
2011-11-15 13:39:45 +00:00
|
|
|
static CRITICAL_SECTION_DEBUG g_sessions_lock_debug =
|
|
|
|
{
|
|
|
|
0, 0, &g_sessions_lock,
|
|
|
|
{ &g_sessions_lock_debug.ProcessLocksList, &g_sessions_lock_debug.ProcessLocksList },
|
|
|
|
0, 0, { (DWORD_PTR)(__FILE__ ": g_sessions_lock") }
|
|
|
|
};
|
|
|
|
static CRITICAL_SECTION g_sessions_lock = { &g_sessions_lock_debug, -1, 0, 0, 0, 0 };
|
2011-05-02 13:21:49 +00:00
|
|
|
static struct list g_sessions = LIST_INIT(g_sessions);
|
|
|
|
|
2020-10-01 20:23:05 +00:00
|
|
|
static const IAudioClient3Vtbl AudioClient3_Vtbl;
|
2023-05-16 01:13:06 +00:00
|
|
|
extern const IAudioRenderClientVtbl AudioRenderClient_Vtbl;
|
2023-05-13 06:28:39 +00:00
|
|
|
extern const IAudioCaptureClientVtbl AudioCaptureClient_Vtbl;
|
2023-04-27 21:57:45 +00:00
|
|
|
extern const IAudioSessionControl2Vtbl AudioSessionControl2_Vtbl;
|
2023-04-29 23:49:14 +00:00
|
|
|
extern const ISimpleAudioVolumeVtbl SimpleAudioVolume_Vtbl;
|
2023-05-12 06:23:57 +00:00
|
|
|
extern const IAudioClockVtbl AudioClock_Vtbl;
|
|
|
|
extern const IAudioClock2Vtbl AudioClock2_Vtbl;
|
2023-05-09 19:36:47 +00:00
|
|
|
extern const IAudioStreamVolumeVtbl AudioStreamVolume_Vtbl;
|
2023-05-01 23:36:27 +00:00
|
|
|
extern const IChannelAudioVolumeVtbl ChannelAudioVolume_Vtbl;
|
2011-04-27 14:12:36 +00:00
|
|
|
|
2023-06-12 17:42:38 +00:00
|
|
|
extern HRESULT main_loop_start(void) DECLSPEC_HIDDEN;
|
|
|
|
|
2023-06-01 19:19:41 +00:00
|
|
|
extern struct audio_session_wrapper *session_wrapper_create(
|
|
|
|
struct audio_client *client) DECLSPEC_HIDDEN;
|
|
|
|
|
2023-06-17 07:44:10 +00:00
|
|
|
extern HRESULT stream_release(stream_handle stream, HANDLE timer_thread);
|
|
|
|
|
2023-06-15 15:51:05 +00:00
|
|
|
extern WCHAR *get_application_name(void);
|
|
|
|
|
2023-06-20 03:59:36 +00:00
|
|
|
extern void set_stream_volumes(struct audio_client *This);
|
|
|
|
|
2023-04-27 21:57:45 +00:00
|
|
|
void DECLSPEC_HIDDEN sessions_lock(void)
|
2023-04-21 21:11:52 +00:00
|
|
|
{
|
|
|
|
EnterCriticalSection(&g_sessions_lock);
|
|
|
|
}
|
|
|
|
|
2023-04-27 21:57:45 +00:00
|
|
|
void DECLSPEC_HIDDEN sessions_unlock(void)
|
2023-04-21 21:11:52 +00:00
|
|
|
{
|
|
|
|
LeaveCriticalSection(&g_sessions_lock);
|
|
|
|
}
|
|
|
|
|
2020-10-01 20:23:05 +00:00
|
|
|
static inline ACImpl *impl_from_IAudioClient3(IAudioClient3 *iface)
|
2011-04-27 14:12:36 +00:00
|
|
|
{
|
2020-10-01 20:23:05 +00:00
|
|
|
return CONTAINING_RECORD(iface, ACImpl, IAudioClient3_iface);
|
2011-04-27 14:12:36 +00:00
|
|
|
}
|
|
|
|
|
2011-05-02 13:21:29 +00:00
|
|
|
BOOL WINAPI DllMain(HINSTANCE dll, DWORD reason, void *reserved)
|
|
|
|
{
|
2011-11-15 13:39:45 +00:00
|
|
|
switch (reason)
|
|
|
|
{
|
|
|
|
case DLL_PROCESS_ATTACH:
|
2023-03-10 02:51:05 +00:00
|
|
|
{
|
|
|
|
WCHAR buf[MAX_PATH];
|
|
|
|
WCHAR *filename;
|
|
|
|
|
2022-11-24 09:32:09 +00:00
|
|
|
if(__wine_init_unix_call()) return FALSE;
|
2011-05-02 13:21:49 +00:00
|
|
|
|
2023-03-10 02:51:05 +00:00
|
|
|
GetModuleFileNameW(dll, buf, ARRAY_SIZE(buf));
|
|
|
|
|
|
|
|
filename = wcsrchr(buf, '\\');
|
|
|
|
filename = filename ? filename + 1 : buf;
|
|
|
|
|
|
|
|
swprintf(drv_key_devicesW, ARRAY_SIZE(drv_key_devicesW),
|
|
|
|
L"Software\\Wine\\Drivers\\%s\\devices", filename);
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
2011-11-15 13:39:45 +00:00
|
|
|
case DLL_PROCESS_DETACH:
|
2013-05-15 08:30:36 +00:00
|
|
|
if (!reserved)
|
2012-04-03 19:05:20 +00:00
|
|
|
{
|
|
|
|
OSSDevice *iter, *iter2;
|
|
|
|
|
|
|
|
DeleteCriticalSection(&g_sessions_lock);
|
|
|
|
|
|
|
|
LIST_FOR_EACH_ENTRY_SAFE(iter, iter2, &g_devices, OSSDevice, entry){
|
|
|
|
HeapFree(GetProcessHeap(), 0, iter);
|
|
|
|
}
|
|
|
|
}
|
2013-05-15 08:30:36 +00:00
|
|
|
break;
|
2011-05-02 13:21:29 +00:00
|
|
|
}
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2012-04-03 19:05:20 +00:00
|
|
|
static void set_device_guid(EDataFlow flow, HKEY drv_key, const WCHAR *key_name,
|
|
|
|
GUID *guid)
|
|
|
|
{
|
|
|
|
HKEY key;
|
|
|
|
BOOL opened = FALSE;
|
|
|
|
LONG lr;
|
|
|
|
|
|
|
|
if(!drv_key){
|
|
|
|
lr = RegCreateKeyExW(HKEY_CURRENT_USER, drv_key_devicesW, 0, NULL, 0, KEY_WRITE,
|
|
|
|
NULL, &drv_key, NULL);
|
|
|
|
if(lr != ERROR_SUCCESS){
|
2022-05-06 14:10:18 +00:00
|
|
|
ERR("RegCreateKeyEx(drv_key) failed: %lu\n", lr);
|
2012-04-03 19:05:20 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
opened = TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
lr = RegCreateKeyExW(drv_key, key_name, 0, NULL, 0, KEY_WRITE,
|
|
|
|
NULL, &key, NULL);
|
|
|
|
if(lr != ERROR_SUCCESS){
|
2022-05-06 14:10:18 +00:00
|
|
|
ERR("RegCreateKeyEx(%s) failed: %lu\n", wine_dbgstr_w(key_name), lr);
|
2012-04-03 19:05:20 +00:00
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
lr = RegSetValueExW(key, guidW, 0, REG_BINARY, (BYTE*)guid,
|
|
|
|
sizeof(GUID));
|
|
|
|
if(lr != ERROR_SUCCESS)
|
2022-05-06 14:10:18 +00:00
|
|
|
ERR("RegSetValueEx(%s\\guid) failed: %lu\n", wine_dbgstr_w(key_name), lr);
|
2012-04-03 19:05:20 +00:00
|
|
|
|
|
|
|
RegCloseKey(key);
|
|
|
|
exit:
|
|
|
|
if(opened)
|
|
|
|
RegCloseKey(drv_key);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void get_device_guid(EDataFlow flow, const char *device, GUID *guid)
|
|
|
|
{
|
|
|
|
HKEY key = NULL, dev_key;
|
|
|
|
DWORD type, size = sizeof(*guid);
|
|
|
|
WCHAR key_name[256];
|
|
|
|
|
|
|
|
if(flow == eCapture)
|
|
|
|
key_name[0] = '1';
|
|
|
|
else
|
|
|
|
key_name[0] = '0';
|
|
|
|
key_name[1] = ',';
|
2018-08-09 18:59:33 +00:00
|
|
|
MultiByteToWideChar(CP_UNIXCP, 0, device, -1, key_name + 2, ARRAY_SIZE(key_name) - 2);
|
2012-04-03 19:05:20 +00:00
|
|
|
|
|
|
|
if(RegOpenKeyExW(HKEY_CURRENT_USER, drv_key_devicesW, 0, KEY_WRITE|KEY_READ, &key) == ERROR_SUCCESS){
|
|
|
|
if(RegOpenKeyExW(key, key_name, 0, KEY_READ, &dev_key) == ERROR_SUCCESS){
|
|
|
|
if(RegQueryValueExW(dev_key, guidW, 0, &type,
|
|
|
|
(BYTE*)guid, &size) == ERROR_SUCCESS){
|
|
|
|
if(type == REG_BINARY){
|
|
|
|
RegCloseKey(dev_key);
|
|
|
|
RegCloseKey(key);
|
|
|
|
return;
|
|
|
|
}
|
2022-05-06 14:10:18 +00:00
|
|
|
ERR("Invalid type for device %s GUID: %lu; ignoring and overwriting\n",
|
2012-04-03 19:05:20 +00:00
|
|
|
wine_dbgstr_w(key_name), type);
|
|
|
|
}
|
|
|
|
RegCloseKey(dev_key);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
CoCreateGuid(guid);
|
|
|
|
|
|
|
|
set_device_guid(flow, key, key_name, guid);
|
|
|
|
|
|
|
|
if(key)
|
|
|
|
RegCloseKey(key);
|
|
|
|
}
|
|
|
|
|
2022-03-31 07:21:49 +00:00
|
|
|
static const OSSDevice *get_ossdevice_from_guid(const GUID *guid)
|
|
|
|
{
|
|
|
|
OSSDevice *dev_item;
|
|
|
|
LIST_FOR_EACH_ENTRY(dev_item, &g_devices, OSSDevice, entry)
|
|
|
|
if(IsEqualGUID(guid, &dev_item->guid))
|
|
|
|
return dev_item;
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2022-03-31 07:21:50 +00:00
|
|
|
static void device_add(OSSDevice *oss_dev)
|
2011-04-27 14:12:36 +00:00
|
|
|
{
|
2022-03-31 07:21:50 +00:00
|
|
|
if(get_ossdevice_from_guid(&oss_dev->guid)) /* already in list */
|
|
|
|
HeapFree(GetProcessHeap(), 0, oss_dev);
|
|
|
|
else
|
|
|
|
list_add_tail(&g_devices, &oss_dev->entry);
|
|
|
|
}
|
2011-04-27 14:12:36 +00:00
|
|
|
|
2022-03-31 07:21:50 +00:00
|
|
|
HRESULT WINAPI AUDDRV_GetEndpointIDs(EDataFlow flow, WCHAR ***ids_out, GUID **guids_out,
|
|
|
|
UINT *num, UINT *def_index)
|
|
|
|
{
|
|
|
|
struct get_endpoint_ids_params params;
|
|
|
|
GUID *guids = NULL;
|
|
|
|
WCHAR **ids = NULL;
|
|
|
|
unsigned int i;
|
2012-04-04 18:16:09 +00:00
|
|
|
|
2012-04-03 19:05:20 +00:00
|
|
|
TRACE("%d %p %p %p %p\n", flow, ids, guids, num, def_index);
|
2011-04-27 14:12:36 +00:00
|
|
|
|
2022-03-31 07:21:50 +00:00
|
|
|
params.flow = flow;
|
|
|
|
params.size = 1000;
|
|
|
|
params.endpoints = NULL;
|
|
|
|
do{
|
|
|
|
HeapFree(GetProcessHeap(), 0, params.endpoints);
|
|
|
|
params.endpoints = HeapAlloc(GetProcessHeap(), 0, params.size);
|
|
|
|
OSS_CALL(get_endpoint_ids, ¶ms);
|
|
|
|
}while(params.result == HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER));
|
|
|
|
|
|
|
|
if(FAILED(params.result)) goto end;
|
|
|
|
|
|
|
|
ids = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, params.num * sizeof(*ids));
|
|
|
|
guids = HeapAlloc(GetProcessHeap(), 0, params.num * sizeof(*guids));
|
|
|
|
if(!ids || !guids){
|
|
|
|
params.result = E_OUTOFMEMORY;
|
|
|
|
goto end;
|
2011-04-27 14:12:36 +00:00
|
|
|
}
|
|
|
|
|
2022-03-31 07:21:50 +00:00
|
|
|
for(i = 0; i < params.num; i++){
|
2022-05-04 06:54:24 +00:00
|
|
|
WCHAR *name = (WCHAR *)((char *)params.endpoints + params.endpoints[i].name);
|
|
|
|
char *device = (char *)params.endpoints + params.endpoints[i].device;
|
|
|
|
unsigned int name_size = (wcslen(name) + 1) * sizeof(WCHAR);
|
|
|
|
unsigned int dev_size = strlen(device) + 1;
|
2022-03-31 07:21:50 +00:00
|
|
|
OSSDevice *oss_dev;
|
|
|
|
|
|
|
|
ids[i] = HeapAlloc(GetProcessHeap(), 0, name_size);
|
|
|
|
oss_dev = HeapAlloc(GetProcessHeap(), 0, offsetof(OSSDevice, devnode[dev_size]));
|
|
|
|
if(!ids[i] || !oss_dev){
|
2022-05-20 20:59:27 +00:00
|
|
|
HeapFree(GetProcessHeap(), 0, oss_dev);
|
2022-03-31 07:21:50 +00:00
|
|
|
params.result = E_OUTOFMEMORY;
|
|
|
|
goto end;
|
2011-04-27 14:12:36 +00:00
|
|
|
}
|
2022-05-04 06:54:24 +00:00
|
|
|
memcpy(ids[i], name, name_size);
|
|
|
|
get_device_guid(flow, device, guids + i);
|
2011-04-27 14:12:36 +00:00
|
|
|
|
2022-03-31 07:21:50 +00:00
|
|
|
oss_dev->flow = flow;
|
|
|
|
oss_dev->guid = guids[i];
|
2022-05-04 06:54:24 +00:00
|
|
|
memcpy(oss_dev->devnode, device, dev_size);
|
2022-03-31 07:21:50 +00:00
|
|
|
device_add(oss_dev);
|
2011-04-27 14:12:36 +00:00
|
|
|
}
|
2022-03-31 07:21:50 +00:00
|
|
|
*def_index = params.default_idx;
|
|
|
|
|
|
|
|
end:
|
|
|
|
HeapFree(GetProcessHeap(), 0, params.endpoints);
|
|
|
|
if(FAILED(params.result)){
|
|
|
|
HeapFree(GetProcessHeap(), 0, guids);
|
|
|
|
if(ids){
|
|
|
|
for(i = 0; i < params.num; i++)
|
|
|
|
HeapFree(GetProcessHeap(), 0, ids[i]);
|
|
|
|
HeapFree(GetProcessHeap(), 0, ids);
|
2011-04-27 14:12:36 +00:00
|
|
|
}
|
2022-03-31 07:21:50 +00:00
|
|
|
}else{
|
|
|
|
*ids_out = ids;
|
|
|
|
*guids_out = guids;
|
|
|
|
*num = params.num;
|
2011-04-27 14:12:36 +00:00
|
|
|
}
|
|
|
|
|
2022-03-31 07:21:50 +00:00
|
|
|
return params.result;
|
2011-04-27 14:12:36 +00:00
|
|
|
}
|
|
|
|
|
2012-04-03 19:05:20 +00:00
|
|
|
HRESULT WINAPI AUDDRV_GetAudioEndpoint(GUID *guid, IMMDevice *dev,
|
2012-04-03 18:48:12 +00:00
|
|
|
IAudioClient **out)
|
2011-04-27 14:12:36 +00:00
|
|
|
{
|
|
|
|
ACImpl *This;
|
2012-04-03 19:05:20 +00:00
|
|
|
const OSSDevice *oss_dev;
|
2013-08-02 01:54:21 +00:00
|
|
|
HRESULT hr;
|
2022-04-06 06:55:52 +00:00
|
|
|
int len;
|
2012-04-03 19:05:20 +00:00
|
|
|
|
|
|
|
TRACE("%s %p %p\n", debugstr_guid(guid), dev, out);
|
2011-04-27 14:12:36 +00:00
|
|
|
|
2012-04-03 19:05:20 +00:00
|
|
|
oss_dev = get_ossdevice_from_guid(guid);
|
|
|
|
if(!oss_dev){
|
|
|
|
WARN("Unknown GUID: %s\n", debugstr_guid(guid));
|
|
|
|
return AUDCLNT_E_DEVICE_INVALIDATED;
|
|
|
|
}
|
2022-04-06 06:55:52 +00:00
|
|
|
len = strlen(oss_dev->devnode);
|
2023-04-11 07:00:25 +00:00
|
|
|
This = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, offsetof(ACImpl, device_name[len + 1]));
|
2011-04-27 14:12:36 +00:00
|
|
|
if(!This)
|
|
|
|
return E_OUTOFMEMORY;
|
|
|
|
|
2023-04-11 07:00:25 +00:00
|
|
|
hr = CoCreateFreeThreadedMarshaler((IUnknown *)&This->IAudioClient3_iface, &This->marshal);
|
2013-08-02 01:54:21 +00:00
|
|
|
if (FAILED(hr)) {
|
|
|
|
HeapFree(GetProcessHeap(), 0, This);
|
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
2012-04-03 19:05:20 +00:00
|
|
|
This->dataflow = oss_dev->flow;
|
2023-04-11 07:00:25 +00:00
|
|
|
strcpy(This->device_name, oss_dev->devnode);
|
2011-10-10 20:57:06 +00:00
|
|
|
|
2020-10-01 20:23:05 +00:00
|
|
|
This->IAudioClient3_iface.lpVtbl = &AudioClient3_Vtbl;
|
2011-04-27 14:12:36 +00:00
|
|
|
This->IAudioRenderClient_iface.lpVtbl = &AudioRenderClient_Vtbl;
|
|
|
|
This->IAudioCaptureClient_iface.lpVtbl = &AudioCaptureClient_Vtbl;
|
|
|
|
This->IAudioClock_iface.lpVtbl = &AudioClock_Vtbl;
|
|
|
|
This->IAudioClock2_iface.lpVtbl = &AudioClock2_Vtbl;
|
2011-05-06 15:34:27 +00:00
|
|
|
This->IAudioStreamVolume_iface.lpVtbl = &AudioStreamVolume_Vtbl;
|
2011-04-27 14:12:36 +00:00
|
|
|
|
|
|
|
This->parent = dev;
|
|
|
|
IMMDevice_AddRef(This->parent);
|
|
|
|
|
2020-10-01 20:23:05 +00:00
|
|
|
*out = (IAudioClient *)&This->IAudioClient3_iface;
|
|
|
|
IAudioClient3_AddRef(&This->IAudioClient3_iface);
|
2011-04-27 14:12:36 +00:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2020-10-01 20:23:05 +00:00
|
|
|
static HRESULT WINAPI AudioClient_QueryInterface(IAudioClient3 *iface,
|
2011-04-27 14:12:36 +00:00
|
|
|
REFIID riid, void **ppv)
|
|
|
|
{
|
2020-10-01 20:23:05 +00:00
|
|
|
ACImpl *This = impl_from_IAudioClient3(iface);
|
2011-04-27 14:12:36 +00:00
|
|
|
TRACE("(%p)->(%s, %p)\n", iface, debugstr_guid(riid), ppv);
|
|
|
|
|
|
|
|
if(!ppv)
|
|
|
|
return E_POINTER;
|
|
|
|
*ppv = NULL;
|
2020-10-01 19:31:22 +00:00
|
|
|
if(IsEqualIID(riid, &IID_IUnknown) ||
|
|
|
|
IsEqualIID(riid, &IID_IAudioClient) ||
|
2020-10-01 20:23:05 +00:00
|
|
|
IsEqualIID(riid, &IID_IAudioClient2) ||
|
|
|
|
IsEqualIID(riid, &IID_IAudioClient3))
|
2011-04-27 14:12:36 +00:00
|
|
|
*ppv = iface;
|
2013-08-02 01:54:21 +00:00
|
|
|
else if(IsEqualIID(riid, &IID_IMarshal))
|
2023-04-11 07:00:25 +00:00
|
|
|
return IUnknown_QueryInterface(This->marshal, riid, ppv);
|
2011-04-27 14:12:36 +00:00
|
|
|
if(*ppv){
|
|
|
|
IUnknown_AddRef((IUnknown*)*ppv);
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
WARN("Unknown interface %s\n", debugstr_guid(riid));
|
|
|
|
return E_NOINTERFACE;
|
|
|
|
}
|
|
|
|
|
2020-10-01 20:23:05 +00:00
|
|
|
static ULONG WINAPI AudioClient_AddRef(IAudioClient3 *iface)
|
2011-04-27 14:12:36 +00:00
|
|
|
{
|
2020-10-01 20:23:05 +00:00
|
|
|
ACImpl *This = impl_from_IAudioClient3(iface);
|
2011-04-27 14:12:36 +00:00
|
|
|
ULONG ref;
|
|
|
|
ref = InterlockedIncrement(&This->ref);
|
2022-05-06 14:10:18 +00:00
|
|
|
TRACE("(%p) Refcount now %lu\n", This, ref);
|
2011-04-27 14:12:36 +00:00
|
|
|
return ref;
|
|
|
|
}
|
|
|
|
|
2020-10-01 20:23:05 +00:00
|
|
|
static ULONG WINAPI AudioClient_Release(IAudioClient3 *iface)
|
2011-04-27 14:12:36 +00:00
|
|
|
{
|
2020-10-01 20:23:05 +00:00
|
|
|
ACImpl *This = impl_from_IAudioClient3(iface);
|
2011-04-27 14:12:36 +00:00
|
|
|
ULONG ref;
|
2014-06-27 16:04:23 +00:00
|
|
|
|
2011-04-27 14:12:36 +00:00
|
|
|
ref = InterlockedDecrement(&This->ref);
|
2022-05-06 14:10:18 +00:00
|
|
|
TRACE("(%p) Refcount now %lu\n", This, ref);
|
2011-04-27 14:12:36 +00:00
|
|
|
if(!ref){
|
2020-10-01 20:23:05 +00:00
|
|
|
IAudioClient3_Stop(iface);
|
2011-04-27 14:12:36 +00:00
|
|
|
IMMDevice_Release(This->parent);
|
2023-04-11 07:00:25 +00:00
|
|
|
IUnknown_Release(This->marshal);
|
2022-04-12 06:58:59 +00:00
|
|
|
if(This->session){
|
2023-04-21 21:11:52 +00:00
|
|
|
sessions_lock();
|
2011-05-02 13:21:49 +00:00
|
|
|
list_remove(&This->entry);
|
2023-04-21 21:11:52 +00:00
|
|
|
sessions_unlock();
|
2011-05-02 13:21:49 +00:00
|
|
|
}
|
2023-06-24 22:36:15 +00:00
|
|
|
free(This->vols);
|
2022-04-12 06:59:04 +00:00
|
|
|
if(This->stream)
|
2022-04-13 06:38:48 +00:00
|
|
|
stream_release(This->stream, This->timer_thread);
|
2011-04-27 14:12:36 +00:00
|
|
|
HeapFree(GetProcessHeap(), 0, This);
|
|
|
|
}
|
|
|
|
return ref;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void dump_fmt(const WAVEFORMATEX *fmt)
|
|
|
|
{
|
|
|
|
TRACE("wFormatTag: 0x%x (", fmt->wFormatTag);
|
|
|
|
switch(fmt->wFormatTag){
|
|
|
|
case WAVE_FORMAT_PCM:
|
|
|
|
TRACE("WAVE_FORMAT_PCM");
|
|
|
|
break;
|
|
|
|
case WAVE_FORMAT_IEEE_FLOAT:
|
|
|
|
TRACE("WAVE_FORMAT_IEEE_FLOAT");
|
|
|
|
break;
|
|
|
|
case WAVE_FORMAT_EXTENSIBLE:
|
|
|
|
TRACE("WAVE_FORMAT_EXTENSIBLE");
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
TRACE("Unknown");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
TRACE(")\n");
|
|
|
|
|
|
|
|
TRACE("nChannels: %u\n", fmt->nChannels);
|
2022-05-06 14:10:18 +00:00
|
|
|
TRACE("nSamplesPerSec: %lu\n", fmt->nSamplesPerSec);
|
|
|
|
TRACE("nAvgBytesPerSec: %lu\n", fmt->nAvgBytesPerSec);
|
2011-04-27 14:12:36 +00:00
|
|
|
TRACE("nBlockAlign: %u\n", fmt->nBlockAlign);
|
|
|
|
TRACE("wBitsPerSample: %u\n", fmt->wBitsPerSample);
|
|
|
|
TRACE("cbSize: %u\n", fmt->cbSize);
|
|
|
|
|
|
|
|
if(fmt->wFormatTag == WAVE_FORMAT_EXTENSIBLE){
|
|
|
|
WAVEFORMATEXTENSIBLE *fmtex = (void*)fmt;
|
2022-05-06 14:10:18 +00:00
|
|
|
TRACE("dwChannelMask: %08lx\n", fmtex->dwChannelMask);
|
2011-04-27 14:12:36 +00:00
|
|
|
TRACE("Samples: %04x\n", fmtex->Samples.wReserved);
|
|
|
|
TRACE("SubFormat: %s\n", wine_dbgstr_guid(&fmtex->SubFormat));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-06-06 13:49:26 +00:00
|
|
|
static void session_init_vols(AudioSession *session, UINT channels)
|
|
|
|
{
|
2011-06-13 20:23:09 +00:00
|
|
|
if(session->channel_count < channels){
|
|
|
|
UINT i;
|
2011-06-06 13:49:26 +00:00
|
|
|
|
2011-06-13 20:23:09 +00:00
|
|
|
if(session->channel_vols)
|
|
|
|
session->channel_vols = HeapReAlloc(GetProcessHeap(), 0,
|
|
|
|
session->channel_vols, sizeof(float) * channels);
|
|
|
|
else
|
|
|
|
session->channel_vols = HeapAlloc(GetProcessHeap(), 0,
|
|
|
|
sizeof(float) * channels);
|
|
|
|
if(!session->channel_vols)
|
|
|
|
return;
|
2011-06-06 13:49:26 +00:00
|
|
|
|
2011-06-13 20:23:09 +00:00
|
|
|
for(i = session->channel_count; i < channels; ++i)
|
|
|
|
session->channel_vols[i] = 1.f;
|
|
|
|
|
|
|
|
session->channel_count = channels;
|
|
|
|
}
|
2011-06-06 13:49:26 +00:00
|
|
|
}
|
|
|
|
|
2011-06-13 20:23:09 +00:00
|
|
|
static AudioSession *create_session(const GUID *guid, IMMDevice *device,
|
2011-06-06 13:49:26 +00:00
|
|
|
UINT num_channels)
|
2011-05-02 13:21:49 +00:00
|
|
|
{
|
|
|
|
AudioSession *ret;
|
|
|
|
|
|
|
|
ret = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(AudioSession));
|
|
|
|
if(!ret)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
memcpy(&ret->guid, guid, sizeof(GUID));
|
|
|
|
|
2011-06-13 20:23:09 +00:00
|
|
|
ret->device = device;
|
2011-05-02 13:21:49 +00:00
|
|
|
|
|
|
|
list_init(&ret->clients);
|
|
|
|
|
|
|
|
list_add_head(&g_sessions, &ret->entry);
|
|
|
|
|
2011-06-13 20:23:09 +00:00
|
|
|
session_init_vols(ret, num_channels);
|
2011-05-06 15:34:27 +00:00
|
|
|
|
|
|
|
ret->master_vol = 1.f;
|
|
|
|
|
2011-05-02 13:21:49 +00:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2011-06-06 13:49:26 +00:00
|
|
|
/* if channels == 0, then this will return or create a session with
|
|
|
|
* matching dataflow and GUID. otherwise, channels must also match */
|
|
|
|
static HRESULT get_audio_session(const GUID *sessionguid,
|
2011-06-13 20:23:09 +00:00
|
|
|
IMMDevice *device, UINT channels, AudioSession **out)
|
2011-06-06 13:49:26 +00:00
|
|
|
{
|
|
|
|
AudioSession *session;
|
|
|
|
|
|
|
|
if(!sessionguid || IsEqualGUID(sessionguid, &GUID_NULL)){
|
2011-06-13 20:23:09 +00:00
|
|
|
*out = create_session(&GUID_NULL, device, channels);
|
2011-06-06 13:49:26 +00:00
|
|
|
if(!*out)
|
|
|
|
return E_OUTOFMEMORY;
|
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
*out = NULL;
|
|
|
|
LIST_FOR_EACH_ENTRY(session, &g_sessions, AudioSession, entry){
|
2011-06-13 20:23:09 +00:00
|
|
|
if(session->device == device &&
|
|
|
|
IsEqualGUID(sessionguid, &session->guid)){
|
|
|
|
session_init_vols(session, channels);
|
2011-06-06 13:49:26 +00:00
|
|
|
*out = session;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!*out){
|
2011-06-13 20:23:09 +00:00
|
|
|
*out = create_session(sessionguid, device, channels);
|
2011-06-06 13:49:26 +00:00
|
|
|
if(!*out)
|
|
|
|
return E_OUTOFMEMORY;
|
|
|
|
}
|
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2020-10-01 20:23:05 +00:00
|
|
|
static HRESULT WINAPI AudioClient_Initialize(IAudioClient3 *iface,
|
2011-04-27 14:12:36 +00:00
|
|
|
AUDCLNT_SHAREMODE mode, DWORD flags, REFERENCE_TIME duration,
|
|
|
|
REFERENCE_TIME period, const WAVEFORMATEX *fmt,
|
|
|
|
const GUID *sessionguid)
|
|
|
|
{
|
2020-10-01 20:23:05 +00:00
|
|
|
ACImpl *This = impl_from_IAudioClient3(iface);
|
2022-04-12 06:59:04 +00:00
|
|
|
struct create_stream_params params;
|
2022-05-04 06:54:23 +00:00
|
|
|
stream_handle stream;
|
2023-06-21 10:41:52 +00:00
|
|
|
unsigned int i, channel_count;
|
2023-06-15 15:51:05 +00:00
|
|
|
WCHAR *name;
|
2011-04-27 14:12:36 +00:00
|
|
|
|
2022-05-06 14:10:18 +00:00
|
|
|
TRACE("(%p)->(%x, %lx, %s, %s, %p, %s)\n", This, mode, flags,
|
2011-05-02 19:03:15 +00:00
|
|
|
wine_dbgstr_longlong(duration), wine_dbgstr_longlong(period), fmt, debugstr_guid(sessionguid));
|
2011-04-27 14:12:36 +00:00
|
|
|
|
|
|
|
if(!fmt)
|
|
|
|
return E_POINTER;
|
|
|
|
|
|
|
|
dump_fmt(fmt);
|
|
|
|
|
|
|
|
if(mode != AUDCLNT_SHAREMODE_SHARED && mode != AUDCLNT_SHAREMODE_EXCLUSIVE)
|
2019-10-24 16:28:43 +00:00
|
|
|
return E_INVALIDARG;
|
2011-04-27 14:12:36 +00:00
|
|
|
|
|
|
|
if(flags & ~(AUDCLNT_STREAMFLAGS_CROSSPROCESS |
|
|
|
|
AUDCLNT_STREAMFLAGS_LOOPBACK |
|
|
|
|
AUDCLNT_STREAMFLAGS_EVENTCALLBACK |
|
|
|
|
AUDCLNT_STREAMFLAGS_NOPERSIST |
|
|
|
|
AUDCLNT_STREAMFLAGS_RATEADJUST |
|
|
|
|
AUDCLNT_SESSIONFLAGS_EXPIREWHENUNOWNED |
|
|
|
|
AUDCLNT_SESSIONFLAGS_DISPLAY_HIDE |
|
2020-07-10 19:13:44 +00:00
|
|
|
AUDCLNT_SESSIONFLAGS_DISPLAY_HIDEWHENEXPIRED |
|
|
|
|
AUDCLNT_STREAMFLAGS_SRC_DEFAULT_QUALITY |
|
|
|
|
AUDCLNT_STREAMFLAGS_AUTOCONVERTPCM)){
|
2022-05-06 14:10:18 +00:00
|
|
|
FIXME("Unknown flags: %08lx\n", flags);
|
2011-04-27 14:12:36 +00:00
|
|
|
return E_INVALIDARG;
|
|
|
|
}
|
|
|
|
|
2023-04-21 21:11:52 +00:00
|
|
|
sessions_lock();
|
2011-04-27 14:12:36 +00:00
|
|
|
|
2022-04-12 06:58:59 +00:00
|
|
|
if(This->stream){
|
2023-04-21 21:11:52 +00:00
|
|
|
sessions_unlock();
|
2011-04-27 14:12:36 +00:00
|
|
|
return AUDCLNT_E_ALREADY_INITIALIZED;
|
|
|
|
}
|
|
|
|
|
2023-06-12 17:42:38 +00:00
|
|
|
if(FAILED(params.result = main_loop_start())){
|
|
|
|
sessions_unlock();
|
|
|
|
return params.result;
|
|
|
|
}
|
|
|
|
|
2023-06-15 15:51:05 +00:00
|
|
|
params.name = name = get_application_name();
|
2023-04-11 07:00:25 +00:00
|
|
|
params.device = This->device_name;
|
2022-04-12 06:59:04 +00:00
|
|
|
params.flow = This->dataflow;
|
|
|
|
params.share = mode;
|
|
|
|
params.flags = flags;
|
|
|
|
params.duration = duration;
|
|
|
|
params.period = period;
|
|
|
|
params.fmt = fmt;
|
2023-06-21 10:41:52 +00:00
|
|
|
params.channel_count = &channel_count;
|
2022-04-12 06:59:04 +00:00
|
|
|
params.stream = &stream;
|
2022-04-06 06:55:57 +00:00
|
|
|
|
2022-04-12 06:59:04 +00:00
|
|
|
OSS_CALL(create_stream, ¶ms);
|
2023-06-15 15:51:05 +00:00
|
|
|
|
|
|
|
free(name);
|
|
|
|
|
2022-04-12 06:59:04 +00:00
|
|
|
if(FAILED(params.result)){
|
2023-04-21 21:11:52 +00:00
|
|
|
sessions_unlock();
|
2022-04-12 06:59:04 +00:00
|
|
|
return params.result;
|
2011-04-27 14:12:36 +00:00
|
|
|
}
|
|
|
|
|
2023-06-24 22:36:15 +00:00
|
|
|
This->vols = malloc(channel_count * sizeof(float));
|
2011-05-06 15:34:27 +00:00
|
|
|
if(!This->vols){
|
2022-04-12 06:59:04 +00:00
|
|
|
params.result = E_OUTOFMEMORY;
|
2022-04-06 06:55:57 +00:00
|
|
|
goto exit;
|
2011-05-06 15:34:27 +00:00
|
|
|
}
|
2023-06-21 10:41:52 +00:00
|
|
|
for(i = 0; i < channel_count; ++i)
|
2011-05-06 15:34:27 +00:00
|
|
|
This->vols[i] = 1.f;
|
|
|
|
|
2023-06-21 10:41:52 +00:00
|
|
|
params.result = get_audio_session(sessionguid, This->parent, channel_count, &This->session);
|
2022-04-06 06:55:57 +00:00
|
|
|
|
|
|
|
exit:
|
2022-04-12 06:59:04 +00:00
|
|
|
if(FAILED(params.result)){
|
2022-04-13 06:38:48 +00:00
|
|
|
stream_release(stream, NULL);
|
2023-06-24 22:36:15 +00:00
|
|
|
free(This->vols);
|
2011-06-06 13:49:26 +00:00
|
|
|
This->vols = NULL;
|
2022-04-06 06:55:57 +00:00
|
|
|
} else {
|
|
|
|
list_add_tail(&This->session->clients, &This->entry);
|
|
|
|
This->stream = stream;
|
2023-06-21 10:41:52 +00:00
|
|
|
This->channel_count = channel_count;
|
2022-04-12 06:59:00 +00:00
|
|
|
set_stream_volumes(This);
|
2011-05-02 13:21:49 +00:00
|
|
|
}
|
|
|
|
|
2023-04-21 21:11:52 +00:00
|
|
|
sessions_unlock();
|
2011-04-27 14:12:36 +00:00
|
|
|
|
2022-04-12 06:59:04 +00:00
|
|
|
return params.result;
|
2011-04-27 14:12:36 +00:00
|
|
|
}
|
|
|
|
|
2023-06-08 00:01:37 +00:00
|
|
|
extern HRESULT WINAPI client_GetBufferSize(IAudioClient3 *iface,
|
|
|
|
UINT32 *frames);
|
2022-04-12 06:59:02 +00:00
|
|
|
|
2023-06-08 00:01:37 +00:00
|
|
|
extern HRESULT WINAPI client_GetStreamLatency(IAudioClient3 *iface,
|
|
|
|
REFERENCE_TIME *latency);
|
2011-04-27 14:12:36 +00:00
|
|
|
|
2023-06-08 00:01:37 +00:00
|
|
|
extern HRESULT WINAPI client_GetCurrentPadding(IAudioClient3 *iface,
|
|
|
|
UINT32 *numpad);
|
2011-04-27 14:12:36 +00:00
|
|
|
|
2023-06-07 23:50:57 +00:00
|
|
|
extern HRESULT WINAPI client_IsFormatSupported(IAudioClient3 *iface,
|
2022-04-06 06:55:55 +00:00
|
|
|
AUDCLNT_SHAREMODE mode, const WAVEFORMATEX *fmt,
|
2023-06-07 23:50:57 +00:00
|
|
|
WAVEFORMATEX **out);
|
2011-06-05 08:32:10 +00:00
|
|
|
|
2023-06-07 23:50:57 +00:00
|
|
|
extern HRESULT WINAPI client_GetMixFormat(IAudioClient3 *iface,
|
|
|
|
WAVEFORMATEX **pwfx);
|
2019-09-10 15:55:16 +00:00
|
|
|
|
2023-06-07 23:50:57 +00:00
|
|
|
extern HRESULT WINAPI client_GetDevicePeriod(IAudioClient3 *iface,
|
|
|
|
REFERENCE_TIME *defperiod, REFERENCE_TIME *minperiod);
|
2011-04-27 14:12:36 +00:00
|
|
|
|
2023-06-06 23:07:03 +00:00
|
|
|
extern HRESULT WINAPI client_Start(IAudioClient3 *iface);
|
2011-04-27 14:12:36 +00:00
|
|
|
|
2023-06-06 22:29:00 +00:00
|
|
|
extern HRESULT WINAPI client_Stop(IAudioClient3 *iface);
|
2022-04-12 06:59:02 +00:00
|
|
|
|
2023-06-06 22:29:00 +00:00
|
|
|
extern HRESULT WINAPI client_Reset(IAudioClient3 *iface);
|
2022-04-12 06:59:02 +00:00
|
|
|
|
2023-06-06 22:29:00 +00:00
|
|
|
extern HRESULT WINAPI client_SetEventHandle(IAudioClient3 *iface,
|
|
|
|
HANDLE event);
|
2011-04-27 14:12:36 +00:00
|
|
|
|
2023-05-25 08:53:58 +00:00
|
|
|
extern HRESULT WINAPI client_GetService(IAudioClient3 *iface, REFIID riid,
|
|
|
|
void **ppv);
|
2011-04-27 14:12:36 +00:00
|
|
|
|
2023-05-25 08:26:19 +00:00
|
|
|
extern HRESULT WINAPI client_IsOffloadCapable(IAudioClient3 *iface,
|
|
|
|
AUDIO_STREAM_CATEGORY category, BOOL *offload_capable);
|
2020-10-01 19:31:32 +00:00
|
|
|
|
2023-05-25 08:26:19 +00:00
|
|
|
extern HRESULT WINAPI client_SetClientProperties(IAudioClient3 *iface,
|
|
|
|
const AudioClientProperties *prop);
|
2020-10-01 19:31:22 +00:00
|
|
|
|
2023-05-25 08:26:19 +00:00
|
|
|
extern HRESULT WINAPI client_GetBufferSizeLimits(IAudioClient3 *iface,
|
2020-10-01 19:31:22 +00:00
|
|
|
const WAVEFORMATEX *format, BOOL event_driven, REFERENCE_TIME *min_duration,
|
2023-05-25 08:26:19 +00:00
|
|
|
REFERENCE_TIME *max_duration);
|
2020-10-01 19:31:22 +00:00
|
|
|
|
2023-05-26 21:04:10 +00:00
|
|
|
extern HRESULT WINAPI client_GetSharedModeEnginePeriod(IAudioClient3 *iface,
|
2020-10-01 20:23:05 +00:00
|
|
|
const WAVEFORMATEX *format, UINT32 *default_period_frames, UINT32 *unit_period_frames,
|
2023-05-26 21:04:10 +00:00
|
|
|
UINT32 *min_period_frames, UINT32 *max_period_frames);
|
2020-10-01 20:23:05 +00:00
|
|
|
|
2023-05-26 21:04:10 +00:00
|
|
|
extern HRESULT WINAPI client_GetCurrentSharedModeEnginePeriod(IAudioClient3 *iface,
|
|
|
|
WAVEFORMATEX **cur_format, UINT32 *cur_period_frames);
|
2020-10-01 20:23:05 +00:00
|
|
|
|
2023-05-26 21:04:10 +00:00
|
|
|
extern HRESULT WINAPI client_InitializeSharedAudioStream(IAudioClient3 *iface,
|
2020-10-01 20:23:05 +00:00
|
|
|
DWORD flags, UINT32 period_frames, const WAVEFORMATEX *format,
|
2023-05-26 21:04:10 +00:00
|
|
|
const GUID *session_guid);
|
2020-10-01 20:23:05 +00:00
|
|
|
|
|
|
|
static const IAudioClient3Vtbl AudioClient3_Vtbl =
|
2011-04-27 14:12:36 +00:00
|
|
|
{
|
|
|
|
AudioClient_QueryInterface,
|
|
|
|
AudioClient_AddRef,
|
|
|
|
AudioClient_Release,
|
|
|
|
AudioClient_Initialize,
|
2023-06-08 00:01:37 +00:00
|
|
|
client_GetBufferSize,
|
|
|
|
client_GetStreamLatency,
|
|
|
|
client_GetCurrentPadding,
|
2023-06-07 23:50:57 +00:00
|
|
|
client_IsFormatSupported,
|
|
|
|
client_GetMixFormat,
|
|
|
|
client_GetDevicePeriod,
|
2023-06-06 23:07:03 +00:00
|
|
|
client_Start,
|
2023-06-06 22:29:00 +00:00
|
|
|
client_Stop,
|
|
|
|
client_Reset,
|
|
|
|
client_SetEventHandle,
|
2023-05-25 08:53:58 +00:00
|
|
|
client_GetService,
|
2023-05-25 08:26:19 +00:00
|
|
|
client_IsOffloadCapable,
|
|
|
|
client_SetClientProperties,
|
|
|
|
client_GetBufferSizeLimits,
|
2023-05-26 21:04:10 +00:00
|
|
|
client_GetSharedModeEnginePeriod,
|
|
|
|
client_GetCurrentSharedModeEnginePeriod,
|
|
|
|
client_InitializeSharedAudioStream,
|
2011-04-27 14:12:36 +00:00
|
|
|
};
|
|
|
|
|
2023-04-12 07:33:28 +00:00
|
|
|
HRESULT WINAPI AUDDRV_GetAudioSessionWrapper(const GUID *guid, IMMDevice *device,
|
|
|
|
AudioSessionWrapper **out)
|
|
|
|
{
|
|
|
|
AudioSession *session;
|
|
|
|
|
|
|
|
HRESULT hr = get_audio_session(guid, device, 0, &session);
|
|
|
|
if(FAILED(hr))
|
|
|
|
return hr;
|
|
|
|
|
2023-06-01 19:19:41 +00:00
|
|
|
*out = session_wrapper_create(NULL);
|
2023-04-12 07:33:28 +00:00
|
|
|
if(!*out)
|
|
|
|
return E_OUTOFMEMORY;
|
|
|
|
|
|
|
|
(*out)->session = session;
|
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|