10Sstevel@tonic-gate /* 20Sstevel@tonic-gate * CDDL HEADER START 30Sstevel@tonic-gate * 40Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*9484Sgarrett.damore@Sun.COM * Common Development and Distribution License (the "License"). 6*9484Sgarrett.damore@Sun.COM * You may not use this file except in compliance with the License. 70Sstevel@tonic-gate * 80Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 90Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 100Sstevel@tonic-gate * See the License for the specific language governing permissions 110Sstevel@tonic-gate * and limitations under the License. 120Sstevel@tonic-gate * 130Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 140Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 150Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 160Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 170Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 180Sstevel@tonic-gate * 190Sstevel@tonic-gate * CDDL HEADER END 200Sstevel@tonic-gate */ 210Sstevel@tonic-gate /* 22*9484Sgarrett.damore@Sun.COM * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 23*9484Sgarrett.damore@Sun.COM * Use is subject to license terms. 240Sstevel@tonic-gate */ 250Sstevel@tonic-gate 260Sstevel@tonic-gate #ifndef _SYS_MIXER_H 270Sstevel@tonic-gate #define _SYS_MIXER_H 280Sstevel@tonic-gate 290Sstevel@tonic-gate #ifdef __cplusplus 300Sstevel@tonic-gate extern "C" { 310Sstevel@tonic-gate #endif 320Sstevel@tonic-gate 330Sstevel@tonic-gate #include <sys/audio.h> 340Sstevel@tonic-gate 350Sstevel@tonic-gate #define AM_MIXER_MODE 0 360Sstevel@tonic-gate #define AM_COMPAT_MODE 1 370Sstevel@tonic-gate 380Sstevel@tonic-gate #define AM_DEFAULT_SAMPLERATE 8000 390Sstevel@tonic-gate #define AM_DEFAULT_CHANNELS AUDIO_CHANNELS_MONO 400Sstevel@tonic-gate #define AM_DEFAULT_PRECISION AUDIO_PRECISION_8 410Sstevel@tonic-gate #define AM_DEFAULT_ENCODING AUDIO_ENCODING_ULAW 420Sstevel@tonic-gate #define AM_DEFAULT_GAIN AUDIO_MID_GAIN 430Sstevel@tonic-gate 440Sstevel@tonic-gate /* 450Sstevel@tonic-gate * Mixer ioctls. 460Sstevel@tonic-gate */ 470Sstevel@tonic-gate #define MIOC ('M'<<8) 480Sstevel@tonic-gate #define AUDIO_MIXER_MULTIPLE_OPEN (MIOC|10) 490Sstevel@tonic-gate #define AUDIO_MIXER_SINGLE_OPEN (MIOC|11) 500Sstevel@tonic-gate #define AUDIO_MIXER_GET_SAMPLE_RATES (MIOC|12) 510Sstevel@tonic-gate #define AUDIO_MIXERCTL_GETINFO (MIOC|13) 520Sstevel@tonic-gate #define AUDIO_MIXERCTL_SETINFO (MIOC|14) 530Sstevel@tonic-gate #define AUDIO_MIXERCTL_GET_CHINFO (MIOC|15) 540Sstevel@tonic-gate #define AUDIO_MIXERCTL_SET_CHINFO (MIOC|16) 550Sstevel@tonic-gate #define AUDIO_MIXERCTL_GET_MODE (MIOC|17) 560Sstevel@tonic-gate #define AUDIO_MIXERCTL_SET_MODE (MIOC|18) 570Sstevel@tonic-gate 580Sstevel@tonic-gate #define AUDIO_MIXER_CTL_STRUCT_SIZE(num_ch) (sizeof (am_control_t) + \ 590Sstevel@tonic-gate ((num_ch - 1) * sizeof (int8_t))) 600Sstevel@tonic-gate 610Sstevel@tonic-gate #define AUDIO_MIXER_SAMP_RATES_STRUCT_SIZE(num_srs) \ 620Sstevel@tonic-gate (sizeof (am_sample_rates_t) + \ 630Sstevel@tonic-gate ((num_srs - 1) * sizeof (uint_t))) 640Sstevel@tonic-gate 650Sstevel@tonic-gate /* 660Sstevel@tonic-gate * Mixer software features 670Sstevel@tonic-gate */ 680Sstevel@tonic-gate #define AM_MIXER 0x00000001 /* audio mixer */ 690Sstevel@tonic-gate 700Sstevel@tonic-gate /* 710Sstevel@tonic-gate * am_control_t - structure that holds information on the audio device 720Sstevel@tonic-gate */ 730Sstevel@tonic-gate struct am_control { 740Sstevel@tonic-gate /* 750Sstevel@tonic-gate * Because a particular channel may be virtual, it isn't possible 760Sstevel@tonic-gate * to use the normal ioctl()s to set the some of the hardware's state. 770Sstevel@tonic-gate * Only the dev_info structure's play/record gain, balance, port, and 780Sstevel@tonic-gate * pause members, as well as the monitor_gain and output_muted members 790Sstevel@tonic-gate * may be modified. 800Sstevel@tonic-gate */ 810Sstevel@tonic-gate audio_info_t dev_info; 820Sstevel@tonic-gate 830Sstevel@tonic-gate /* 840Sstevel@tonic-gate * The mixer(7I) manual page shows an example of using the ch_open[] 850Sstevel@tonic-gate * array. Each element that is set to 0 represents a channel which 860Sstevel@tonic-gate * isn't allocated, and non-zero elements represent a channel that is 870Sstevel@tonic-gate * alloacted. This size of this array may change, depending on the 880Sstevel@tonic-gate * number of channels the audiosup module allocates per device. 890Sstevel@tonic-gate */ 900Sstevel@tonic-gate int8_t ch_open[1]; 910Sstevel@tonic-gate }; 920Sstevel@tonic-gate typedef struct am_control am_control_t; 930Sstevel@tonic-gate 940Sstevel@tonic-gate /* 950Sstevel@tonic-gate * am_sample_rates_t - structure for a list of supported sample rates 960Sstevel@tonic-gate */ 970Sstevel@tonic-gate struct am_sample_rates { 980Sstevel@tonic-gate /* 990Sstevel@tonic-gate * Set this to AUIDO_PLAY or AUDIO_RECORD, but not both, to get 1000Sstevel@tonic-gate * the play or record sample rates, respectively. 1010Sstevel@tonic-gate */ 1020Sstevel@tonic-gate uint_t type; 1030Sstevel@tonic-gate 1040Sstevel@tonic-gate /* 1050Sstevel@tonic-gate * Some devices support a complete range of sample rates between the 1060Sstevel@tonic-gate * two provided in the samp_rates[] array. If this is so then this 1070Sstevel@tonic-gate * flag is set to MIXER_SR_LIMITS when AUDIO_MIXER_GET_SAMPLE_RATES 1080Sstevel@tonic-gate * returns this structure. 1090Sstevel@tonic-gate */ 1100Sstevel@tonic-gate uint_t flags; 1110Sstevel@tonic-gate 1120Sstevel@tonic-gate /* 1130Sstevel@tonic-gate * Set this number to the number of sample rates to request. The 1140Sstevel@tonic-gate * mixer(7I) manual page shows an example of using this structure. 1150Sstevel@tonic-gate * When AUDIO_MIXER_GET_SAMPLE_RATES returns the number of samples 1160Sstevel@tonic-gate * available is set. This may be more or less than the number requested. 1170Sstevel@tonic-gate * If more that only the requested number of samples is arctually 1180Sstevel@tonic-gate * returned in the samp_rates array. 1190Sstevel@tonic-gate */ 1200Sstevel@tonic-gate uint_t num_samp_rates; 1210Sstevel@tonic-gate 1220Sstevel@tonic-gate /* 1230Sstevel@tonic-gate * Variable size array for the supported sample rates. See the example 1240Sstevel@tonic-gate * in the mixer(7I) manual page for how to use this array. 1250Sstevel@tonic-gate */ 1260Sstevel@tonic-gate uint_t samp_rates[1]; 1270Sstevel@tonic-gate }; 1280Sstevel@tonic-gate typedef struct am_sample_rates am_sample_rates_t; 1290Sstevel@tonic-gate 1300Sstevel@tonic-gate /* am_sample_rates.flags defines */ 1310Sstevel@tonic-gate #define MIXER_SR_LIMITS 0x00000001u /* sample rates set limits */ 1320Sstevel@tonic-gate 1330Sstevel@tonic-gate #ifdef __cplusplus 1340Sstevel@tonic-gate } 1350Sstevel@tonic-gate #endif 1360Sstevel@tonic-gate 1370Sstevel@tonic-gate #endif /* _SYS_MIXER_H */ 138