2022-02-15 14:09:53 +01: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 10:34:49 +01:00
|
|
|
#include "audioclient.h"
|
|
|
|
|
2022-03-10 09:20:06 +01:00
|
|
|
struct alsa_stream;
|
2022-02-16 10:34:49 +01:00
|
|
|
|
2022-02-15 14:09:53 +01:00
|
|
|
struct endpoint
|
|
|
|
{
|
|
|
|
WCHAR *name;
|
|
|
|
char *device;
|
|
|
|
};
|
|
|
|
|
|
|
|
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 09:14:18 +01: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;
|
|
|
|
struct alsa_stream **stream;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct release_stream_params
|
|
|
|
{
|
|
|
|
struct alsa_stream *stream;
|
2022-03-02 11:53:16 +01:00
|
|
|
HANDLE timer_thread;
|
2022-02-22 09:14:18 +01:00
|
|
|
HRESULT result;
|
|
|
|
};
|
|
|
|
|
2022-03-02 11:53:17 +01:00
|
|
|
struct start_params
|
|
|
|
{
|
|
|
|
struct alsa_stream *stream;
|
|
|
|
HRESULT result;
|
|
|
|
};
|
|
|
|
|
2022-03-02 11:53:18 +01:00
|
|
|
struct stop_params
|
|
|
|
{
|
|
|
|
struct alsa_stream *stream;
|
|
|
|
HRESULT result;
|
|
|
|
};
|
|
|
|
|
2022-03-02 11:53:19 +01:00
|
|
|
struct reset_params
|
|
|
|
{
|
|
|
|
struct alsa_stream *stream;
|
|
|
|
HRESULT result;
|
|
|
|
};
|
|
|
|
|
2022-03-02 11:53:16 +01:00
|
|
|
struct timer_loop_params
|
|
|
|
{
|
|
|
|
struct alsa_stream *stream;
|
|
|
|
};
|
|
|
|
|
2022-03-04 10:54:19 +01:00
|
|
|
struct get_render_buffer_params
|
|
|
|
{
|
|
|
|
struct alsa_stream *stream;
|
|
|
|
UINT32 frames;
|
|
|
|
HRESULT result;
|
|
|
|
BYTE **data;
|
|
|
|
};
|
|
|
|
|
2022-03-04 10:54:20 +01:00
|
|
|
struct release_render_buffer_params
|
|
|
|
{
|
|
|
|
struct alsa_stream *stream;
|
|
|
|
UINT32 written_frames;
|
|
|
|
UINT flags;
|
|
|
|
HRESULT result;
|
|
|
|
};
|
|
|
|
|
2022-03-04 10:54:21 +01:00
|
|
|
struct get_capture_buffer_params
|
|
|
|
{
|
|
|
|
struct alsa_stream *stream;
|
|
|
|
HRESULT result;
|
|
|
|
BYTE **data;
|
|
|
|
UINT32 *frames;
|
|
|
|
UINT *flags;
|
|
|
|
UINT64 *devpos;
|
|
|
|
UINT64 *qpcpos;
|
|
|
|
};
|
|
|
|
|
2022-03-04 10:54:22 +01:00
|
|
|
struct release_capture_buffer_params
|
|
|
|
{
|
|
|
|
struct alsa_stream *stream;
|
|
|
|
UINT32 done;
|
|
|
|
HRESULT result;
|
|
|
|
};
|
|
|
|
|
2022-02-16 10:34:52 +01: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 10:34:51 +01:00
|
|
|
struct get_mix_format_params
|
|
|
|
{
|
|
|
|
const char *alsa_name;
|
|
|
|
EDataFlow flow;
|
|
|
|
WAVEFORMATEXTENSIBLE *fmt;
|
|
|
|
HRESULT result;
|
|
|
|
};
|
|
|
|
|
2022-02-23 10:08:21 +01:00
|
|
|
struct get_buffer_size_params
|
|
|
|
{
|
|
|
|
struct alsa_stream *stream;
|
|
|
|
HRESULT result;
|
|
|
|
UINT32 *size;
|
|
|
|
};
|
|
|
|
|
2022-02-23 10:08:22 +01:00
|
|
|
struct get_latency_params
|
|
|
|
{
|
|
|
|
struct alsa_stream *stream;
|
|
|
|
HRESULT result;
|
|
|
|
REFERENCE_TIME *latency;
|
|
|
|
};
|
|
|
|
|
2022-02-23 10:08:23 +01:00
|
|
|
struct get_current_padding_params
|
|
|
|
{
|
|
|
|
struct alsa_stream *stream;
|
|
|
|
HRESULT result;
|
|
|
|
UINT32 *padding;
|
|
|
|
};
|
|
|
|
|
2022-03-10 09:20:02 +01:00
|
|
|
struct get_next_packet_size_params
|
|
|
|
{
|
|
|
|
struct alsa_stream *stream;
|
|
|
|
HRESULT result;
|
|
|
|
UINT32 *frames;
|
|
|
|
};
|
|
|
|
|
2022-03-10 09:20:03 +01:00
|
|
|
struct get_frequency_params
|
|
|
|
{
|
|
|
|
struct alsa_stream *stream;
|
|
|
|
HRESULT result;
|
|
|
|
UINT64 *freq;
|
|
|
|
};
|
|
|
|
|
2022-03-10 09:20:04 +01:00
|
|
|
struct get_position_params
|
|
|
|
{
|
|
|
|
struct alsa_stream *stream;
|
|
|
|
HRESULT result;
|
|
|
|
UINT64 *pos;
|
|
|
|
UINT64 *qpctime;
|
|
|
|
};
|
|
|
|
|
2022-03-10 09:20:06 +01:00
|
|
|
struct set_volumes_params
|
|
|
|
{
|
|
|
|
struct alsa_stream *stream;
|
|
|
|
float master_volume;
|
|
|
|
const float *volumes;
|
|
|
|
const float *session_volumes;
|
|
|
|
};
|
|
|
|
|
2022-03-02 11:53:20 +01:00
|
|
|
struct set_event_handle_params
|
|
|
|
{
|
|
|
|
struct alsa_stream *stream;
|
|
|
|
HANDLE event;
|
|
|
|
HRESULT result;
|
|
|
|
};
|
|
|
|
|
2022-03-10 09:20:05 +01:00
|
|
|
struct is_started_params
|
|
|
|
{
|
|
|
|
struct alsa_stream *stream;
|
|
|
|
HRESULT result;
|
|
|
|
};
|
|
|
|
|
2022-03-14 11:21:46 +01: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 17:18:59 +01:00
|
|
|
#include <alsa/asoundlib.h>
|
|
|
|
#include "mmddk.h"
|
|
|
|
|
|
|
|
typedef struct midi_src
|
|
|
|
{
|
|
|
|
int state; /* -1 disabled, 0 is no recording started, 1 in recording, bit 2 set if in sys exclusive recording */
|
|
|
|
MIDIOPENDESC midiDesc;
|
|
|
|
WORD wFlags;
|
|
|
|
MIDIHDR *lpQueueHdr;
|
|
|
|
UINT startTime;
|
|
|
|
MIDIINCAPSW caps;
|
2022-03-15 17:19:00 +01:00
|
|
|
snd_seq_t *seq;
|
2022-03-15 17:18:59 +01:00
|
|
|
snd_seq_addr_t addr;
|
2022-03-15 17:19:00 +01:00
|
|
|
int port_in;
|
2022-03-15 17:18:59 +01:00
|
|
|
} WINE_MIDIIN;
|
|
|
|
|
|
|
|
typedef struct midi_dest
|
|
|
|
{
|
|
|
|
BOOL bEnabled;
|
|
|
|
MIDIOPENDESC midiDesc;
|
|
|
|
WORD wFlags;
|
|
|
|
MIDIOUTCAPSW caps;
|
2022-03-15 17:19:00 +01:00
|
|
|
snd_seq_t *seq;
|
2022-03-15 17:18:59 +01:00
|
|
|
snd_seq_addr_t addr;
|
|
|
|
int port_out;
|
|
|
|
} WINE_MIDIOUT;
|
|
|
|
|
|
|
|
struct midi_init_params
|
|
|
|
{
|
|
|
|
UINT *err;
|
|
|
|
unsigned int num_dests, num_srcs;
|
|
|
|
void *dests, *srcs;
|
|
|
|
};
|
|
|
|
|
2022-02-15 14:09:53 +01:00
|
|
|
enum alsa_funcs
|
|
|
|
{
|
|
|
|
alsa_get_endpoint_ids,
|
2022-02-22 09:14:18 +01:00
|
|
|
alsa_create_stream,
|
|
|
|
alsa_release_stream,
|
2022-03-02 11:53:17 +01:00
|
|
|
alsa_start,
|
2022-03-02 11:53:18 +01:00
|
|
|
alsa_stop,
|
2022-03-02 11:53:19 +01:00
|
|
|
alsa_reset,
|
2022-03-02 11:53:16 +01:00
|
|
|
alsa_timer_loop,
|
2022-03-04 10:54:19 +01:00
|
|
|
alsa_get_render_buffer,
|
2022-03-04 10:54:20 +01:00
|
|
|
alsa_release_render_buffer,
|
2022-03-04 10:54:21 +01:00
|
|
|
alsa_get_capture_buffer,
|
2022-03-04 10:54:22 +01:00
|
|
|
alsa_release_capture_buffer,
|
2022-02-16 10:34:52 +01:00
|
|
|
alsa_is_format_supported,
|
2022-02-16 10:34:51 +01:00
|
|
|
alsa_get_mix_format,
|
2022-02-23 10:08:21 +01:00
|
|
|
alsa_get_buffer_size,
|
2022-02-23 10:08:22 +01:00
|
|
|
alsa_get_latency,
|
2022-02-23 10:08:23 +01:00
|
|
|
alsa_get_current_padding,
|
2022-03-10 09:20:02 +01:00
|
|
|
alsa_get_next_packet_size,
|
2022-03-10 09:20:03 +01:00
|
|
|
alsa_get_frequency,
|
2022-03-10 09:20:04 +01:00
|
|
|
alsa_get_position,
|
2022-03-10 09:20:06 +01:00
|
|
|
alsa_set_volumes,
|
2022-03-02 11:53:20 +01:00
|
|
|
alsa_set_event_handle,
|
2022-03-10 09:20:05 +01:00
|
|
|
alsa_is_started,
|
2022-03-14 11:21:46 +01:00
|
|
|
alsa_get_prop_value,
|
2022-03-15 17:18:59 +01:00
|
|
|
alsa_midi_init,
|
2022-03-14 11:21:49 +01:00
|
|
|
|
|
|
|
alsa_midi_seq_lock, /* temporary */
|
2022-02-15 14:09:53 +01:00
|
|
|
};
|
|
|
|
|
2022-03-15 17:18:59 +01:00
|
|
|
NTSTATUS midi_init(void *args) DECLSPEC_HIDDEN;
|
|
|
|
|
2022-03-14 11:21:49 +01:00
|
|
|
NTSTATUS midi_seq_lock(void *args) DECLSPEC_HIDDEN;
|
|
|
|
|
2022-02-15 14:09:53 +01:00
|
|
|
extern unixlib_handle_t alsa_handle;
|
|
|
|
|
|
|
|
#define ALSA_CALL(func, params) __wine_unix_call(alsa_handle, alsa_ ## func, params)
|