1 /* ++++++++++ 2 $Source: /home/cltien/cvs/BeOS/inc/sound.h,v $ 3 $Revision: 1.1.1.1 $ 4 $Author: cltien $ 5 $Date: 1999/10/12 18:38:08 $ 6 7 Data structures and control calls for using the sound driver 8 +++++ */ 9 /* 10 Copyright 1999, Be Incorporated. All Rights Reserved. 11 This file may be used under the terms of the Be Sample Code License. 12 */ 13 14 #ifndef _SOUND_H 15 #define _SOUND_H 16 17 #ifndef _DRIVERS_H 18 #include <Drivers.h> 19 #endif 20 21 enum adc_source { 22 line=0, aux1, mic, loopback 23 }; 24 25 enum sample_rate { 26 kHz_8_0 = 0, kHz_5_51, kHz_16_0, kHz_11_025, kHz_27_42, kHz_18_9, 27 kHz_32_0, kHz_22_05, kHz_37_8 = 9, kHz_44_1 = 11, kHz_48_0, kHz_33_075, 28 kHz_9_6, kHz_6_62 29 }; 30 31 enum sample_format { 32 linear_8bit_unsigned_mono = 0, linear_8bit_unsigned_stereo, 33 ulaw_8bit_companded_mono, ulaw_8bit_companded_stereo, 34 linear_16bit_little_endian_mono, linear_16bit_little_endian_stereo, 35 alaw_8bit_companded_mono, alaw_8bit_companded_stereo, 36 sample_format_reserved_1, sample_format_reserved_2, 37 adpcm_4bit_mono, adpcm_4bit_stereo, 38 linear_16bit_big_endian_mono, linear_16bit_big_endian_stereo, 39 sample_format_reserved_3, sample_format_reserved_4 40 }; 41 42 struct channel { 43 enum adc_source adc_source; /* adc input source */ 44 char adc_gain; /* 0..15 adc gain, in 1.5 dB steps */ 45 char mic_gain_enable; /* non-zero enables 20 dB MIC input gain */ 46 char aux1_mix_gain; /* 0..31 aux1 mix to output gain. 12.0 to -34.5 dB in 1.5dB steps */ 47 char aux1_mix_mute; /* non-zero mutes aux1 mix */ 48 char aux2_mix_gain; /* 0..31 aux2 mix to output gain. 12.0 to -34.5 dB in 1.5dB steps */ 49 char aux2_mix_mute; /* non-zero mutes aux2 mix */ 50 char line_mix_gain; /* 0..31 line mix to output gain. 12.0 to -34.5 dB in 1.5dB steps */ 51 char line_mix_mute; /* non-zero mutes line mix */ 52 char dac_attn; /* 0..61 dac attenuation, in -1.5 dB steps */ 53 char dac_mute; /* non-zero mutes dac output */ 54 }; 55 56 typedef struct sound_setup { 57 struct channel left; /* left channel setup */ 58 struct channel right; /* right channel setup */ 59 enum sample_rate sample_rate; /* sample rate */ 60 enum sample_format playback_format;/* sample format for playback */ 61 enum sample_format capture_format; /* sample format for capture */ 62 char dither_enable; /* non-zero enables dither on 16 => 8 bit */ 63 char loop_attn; /* 0..64 adc to dac loopback attenuation, in -1.5 dB steps */ 64 char loop_enable; /* non-zero enables loopback */ 65 char output_boost; /* zero (2.0 Vpp) non-zero (2.8 Vpp) output level boost */ 66 char highpass_enable;/* non-zero enables highpass filter in adc */ 67 char mono_gain; /* 0..64 mono speaker gain */ 68 char mono_mute; /* non-zero mutes speaker */ 69 // char spdif_mute; /* non-zero mutes spdif out */ 70 } sound_setup; 71 72 73 /* ----- 74 control opcodes for sound driver 75 ----- */ 76 77 enum { 78 SOUND_GET_PARAMS = B_DEVICE_OP_CODES_END, 79 SOUND_SET_PARAMS, /* 10000 */ 80 SOUND_SET_PLAYBACK_COMPLETION_SEM, 81 SOUND_SET_CAPTURE_COMPLETION_SEM, 82 SOUND_GET_PLAYBACK_TIMESTAMP, /* 10003 */ 83 SOUND_GET_CAPTURE_TIMESTAMP, 84 SOUND_DEBUG_ON, 85 SOUND_DEBUG_OFF, /* 10006 */ 86 SOUND_UNSAFE_WRITE, 87 SOUND_UNSAFE_READ, 88 SOUND_LOCK_FOR_DMA, /* 10009 */ 89 SOUND_SET_CAPTURE_PREFERRED_BUF_SIZE, 90 SOUND_SET_PLAYBACK_PREFERRED_BUF_SIZE, 91 SOUND_GET_CAPTURE_PREFERRED_BUF_SIZE, /* 10012 */ 92 SOUND_GET_PLAYBACK_PREFERRED_BUF_SIZE, 93 94 // control ports for SPDIF settings 95 SOUND_GET_SPDIF_IN_OUT_LOOPBACK, 96 SOUND_SET_SPDIF_IN_OUT_LOOPBACK, 97 SOUND_GET_SPDIF_OUT, 98 SOUND_SET_SPDIF_OUT, 99 SOUND_GET_SPDIF_MONITOR, 100 SOUND_SET_SPDIF_MONITOR, 101 SOUND_GET_SPDIF_OUT_LEVEL, 102 SOUND_SET_SPDIF_OUT_LEVEL, 103 SOUND_GET_SPDIF_IN_FORMAT, 104 SOUND_SET_SPDIF_IN_FORMAT, 105 SOUND_GET_SPDIF_IN_OUT_COPYRIGHT, 106 SOUND_SET_SPDIF_IN_OUT_COPYRIGHT, 107 SOUND_GET_SPDIF_IN_VALIDITY, 108 SOUND_SET_SPDIF_IN_VALIDITY, 109 // control ports for analog settings 110 SOUND_GET_4_CHANNEL_DUPLICATE, 111 SOUND_SET_4_CHANNEL_DUPLICATE, 112 // control ports for additional info 113 SOUND_GET_DEVICE_ID, 114 SOUND_GET_INTERNAL_CHIP_ID, 115 SOUND_GET_DRIVER_VERSION 116 }; 117 118 #endif 119