audio_mixer_impl.h revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2004 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*
* This header file defines the internal interfaces for the audio mixer
* audio personality module. It is NOT to be distributed with Solaris or
* included in any audio drivers.
*/
#ifndef _SYS_AUDIO_MIXER_IMPL_H
#define _SYS_AUDIO_MIXER_IMPL_H
#pragma ident "%Z%%M% %I% %E% SMI"
#ifdef __cplusplus
extern "C" {
#endif
#define AM_BALANCE_SHIFT 5
#define AM_MIN_CHS 1
/*
* Flow control is used to keep too many buffers from being allocated.
* However, sometimes we come across apps that have a problem with flow
* control. Therefore we can comment out and turn off flow control temporarily
* so we can debug the app and come up with a work around.
*/
#define FLOW_CONTROL
/*
* Miscellaneous defines
*/
#define AM_INT16_SHIFT 1
#define AM_INT32_SHIFT 2
#define AM_256_SHIFT 8
#define AM_8_SHIFT 3
#define AM_HALF_ENERGY_SHIFT 1
#define AM_TIMES_2_SHIFT 1
#define AM_TIMES_4_SHIFT 2
#define AM_TIMES_8_SHIFT 3
#define AM_TIMES_16_SHIFT 4
#define AM_TIMES_32_SHIFT 5
#define AM_MIN_MIX_BUFSIZE 48000
#define AM_MAX_QUEUED_MSGS_CNT 500
#define AM_MIN_QUEUED_MSGS_CNT 200
#define AM_MAX_QUEUED_MSGS 4
#define AM_SINGLE_OPEN 0
#define AM_MULTIPLE_OPEN 1
#define AM_NOT_MUTED 0
#define AM_MUTED (~AM_NOT_MUTED)
#define AM_NO_FORCE 0
#define AM_FORCE (~AM_NO_FORCE)
#define AM_NO_SERIALIZE 0
#define AM_SERIALIZE (~AM_NO_SERIALIZE)
#define AM_MISC_MASK 0x00000003
#define AM_CHAR2INT_MASK 0x000000ff
#define AM_NO_PID 0
#define AM_SET_WAITING 1
#define AM_CLEAR_WAITING 0
#define AM_SET_RECORD 1
#define AM_NOT_RECORD 0
#define AM_SET_PLAY 1
#define AM_NOT_PLAY 0
#define AM_EXTRA_SAMPLES 16
/* Private mixer return codes */
/*
* The sample rate conversion handle is implemented as the channel pointer.
* But the sample rate converter doesn't have to know about this at all.
*/
/*
* am_ch_private_t - audio mixer channel private data
*/
struct am_ch_private {
int acp_EOF_toggle; /* toggle for EOF signals */
int acp_psamples_f; /* sample frame count mp_orig */
int acp_psamples_c; /* samples in buf to play */
int acp_psamples_p; /* samples in played buf */
int acp_busy_cnt; /* # of calls outstanding */
int acp_rec_remaining; /* # bytes left in mp buf */
int *acp_play_samp_buf; /* play sample buf space */
void *acp_play_src_data; /* play src data */
void *acp_rec_src_data; /* rec. src data */
void *acp_ch_psrc1; /* play src buffer #1 */
void *acp_ch_psrc2; /* play src buffer #2 */
void *acp_ch_pconv1; /* play conversion buffer #1 */
void *acp_ch_pconv2; /* play conversion buffer #1 */
void *acp_ch_rsrc1; /* record src buffer #1 */
void *acp_ch_rsrc2; /* record src buffer #2 */
void *acp_ch_rconv1; /* record conv. buffer #1 */
void *acp_ch_rconv2; /* record conv. buffer #1 */
};
typedef struct am_ch_private am_ch_private_t;
/* am_ch_private.acp_flags defines */
/*
* am_apm_persist_t - audio mixer persistent private state data
*/
struct am_apm_persist {
int apm_mode; /* mixer mode */
int apm_mpgain; /* saved master play gain, mixer mode */
int apm_mpbal; /* saved master play bal, mixer mode */
int apm_mrgain; /* saved master rec. gain, mixer mode */
int apm_mrbal; /* saved master rec. bal, mixer mode */
};
typedef struct am_apm_persist am_apm_persist_t;
/*
* am_apm_private_t - audio mixer state private data
*/
struct am_apm_private {
int am_ad_in; /* set when calling driver */
void *am_args; /* qtimeout() args */
int *am_mix_buf; /* buffer to mix audio in */
int *am_send_buf; /* buffer to send audio from */
int am_channels; /* current channels */
int am_in_chs; /* current record channels */
int am_out_chs; /* current play channels */
int am_max_in_chs; /* R/O, max input channels */
int am_max_out_chs; /* R/O, max output channels */
};
typedef struct am_apm_private am_apm_private_t;
/* defines for am_apm_private.am_ad_in */
/*
* These are modified only when the taskq lock is held, which ensures a
* single thread.
*/
/*
* Further analysis is needed on the structure members of am_apm_private.
*/
/* am_apm_private.am_flags defines */
/* am_apm_private.am_pflags and .am_rflags defines */
/*
* The following data structures are used by taskq_dispatch() to queue up
* ioctl() requests.
*/
struct am_ioctl_args {
};
typedef struct am_ioctl_args am_ioctl_args_t;
struct am_state_ch_args {
int asca_cmd; /* hw state change command */
int asca_dir; /* direction for the update */
int asca_value; /* value for cmd to use */
};
typedef struct am_state_ch_args am_state_ch_args_t;
/*
* Used only to execute a task off the taskq, so it is not shared.
* am_sample_rates_t is defined in mixer.h.
*/
/* steams stuff */
/*
* The following routines are provided by the different source code
* modules that make up the audio mixer.
*
* From am_main.c
*/
void am_apply_gain_balance(int *, int, int, int, int);
void am_convert_int_mono_stereo(int *, int *, int *, int, int);
void am_convert_to_int(void *, int *, int, int, int, int);
/*
* From am_ad.c
*/
int, int, int, int, int);
int, int, int, int, int, int);
int);
int, int);
int);
int);
int am_ck_sample_rate(am_ad_ch_cap_t *, int, int);
int am_test_canputnext(audio_ch_t *);
int am_set_record_streams(audio_ch_t *);
/*
* From am_ioctl.c
*/
void am_audio_drained(audio_ch_t *);
int, int, int, int, int, int, int);
uint_t, int, int, int, int);
/*
* From g711.h
*/
#ifdef __cplusplus
}
#endif
#endif /* _SYS_AUDIO_MIXER_IMPL_H */