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