Signed-off-by: Huw Davies huw@codeweavers.com --- dlls/winecoreaudio.drv/coreaudio.c | 313 +++++++++++++++++++++++++++++ 1 file changed, 313 insertions(+)
diff --git a/dlls/winecoreaudio.drv/coreaudio.c b/dlls/winecoreaudio.drv/coreaudio.c index 463a330eeda..fb36298ba57 100644 --- a/dlls/winecoreaudio.drv/coreaudio.c +++ b/dlls/winecoreaudio.drv/coreaudio.c @@ -1661,3 +1661,316 @@ unixlib_entry_t __wine_unix_call_funcs[] = midi_in_message, midi_notify_wait, }; + +#ifdef _WIN64 + +typedef UINT PTR32; + +static NTSTATUS wow64_get_endpoint_ids(void *args) +{ + struct + { + EDataFlow flow; + PTR32 endpoints; + unsigned int size; + HRESULT result; + unsigned int num; + unsigned int default_idx; + } *params32 = args; + struct get_endpoint_ids_params params = + { + .flow = params32->flow, + .endpoints = ULongToPtr(params32->endpoints), + .size = params32->size + }; + get_endpoint_ids(¶ms); + params32->size = params.size; + params32->result = params.result; + params32->num = params.num; + params32->default_idx = params.default_idx; + return STATUS_SUCCESS; +} + +static NTSTATUS wow64_create_stream(void *args) +{ + struct + { + DWORD dev_id; + EDataFlow flow; + AUDCLNT_SHAREMODE share; + REFERENCE_TIME duration; + REFERENCE_TIME period; + PTR32 fmt; + HRESULT result; + PTR32 stream; + } *params32 = args; + struct create_stream_params params = + { + .dev_id = params32->dev_id, + .flow = params32->flow, + .share = params32->share, + .duration = params32->duration, + .period = params32->period, + .fmt = ULongToPtr(params32->fmt), + .stream = ULongToPtr(params32->stream) + }; + create_stream(¶ms); + params32->result = params.result; + return STATUS_SUCCESS; +} + +static NTSTATUS wow64_get_render_buffer(void *args) +{ + struct + { + stream_handle stream; + UINT32 frames; + HRESULT result; + PTR32 data; + } *params32 = args; + BYTE *data = NULL; + struct get_render_buffer_params params = + { + .stream = params32->stream, + .frames = params32->frames, + .data = &data + }; + get_render_buffer(¶ms); + params32->result = params.result; + *(unsigned int *)ULongToPtr(params32->data) = PtrToUlong(data); + return STATUS_SUCCESS; +} + +static NTSTATUS wow64_get_capture_buffer(void *args) +{ + struct + { + stream_handle stream; + HRESULT result; + PTR32 data; + PTR32 frames; + PTR32 flags; + PTR32 devpos; + PTR32 qpcpos; + } *params32 = args; + BYTE *data = NULL; + struct get_capture_buffer_params params = + { + .stream = params32->stream, + .data = &data, + .frames = ULongToPtr(params32->frames), + .flags = ULongToPtr(params32->flags), + .devpos = ULongToPtr(params32->devpos), + .qpcpos = ULongToPtr(params32->qpcpos) + }; + get_capture_buffer(¶ms); + params32->result = params.result; + *(unsigned int *)ULongToPtr(params32->data) = PtrToUlong(data); + return STATUS_SUCCESS; +}; + +static NTSTATUS wow64_is_format_supported(void *args) +{ + struct + { + EDataFlow flow; + DWORD dev_id; + AUDCLNT_SHAREMODE share; + PTR32 fmt_in; + PTR32 fmt_out; + HRESULT result; + } *params32 = args; + struct is_format_supported_params params = + { + .flow = params32->flow, + .dev_id = params32->dev_id, + .share = params32->share, + .fmt_in = ULongToPtr(params32->fmt_in), + .fmt_out = ULongToPtr(params32->fmt_out) + }; + is_format_supported(¶ms); + params32->result = params.result; + return STATUS_SUCCESS; +} + +static NTSTATUS wow64_get_mix_format(void *args) +{ + struct + { + EDataFlow flow; + DWORD dev_id; + PTR32 fmt; + HRESULT result; + } *params32 = args; + struct get_mix_format_params params = + { + .flow = params32->flow, + .dev_id = params32->dev_id, + .fmt = ULongToPtr(params32->fmt) + }; + get_mix_format(¶ms); + params32->result = params.result; + return STATUS_SUCCESS; +} + +static NTSTATUS wow64_get_buffer_size(void *args) +{ + struct + { + stream_handle stream; + HRESULT result; + PTR32 frames; + } *params32 = args; + struct get_buffer_size_params params = + { + .stream = params32->stream, + .frames = ULongToPtr(params32->frames) + }; + get_buffer_size(¶ms); + params32->result = params.result; + return STATUS_SUCCESS; +} + +static NTSTATUS wow64_get_latency(void *args) +{ + struct + { + stream_handle stream; + HRESULT result; + PTR32 latency; + } *params32 = args; + struct get_latency_params params = + { + .stream = params32->stream, + .latency = ULongToPtr(params32->latency) + }; + get_latency(¶ms); + params32->result = params.result; + return STATUS_SUCCESS; +} + +static NTSTATUS wow64_get_current_padding(void *args) +{ + struct + { + stream_handle stream; + HRESULT result; + PTR32 padding; + } *params32 = args; + struct get_current_padding_params params = + { + .stream = params32->stream, + .padding = ULongToPtr(params32->padding) + }; + get_current_padding(¶ms); + params32->result = params.result; + return STATUS_SUCCESS; +} + +static NTSTATUS wow64_get_next_packet_size(void *args) +{ + struct + { + stream_handle stream; + HRESULT result; + PTR32 frames; + } *params32 = args; + struct get_next_packet_size_params params = + { + .stream = params32->stream, + .frames = ULongToPtr(params32->frames) + }; + get_next_packet_size(¶ms); + params32->result = params.result; + return STATUS_SUCCESS; +} + +static NTSTATUS wow64_get_position(void *args) +{ + struct + { + stream_handle stream; + HRESULT result; + PTR32 pos; + PTR32 qpctime; + } *params32 = args; + struct get_position_params params = + { + .stream = params32->stream, + .pos = ULongToPtr(params32->pos), + .qpctime = ULongToPtr(params32->qpctime) + }; + get_position(¶ms); + params32->result = params.result; + return STATUS_SUCCESS; +} + +static NTSTATUS wow64_get_frequency(void *args) +{ + struct + { + stream_handle stream; + HRESULT result; + PTR32 freq; + } *params32 = args; + struct get_frequency_params params = + { + .stream = params32->stream, + .freq = ULongToPtr(params32->freq) + }; + get_frequency(¶ms); + params32->result = params.result; + return STATUS_SUCCESS; +} + +static NTSTATUS wow64_set_volumes(void *args) +{ + struct + { + stream_handle stream; + float master_volume; + PTR32 volumes; + PTR32 session_volumes; + int channel; + } *params32 = args; + struct set_volumes_params params = + { + .stream = params32->stream, + .master_volume = params32->master_volume, + .volumes = ULongToPtr(params32->volumes), + .session_volumes = ULongToPtr(params32->session_volumes), + .channel = params32->channel + }; + return set_volumes(¶ms); +} + +unixlib_entry_t __wine_unix_call_wow64_funcs[] = +{ + wow64_get_endpoint_ids, + wow64_create_stream, + release_stream, + start, + stop, + reset, + wow64_get_render_buffer, + release_render_buffer, + wow64_get_capture_buffer, + release_capture_buffer, + wow64_get_mix_format, + wow64_is_format_supported, + wow64_get_buffer_size, + wow64_get_latency, + wow64_get_current_padding, + wow64_get_next_packet_size, + wow64_get_position, + wow64_get_frequency, + is_started, + wow64_set_volumes, + midi_init, + midi_release, + midi_out_message, + midi_in_message, + midi_notify_wait, +}; + +#endif /* _WIN64 */