2022-02-15 13:09:53 +00:00
|
|
|
/*
|
|
|
|
* 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
|
|
|
|
*/
|
|
|
|
|
2022-02-16 09:34:49 +00:00
|
|
|
#include "audioclient.h"
|
|
|
|
|
2022-04-22 07:37:54 +00:00
|
|
|
typedef UINT64 stream_handle;
|
2022-02-16 09:34:49 +00:00
|
|
|
|
2022-02-15 13:09:53 +00:00
|
|
|
struct endpoint
|
|
|
|
{
|
2022-04-22 07:37:55 +00:00
|
|
|
unsigned int name;
|
|
|
|
unsigned int device;
|
2022-02-15 13:09:53 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct get_endpoint_ids_params
|
|
|
|
{
|
|
|
|
EDataFlow flow;
|
|
|
|
struct endpoint *endpoints;
|
|
|
|
unsigned int size;
|
|
|
|
HRESULT result;
|
|
|
|
unsigned int num;
|
|
|
|
unsigned int default_idx;
|
|
|
|
};
|
|
|
|
|
2022-02-22 08:14:18 +00:00
|
|
|
struct create_stream_params
|
|
|
|
{
|
|
|
|
const char *alsa_name;
|
|
|
|
EDataFlow flow;
|
|
|
|
AUDCLNT_SHAREMODE share;
|
|
|
|
DWORD flags;
|
|
|
|
REFERENCE_TIME duration;
|
|
|
|
REFERENCE_TIME period;
|
|
|
|
const WAVEFORMATEX *fmt;
|
|
|
|
HRESULT result;
|
2022-04-22 07:37:54 +00:00
|
|
|
stream_handle *stream;
|
2022-02-22 08:14:18 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct release_stream_params
|
|
|
|
{
|
2022-04-22 07:37:54 +00:00
|
|
|
stream_handle stream;
|
2022-03-02 10:53:16 +00:00
|
|
|
HANDLE timer_thread;
|
2022-02-22 08:14:18 +00:00
|
|
|
HRESULT result;
|
|
|
|
};
|
|
|
|
|
2022-03-02 10:53:17 +00:00
|
|
|
struct start_params
|
|
|
|
{
|
2022-04-22 07:37:54 +00:00
|
|
|
stream_handle stream;
|
2022-03-02 10:53:17 +00:00
|
|
|
HRESULT result;
|
|
|
|
};
|
|
|
|
|
2022-03-02 10:53:18 +00:00
|
|
|
struct stop_params
|
|
|
|
{
|
2022-04-22 07:37:54 +00:00
|
|
|
stream_handle stream;
|
2022-03-02 10:53:18 +00:00
|
|
|
HRESULT result;
|
|
|
|
};
|
|
|
|
|
2022-03-02 10:53:19 +00:00
|
|
|
struct reset_params
|
|
|
|
{
|
2022-04-22 07:37:54 +00:00
|
|
|
stream_handle stream;
|
2022-03-02 10:53:19 +00:00
|
|
|
HRESULT result;
|
|
|
|
};
|
|
|
|
|
2022-03-02 10:53:16 +00:00
|
|
|
struct timer_loop_params
|
|
|
|
{
|
2022-04-22 07:37:54 +00:00
|
|
|
stream_handle stream;
|
2022-03-02 10:53:16 +00:00
|
|
|
};
|
|
|
|
|
2022-03-04 09:54:19 +00:00
|
|
|
struct get_render_buffer_params
|
|
|
|
{
|
2022-04-22 07:37:54 +00:00
|
|
|
stream_handle stream;
|
2022-03-04 09:54:19 +00:00
|
|
|
UINT32 frames;
|
|
|
|
HRESULT result;
|
|
|
|
BYTE **data;
|
|
|
|
};
|
|
|
|
|
2022-03-04 09:54:20 +00:00
|
|
|
struct release_render_buffer_params
|
|
|
|
{
|
2022-04-22 07:37:54 +00:00
|
|
|
stream_handle stream;
|
2022-03-04 09:54:20 +00:00
|
|
|
UINT32 written_frames;
|
|
|
|
UINT flags;
|
|
|
|
HRESULT result;
|
|
|
|
};
|
|
|
|
|
2022-03-04 09:54:21 +00:00
|
|
|
struct get_capture_buffer_params
|
|
|
|
{
|
2022-04-22 07:37:54 +00:00
|
|
|
stream_handle stream;
|
2022-03-04 09:54:21 +00:00
|
|
|
HRESULT result;
|
|
|
|
BYTE **data;
|
|
|
|
UINT32 *frames;
|
|
|
|
UINT *flags;
|
|
|
|
UINT64 *devpos;
|
|
|
|
UINT64 *qpcpos;
|
|
|
|
};
|
|
|
|
|
2022-03-04 09:54:22 +00:00
|
|
|
struct release_capture_buffer_params
|
|
|
|
{
|
2022-04-22 07:37:54 +00:00
|
|
|
stream_handle stream;
|
2022-03-04 09:54:22 +00:00
|
|
|
UINT32 done;
|
|
|
|
HRESULT result;
|
|
|
|
};
|
|
|
|
|
2022-02-16 09:34:52 +00:00
|
|
|
struct is_format_supported_params
|
|
|
|
{
|
|
|
|
const char *alsa_name;
|
|
|
|
EDataFlow flow;
|
|
|
|
AUDCLNT_SHAREMODE share;
|
|
|
|
const WAVEFORMATEX *fmt_in;
|
|
|
|
WAVEFORMATEXTENSIBLE *fmt_out;
|
|
|
|
HRESULT result;
|
|
|
|
};
|
|
|
|
|
2022-02-16 09:34:51 +00:00
|
|
|
struct get_mix_format_params
|
|
|
|
{
|
|
|
|
const char *alsa_name;
|
|
|
|
EDataFlow flow;
|
|
|
|
WAVEFORMATEXTENSIBLE *fmt;
|
|
|
|
HRESULT result;
|
|
|
|
};
|
|
|
|
|
2022-02-23 09:08:21 +00:00
|
|
|
struct get_buffer_size_params
|
|
|
|
{
|
2022-04-22 07:37:54 +00:00
|
|
|
stream_handle stream;
|
2022-02-23 09:08:21 +00:00
|
|
|
HRESULT result;
|
|
|
|
UINT32 *size;
|
|
|
|
};
|
|
|
|
|
2022-02-23 09:08:22 +00:00
|
|
|
struct get_latency_params
|
|
|
|
{
|
2022-04-22 07:37:54 +00:00
|
|
|
stream_handle stream;
|
2022-02-23 09:08:22 +00:00
|
|
|
HRESULT result;
|
|
|
|
REFERENCE_TIME *latency;
|
|
|
|
};
|
|
|
|
|
2022-02-23 09:08:23 +00:00
|
|
|
struct get_current_padding_params
|
|
|
|
{
|
2022-04-22 07:37:54 +00:00
|
|
|
stream_handle stream;
|
2022-02-23 09:08:23 +00:00
|
|
|
HRESULT result;
|
|
|
|
UINT32 *padding;
|
|
|
|
};
|
|
|
|
|
2022-03-10 08:20:02 +00:00
|
|
|
struct get_next_packet_size_params
|
|
|
|
{
|
2022-04-22 07:37:54 +00:00
|
|
|
stream_handle stream;
|
2022-03-10 08:20:02 +00:00
|
|
|
HRESULT result;
|
|
|
|
UINT32 *frames;
|
|
|
|
};
|
|
|
|
|
2022-03-10 08:20:03 +00:00
|
|
|
struct get_frequency_params
|
|
|
|
{
|
2022-04-22 07:37:54 +00:00
|
|
|
stream_handle stream;
|
2022-03-10 08:20:03 +00:00
|
|
|
HRESULT result;
|
|
|
|
UINT64 *freq;
|
|
|
|
};
|
|
|
|
|
2022-03-10 08:20:04 +00:00
|
|
|
struct get_position_params
|
|
|
|
{
|
2022-04-22 07:37:54 +00:00
|
|
|
stream_handle stream;
|
2022-03-10 08:20:04 +00:00
|
|
|
HRESULT result;
|
|
|
|
UINT64 *pos;
|
|
|
|
UINT64 *qpctime;
|
|
|
|
};
|
|
|
|
|
2022-03-10 08:20:06 +00:00
|
|
|
struct set_volumes_params
|
|
|
|
{
|
2022-04-22 07:37:54 +00:00
|
|
|
stream_handle stream;
|
2022-03-10 08:20:06 +00:00
|
|
|
float master_volume;
|
|
|
|
const float *volumes;
|
|
|
|
const float *session_volumes;
|
|
|
|
};
|
|
|
|
|
2022-03-02 10:53:20 +00:00
|
|
|
struct set_event_handle_params
|
|
|
|
{
|
2022-04-22 07:37:54 +00:00
|
|
|
stream_handle stream;
|
2022-03-02 10:53:20 +00:00
|
|
|
HANDLE event;
|
|
|
|
HRESULT result;
|
|
|
|
};
|
|
|
|
|
2022-03-10 08:20:05 +00:00
|
|
|
struct is_started_params
|
|
|
|
{
|
2022-04-22 07:37:54 +00:00
|
|
|
stream_handle stream;
|
2022-03-10 08:20:05 +00:00
|
|
|
HRESULT result;
|
|
|
|
};
|
|
|
|
|
2022-03-14 10:21:46 +00:00
|
|
|
struct get_prop_value_params
|
|
|
|
{
|
|
|
|
const char *alsa_name;
|
|
|
|
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;
|
|
|
|
};
|
|
|
|
|
2022-03-15 16:19:02 +00:00
|
|
|
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;
|
|
|
|
};
|
|
|
|
|
2022-03-22 13:56:00 +00:00
|
|
|
struct midi_in_message_params
|
|
|
|
{
|
|
|
|
UINT dev_id;
|
|
|
|
UINT msg;
|
|
|
|
UINT_PTR user;
|
|
|
|
UINT_PTR param_1;
|
|
|
|
UINT_PTR param_2;
|
|
|
|
UINT *err;
|
2022-03-23 08:16:50 +00:00
|
|
|
struct notify_context *notify;
|
2022-03-22 13:56:00 +00:00
|
|
|
};
|
|
|
|
|
2022-03-23 08:16:53 +00:00
|
|
|
struct midi_notify_wait_params
|
|
|
|
{
|
|
|
|
BOOL *quit;
|
|
|
|
struct notify_context *notify;
|
|
|
|
};
|
|
|
|
|
2022-02-15 13:09:53 +00:00
|
|
|
enum alsa_funcs
|
|
|
|
{
|
|
|
|
alsa_get_endpoint_ids,
|
2022-02-22 08:14:18 +00:00
|
|
|
alsa_create_stream,
|
|
|
|
alsa_release_stream,
|
2022-03-02 10:53:17 +00:00
|
|
|
alsa_start,
|
2022-03-02 10:53:18 +00:00
|
|
|
alsa_stop,
|
2022-03-02 10:53:19 +00:00
|
|
|
alsa_reset,
|
2022-03-02 10:53:16 +00:00
|
|
|
alsa_timer_loop,
|
2022-03-04 09:54:19 +00:00
|
|
|
alsa_get_render_buffer,
|
2022-03-04 09:54:20 +00:00
|
|
|
alsa_release_render_buffer,
|
2022-03-04 09:54:21 +00:00
|
|
|
alsa_get_capture_buffer,
|
2022-03-04 09:54:22 +00:00
|
|
|
alsa_release_capture_buffer,
|
2022-02-16 09:34:52 +00:00
|
|
|
alsa_is_format_supported,
|
2022-02-16 09:34:51 +00:00
|
|
|
alsa_get_mix_format,
|
2022-02-23 09:08:21 +00:00
|
|
|
alsa_get_buffer_size,
|
2022-02-23 09:08:22 +00:00
|
|
|
alsa_get_latency,
|
2022-02-23 09:08:23 +00:00
|
|
|
alsa_get_current_padding,
|
2022-03-10 08:20:02 +00:00
|
|
|
alsa_get_next_packet_size,
|
2022-03-10 08:20:03 +00:00
|
|
|
alsa_get_frequency,
|
2022-03-10 08:20:04 +00:00
|
|
|
alsa_get_position,
|
2022-03-10 08:20:06 +00:00
|
|
|
alsa_set_volumes,
|
2022-03-02 10:53:20 +00:00
|
|
|
alsa_set_event_handle,
|
2022-03-10 08:20:05 +00:00
|
|
|
alsa_is_started,
|
2022-03-14 10:21:46 +00:00
|
|
|
alsa_get_prop_value,
|
2022-03-23 08:16:53 +00:00
|
|
|
alsa_midi_release,
|
2022-03-15 16:19:02 +00:00
|
|
|
alsa_midi_out_message,
|
2022-03-22 13:56:00 +00:00
|
|
|
alsa_midi_in_message,
|
2022-03-23 08:16:53 +00:00
|
|
|
alsa_midi_notify_wait,
|
2022-02-15 13:09:53 +00:00
|
|
|
};
|
|
|
|
|
2022-03-23 08:16:53 +00:00
|
|
|
NTSTATUS midi_release(void *args) DECLSPEC_HIDDEN;
|
2022-03-15 16:19:02 +00:00
|
|
|
NTSTATUS midi_out_message(void *args) DECLSPEC_HIDDEN;
|
2022-03-22 13:56:00 +00:00
|
|
|
NTSTATUS midi_in_message(void *args) DECLSPEC_HIDDEN;
|
2022-03-23 08:16:53 +00:00
|
|
|
NTSTATUS midi_notify_wait(void *args) DECLSPEC_HIDDEN;
|
2022-03-15 16:18:59 +00:00
|
|
|
|
2022-04-22 07:37:58 +00:00
|
|
|
#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;
|
|
|
|
#endif
|
|
|
|
|
2022-02-15 13:09:53 +00:00
|
|
|
extern unixlib_handle_t alsa_handle;
|
|
|
|
|
|
|
|
#define ALSA_CALL(func, params) __wine_unix_call(alsa_handle, alsa_ ## func, params)
|