1/* multi_audio.h */
2
3/* Interface description for drivers implementing studio-level audio I/O with */
4/* possible auxillary functions (transport, time code, etc). */
5/* Copyright © 1998-1999 Be Incorporated. All rights reserved. */
6
7/* This is the first release candidate for the API. Unless we hear feedback that */
8/* forces a change before the end of August, we will try to stay binary compatible */
9/* with this interface. */
10/* Send feedback to trinity@be.com [1999-07-02] */
11
12#if !defined(_MULTI_AUDIO_H)
13#define _MULTI_AUDIO_H
14
15#include <Drivers.h>
16
17#ifndef ASSERT
18#include <Debug.h>
19#endif
20
21#define B_MULTI_DRIVER_BASE (B_AUDIO_DRIVER_BASE+20)
22
23enum {	/* open() modes */
24	/*	O_RDONLY is 0, O_WRONLY is 1, O_RDWR is 2	*/
25	B_MULTI_CONTROL = 3
26};
27
28/* ioctl codes */
29enum {
30	/* multi_description */
31	B_MULTI_GET_DESCRIPTION = B_MULTI_DRIVER_BASE,
32	/* multi_event_handling */
33	B_MULTI_GET_EVENT_INFO,
34	B_MULTI_SET_EVENT_INFO,
35	B_MULTI_GET_EVENT,
36	/* multi_channel_enable */
37	B_MULTI_GET_ENABLED_CHANNELS,
38	B_MULTI_SET_ENABLED_CHANNELS,
39	/* multi_format_info */
40	B_MULTI_GET_GLOBAL_FORMAT,
41	B_MULTI_SET_GLOBAL_FORMAT,		/* always sets for all channels, always implemented */
42	/* multi_channel_formats */
43	B_MULTI_GET_CHANNEL_FORMATS,
44	B_MULTI_SET_CHANNEL_FORMATS,	/* only implemented if possible */
45	/* multi_mix_value_info */
46	B_MULTI_GET_MIX,
47	B_MULTI_SET_MIX,
48	/* multi_mix_channel_info */
49	B_MULTI_LIST_MIX_CHANNELS,
50	/* multi_mix_control_info */
51	B_MULTI_LIST_MIX_CONTROLS,
52	/* multi_mix_connection_info */
53	B_MULTI_LIST_MIX_CONNECTIONS,
54	/* multi_buffer_list */
55	B_MULTI_GET_BUFFERS,			/* Fill out the struct for the first time; doesn't start anything. */
56	B_MULTI_SET_BUFFERS,			/* Set what buffers to use, if the driver supports soft buffers. */
57	/* bigtime_t */
58	B_MULTI_SET_START_TIME,			/* When to actually start */
59	/* multi_buffer_info */
60	B_MULTI_BUFFER_EXCHANGE,		/* stop and go are derived from this being called */
61	B_MULTI_BUFFER_FORCE_STOP,		/* force stop of playback */
62	/* extension protocol */
63	B_MULTI_LIST_EXTENSIONS,		/* get a list of supported extensions */
64	B_MULTI_GET_EXTENSION,			/* get the value of an extension (or return error if not supported) */
65	B_MULTI_SET_EXTENSION,			/* set the value of an extension */
66	/* multi_mode_list */
67	B_MULTI_LIST_MODES,				/* get a list of possible modes (multi_mode_list * arg) */
68	B_MULTI_GET_MODE,				/* get the current mode (int32 * arg) */
69	B_MULTI_SET_MODE				/* set a new mode (int32 * arg) */
70};
71
72/* sample rate values */
73/* various fixed sample rates we support (for hard-sync clocked values) */
74#define B_SR_8000 0x1
75#define B_SR_11025 0x2
76#define B_SR_12000 0x4
77#define B_SR_16000 0x8
78#define B_SR_22050 0x10
79#define B_SR_24000 0x20
80#define B_SR_32000 0x40
81#define B_SR_44100 0x80
82#define B_SR_48000 0x100
83#define B_SR_64000 0x200
84#define B_SR_88200 0x400
85#define B_SR_96000 0x800
86#define B_SR_176400 0x1000
87#define B_SR_192000 0x2000
88#define B_SR_384000 0x4000
89#define B_SR_1536000 0x10000
90/* continuously variable sample rate (typically board-generated) */
91#define B_SR_CVSR 0x10000000UL
92/* sample rate parameter global to all channels (input and output rates respectively) */
93#define B_SR_IS_GLOBAL 0x80000000UL
94/* output sample rate locked to input sample rate (output_rates only; the common case!) */
95#define B_SR_SAME_AS_INPUT 0x40000000UL
96
97
98/* format values */
99/* signed char */
100#define B_FMT_8BIT_S 0x01
101/* unsigned char -- this is special case */
102#define B_FMT_8BIT_U 0x02
103/* traditional 16 bit signed format (host endian) */
104#define B_FMT_16BIT 0x10
105/* left-adjusted in 32 bit signed word */
106#define B_FMT_18BIT 0x20
107#define B_FMT_20BIT 0x40
108#define B_FMT_24BIT 0x100
109#define B_FMT_32BIT 0x1000
110/* 32-bit floating point, -1.0 to 1.0 */
111#define B_FMT_FLOAT 0x20000
112/* 64-bit floating point, -1.0 to 1.0 */
113#define B_FMT_DOUBLE 0x40000
114/* 80-bit floating point, -1.0 to 1.0 */
115#define B_FMT_EXTENDED 0x80000
116/* bit stream */
117#define B_FMT_BITSTREAM 0x1000000
118/* format parameter global to all channels (input and output formats respectively) */
119#define B_FMT_IS_GLOBAL 0x80000000UL
120/* output format locked to input format (output_formats) */
121#define B_FMT_SAME_AS_INPUT 0x40000000UL
122
123/*	possible sample lock sources */
124#define B_MULTI_LOCK_INPUT_CHANNEL 0x0	/* lock_source_data is channel id */
125#define B_MULTI_LOCK_INTERNAL 0x1
126#define B_MULTI_LOCK_WORDCLOCK 0x2
127#define B_MULTI_LOCK_SUPERCLOCK 0x4
128#define B_MULTI_LOCK_LIGHTPIPE 0x8
129#define B_MULTI_LOCK_VIDEO 0x10			/* or blackburst */
130#define B_MULTI_LOCK_FIRST_CARD 0x20	/* if you have more than one card */
131#define B_MULTI_LOCK_MTC 0x40
132#define B_MULTI_LOCK_SPDIF 0x80
133
134/* possible timecode sources */
135#define B_MULTI_TIMECODE_MTC 0x1
136#define B_MULTI_TIMECODE_VTC 0x2
137#define B_MULTI_TIMECODE_SMPTE 0x4
138#define B_MULTI_TIMECODE_SUPERCLOCK 0x8
139#define B_MULTI_TIMECODE_FIREWIRE 0x10
140
141/* interface_flags values */
142/* Available functions on this device. */
143#define B_MULTI_INTERFACE_PLAYBACK 0x1
144#define B_MULTI_INTERFACE_RECORD 0x2
145#define B_MULTI_INTERFACE_TRANSPORT 0x4
146#define B_MULTI_INTERFACE_TIMECODE 0x8
147/* "Soft" buffers means you can change the pointer values and the driver will still be happy. */
148#define B_MULTI_INTERFACE_SOFT_PLAY_BUFFERS 0x10000
149#define B_MULTI_INTERFACE_SOFT_REC_BUFFERS 0x20000
150/* Whether the data stream is interrupted when changing channel enables. */
151#define B_MULTI_INTERFACE_CLICKS_WHEN_ENABLING_OUTPUTS 0x40000
152#define B_MULTI_INTERFACE_CLICKS_WHEN_ENABLING_INPUTS 0x80000
153
154#define B_CURRENT_INTERFACE_VERSION 0x4502
155#define B_MINIMUM_INTERFACE_VERSION 0x4502
156
157typedef struct multi_description multi_description;
158typedef struct multi_channel_info multi_channel_info;
159struct multi_description {
160
161	size_t			info_size;			/* sizeof(multi_description) */
162	uint32			interface_version;	/* current version of interface that's implemented */
163	uint32			interface_minimum;	/* minimum version required to understand driver */
164
165	char			friendly_name[32];	/* name displayed to user (C string) */
166	char			vendor_info[32];	/* name used internally by vendor (C string) */
167
168	int32			output_channel_count;
169	int32			input_channel_count;
170	int32			output_bus_channel_count;
171	int32			input_bus_channel_count;
172	int32			aux_bus_channel_count;
173
174	int32			request_channel_count;		/* how many channel_infos are there */
175	multi_channel_info *
176					channels;
177
178	uint32			output_rates;
179	uint32			input_rates;
180	float			min_cvsr_rate;
181	float			max_cvsr_rate;
182	uint32			output_formats;
183	uint32			input_formats;
184	uint32			lock_sources;
185	uint32			timecode_sources;
186
187	uint32			interface_flags;
188	bigtime_t		start_latency;		/* how much in advance driver needs SET_START_TIME */
189
190	uint32			_reserved_[11];
191
192	char			control_panel[64];	/* MIME type of control panel application */
193};
194
195#if !defined(_MEDIA_DEFS_H)	/* enum in MediaDefs.h */
196/* designation values */
197/* mono channels have no designation */
198#define B_CHANNEL_LEFT 0x1
199#define B_CHANNEL_RIGHT 0x2
200#define B_CHANNEL_CENTER 0x4			/* 5.1+ or fake surround */
201#define B_CHANNEL_SUB 0x8				/* 5.1+ */
202#define B_CHANNEL_REARLEFT 0x10			/* quad surround or 5.1+ */
203#define B_CHANNEL_REARRIGHT 0x20		/* quad surround or 5.1+ */
204#define B_CHANNEL_FRONT_LEFT_CENTER 0x40
205#define B_CHANNEL_FRONT_RIGHT_CENTER 0x80
206#define B_CHANNEL_BACK_CENTER 0x100		/* 6.1 or fake surround */
207#define B_CHANNEL_SIDE_LEFT 0x200
208#define B_CHANNEL_SIDE_RIGHT 0x400
209#define B_CHANNEL_TOP_CENTER 0x800
210#define B_CHANNEL_TOP_FRONT_LEFT 0x1000
211#define B_CHANNEL_TOP_FRONT_CENTER 0x2000
212#define B_CHANNEL_TOP_FRONT_RIGHT 0x4000
213#define B_CHANNEL_TOP_BACK_LEFT 0x8000
214#define B_CHANNEL_TOP_BACK_CENTER 0x10000
215#define B_CHANNEL_TOP_BACK_RIGHT 0x20000
216#endif
217
218#define B_CHANNEL_MONO_BUS 0x4000000
219#define B_CHANNEL_STEREO_BUS 0x2000000		/* + left/right */
220#define B_CHANNEL_SURROUND_BUS 0x1000000	/* multichannel */
221
222/* If you have interactions where some inputs can not be used when some */
223/* outputs are used, mark both inputs and outputs with this flag. */
224#define B_CHANNEL_INTERACTION 0x80000000UL
225/* If input channel #n is simplexed with output channel #n, they should both */
226/* have this flag set (different from the previous flag, which is more vague). */
227#define B_CHANNEL_SIMPLEX 0x40000000UL
228
229/* connector values */
230/* analog connectors */
231#define B_CHANNEL_RCA 0x1
232#define B_CHANNEL_XLR 0x2
233#define B_CHANNEL_TRS 0x4
234#define B_CHANNEL_QUARTER_INCH_MONO 0x8
235#define B_CHANNEL_MINI_JACK_STEREO 0x10
236#define B_CHANNEL_QUARTER_INCH_STEREO 0x20
237#define B_CHANNEL_ANALOG_HEADER 0x100	/* internal on card */
238#define B_CHANNEL_SNAKE 0x200			/* or D-sub */
239/* digital connectors (stereo) */
240#define B_CHANNEL_OPTICAL_SPDIF 0x1000
241#define B_CHANNEL_COAX_SPDIF 0x2000
242#define B_CHANNEL_COAX_EBU 0x4000
243#define B_CHANNEL_XLR_EBU 0x8000
244#define B_CHANNEL_TRS_EBU 0x10000
245#define B_CHANNEL_SPDIF_HEADER 0x20000	/* internal on card */
246/* multi-channel digital connectors */
247#define B_CHANNEL_LIGHTPIPE 0x100000
248#define B_CHANNEL_TDIF 0x200000
249#define B_CHANNEL_FIREWIRE 0x400000
250#define B_CHANNEL_USB 0x800000
251/* If you have multiple output connectors, only one of which can */
252/* be active at a time. */
253#define B_CHANNEL_EXCLUSIVE_SELECTION 0x80000000UL
254
255
256typedef enum {
257	B_MULTI_NO_CHANNEL_KIND,
258	B_MULTI_OUTPUT_CHANNEL = 0x1,
259	B_MULTI_INPUT_CHANNEL = 0x2,
260	B_MULTI_OUTPUT_BUS = 0x4,
261	B_MULTI_INPUT_BUS = 0x8,
262	B_MULTI_AUX_BUS = 0x10
263} channel_kind;
264
265struct multi_channel_info {
266	int32			channel_id;
267	channel_kind	kind;
268	uint32			designations;
269	uint32			connectors;
270	uint32			_reserved_[4];
271};
272
273
274/* Constants */
275#define B_MULTI_EVENT_MINMAX		16
276/* Event flags/masks */
277#define B_MULTI_EVENT_TRANSPORT 	0x40000000UL
278#define B_MULTI_EVENT_HAS_TIMECODE 	0x80000000UL
279
280/* possible transport events */
281#define B_MULTI_EVENT_NONE			0x00000000UL
282#define B_MULTI_EVENT_START 		0x40010000UL
283#define B_MULTI_EVENT_LOCATION 		0x40020000UL		/* location when shuttling or locating */
284#define B_MULTI_EVENT_SHUTTLING 	0x40040000UL
285#define B_MULTI_EVENT_STOP 			0x40080000UL
286#define B_MULTI_EVENT_RECORD 		0x40100000UL
287#define B_MULTI_EVENT_PAUSE 		0x40200000UL
288#define B_MULTI_EVENT_RUNNING 		0x40400000UL		/* location when running */
289/* possible device events */
290enum {
291	B_MULTI_EVENT_STARTED				= 0x1,
292	B_MULTI_EVENT_STOPPED				= 0x2,
293	B_MULTI_EVENT_CHANNEL_FORMAT_CHANGED= 0x4,
294	B_MULTI_EVENT_BUFFER_OVERRUN 		= 0x8,
295	B_MULTI_EVENT_SIGNAL_LOST 			= 0x10,
296	B_MULTI_EVENT_SIGNAL_DETECTED 		= 0x20,
297	B_MULTI_EVENT_CLOCK_LOST 			= 0x40,
298	B_MULTI_EVENT_CLOCK_DETECTED 		= 0x80,
299	B_MULTI_EVENT_NEW_MODE 				= 0x100,
300	B_MULTI_EVENT_CONTROL_CHANGED 		= 0x200
301};
302
303typedef struct multi_get_event_info multi_get_event_info;
304struct multi_get_event_info {
305	size_t		info_size;		/* sizeof(multi_get_event_info) */
306	uint32		supported_mask;	/* what events h/w supports */
307	uint32		current_mask;	/* current driver value */
308	uint32		queue_size;		/* current queue size */
309	uint32		event_count;	/* number of events currently in queue*/
310	uint32		_reserved[3];
311};
312
313typedef struct multi_set_event_info multi_set_event_info;
314struct multi_set_event_info {
315	size_t		info_size;		/* sizeof(multi_set_event_info) */
316	uint32		in_mask;		/* what events to wait for */
317	int32		semaphore;		/* semaphore app will wait on */
318	uint32		queue_size;		/* minimum number of events to save */
319	uint32		_reserved[4];
320};
321
322typedef struct multi_get_event multi_get_event;
323struct multi_get_event {
324	size_t		info_size;		/* sizeof(multi_get_event) */
325	uint32		event;
326	bigtime_t	timestamp;		/* real time at which event was received */
327	int32		count;			/* used for configuration events */
328	union {
329			int32		channels[100];
330			uint32		clocks;
331			int32		mode;
332			int32		controls[100];
333			struct { /* transport event */
334				float		out_rate;		/* what rate it's now playing at */
335				int32		out_hours;		/* location at the time given */
336				int32		out_minutes;
337				int32		out_seconds;
338				int32		out_frames;
339			}transport;
340			char			_reserved_[400];
341	#if defined(__cplusplus)
342		};
343	#else
344		} u;
345	#endif
346	uint32	_reserved_1[10];
347};
348
349typedef struct multi_channel_enable multi_channel_enable;
350struct multi_channel_enable {
351	size_t			info_size;			/* sizeof(multi_channel_enable) */
352	/* this must have bytes for all channels (see multi_description) */
353	/* channel 0 is lowest bit of first byte */
354	uchar *			enable_bits;
355
356	uint32			lock_source;
357	int32			lock_data;
358	uint32			timecode_source;
359	uint32 *		connectors;			/* which connector(s) is/are active, per channel */
360};
361
362#include <stdio.h>
363
364#if defined(__cplusplus)
365	inline void B_SET_CHANNEL(void * bits, int channel, bool value)
366	{
367		ASSERT(channel>=0);
368		(((uchar *)(bits))[((channel)&0x7fff)>>3] =
369			(((uchar *)(bits))[((channel)&0x7fff)>>3] & ~(1<<((channel)&0x7))) |
370			((value) ? (1<<((channel)&0x7)) : 0));
371	}
372	inline bool B_TEST_CHANNEL(const void * bits, int channel)
373	{
374		return ((((uchar *)(bits))[((channel)&0x7fff)>>3] >> ((channel)&0x7)) & 1);
375	}
376#else
377	#define B_SET_CHANNEL(bits, channel, value) \
378		ASSERT(channel>=0); \
379		(((uchar *)(bits))[((channel)&0x7fff)>>3] = \
380			(((uchar *)(bits))[((channel)&0x7fff)>>3] & ~(1<<((channel)&0x7))) | \
381			((value) ? (1<<((channel)&0x7)) : 0))
382	#define B_TEST_CHANNEL(bits, channel) \
383		((((uchar *)(bits))[((channel)&0x7fff)>>3] >> ((channel)&0x7)) & 1)
384#endif
385
386typedef struct multi_channel_formats multi_channel_formats;
387typedef struct multi_format_info multi_format_info;
388typedef struct _multi_format _multi_format;
389
390struct _multi_format {
391	uint32			rate;
392	float			cvsr;
393	uint32			format;
394	uint32			_reserved_[3];
395};
396enum {	/* timecode kinds */
397	B_MULTI_NO_TIMECODE,
398	B_MULTI_TIMECODE_30,			/* MIDI */
399	B_MULTI_TIMECODE_30_DROP_2,		/* NTSC */
400	B_MULTI_TIMECODE_30_DROP_4,		/* Brazil */
401	B_MULTI_TIMECODE_25,			/* PAL */
402	B_MULTI_TIMECODE_24				/* Film */
403};
404struct multi_format_info {
405	size_t			info_size;			/* sizeof(multi_format_info) */
406	bigtime_t		output_latency;
407	bigtime_t		input_latency;
408	int32			timecode_kind;
409	uint32			_reserved_[7];
410	_multi_format	input;
411	_multi_format	output;
412};
413struct multi_channel_formats {
414	size_t			info_size;			/* sizeof(multi_channel_formats) */
415	int32			request_channel_count;
416	int32			request_first_channel;
417	int32			returned_channel_count;
418	int32			timecode_kind;
419	int32			_reserved_[4];
420	_multi_format *
421					channels;
422	bigtime_t *		latencies;			/* DMA/hardware latencies; client calculates for buffers */
423};
424
425
426typedef struct multi_mix_value multi_mix_value;
427struct multi_mix_value {
428	int32			id;
429	union {
430		float			gain;
431		uint32			mux;	/* bitmask of mux points */
432		bool			enable;
433		uint32			_reserved_[2];
434#if defined(__cplusplus)
435	};
436#else
437	} u;
438#endif
439	int32			ramp;
440	uint32			_reserved_2[2];
441};
442
443typedef struct multi_mix_value_info multi_mix_value_info;
444struct multi_mix_value_info {
445	size_t			info_size;		/* sizeof(multi_mix_value_info) */
446	int32			item_count;
447	multi_mix_value *
448					values;
449	int32			at_frame;		/* time at which to start the change */
450};
451
452//	only one of these should be set
453#define B_MULTI_MIX_JUNCTION 0x1
454#define B_MULTI_MIX_GAIN 0x2
455#define B_MULTI_MIX_MUX 0x4
456#define B_MULTI_MIX_ENABLE 0x8
457#define B_MULTI_MIX_KIND_MASK 0xffff
458//	any combination of these can be set
459#define B_MULTI_MIX_RAMP 0x10000
460
461typedef struct multi_mix_control multi_mix_control;
462struct multi_mix_control {
463	int32			id;				/* unique for device -- not same id as any channel/bus ! */
464	uint32			flags;			/* including kind */
465	int32			master;			/* or 0 if it's not slaved */
466	union {
467		struct {
468			float			min_gain;		/* dB */
469			float			max_gain;		/* dB */
470			float			granularity;	/* dB */
471		}			gain;
472		struct {
473			uint32			_reserved;
474		}			mux;
475		struct {
476			uint32			_reserved;
477		}			enable;
478		uint32		_reserved[12];
479#if defined(__cplusplus)
480	};
481#else
482	}				u;
483#endif
484	char			name[32];
485};
486
487typedef struct multi_mix_channel_info multi_mix_channel_info;
488struct multi_mix_channel_info {
489	size_t			info_size;		/* sizeof(multi_mix_channel_info) */
490	int32			channel_count;
491	int32 *			channels;		/* allocated by caller, lists requested channels */
492	int32			max_count;		/* in: control ids per channel */
493	int32			actual_count;	/* out: actual max # controls for any individual requested channel */
494	int32 **		controls;
495};
496
497typedef struct multi_mix_control_info multi_mix_control_info;
498struct multi_mix_control_info {
499	size_t			info_size;		/* sizeof(multi_mix_control_info) */
500	int32			control_count;	/* in: number of controls */
501	multi_mix_control *
502					controls;		/* allocated by caller, returns control description for each */
503};
504
505typedef struct multi_mix_connection multi_mix_connection;
506struct multi_mix_connection {
507	int32			from;
508	int32			to;
509	uint32			_reserved_[2];
510};
511
512typedef struct multi_mix_connection_info multi_mix_connection_info;
513struct multi_mix_connection_info {
514	size_t			info_size;
515	int32			max_count;		/* in: available space */
516	int32			actual_count;	/* out: actual count */
517	multi_mix_connection *
518					connections;	/* allocated by caller, returns connections */
519};
520
521
522/* possible flags values for what is available (in and out) */
523#define B_MULTI_BUFFER_PLAYBACK 0x1
524#define B_MULTI_BUFFER_RECORD 0x2
525#define B_MULTI_BUFFER_METERING 0x4
526#define B_MULTI_BUFFER_TIMECODE 0x40000
527
528typedef struct multi_buffer_list multi_buffer_list;
529typedef struct buffer_desc buffer_desc;
530/* This struct is used to query the driver about what buffers it will use, */
531/* and to tell it what buffers to use if it supports soft buffers. */
532struct multi_buffer_list {
533
534	size_t			info_size;				/* sizeof(multi_buffer_list) */
535	uint32			flags;
536
537	int32			request_playback_buffers;
538	int32			request_playback_channels;
539	uint32			request_playback_buffer_size;		/* frames per buffer */
540	int32			return_playback_buffers;			/* playback_buffers[b][] */
541	int32			return_playback_channels;			/* playback_buffers[][c] */
542	uint32			return_playback_buffer_size;		/* frames */
543	buffer_desc **	playback_buffers;
544	void *			_reserved_1;
545
546	int32			request_record_buffers;
547	int32			request_record_channels;
548	uint32			request_record_buffer_size;			/* frames per buffer */
549	int32			return_record_buffers;
550	int32			return_record_channels;
551	uint32			return_record_buffer_size;			/* frames */
552	buffer_desc **	record_buffers;
553	void *			_reserved_2;
554
555};
556
557struct buffer_desc {
558	char *			base;		/* pointer to first sample for channel for buffer */
559	size_t			stride;		/* offset to next sample */
560	uint32			_reserved_[2];
561};
562
563
564/* This struct is used when actually queuing data to be played, and/or */
565/* receiving data from a recorder. */
566typedef struct multi_buffer_info multi_buffer_info;
567struct multi_buffer_info {
568
569	size_t			info_size;			/* sizeof(multi_buffer_info) */
570	uint32			flags;
571
572	bigtime_t		played_real_time;
573	bigtime_t		played_frames_count;
574	int32			_reserved_0;
575	int32			playback_buffer_cycle;
576
577	bigtime_t		recorded_real_time;
578	bigtime_t		recorded_frames_count;
579	int32			_reserved_1;
580	int32			record_buffer_cycle;
581
582	int32			meter_channel_count;
583	char *			meters_peak;	/* in the same format as the data; allocated by caller */
584	char *			meters_average;	/* in the same format as the data; allocated by caller */
585
586	/*	timecode sent and received at buffer swap	*/
587	int32			hours;
588	int32			minutes;
589	int32			seconds;
590	int32			tc_frames;		/* for timecode frames as opposed to sample frames */
591	int32			at_frame_delta;	/* how far into buffer (or before buffer for negative) */
592
593};
594
595
596typedef struct multi_mode_info multi_mode_info;
597typedef struct multi_mode_list multi_mode_list;
598
599struct multi_mode_list {
600	size_t			info_size;		/* sizeof(multi_mode_list) */
601	int32			in_request_count;
602	int32			out_actual_count;
603	int32			out_current_mode;
604	multi_mode_info *
605					io_modes;
606};
607
608struct multi_mode_info {
609	int32			mode_id;
610	uint32			flags;
611	char			mode_name[64];
612	int32			input_channel_count;
613	int32			output_channel_count;
614	float			best_frame_rate_in;
615	float			best_frame_rate_out;
616	uint32			sample_formats_in;
617	uint32			sample_formats_out;
618	char			_reserved[160];
619};
620
621
622/*	This extension protocol can grow however much you want.	*/
623/*	Good extensions should be put into this header; really	*/
624/*	good extensions should become part of the regular API.	*/
625/*	For developer-developed extensions, use all lowercase	*/
626/*	and digits (no upper case). If we then bless a third-	*/
627/*	party extension, we can just upper-case the selector.	*/
628
629typedef struct multi_extension_list multi_extension_list;
630typedef struct multi_extension_info multi_extension_info;
631struct multi_extension_info {
632	uint32			code;
633	uint32			flags;
634	char			name[24];
635};
636
637#define B_MULTI_MAX_EXTENSION_COUNT 31
638struct multi_extension_list	{ /* MULTI_LIST_EXTENSIONS */
639	size_t			info_size;		/* sizeof(multi_extension_list) */
640	uint32			max_count;
641	int32			actual_count;	/* return # of actual extensions */
642	multi_extension_info *
643					extensions;		/* allocated by caller */
644};
645
646typedef struct multi_extension_cmd multi_extension_cmd;
647struct multi_extension_cmd {	/* MULTI_GET_EXTENSION and MULTI_SET_EXTENSION */
648	size_t			info_size;		/* sizeof(multi_extension_cmd) */
649	uint32			code;
650	uint32			_reserved_1;
651	void *			in_data;
652	size_t			in_size;
653	void *			out_data;
654	size_t			out_size;
655};
656
657enum {
658	B_MULTI_EX_CLOCK_GENERATION = 'CLGE',
659	B_MULTI_EX_DIGITAL_FORMAT = 'DIFO',
660	B_MULTI_EX_OUTPUT_NOMINAL = 'OUNO',
661	B_MULTI_EX_INPUT_NOMINAL = 'INNO'
662};
663
664typedef struct multi_ex_clock_generation multi_ex_clock_generation;
665struct multi_ex_clock_generation {
666	int32			channel;	/* if specific, or -1 for all */
667	uint32			clock;		/* WORDCLOCK or SUPERCLOCK, typically */
668};
669
670typedef struct multi_ex_digital_format multi_ex_digital_format;
671struct multi_ex_digital_format {
672	int32			channel;	/* if specific, or -1 for all */
673	uint32			format; 	/* B_CHANNEL_*_SPDIF or B_CHANNEL_*_EBU */
674};
675
676enum {
677	B_MULTI_NOMINAL_MINUS_10 = 1,
678	B_MULTI_NOMINAL_PLUS_4
679};
680
681typedef struct multi_ex_nominal_level multi_ex_nominal_level;
682struct multi_ex_nominal_level {
683	int32			channel;	/* if specific, or -1 for all */
684	int32			level;
685};
686
687#endif /* _MULTI_AUDIO_H */
688
689