2021-11-17 16:08:49 +01:00
|
|
|
/*
|
|
|
|
* Unixlib header file for winecoreaudio driver.
|
|
|
|
*
|
|
|
|
* Copyright 2021 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
|
|
|
|
*/
|
|
|
|
|
2021-11-17 16:09:29 +01:00
|
|
|
struct coreaudio_stream /* To be made private */
|
|
|
|
{
|
|
|
|
OSSpinLock lock;
|
|
|
|
AudioComponentInstance unit;
|
|
|
|
AudioConverterRef converter;
|
|
|
|
AudioStreamBasicDescription dev_desc; /* audio unit format, not necessarily the same as fmt */
|
|
|
|
AudioDeviceID dev_id;
|
|
|
|
EDataFlow flow;
|
|
|
|
AUDCLNT_SHAREMODE share;
|
|
|
|
|
|
|
|
BOOL playing;
|
|
|
|
UINT32 period_ms, period_frames;
|
|
|
|
UINT32 bufsize_frames, resamp_bufsize_frames;
|
|
|
|
UINT32 lcl_offs_frames, held_frames, wri_offs_frames, tmp_buffer_frames;
|
|
|
|
UINT32 cap_bufsize_frames, cap_offs_frames, cap_held_frames;
|
|
|
|
UINT32 wrap_bufsize_frames;
|
|
|
|
UINT64 written_frames;
|
|
|
|
INT32 getbuf_last;
|
|
|
|
WAVEFORMATEX *fmt;
|
|
|
|
BYTE *local_buffer, *cap_buffer, *wrap_buffer, *resamp_buffer, *tmp_buffer;
|
2021-11-18 08:52:32 +01:00
|
|
|
SIZE_T local_buffer_size, tmp_buffer_size;
|
2021-11-17 16:09:29 +01:00
|
|
|
};
|
|
|
|
|
2021-11-17 16:08:49 +01:00
|
|
|
struct endpoint
|
|
|
|
{
|
|
|
|
WCHAR *name;
|
|
|
|
DWORD id;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct get_endpoint_ids_params
|
|
|
|
{
|
|
|
|
EDataFlow flow;
|
|
|
|
struct endpoint *endpoints;
|
|
|
|
unsigned int size;
|
|
|
|
HRESULT result;
|
|
|
|
unsigned int num;
|
|
|
|
unsigned int default_idx;
|
|
|
|
};
|
|
|
|
|
2021-11-18 08:52:37 +01:00
|
|
|
struct create_stream_params
|
|
|
|
{
|
|
|
|
DWORD dev_id;
|
|
|
|
EDataFlow flow;
|
|
|
|
AUDCLNT_SHAREMODE share;
|
|
|
|
REFERENCE_TIME duration;
|
|
|
|
REFERENCE_TIME period;
|
|
|
|
const WAVEFORMATEX *fmt;
|
|
|
|
HRESULT result;
|
|
|
|
struct coreaudio_stream *stream;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct release_stream_params
|
|
|
|
{
|
|
|
|
struct coreaudio_stream *stream;
|
|
|
|
HRESULT result;
|
|
|
|
};
|
|
|
|
|
2021-11-23 08:55:03 +01:00
|
|
|
struct start_params
|
|
|
|
{
|
|
|
|
struct coreaudio_stream *stream;
|
|
|
|
HRESULT result;
|
|
|
|
};
|
|
|
|
|
2021-11-23 08:55:04 +01:00
|
|
|
struct stop_params
|
|
|
|
{
|
|
|
|
struct coreaudio_stream *stream;
|
|
|
|
HRESULT result;
|
|
|
|
};
|
|
|
|
|
2021-11-23 08:55:05 +01:00
|
|
|
struct reset_params
|
|
|
|
{
|
|
|
|
struct coreaudio_stream *stream;
|
|
|
|
HRESULT result;
|
|
|
|
};
|
|
|
|
|
2021-11-23 08:55:06 +01:00
|
|
|
struct get_render_buffer_params
|
|
|
|
{
|
|
|
|
struct coreaudio_stream *stream;
|
|
|
|
UINT32 frames;
|
|
|
|
HRESULT result;
|
|
|
|
BYTE **data;
|
|
|
|
};
|
|
|
|
|
2021-11-23 08:55:07 +01:00
|
|
|
struct release_render_buffer_params
|
|
|
|
{
|
|
|
|
struct coreaudio_stream *stream;
|
|
|
|
UINT32 frames;
|
|
|
|
DWORD flags;
|
|
|
|
HRESULT result;
|
|
|
|
};
|
|
|
|
|
2021-11-23 08:55:08 +01:00
|
|
|
struct get_capture_buffer_params
|
|
|
|
{
|
|
|
|
struct coreaudio_stream *stream;
|
|
|
|
HRESULT result;
|
|
|
|
BYTE **data;
|
|
|
|
UINT32 *frames;
|
|
|
|
DWORD *flags;
|
|
|
|
UINT64 *devpos;
|
|
|
|
UINT64 *qpcpos;
|
|
|
|
};
|
|
|
|
|
2021-11-23 08:55:09 +01:00
|
|
|
struct release_capture_buffer_params
|
|
|
|
{
|
|
|
|
struct coreaudio_stream *stream;
|
|
|
|
UINT32 done;
|
|
|
|
HRESULT result;
|
|
|
|
};
|
|
|
|
|
2021-11-18 08:52:38 +01:00
|
|
|
struct get_mix_format_params
|
|
|
|
{
|
|
|
|
EDataFlow flow;
|
|
|
|
DWORD dev_id;
|
|
|
|
WAVEFORMATEXTENSIBLE *fmt;
|
|
|
|
HRESULT result;
|
|
|
|
};
|
|
|
|
|
2021-11-23 08:54:58 +01:00
|
|
|
struct is_format_supported_params
|
|
|
|
{
|
|
|
|
EDataFlow flow;
|
|
|
|
DWORD dev_id;
|
|
|
|
AUDCLNT_SHAREMODE share;
|
|
|
|
const WAVEFORMATEX *fmt_in;
|
|
|
|
WAVEFORMATEXTENSIBLE *fmt_out;
|
|
|
|
HRESULT result;
|
|
|
|
};
|
|
|
|
|
2021-11-23 08:55:00 +01:00
|
|
|
struct get_buffer_size_params
|
|
|
|
{
|
|
|
|
struct coreaudio_stream *stream;
|
|
|
|
HRESULT result;
|
|
|
|
UINT32 *frames;
|
|
|
|
};
|
|
|
|
|
2021-11-23 08:55:01 +01:00
|
|
|
struct get_latency_params
|
|
|
|
{
|
|
|
|
struct coreaudio_stream *stream;
|
|
|
|
HRESULT result;
|
|
|
|
REFERENCE_TIME *latency;
|
|
|
|
};
|
|
|
|
|
2021-11-23 08:55:02 +01:00
|
|
|
struct get_current_padding_params
|
|
|
|
{
|
|
|
|
struct coreaudio_stream *stream;
|
|
|
|
HRESULT result;
|
|
|
|
UINT32 *padding;
|
|
|
|
};
|
|
|
|
|
2021-11-24 12:26:44 +01:00
|
|
|
struct get_next_packet_size_params
|
|
|
|
{
|
|
|
|
struct coreaudio_stream *stream;
|
|
|
|
HRESULT result;
|
|
|
|
UINT32 *frames;
|
|
|
|
};
|
|
|
|
|
2021-11-24 12:26:45 +01:00
|
|
|
struct get_position_params
|
|
|
|
{
|
|
|
|
struct coreaudio_stream *stream;
|
|
|
|
HRESULT result;
|
|
|
|
UINT64 *pos;
|
|
|
|
UINT64 *qpctime;
|
|
|
|
};
|
|
|
|
|
2021-11-24 12:26:46 +01:00
|
|
|
struct get_frequency_params
|
|
|
|
{
|
|
|
|
struct coreaudio_stream *stream;
|
|
|
|
HRESULT result;
|
|
|
|
UINT64 *freq;
|
|
|
|
};
|
|
|
|
|
2021-11-24 12:26:47 +01:00
|
|
|
struct is_started_params
|
|
|
|
{
|
|
|
|
struct coreaudio_stream *stream;
|
|
|
|
HRESULT result;
|
|
|
|
};
|
|
|
|
|
2021-11-17 16:08:49 +01:00
|
|
|
enum unix_funcs
|
|
|
|
{
|
|
|
|
unix_get_endpoint_ids,
|
2021-11-18 08:52:37 +01:00
|
|
|
unix_create_stream,
|
|
|
|
unix_release_stream,
|
2021-11-23 08:55:03 +01:00
|
|
|
unix_start,
|
2021-11-23 08:55:04 +01:00
|
|
|
unix_stop,
|
2021-11-23 08:55:05 +01:00
|
|
|
unix_reset,
|
2021-11-23 08:55:06 +01:00
|
|
|
unix_get_render_buffer,
|
2021-11-23 08:55:07 +01:00
|
|
|
unix_release_render_buffer,
|
2021-11-23 08:55:08 +01:00
|
|
|
unix_get_capture_buffer,
|
2021-11-23 08:55:09 +01:00
|
|
|
unix_release_capture_buffer,
|
2021-11-18 08:52:38 +01:00
|
|
|
unix_get_mix_format,
|
2021-11-23 08:54:58 +01:00
|
|
|
unix_is_format_supported,
|
2021-11-23 08:55:00 +01:00
|
|
|
unix_get_buffer_size,
|
2021-11-23 08:55:01 +01:00
|
|
|
unix_get_latency,
|
2021-11-23 08:55:02 +01:00
|
|
|
unix_get_current_padding,
|
2021-11-24 12:26:44 +01:00
|
|
|
unix_get_next_packet_size,
|
2021-11-24 12:26:45 +01:00
|
|
|
unix_get_position,
|
2021-11-24 12:26:46 +01:00
|
|
|
unix_get_frequency,
|
2021-11-24 12:26:47 +01:00
|
|
|
unix_is_started,
|
2021-11-17 16:08:49 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
extern unixlib_handle_t coreaudio_handle;
|
|
|
|
|
|
|
|
#define UNIX_CALL( func, params ) __wine_unix_call( coreaudio_handle, unix_ ## func, params )
|