From: Davide Beatrici git@davidebeatrici.dev
--- dlls/winecoreaudio.drv/coreaudio.c | 24 ++++- dlls/winecoreaudio.drv/mmdevdrv.c | 139 +---------------------------- 2 files changed, 25 insertions(+), 138 deletions(-)
diff --git a/dlls/winecoreaudio.drv/coreaudio.c b/dlls/winecoreaudio.drv/coreaudio.c index d031b82583e..f41118e62f5 100644 --- a/dlls/winecoreaudio.drv/coreaudio.c +++ b/dlls/winecoreaudio.drv/coreaudio.c @@ -196,6 +196,13 @@ static BOOL device_has_channels(AudioDeviceID device, EDataFlow flow) return ret; }
+static NTSTATUS unix_main_loop(void *args) +{ + struct main_loop_params *params = args; + NtSetEvent(params->event, NULL); + return STATUS_SUCCESS; +} + static NTSTATUS unix_get_endpoint_ids(void *args) { struct get_endpoint_ids_params *params = args; @@ -1775,7 +1782,7 @@ unixlib_entry_t __wine_unix_call_funcs[] = { unix_not_implemented, unix_not_implemented, - unix_not_implemented, + unix_main_loop, unix_get_endpoint_ids, unix_create_stream, unix_release_stream, @@ -1813,6 +1820,19 @@ unixlib_entry_t __wine_unix_call_funcs[] =
typedef UINT PTR32;
+static NTSTATUS unix_wow64_main_loop(void *args) +{ + struct + { + PTR32 event; + } *params32 = args; + struct main_loop_params params = + { + .event = ULongToHandle(params32->event) + }; + return unix_main_loop(¶ms); +} + static NTSTATUS unix_wow64_get_endpoint_ids(void *args) { struct @@ -2157,7 +2177,7 @@ unixlib_entry_t __wine_unix_call_wow64_funcs[] = { unix_not_implemented, unix_not_implemented, - unix_not_implemented, + unix_wow64_main_loop, unix_wow64_get_endpoint_ids, unix_wow64_create_stream, unix_wow64_release_stream, diff --git a/dlls/winecoreaudio.drv/mmdevdrv.c b/dlls/winecoreaudio.drv/mmdevdrv.c index 50af5409d8a..8e712867d1b 100644 --- a/dlls/winecoreaudio.drv/mmdevdrv.c +++ b/dlls/winecoreaudio.drv/mmdevdrv.c @@ -192,18 +192,6 @@ static void get_device_guid(EDataFlow flow, const char *dev, GUID *guid) RegCloseKey(key); }
-static void set_stream_volumes(ACImpl *This) -{ - struct set_volumes_params params; - - params.stream = This->stream; - params.master_volume = This->session->mute ? 0.0f : This->session->master_vol; - params.volumes = This->vols; - params.session_volumes = This->session->channel_vols; - - UNIX_CALL(set_volumes, ¶ms); -} - HRESULT WINAPI AUDDRV_GetEndpointIDs(EDataFlow flow, WCHAR ***ids_out, GUID **guids_out, UINT *num, UINT *def_index) { @@ -431,40 +419,6 @@ static ULONG WINAPI AudioClient_Release(IAudioClient3 *iface) 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); - TRACE("nSamplesPerSec: %lu\n", fmt->nSamplesPerSec); - TRACE("nAvgBytesPerSec: %lu\n", fmt->nAvgBytesPerSec); - 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; - TRACE("dwChannelMask: %08lx\n", fmtex->dwChannelMask); - TRACE("Samples: %04x\n", fmtex->Samples.wReserved); - TRACE("SubFormat: %s\n", wine_dbgstr_guid(&fmtex->SubFormat)); - } -} - static void session_init_vols(AudioSession *session, UINT channels) { if(session->channel_count < channels){ @@ -544,97 +498,10 @@ HRESULT get_audio_session(const GUID *sessionguid, return S_OK; }
-static HRESULT WINAPI AudioClient_Initialize(IAudioClient3 *iface, +extern HRESULT WINAPI client_Initialize(IAudioClient3 *iface, AUDCLNT_SHAREMODE mode, DWORD flags, REFERENCE_TIME duration, REFERENCE_TIME period, const WAVEFORMATEX *fmt, - const GUID *sessionguid) -{ - ACImpl *This = impl_from_IAudioClient3(iface); - struct release_stream_params release_params; - struct create_stream_params params; - stream_handle stream; - UINT32 i; - - TRACE("(%p)->(%x, %lx, %s, %s, %p, %s)\n", This, mode, flags, - wine_dbgstr_longlong(duration), wine_dbgstr_longlong(period), fmt, debugstr_guid(sessionguid)); - - if(!fmt) - return E_POINTER; - - dump_fmt(fmt); - - if(mode != AUDCLNT_SHAREMODE_SHARED && mode != AUDCLNT_SHAREMODE_EXCLUSIVE) - return E_INVALIDARG; - - if(flags & ~(AUDCLNT_STREAMFLAGS_CROSSPROCESS | - AUDCLNT_STREAMFLAGS_LOOPBACK | - AUDCLNT_STREAMFLAGS_EVENTCALLBACK | - AUDCLNT_STREAMFLAGS_NOPERSIST | - AUDCLNT_STREAMFLAGS_RATEADJUST | - AUDCLNT_SESSIONFLAGS_EXPIREWHENUNOWNED | - AUDCLNT_SESSIONFLAGS_DISPLAY_HIDE | - AUDCLNT_SESSIONFLAGS_DISPLAY_HIDEWHENEXPIRED | - AUDCLNT_STREAMFLAGS_SRC_DEFAULT_QUALITY | - AUDCLNT_STREAMFLAGS_AUTOCONVERTPCM)){ - FIXME("Unknown flags: %08lx\n", flags); - return E_INVALIDARG; - } - - sessions_lock(); - - if(This->stream){ - sessions_unlock(); - return AUDCLNT_E_ALREADY_INITIALIZED; - } - - params.name = NULL; - params.device = This->device_name; - params.flow = This->dataflow; - params.share = mode; - params.flags = flags; - params.duration = duration; - params.period = period; - params.fmt = fmt; - params.channel_count = NULL; - params.stream = &stream; - - UNIX_CALL(create_stream, ¶ms); - if(FAILED(params.result)){ - sessions_unlock(); - return params.result; - } - - This->channel_count = fmt->nChannels; - - This->vols = HeapAlloc(GetProcessHeap(), 0, This->channel_count * sizeof(float)); - if(!This->vols){ - params.result = E_OUTOFMEMORY; - goto end; - } - - for(i = 0; i < This->channel_count; ++i) - This->vols[i] = 1.f; - - params.result = get_audio_session(sessionguid, This->parent, fmt->nChannels, &This->session); - if(FAILED(params.result)) goto end; - - list_add_tail(&This->session->clients, &This->entry); - -end: - if(FAILED(params.result)){ - release_params.stream = stream; - UNIX_CALL(release_stream, &release_params); - HeapFree(GetProcessHeap(), 0, This->vols); - This->vols = NULL; - }else{ - This->stream = stream; - set_stream_volumes(This); - } - - sessions_unlock(); - - return params.result; -} + const GUID *sessionguid);
extern HRESULT WINAPI client_GetBufferSize(IAudioClient3 *iface, UINT32 *frames); @@ -693,7 +560,7 @@ static const IAudioClient3Vtbl AudioClient3_Vtbl = AudioClient_QueryInterface, AudioClient_AddRef, AudioClient_Release, - AudioClient_Initialize, + client_Initialize, client_GetBufferSize, client_GetStreamLatency, client_GetCurrentPadding,