This is the very first step for merging the `mmdevdrv.c` files into a single one.
The commit strictly focuses on Linux drivers, `wine{oss,coreaudio}` will follow.
Huge thanks to @jacek and @huw for making this simple, as they took care of ELF/PE separation.
-- v6: mmdevapi: Integrate winepulse's additions in unixlib.h winealsa: Move common unixlib.h content into mmdevapi winealsa: Drop "alsa_" prefix in unixlib enum, apply it to the functions instead
From: Davide Beatrici git@davidebeatrici.dev
--- dlls/winealsa.drv/alsa.c | 242 +++++++++++++++++------------------ dlls/winealsa.drv/alsamidi.c | 20 +-- dlls/winealsa.drv/mmdevdrv.c | 8 +- dlls/winealsa.drv/unixlib.h | 80 ++++++------ 4 files changed, 175 insertions(+), 175 deletions(-)
diff --git a/dlls/winealsa.drv/alsa.c b/dlls/winealsa.drv/alsa.c index 8439262428f..3274bae70be 100644 --- a/dlls/winealsa.drv/alsa.c +++ b/dlls/winealsa.drv/alsa.c @@ -468,7 +468,7 @@ static WCHAR *alsa_get_card_name(int card) return ret; }
-static NTSTATUS get_endpoint_ids(void *args) +static NTSTATUS alsa_get_endpoint_ids(void *args) { static const WCHAR defaultW[] = {'d','e','f','a','u','l','t',0}; struct get_endpoint_ids_params *params = args; @@ -775,7 +775,7 @@ static ULONG_PTR zero_bits(void) #endif }
-static NTSTATUS create_stream(void *args) +static NTSTATUS alsa_create_stream(void *args) { struct create_stream_params *params = args; struct alsa_stream *stream; @@ -792,7 +792,7 @@ static NTSTATUS create_stream(void *args) return STATUS_SUCCESS; }
- params->result = alsa_open_device(params->alsa_name, params->flow, &stream->pcm_handle, &stream->hw_params); + params->result = alsa_open_device(params->device, params->flow, &stream->pcm_handle, &stream->hw_params); if(FAILED(params->result)){ free(stream); return STATUS_SUCCESS; @@ -1009,7 +1009,7 @@ exit: return STATUS_SUCCESS; }
-static NTSTATUS release_stream(void *args) +static NTSTATUS alsa_release_stream(void *args) { struct release_stream_params *params = args; struct alsa_stream *stream = handle_get_stream(params->stream); @@ -1505,7 +1505,7 @@ static int alsa_rewind_best_effort(struct alsa_stream *stream) return len; }
-static NTSTATUS start(void *args) +static NTSTATUS alsa_start(void *args) { struct start_params *params = args; struct alsa_stream *stream = handle_get_stream(params->stream); @@ -1551,7 +1551,7 @@ static NTSTATUS start(void *args) return alsa_unlock_result(stream, ¶ms->result, S_OK); }
-static NTSTATUS stop(void *args) +static NTSTATUS alsa_stop(void *args) { struct stop_params *params = args; struct alsa_stream *stream = handle_get_stream(params->stream); @@ -1569,7 +1569,7 @@ static NTSTATUS stop(void *args) return alsa_unlock_result(stream, ¶ms->result, S_OK); }
-static NTSTATUS reset(void *args) +static NTSTATUS alsa_reset(void *args) { struct reset_params *params = args; struct alsa_stream *stream = handle_get_stream(params->stream); @@ -1604,7 +1604,7 @@ static NTSTATUS reset(void *args) return alsa_unlock_result(stream, ¶ms->result, S_OK); }
-static NTSTATUS timer_loop(void *args) +static NTSTATUS alsa_timer_loop(void *args) { struct timer_loop_params *params = args; struct alsa_stream *stream = handle_get_stream(params->stream); @@ -1642,7 +1642,7 @@ static NTSTATUS timer_loop(void *args) return STATUS_SUCCESS; }
-static NTSTATUS get_render_buffer(void *args) +static NTSTATUS alsa_get_render_buffer(void *args) { struct get_render_buffer_params *params = args; struct alsa_stream *stream = handle_get_stream(params->stream); @@ -1706,7 +1706,7 @@ static void alsa_wrap_buffer(struct alsa_stream *stream, BYTE *buffer, UINT32 wr } }
-static NTSTATUS release_render_buffer(void *args) +static NTSTATUS alsa_release_render_buffer(void *args) { struct release_render_buffer_params *params = args; struct alsa_stream *stream = handle_get_stream(params->stream); @@ -1746,7 +1746,7 @@ static NTSTATUS release_render_buffer(void *args) return alsa_unlock_result(stream, ¶ms->result, S_OK); }
-static NTSTATUS get_capture_buffer(void *args) +static NTSTATUS alsa_get_capture_buffer(void *args) { struct get_capture_buffer_params *params = args; struct alsa_stream *stream = handle_get_stream(params->stream); @@ -1807,7 +1807,7 @@ static NTSTATUS get_capture_buffer(void *args) return alsa_unlock_result(stream, ¶ms->result, *frames ? S_OK : AUDCLNT_S_BUFFER_EMPTY); }
-static NTSTATUS release_capture_buffer(void *args) +static NTSTATUS alsa_release_capture_buffer(void *args) { struct release_capture_buffer_params *params = args; struct alsa_stream *stream = handle_get_stream(params->stream); @@ -1835,7 +1835,7 @@ static NTSTATUS release_capture_buffer(void *args) return alsa_unlock_result(stream, ¶ms->result, S_OK); }
-static NTSTATUS is_format_supported(void *args) +static NTSTATUS alsa_is_format_supported(void *args) { struct is_format_supported_params *params = args; const WAVEFORMATEXTENSIBLE *fmtex = (const WAVEFORMATEXTENSIBLE *)params->fmt_in; @@ -1869,7 +1869,7 @@ static NTSTATUS is_format_supported(void *args) return STATUS_SUCCESS; }
- params->result = alsa_open_device(params->alsa_name, params->flow, &pcm_handle, &hw_params); + params->result = alsa_open_device(params->device, params->flow, &pcm_handle, &hw_params); if(FAILED(params->result)) return STATUS_SUCCESS;
@@ -1974,7 +1974,7 @@ exit: return STATUS_SUCCESS; }
-static NTSTATUS get_mix_format(void *args) +static NTSTATUS alsa_get_mix_format(void *args) { struct get_mix_format_params *params = args; WAVEFORMATEXTENSIBLE *fmt = params->fmt; @@ -1984,7 +1984,7 @@ static NTSTATUS get_mix_format(void *args) unsigned int max_rate, max_channels; int err;
- params->result = alsa_open_device(params->alsa_name, params->flow, &pcm_handle, &hw_params); + params->result = alsa_open_device(params->device, params->flow, &pcm_handle, &hw_params); if(FAILED(params->result)) return STATUS_SUCCESS;
@@ -2091,7 +2091,7 @@ exit: return STATUS_SUCCESS; }
-static NTSTATUS get_buffer_size(void *args) +static NTSTATUS alsa_get_buffer_size(void *args) { struct get_buffer_size_params *params = args; struct alsa_stream *stream = handle_get_stream(params->stream); @@ -2103,7 +2103,7 @@ static NTSTATUS get_buffer_size(void *args) return alsa_unlock_result(stream, ¶ms->result, S_OK); }
-static NTSTATUS get_latency(void *args) +static NTSTATUS alsa_get_latency(void *args) { struct get_latency_params *params = args; struct alsa_stream *stream = handle_get_stream(params->stream); @@ -2124,7 +2124,7 @@ static NTSTATUS get_latency(void *args) return alsa_unlock_result(stream, ¶ms->result, S_OK); }
-static NTSTATUS get_current_padding(void *args) +static NTSTATUS alsa_get_current_padding(void *args) { struct get_current_padding_params *params = args; struct alsa_stream *stream = handle_get_stream(params->stream); @@ -2137,7 +2137,7 @@ static NTSTATUS get_current_padding(void *args) return alsa_unlock_result(stream, ¶ms->result, S_OK); }
-static NTSTATUS get_next_packet_size(void *args) +static NTSTATUS alsa_get_next_packet_size(void *args) { struct get_next_packet_size_params *params = args; struct alsa_stream *stream = handle_get_stream(params->stream); @@ -2149,7 +2149,7 @@ static NTSTATUS get_next_packet_size(void *args) return alsa_unlock_result(stream, ¶ms->result, S_OK); }
-static NTSTATUS get_frequency(void *args) +static NTSTATUS alsa_get_frequency(void *args) { struct get_frequency_params *params = args; struct alsa_stream *stream = handle_get_stream(params->stream); @@ -2165,7 +2165,7 @@ static NTSTATUS get_frequency(void *args) return alsa_unlock_result(stream, ¶ms->result, S_OK); }
-static NTSTATUS get_position(void *args) +static NTSTATUS alsa_get_position(void *args) { struct get_position_params *params = args; struct alsa_stream *stream = handle_get_stream(params->stream); @@ -2217,7 +2217,7 @@ static NTSTATUS get_position(void *args) return alsa_unlock_result(stream, ¶ms->result, S_OK); }
-static NTSTATUS set_volumes(void *args) +static NTSTATUS alsa_set_volumes(void *args) { struct set_volumes_params *params = args; struct alsa_stream *stream = handle_get_stream(params->stream); @@ -2229,7 +2229,7 @@ static NTSTATUS set_volumes(void *args) return STATUS_SUCCESS; }
-static NTSTATUS set_event_handle(void *args) +static NTSTATUS alsa_set_event_handle(void *args) { struct set_event_handle_params *params = args; struct alsa_stream *stream = handle_get_stream(params->stream); @@ -2249,7 +2249,7 @@ static NTSTATUS set_event_handle(void *args) return alsa_unlock_result(stream, ¶ms->result, S_OK); }
-static NTSTATUS is_started(void *args) +static NTSTATUS alsa_is_started(void *args) { struct is_started_params *params = args; struct alsa_stream *stream = handle_get_stream(params->stream); @@ -2304,10 +2304,10 @@ enum AudioDeviceConnectionType { AudioDeviceConnectionType_USB };
-static NTSTATUS get_prop_value(void *args) +static NTSTATUS alsa_get_prop_value(void *args) { struct get_prop_value_params *params = args; - const char *name = params->alsa_name; + const char *name = params->device; EDataFlow flow = params->flow; const GUID *guid = params->guid; const PROPERTYKEY *prop = params->prop; @@ -2431,40 +2431,40 @@ static NTSTATUS get_prop_value(void *args)
unixlib_entry_t __wine_unix_call_funcs[] = { - get_endpoint_ids, - create_stream, - release_stream, - start, - stop, - reset, - timer_loop, - get_render_buffer, - release_render_buffer, - get_capture_buffer, - release_capture_buffer, - is_format_supported, - get_mix_format, - get_buffer_size, - get_latency, - get_current_padding, - get_next_packet_size, - get_frequency, - get_position, - set_volumes, - set_event_handle, - is_started, - get_prop_value, - midi_release, - midi_out_message, - midi_in_message, - midi_notify_wait, + alsa_get_endpoint_ids, + alsa_create_stream, + alsa_release_stream, + alsa_start, + alsa_stop, + alsa_reset, + alsa_timer_loop, + alsa_get_render_buffer, + alsa_release_render_buffer, + alsa_get_capture_buffer, + alsa_release_capture_buffer, + alsa_is_format_supported, + alsa_get_mix_format, + alsa_get_buffer_size, + alsa_get_latency, + alsa_get_current_padding, + alsa_get_next_packet_size, + alsa_get_frequency, + alsa_get_position, + alsa_set_volumes, + alsa_set_event_handle, + alsa_is_started, + alsa_get_prop_value, + alsa_midi_release, + alsa_midi_out_message, + alsa_midi_in_message, + alsa_midi_notify_wait, };
#ifdef _WIN64
typedef UINT PTR32;
-static NTSTATUS wow64_get_endpoint_ids(void *args) +static NTSTATUS alsa_wow64_get_endpoint_ids(void *args) { struct { @@ -2481,7 +2481,7 @@ static NTSTATUS wow64_get_endpoint_ids(void *args) .endpoints = ULongToPtr(params32->endpoints), .size = params32->size }; - get_endpoint_ids(¶ms); + alsa_get_endpoint_ids(¶ms); params32->size = params.size; params32->result = params.result; params32->num = params.num; @@ -2489,11 +2489,11 @@ static NTSTATUS wow64_get_endpoint_ids(void *args) return STATUS_SUCCESS; }
-static NTSTATUS wow64_create_stream(void *args) +static NTSTATUS alsa_wow64_create_stream(void *args) { struct { - PTR32 alsa_name; + PTR32 device; EDataFlow flow; AUDCLNT_SHAREMODE share; DWORD flags; @@ -2505,7 +2505,7 @@ static NTSTATUS wow64_create_stream(void *args) } *params32 = args; struct create_stream_params params = { - .alsa_name = ULongToPtr(params32->alsa_name), + .device = ULongToPtr(params32->device), .flow = params32->flow, .share = params32->share, .flags = params32->flags, @@ -2514,12 +2514,12 @@ static NTSTATUS wow64_create_stream(void *args) .fmt = ULongToPtr(params32->fmt), .stream = ULongToPtr(params32->stream) }; - create_stream(¶ms); + alsa_create_stream(¶ms); params32->result = params.result; return STATUS_SUCCESS; }
-static NTSTATUS wow64_release_stream(void *args) +static NTSTATUS alsa_wow64_release_stream(void *args) { struct { @@ -2532,12 +2532,12 @@ static NTSTATUS wow64_release_stream(void *args) .stream = params32->stream, .timer_thread = ULongToHandle(params32->timer_thread) }; - release_stream(¶ms); + alsa_release_stream(¶ms); params32->result = params.result; return STATUS_SUCCESS; }
-static NTSTATUS wow64_get_render_buffer(void *args) +static NTSTATUS alsa_wow64_get_render_buffer(void *args) { struct { @@ -2553,13 +2553,13 @@ static NTSTATUS wow64_get_render_buffer(void *args) .frames = params32->frames, .data = &data }; - get_render_buffer(¶ms); + alsa_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) +static NTSTATUS alsa_wow64_get_capture_buffer(void *args) { struct { @@ -2581,17 +2581,17 @@ static NTSTATUS wow64_get_capture_buffer(void *args) .devpos = ULongToPtr(params32->devpos), .qpcpos = ULongToPtr(params32->qpcpos) }; - get_capture_buffer(¶ms); + alsa_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) +static NTSTATUS alsa_wow64_is_format_supported(void *args) { struct { - PTR32 alsa_name; + PTR32 device; EDataFlow flow; AUDCLNT_SHAREMODE share; PTR32 fmt_in; @@ -2600,38 +2600,38 @@ static NTSTATUS wow64_is_format_supported(void *args) } *params32 = args; struct is_format_supported_params params = { - .alsa_name = ULongToPtr(params32->alsa_name), + .device = ULongToPtr(params32->device), .flow = params32->flow, .share = params32->share, .fmt_in = ULongToPtr(params32->fmt_in), .fmt_out = ULongToPtr(params32->fmt_out) }; - is_format_supported(¶ms); + alsa_is_format_supported(¶ms); params32->result = params.result; return STATUS_SUCCESS; }
-static NTSTATUS wow64_get_mix_format(void *args) +static NTSTATUS alsa_wow64_get_mix_format(void *args) { struct { - PTR32 alsa_name; + PTR32 device; EDataFlow flow; PTR32 fmt; HRESULT result; } *params32 = args; struct get_mix_format_params params = { - .alsa_name = ULongToPtr(params32->alsa_name), + .device = ULongToPtr(params32->device), .flow = params32->flow, .fmt = ULongToPtr(params32->fmt) }; - get_mix_format(¶ms); + alsa_get_mix_format(¶ms); params32->result = params.result; return STATUS_SUCCESS; }
-static NTSTATUS wow64_get_buffer_size(void *args) +static NTSTATUS alsa_wow64_get_buffer_size(void *args) { struct { @@ -2644,12 +2644,12 @@ static NTSTATUS wow64_get_buffer_size(void *args) .stream = params32->stream, .size = ULongToPtr(params32->size) }; - get_buffer_size(¶ms); + alsa_get_buffer_size(¶ms); params32->result = params.result; return STATUS_SUCCESS; }
-static NTSTATUS wow64_get_latency(void *args) +static NTSTATUS alsa_wow64_get_latency(void *args) { struct { @@ -2662,12 +2662,12 @@ static NTSTATUS wow64_get_latency(void *args) .stream = params32->stream, .latency = ULongToPtr(params32->latency) }; - get_latency(¶ms); + alsa_get_latency(¶ms); params32->result = params.result; return STATUS_SUCCESS; }
-static NTSTATUS wow64_get_current_padding(void *args) +static NTSTATUS alsa_wow64_get_current_padding(void *args) { struct { @@ -2680,12 +2680,12 @@ static NTSTATUS wow64_get_current_padding(void *args) .stream = params32->stream, .padding = ULongToPtr(params32->padding) }; - get_current_padding(¶ms); + alsa_get_current_padding(¶ms); params32->result = params.result; return STATUS_SUCCESS; }
-static NTSTATUS wow64_get_next_packet_size(void *args) +static NTSTATUS alsa_wow64_get_next_packet_size(void *args) { struct { @@ -2698,12 +2698,12 @@ static NTSTATUS wow64_get_next_packet_size(void *args) .stream = params32->stream, .frames = ULongToPtr(params32->frames) }; - get_next_packet_size(¶ms); + alsa_get_next_packet_size(¶ms); params32->result = params.result; return STATUS_SUCCESS; }
-static NTSTATUS wow64_get_frequency(void *args) +static NTSTATUS alsa_wow64_get_frequency(void *args) { struct { @@ -2716,12 +2716,12 @@ static NTSTATUS wow64_get_frequency(void *args) .stream = params32->stream, .freq = ULongToPtr(params32->freq) }; - get_frequency(¶ms); + alsa_get_frequency(¶ms); params32->result = params.result; return STATUS_SUCCESS; }
-static NTSTATUS wow64_get_position(void *args) +static NTSTATUS alsa_wow64_get_position(void *args) { struct { @@ -2736,12 +2736,12 @@ static NTSTATUS wow64_get_position(void *args) .pos = ULongToPtr(params32->pos), .qpctime = ULongToPtr(params32->qpctime) }; - get_position(¶ms); + alsa_get_position(¶ms); params32->result = params.result; return STATUS_SUCCESS; }
-static NTSTATUS wow64_set_volumes(void *args) +static NTSTATUS alsa_wow64_set_volumes(void *args) { struct { @@ -2757,10 +2757,10 @@ static NTSTATUS wow64_set_volumes(void *args) .volumes = ULongToPtr(params32->volumes), .session_volumes = ULongToPtr(params32->session_volumes) }; - return set_volumes(¶ms); + return alsa_set_volumes(¶ms); }
-static NTSTATUS wow64_set_event_handle(void *args) +static NTSTATUS alsa_wow64_set_event_handle(void *args) { struct { @@ -2774,12 +2774,12 @@ static NTSTATUS wow64_set_event_handle(void *args) .event = ULongToHandle(params32->event) };
- set_event_handle(¶ms); + alsa_set_event_handle(¶ms); params32->result = params.result; return STATUS_SUCCESS; }
-static NTSTATUS wow64_get_prop_value(void *args) +static NTSTATUS alsa_wow64_get_prop_value(void *args) { struct propvariant32 { @@ -2794,7 +2794,7 @@ static NTSTATUS wow64_get_prop_value(void *args) } *value32; struct { - PTR32 alsa_name; + PTR32 device; EDataFlow flow; PTR32 guid; PTR32 prop; @@ -2806,7 +2806,7 @@ static NTSTATUS wow64_get_prop_value(void *args) PROPVARIANT value; struct get_prop_value_params params = { - .alsa_name = ULongToPtr(params32->alsa_name), + .device = ULongToPtr(params32->device), .flow = params32->flow, .guid = ULongToPtr(params32->guid), .prop = ULongToPtr(params32->prop), @@ -2814,7 +2814,7 @@ static NTSTATUS wow64_get_prop_value(void *args) .buffer = ULongToPtr(params32->buffer), .buffer_size = ULongToPtr(params32->buffer_size) }; - get_prop_value(¶ms); + alsa_get_prop_value(¶ms); params32->result = params.result; if (SUCCEEDED(params.result)) { @@ -2837,33 +2837,33 @@ static NTSTATUS wow64_get_prop_value(void *args)
unixlib_entry_t __wine_unix_call_wow64_funcs[] = { - wow64_get_endpoint_ids, - wow64_create_stream, - wow64_release_stream, - start, - stop, - reset, - timer_loop, - wow64_get_render_buffer, - release_render_buffer, - wow64_get_capture_buffer, - release_capture_buffer, - wow64_is_format_supported, - wow64_get_mix_format, - wow64_get_buffer_size, - wow64_get_latency, - wow64_get_current_padding, - wow64_get_next_packet_size, - wow64_get_frequency, - wow64_get_position, - wow64_set_volumes, - wow64_set_event_handle, - is_started, - wow64_get_prop_value, - midi_release, - wow64_midi_out_message, - wow64_midi_in_message, - wow64_midi_notify_wait, + alsa_wow64_get_endpoint_ids, + alsa_wow64_create_stream, + alsa_wow64_release_stream, + alsa_start, + alsa_stop, + alsa_reset, + alsa_timer_loop, + alsa_wow64_get_render_buffer, + alsa_release_render_buffer, + alsa_wow64_get_capture_buffer, + alsa_release_capture_buffer, + alsa_wow64_is_format_supported, + alsa_wow64_get_mix_format, + alsa_wow64_get_buffer_size, + alsa_wow64_get_latency, + alsa_wow64_get_current_padding, + alsa_wow64_get_next_packet_size, + alsa_wow64_get_frequency, + alsa_wow64_get_position, + alsa_wow64_set_volumes, + alsa_wow64_set_event_handle, + alsa_is_started, + alsa_wow64_get_prop_value, + alsa_midi_release, + alsa_wow64_midi_out_message, + alsa_wow64_midi_in_message, + alsa_wow64_midi_notify_wait, };
#endif /* _WIN64 */ diff --git a/dlls/winealsa.drv/alsamidi.c b/dlls/winealsa.drv/alsamidi.c index 6350e3e4265..6fe6fee85a9 100644 --- a/dlls/winealsa.drv/alsamidi.c +++ b/dlls/winealsa.drv/alsamidi.c @@ -468,7 +468,7 @@ static UINT midi_init(void) return NOERROR; }
-NTSTATUS midi_release(void *args) +NTSTATUS alsa_midi_release(void *args) { /* stop the notify_wait thread */ notify_post(NULL); @@ -1389,7 +1389,7 @@ static DWORD midi_in_reset(WORD dev_id, struct notify_context *notify) return err; }
-NTSTATUS midi_out_message(void *args) +NTSTATUS alsa_midi_out_message(void *args) { struct midi_out_message_params *params = args;
@@ -1447,7 +1447,7 @@ NTSTATUS midi_out_message(void *args) return STATUS_SUCCESS; }
-NTSTATUS midi_in_message(void *args) +NTSTATUS alsa_midi_in_message(void *args) { struct midi_in_message_params *params = args;
@@ -1502,7 +1502,7 @@ NTSTATUS midi_in_message(void *args) return STATUS_SUCCESS; }
-NTSTATUS midi_notify_wait(void *args) +NTSTATUS alsa_midi_notify_wait(void *args) { struct midi_notify_wait_params *params = args;
@@ -1606,7 +1606,7 @@ static UINT wow64_midi_out_unprepare(WORD dev_id, struct midi_hdr32 *hdr, UINT h return MMSYSERR_NOERROR; }
-NTSTATUS wow64_midi_out_message(void *args) +NTSTATUS alsa_wow64_midi_out_message(void *args) { struct { @@ -1677,7 +1677,7 @@ NTSTATUS wow64_midi_out_message(void *args) return STATUS_SUCCESS; }
- midi_out_message(¶ms); + alsa_midi_out_message(¶ms);
switch (params32->msg) { @@ -1730,7 +1730,7 @@ static UINT wow64_midi_in_unprepare(WORD dev_id, struct midi_hdr32 *hdr, UINT hd return MMSYSERR_NOERROR; }
-NTSTATUS wow64_midi_in_message(void *args) +NTSTATUS alsa_wow64_midi_in_message(void *args) { struct { @@ -1802,7 +1802,7 @@ NTSTATUS wow64_midi_in_message(void *args) return STATUS_SUCCESS; }
- midi_in_message(¶ms); + alsa_midi_in_message(¶ms);
switch (params32->msg) { @@ -1837,7 +1837,7 @@ NTSTATUS wow64_midi_in_message(void *args) return STATUS_SUCCESS; }
-NTSTATUS wow64_midi_notify_wait(void *args) +NTSTATUS alsa_wow64_midi_notify_wait(void *args) { struct { @@ -1855,7 +1855,7 @@ NTSTATUS wow64_midi_notify_wait(void *args) }; notify32->send_notify = FALSE;
- midi_notify_wait(¶ms); + alsa_midi_notify_wait(¶ms);
if (!*params.quit && notify.send_notify) { diff --git a/dlls/winealsa.drv/mmdevdrv.c b/dlls/winealsa.drv/mmdevdrv.c index cba96cdcfb8..b77c6e7418b 100644 --- a/dlls/winealsa.drv/mmdevdrv.c +++ b/dlls/winealsa.drv/mmdevdrv.c @@ -746,7 +746,7 @@ static HRESULT WINAPI AudioClient_Initialize(IAudioClient3 *iface,
dump_fmt(fmt);
- params.alsa_name = This->alsa_name; + params.device = This->alsa_name; params.flow = This->dataflow; params.share = mode; params.flags = flags; @@ -870,7 +870,7 @@ static HRESULT WINAPI AudioClient_IsFormatSupported(IAudioClient3 *iface, TRACE("(%p)->(%x, %p, %p)\n", This, mode, fmt, out); if(fmt) dump_fmt(fmt);
- params.alsa_name = This->alsa_name; + params.device = This->alsa_name; params.flow = This->dataflow; params.share = mode; params.fmt_in = fmt; @@ -903,7 +903,7 @@ static HRESULT WINAPI AudioClient_GetMixFormat(IAudioClient3 *iface, return E_POINTER; *pwfx = NULL;
- params.alsa_name = This->alsa_name; + params.device = This->alsa_name; params.flow = This->dataflow; params.fmt = CoTaskMemAlloc(sizeof(WAVEFORMATEXTENSIBLE)); if(!params.fmt) @@ -2455,7 +2455,7 @@ HRESULT WINAPI AUDDRV_GetPropValue(GUID *guid, const PROPERTYKEY *prop, PROPVARI return E_NOINTERFACE; }
- params.alsa_name = name; + params.device = name; params.flow = flow; params.guid = guid; params.prop = prop; diff --git a/dlls/winealsa.drv/unixlib.h b/dlls/winealsa.drv/unixlib.h index dea3b5ebdc9..dce2a34e05c 100644 --- a/dlls/winealsa.drv/unixlib.h +++ b/dlls/winealsa.drv/unixlib.h @@ -38,7 +38,7 @@ struct get_endpoint_ids_params
struct create_stream_params { - const char *alsa_name; + const char *device; EDataFlow flow; AUDCLNT_SHAREMODE share; DWORD flags; @@ -115,7 +115,7 @@ struct release_capture_buffer_params
struct is_format_supported_params { - const char *alsa_name; + const char *device; EDataFlow flow; AUDCLNT_SHAREMODE share; const WAVEFORMATEX *fmt_in; @@ -125,7 +125,7 @@ struct is_format_supported_params
struct get_mix_format_params { - const char *alsa_name; + const char *device; EDataFlow flow; WAVEFORMATEXTENSIBLE *fmt; HRESULT result; @@ -197,7 +197,7 @@ struct is_started_params
struct get_prop_value_params { - const char *alsa_name; + const char *device; EDataFlow flow; const GUID *guid; const PROPERTYKEY *prop; @@ -248,48 +248,48 @@ struct midi_notify_wait_params struct notify_context *notify; };
-enum alsa_funcs +enum unix_funcs { - alsa_get_endpoint_ids, - alsa_create_stream, - alsa_release_stream, - alsa_start, - alsa_stop, - alsa_reset, - alsa_timer_loop, - alsa_get_render_buffer, - alsa_release_render_buffer, - alsa_get_capture_buffer, - alsa_release_capture_buffer, - alsa_is_format_supported, - alsa_get_mix_format, - alsa_get_buffer_size, - alsa_get_latency, - alsa_get_current_padding, - alsa_get_next_packet_size, - alsa_get_frequency, - alsa_get_position, - alsa_set_volumes, - alsa_set_event_handle, - alsa_is_started, - alsa_get_prop_value, - alsa_midi_release, - alsa_midi_out_message, - alsa_midi_in_message, - alsa_midi_notify_wait, + get_endpoint_ids, + create_stream, + release_stream, + start, + stop, + reset, + timer_loop, + get_render_buffer, + release_render_buffer, + get_capture_buffer, + release_capture_buffer, + is_format_supported, + get_mix_format, + get_buffer_size, + get_latency, + get_current_padding, + get_next_packet_size, + get_frequency, + get_position, + set_volumes, + set_event_handle, + is_started, + get_prop_value, + midi_release, + midi_out_message, + midi_in_message, + midi_notify_wait, };
-NTSTATUS midi_release(void *args) DECLSPEC_HIDDEN; -NTSTATUS midi_out_message(void *args) DECLSPEC_HIDDEN; -NTSTATUS midi_in_message(void *args) DECLSPEC_HIDDEN; -NTSTATUS midi_notify_wait(void *args) DECLSPEC_HIDDEN; +NTSTATUS alsa_midi_release(void *args) DECLSPEC_HIDDEN; +NTSTATUS alsa_midi_out_message(void *args) DECLSPEC_HIDDEN; +NTSTATUS alsa_midi_in_message(void *args) DECLSPEC_HIDDEN; +NTSTATUS alsa_midi_notify_wait(void *args) DECLSPEC_HIDDEN;
#ifdef _WIN64 -NTSTATUS wow64_midi_out_message(void *args) DECLSPEC_HIDDEN; -NTSTATUS wow64_midi_in_message(void *args) DECLSPEC_HIDDEN; -NTSTATUS wow64_midi_notify_wait(void *args) DECLSPEC_HIDDEN; +NTSTATUS alsa_wow64_midi_out_message(void *args) DECLSPEC_HIDDEN; +NTSTATUS alsa_wow64_midi_in_message(void *args) DECLSPEC_HIDDEN; +NTSTATUS alsa_wow64_midi_notify_wait(void *args) DECLSPEC_HIDDEN; #endif
extern unixlib_handle_t alsa_handle;
-#define ALSA_CALL(func, params) __wine_unix_call(alsa_handle, alsa_ ## func, params) +#define ALSA_CALL(func, params) __wine_unix_call(alsa_handle, func, params)
From: Davide Beatrici git@davidebeatrici.dev
--- dlls/mmdevapi/unixlib.h | 281 ++++++++++++++++++++++++++++++++++++ dlls/winealsa.drv/unixlib.h | 263 +-------------------------------- 2 files changed, 282 insertions(+), 262 deletions(-) create mode 100644 dlls/mmdevapi/unixlib.h
diff --git a/dlls/mmdevapi/unixlib.h b/dlls/mmdevapi/unixlib.h new file mode 100644 index 00000000000..d17439ebd73 --- /dev/null +++ b/dlls/mmdevapi/unixlib.h @@ -0,0 +1,281 @@ +/* + * Copyright 2022 Huw Davies + * + * 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 + */ + +#include "audioclient.h" +#include "mmdeviceapi.h" + +typedef UINT64 stream_handle; + +struct endpoint +{ + unsigned int name; + unsigned int device; +}; + +struct get_endpoint_ids_params +{ + EDataFlow flow; + struct endpoint *endpoints; + unsigned int size; + HRESULT result; + unsigned int num; + unsigned int default_idx; +}; + +struct create_stream_params +{ + const char *device; + EDataFlow flow; + AUDCLNT_SHAREMODE share; + DWORD flags; + REFERENCE_TIME duration; + REFERENCE_TIME period; + const WAVEFORMATEX *fmt; + HRESULT result; + stream_handle *stream; +}; + +struct release_stream_params +{ + stream_handle stream; + HANDLE timer_thread; + HRESULT result; +}; + +struct start_params +{ + stream_handle stream; + HRESULT result; +}; + +struct stop_params +{ + stream_handle stream; + HRESULT result; +}; + +struct reset_params +{ + stream_handle stream; + HRESULT result; +}; + +struct timer_loop_params +{ + stream_handle stream; +}; + +struct get_render_buffer_params +{ + stream_handle stream; + UINT32 frames; + HRESULT result; + BYTE **data; +}; + +struct release_render_buffer_params +{ + stream_handle stream; + UINT32 written_frames; + UINT flags; + HRESULT result; +}; + +struct get_capture_buffer_params +{ + stream_handle stream; + HRESULT result; + BYTE **data; + UINT32 *frames; + UINT *flags; + UINT64 *devpos; + UINT64 *qpcpos; +}; + +struct release_capture_buffer_params +{ + stream_handle stream; + UINT32 done; + HRESULT result; +}; + +struct is_format_supported_params +{ + const char *device; + EDataFlow flow; + AUDCLNT_SHAREMODE share; + const WAVEFORMATEX *fmt_in; + WAVEFORMATEXTENSIBLE *fmt_out; + HRESULT result; +}; + +struct get_mix_format_params +{ + const char *device; + EDataFlow flow; + WAVEFORMATEXTENSIBLE *fmt; + HRESULT result; +}; + +struct get_buffer_size_params +{ + stream_handle stream; + HRESULT result; + UINT32 *size; +}; + +struct get_latency_params +{ + stream_handle stream; + HRESULT result; + REFERENCE_TIME *latency; +}; + +struct get_current_padding_params +{ + stream_handle stream; + HRESULT result; + UINT32 *padding; +}; + +struct get_next_packet_size_params +{ + stream_handle stream; + HRESULT result; + UINT32 *frames; +}; + +struct get_frequency_params +{ + stream_handle stream; + HRESULT result; + UINT64 *freq; +}; + +struct get_position_params +{ + stream_handle stream; + HRESULT result; + UINT64 *pos; + UINT64 *qpctime; +}; + +struct set_volumes_params +{ + stream_handle stream; + float master_volume; + const float *volumes; + const float *session_volumes; +}; + +struct set_event_handle_params +{ + stream_handle stream; + HANDLE event; + HRESULT result; +}; + +struct is_started_params +{ + stream_handle stream; + HRESULT result; +}; + +struct get_prop_value_params +{ + const char *device; + EDataFlow flow; + const GUID *guid; + const PROPERTYKEY *prop; + HRESULT result; + PROPVARIANT *value; + void *buffer; /* caller allocated buffer to hold value's strings */ + unsigned int *buffer_size; +}; + +struct notify_context +{ + BOOL send_notify; + WORD dev_id; + WORD msg; + UINT_PTR param_1; + UINT_PTR param_2; + UINT_PTR callback; + UINT flags; + HANDLE device; + UINT_PTR instance; +}; + +struct midi_out_message_params +{ + UINT dev_id; + UINT msg; + UINT_PTR user; + UINT_PTR param_1; + UINT_PTR param_2; + UINT *err; + struct notify_context *notify; +}; + +struct midi_in_message_params +{ + UINT dev_id; + UINT msg; + UINT_PTR user; + UINT_PTR param_1; + UINT_PTR param_2; + UINT *err; + struct notify_context *notify; +}; + +struct midi_notify_wait_params +{ + BOOL *quit; + struct notify_context *notify; +}; + +enum unix_funcs +{ + get_endpoint_ids, + create_stream, + release_stream, + start, + stop, + reset, + timer_loop, + get_render_buffer, + release_render_buffer, + get_capture_buffer, + release_capture_buffer, + is_format_supported, + get_mix_format, + get_buffer_size, + get_latency, + get_current_padding, + get_next_packet_size, + get_frequency, + get_position, + set_volumes, + set_event_handle, + is_started, + get_prop_value, + midi_release, + midi_out_message, + midi_in_message, + midi_notify_wait, +}; diff --git a/dlls/winealsa.drv/unixlib.h b/dlls/winealsa.drv/unixlib.h index dce2a34e05c..8c82281012a 100644 --- a/dlls/winealsa.drv/unixlib.h +++ b/dlls/winealsa.drv/unixlib.h @@ -16,268 +16,7 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */
-#include "audioclient.h" - -typedef UINT64 stream_handle; - -struct endpoint -{ - unsigned int name; - unsigned int device; -}; - -struct get_endpoint_ids_params -{ - EDataFlow flow; - struct endpoint *endpoints; - unsigned int size; - HRESULT result; - unsigned int num; - unsigned int default_idx; -}; - -struct create_stream_params -{ - const char *device; - EDataFlow flow; - AUDCLNT_SHAREMODE share; - DWORD flags; - REFERENCE_TIME duration; - REFERENCE_TIME period; - const WAVEFORMATEX *fmt; - HRESULT result; - stream_handle *stream; -}; - -struct release_stream_params -{ - stream_handle stream; - HANDLE timer_thread; - HRESULT result; -}; - -struct start_params -{ - stream_handle stream; - HRESULT result; -}; - -struct stop_params -{ - stream_handle stream; - HRESULT result; -}; - -struct reset_params -{ - stream_handle stream; - HRESULT result; -}; - -struct timer_loop_params -{ - stream_handle stream; -}; - -struct get_render_buffer_params -{ - stream_handle stream; - UINT32 frames; - HRESULT result; - BYTE **data; -}; - -struct release_render_buffer_params -{ - stream_handle stream; - UINT32 written_frames; - UINT flags; - HRESULT result; -}; - -struct get_capture_buffer_params -{ - stream_handle stream; - HRESULT result; - BYTE **data; - UINT32 *frames; - UINT *flags; - UINT64 *devpos; - UINT64 *qpcpos; -}; - -struct release_capture_buffer_params -{ - stream_handle stream; - UINT32 done; - HRESULT result; -}; - -struct is_format_supported_params -{ - const char *device; - EDataFlow flow; - AUDCLNT_SHAREMODE share; - const WAVEFORMATEX *fmt_in; - WAVEFORMATEXTENSIBLE *fmt_out; - HRESULT result; -}; - -struct get_mix_format_params -{ - const char *device; - EDataFlow flow; - WAVEFORMATEXTENSIBLE *fmt; - HRESULT result; -}; - -struct get_buffer_size_params -{ - stream_handle stream; - HRESULT result; - UINT32 *size; -}; - -struct get_latency_params -{ - stream_handle stream; - HRESULT result; - REFERENCE_TIME *latency; -}; - -struct get_current_padding_params -{ - stream_handle stream; - HRESULT result; - UINT32 *padding; -}; - -struct get_next_packet_size_params -{ - stream_handle stream; - HRESULT result; - UINT32 *frames; -}; - -struct get_frequency_params -{ - stream_handle stream; - HRESULT result; - UINT64 *freq; -}; - -struct get_position_params -{ - stream_handle stream; - HRESULT result; - UINT64 *pos; - UINT64 *qpctime; -}; - -struct set_volumes_params -{ - stream_handle stream; - float master_volume; - const float *volumes; - const float *session_volumes; -}; - -struct set_event_handle_params -{ - stream_handle stream; - HANDLE event; - HRESULT result; -}; - -struct is_started_params -{ - stream_handle stream; - HRESULT result; -}; - -struct get_prop_value_params -{ - const char *device; - EDataFlow flow; - const GUID *guid; - const PROPERTYKEY *prop; - HRESULT result; - PROPVARIANT *value; - void *buffer; /* caller allocated buffer to hold value's strings */ - unsigned int *buffer_size; -}; - -struct notify_context -{ - BOOL send_notify; - WORD dev_id; - WORD msg; - UINT_PTR param_1; - UINT_PTR param_2; - UINT_PTR callback; - UINT flags; - HANDLE device; - UINT_PTR instance; -}; - -struct midi_out_message_params -{ - UINT dev_id; - UINT msg; - UINT_PTR user; - UINT_PTR param_1; - UINT_PTR param_2; - UINT *err; - struct notify_context *notify; -}; - -struct midi_in_message_params -{ - UINT dev_id; - UINT msg; - UINT_PTR user; - UINT_PTR param_1; - UINT_PTR param_2; - UINT *err; - struct notify_context *notify; -}; - -struct midi_notify_wait_params -{ - BOOL *quit; - struct notify_context *notify; -}; - -enum unix_funcs -{ - get_endpoint_ids, - create_stream, - release_stream, - start, - stop, - reset, - timer_loop, - get_render_buffer, - release_render_buffer, - get_capture_buffer, - release_capture_buffer, - is_format_supported, - get_mix_format, - get_buffer_size, - get_latency, - get_current_padding, - get_next_packet_size, - get_frequency, - get_position, - set_volumes, - set_event_handle, - is_started, - get_prop_value, - midi_release, - midi_out_message, - midi_in_message, - midi_notify_wait, -}; +#include "../mmdevapi/unixlib.h"
NTSTATUS alsa_midi_release(void *args) DECLSPEC_HIDDEN; NTSTATUS alsa_midi_out_message(void *args) DECLSPEC_HIDDEN;
From: Davide Beatrici git@davidebeatrici.dev
--- dlls/mmdevapi/unixlib.h | 31 ++++++++++++++++++++++++++++++- dlls/winealsa.drv/alsa.c | 14 ++++++++++++++ dlls/winealsa.drv/mmdevdrv.c | 2 ++ 3 files changed, 46 insertions(+), 1 deletion(-)
diff --git a/dlls/mmdevapi/unixlib.h b/dlls/mmdevapi/unixlib.h index d17439ebd73..163272c4398 100644 --- a/dlls/mmdevapi/unixlib.h +++ b/dlls/mmdevapi/unixlib.h @@ -1,4 +1,5 @@ /* + * Copyright 2021 Jacek Caban for CodeWeavers * Copyright 2022 Huw Davies * * This library is free software; you can redistribute it and/or @@ -27,6 +28,11 @@ struct endpoint unsigned int device; };
+struct main_loop_params +{ + HANDLE event; +}; + struct get_endpoint_ids_params { EDataFlow flow; @@ -39,6 +45,7 @@ struct get_endpoint_ids_params
struct create_stream_params { + const char *name; const char *device; EDataFlow flow; AUDCLNT_SHAREMODE share; @@ -47,6 +54,7 @@ struct create_stream_params REFERENCE_TIME period; const WAVEFORMATEX *fmt; HRESULT result; + UINT32 *channel_count; stream_handle *stream; };
@@ -110,7 +118,7 @@ struct get_capture_buffer_params struct release_capture_buffer_params { stream_handle stream; - UINT32 done; + BOOL done; HRESULT result; };
@@ -132,6 +140,15 @@ struct get_mix_format_params HRESULT result; };
+struct get_device_period_params +{ + const char *device; + EDataFlow flow; + HRESULT result; + REFERENCE_TIME *def_period; + REFERENCE_TIME *min_period; +}; + struct get_buffer_size_params { stream_handle stream; @@ -170,6 +187,7 @@ struct get_frequency_params struct get_position_params { stream_handle stream; + BOOL device; HRESULT result; UINT64 *pos; UINT64 *qpctime; @@ -190,6 +208,12 @@ struct set_event_handle_params HRESULT result; };
+struct test_connect_params +{ + const char *name; + HRESULT result; +}; + struct is_started_params { stream_handle stream; @@ -251,6 +275,9 @@ struct midi_notify_wait_params
enum unix_funcs { + process_attach, + process_detach, + main_loop, get_endpoint_ids, create_stream, release_stream, @@ -264,6 +291,7 @@ enum unix_funcs release_capture_buffer, is_format_supported, get_mix_format, + get_device_period, get_buffer_size, get_latency, get_current_padding, @@ -272,6 +300,7 @@ enum unix_funcs get_position, set_volumes, set_event_handle, + test_connect, is_started, get_prop_value, midi_release, diff --git a/dlls/winealsa.drv/alsa.c b/dlls/winealsa.drv/alsa.c index 3274bae70be..fb688fe61c6 100644 --- a/dlls/winealsa.drv/alsa.c +++ b/dlls/winealsa.drv/alsa.c @@ -2431,6 +2431,9 @@ static NTSTATUS alsa_get_prop_value(void *args)
unixlib_entry_t __wine_unix_call_funcs[] = { + NULL, + NULL, + NULL, alsa_get_endpoint_ids, alsa_create_stream, alsa_release_stream, @@ -2444,6 +2447,7 @@ unixlib_entry_t __wine_unix_call_funcs[] = alsa_release_capture_buffer, alsa_is_format_supported, alsa_get_mix_format, + NULL, alsa_get_buffer_size, alsa_get_latency, alsa_get_current_padding, @@ -2452,6 +2456,7 @@ unixlib_entry_t __wine_unix_call_funcs[] = alsa_get_position, alsa_set_volumes, alsa_set_event_handle, + NULL, alsa_is_started, alsa_get_prop_value, alsa_midi_release, @@ -2493,6 +2498,7 @@ static NTSTATUS alsa_wow64_create_stream(void *args) { struct { + PTR32 name; PTR32 device; EDataFlow flow; AUDCLNT_SHAREMODE share; @@ -2501,10 +2507,12 @@ static NTSTATUS alsa_wow64_create_stream(void *args) REFERENCE_TIME period; PTR32 fmt; HRESULT result; + PTR32 channel_count; PTR32 stream; } *params32 = args; struct create_stream_params params = { + .name = ULongToPtr(params32->name), .device = ULongToPtr(params32->device), .flow = params32->flow, .share = params32->share, @@ -2512,6 +2520,7 @@ static NTSTATUS alsa_wow64_create_stream(void *args) .duration = params32->duration, .period = params32->period, .fmt = ULongToPtr(params32->fmt), + .channel_count = ULongToPtr(params32->channel_count), .stream = ULongToPtr(params32->stream) }; alsa_create_stream(¶ms); @@ -2837,6 +2846,9 @@ static NTSTATUS alsa_wow64_get_prop_value(void *args)
unixlib_entry_t __wine_unix_call_wow64_funcs[] = { + NULL, + NULL, + NULL, alsa_wow64_get_endpoint_ids, alsa_wow64_create_stream, alsa_wow64_release_stream, @@ -2850,6 +2862,7 @@ unixlib_entry_t __wine_unix_call_wow64_funcs[] = alsa_release_capture_buffer, alsa_wow64_is_format_supported, alsa_wow64_get_mix_format, + NULL, alsa_wow64_get_buffer_size, alsa_wow64_get_latency, alsa_wow64_get_current_padding, @@ -2858,6 +2871,7 @@ unixlib_entry_t __wine_unix_call_wow64_funcs[] = alsa_wow64_get_position, alsa_wow64_set_volumes, alsa_wow64_set_event_handle, + NULL, alsa_is_started, alsa_wow64_get_prop_value, alsa_midi_release, diff --git a/dlls/winealsa.drv/mmdevdrv.c b/dlls/winealsa.drv/mmdevdrv.c index b77c6e7418b..d5cce1b9f4d 100644 --- a/dlls/winealsa.drv/mmdevdrv.c +++ b/dlls/winealsa.drv/mmdevdrv.c @@ -746,6 +746,7 @@ static HRESULT WINAPI AudioClient_Initialize(IAudioClient3 *iface,
dump_fmt(fmt);
+ params.name = NULL; params.device = This->alsa_name; params.flow = This->dataflow; params.share = mode; @@ -753,6 +754,7 @@ static HRESULT WINAPI AudioClient_Initialize(IAudioClient3 *iface, params.duration = duration; params.period = period; params.fmt = fmt; + params.channel_count = NULL; params.stream = &stream;
ALSA_CALL(create_stream, ¶ms);