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