1
2		Sound Blaster Live mixer / default DSP code
3		===========================================
4
5
6The EMU10K1 chips have a DSP part which can be programmed to support
7various ways of sample processing, which is described here.
8(This article does not deal with the overall functionality of the 
9EMU10K1 chips. See the manuals section for further details.)
10
11The ALSA driver programs this portion of chip by default code
12(can be altered later) which offers the following functionality:
13
14
151) IEC958 (S/PDIF) raw PCM
16--------------------------
17
18This PCM device (it's the 4th PCM device (index 3!) and first subdevice
19(index 0) for a given card) allows to forward 48kHz, stereo, 16-bit
20little endian streams without any modifications to the digital output
21(coaxial or optical). The universal interface allows the creation of up
22to 8 raw PCM devices operating at 48kHz, 16-bit little endian. It would
23be easy to add support for multichannel devices to the current code,
24but the conversion routines exist only for stereo (2-channel streams)
25at the time. 
26
27Look to tram_poke routines in lowlevel/emu10k1/emufx.c for more details.
28
29
302) Digital mixer controls
31-------------------------
32
33These controls are built using the DSP instructions. They offer extended
34functionality. Only the default build-in code in the ALSA driver is described
35here. Note that the controls work as attenuators: the maximum value is the 
36neutral position leaving the signal unchanged. Note that if the  same destination 
37is mentioned in multiple controls, the signal is accumulated and can be wrapped 
38(set to maximal or minimal value without checking of overflow).
39
40
41Explanation of used abbreviations:
42
43DAC    - digital to analog converter
44ADC    - analog to digital converter
45I2S    - one-way three wire serial bus for digital sound by Philips Semiconductors
46         (this standard is used for connecting standalone DAC and ADC converters)
47LFE    - low frequency effects (subwoofer signal)
48AC97   - a chip containing an analog mixer, DAC and ADC converters
49IEC958 - S/PDIF
50FX-bus - the EMU10K1 chip has an effect bus containing 16 accumulators.
51         Each of the synthesizer voices can feed its output to these accumulators
52         and the DSP microcontroller can operate with the resulting sum.
53
54
55name='Wave Playback Volume',index=0
56
57This control is used to attenuate samples for left and right PCM FX-bus
58accumulators. ALSA uses accumulators 0 and 1 for left and right PCM samples.
59The result samples are forwarded to the front DAC PCM slots of the AC97 codec.
60
61name='Wave Surround Playback Volume',index=0
62
63This control is used to attenuate samples for left and right PCM FX-bus
64accumulators. ALSA uses accumulators 0 and 1 for left and right PCM samples.
65The result samples are forwarded to the rear I2S DACs. These DACs operates
66separately (they are not inside the AC97 codec).
67
68name='Wave Center Playback Volume',index=0
69
70This control is used to attenuate samples for left and right PCM FX-bus
71accumulators. ALSA uses accumulators 0 and 1 for left and right PCM samples.
72The result is mixed to mono signal (single channel) and forwarded to
73the ??rear?? right DAC PCM slot of the AC97 codec.
74
75name='Wave LFE Playback Volume',index=0
76
77This control is used to attenuate samples for left and right PCM FX-bus
78accumulators. ALSA uses accumulators 0 and 1 for left and right PCM.
79The result is mixed to mono signal (single channel) and forwarded to
80the ??rear?? left DAC PCM slot of the AC97 codec.
81
82name='Wave Capture Volume',index=0
83name='Wave Capture Switch',index=0
84
85These controls are used to attenuate samples for left and right PCM FX-bus
86accumulator. ALSA uses accumulators 0 and 1 for left and right PCM.
87The result is forwarded to the ADC capture FIFO (thus to the standard capture
88PCM device).
89
90name='Synth Playback Volume',index=0
91
92This control is used to attenuate samples for left and right MIDI FX-bus
93accumulators. ALSA uses accumulators 4 and 5 for left and right MIDI samples.
94The result samples are forwarded to the front DAC PCM slots of the AC97 codec.
95
96name='Synth Capture Volume',index=0
97name='Synth Capture Switch',index=0
98
99These controls are used to attenuate samples for left and right MIDI FX-bus
100accumulator. ALSA uses accumulators 4 and 5 for left and right PCM.
101The result is forwarded to the ADC capture FIFO (thus to the standard capture
102PCM device).
103
104name='Surround Playback Volume',index=0
105
106This control is used to attenuate samples for left and right rear PCM FX-bus
107accumulators. ALSA uses accumulators 2 and 3 for left and right rear PCM samples.
108The result samples are forwarded to the rear I2S DACs. These DACs operate
109separately (they are not inside the AC97 codec).
110
111name='Surround Capture Volume',index=0
112name='Surround Capture Switch',index=0
113
114These controls are used to attenuate samples for left and right rear PCM FX-bus
115accumulators. ALSA uses accumulators 2 and 3 for left and right rear PCM samples.
116The result is forwarded to the ADC capture FIFO (thus to the standard capture
117PCM device).
118
119name='Center Playback Volume',index=0
120
121This control is used to attenuate sample for center PCM FX-bus accumulator.
122ALSA uses accumulator 6 for center PCM sample. The result sample is forwarded
123to the ??rear?? right DAC PCM slot of the AC97 codec.
124
125name='LFE Playback Volume',index=0
126
127This control is used to attenuate sample for center PCM FX-bus accumulator.
128ALSA uses accumulator 6 for center PCM sample. The result sample is forwarded
129to the ??rear?? left DAC PCM slot of the AC97 codec.
130
131name='AC97 Playback Volume',index=0
132
133This control is used to attenuate samples for left and right front ADC PCM slots
134of the AC97 codec. The result samples are forwarded to the front DAC PCM
135slots of the AC97 codec.
136********************************************************************************
137*** Note: This control should be zero for the standard operations, otherwise ***
138*** a digital loopback is activated.                                         ***
139********************************************************************************
140
141name='AC97 Capture Volume',index=0
142
143This control is used to attenuate samples for left and right front ADC PCM slots
144of the AC97 codec. The result is forwarded to the ADC capture FIFO (thus to
145the standard capture PCM device).
146********************************************************************************
147*** Note: This control should be 100 (maximal value), otherwise no analog    ***
148*** inputs of the AC97 codec can be captured (recorded).                     ***
149********************************************************************************
150
151name='IEC958 TTL Playback Volume',index=0
152
153This control is used to attenuate samples from left and right IEC958 TTL
154digital inputs (usually used by a CDROM drive). The result samples are
155forwarded to the front DAC PCM slots of the AC97 codec.
156
157name='IEC958 TTL Capture Volume',index=0
158
159This control is used to attenuate samples from left and right IEC958 TTL
160digital inputs (usually used by a CDROM drive). The result samples are
161forwarded to the ADC capture FIFO (thus to the standard capture PCM device).
162
163name='Zoom Video Playback Volume',index=0
164
165This control is used to attenuate samples from left and right zoom video
166digital inputs (usually used by a CDROM drive). The result samples are
167forwarded to the front DAC PCM slots of the AC97 codec.
168
169name='Zoom Video Capture Volume',index=0
170
171This control is used to attenuate samples from left and right zoom video
172digital inputs (usually used by a CDROM drive). The result samples are
173forwarded to the ADC capture FIFO (thus to the standard capture PCM device).
174
175name='IEC958 LiveDrive Playback Volume',index=0
176
177This control is used to attenuate samples from left and right IEC958 optical
178digital input. The result samples are forwarded to the front DAC PCM slots
179of the AC97 codec.
180
181name='IEC958 LiveDrive Capture Volume',index=0
182
183This control is used to attenuate samples from left and right IEC958 optical
184digital inputs. The result samples are forwarded to the ADC capture FIFO
185(thus to the standard capture PCM device).
186
187name='IEC958 Coaxial Playback Volume',index=0
188
189This control is used to attenuate samples from left and right IEC958 coaxial
190digital inputs. The result samples are forwarded to the front DAC PCM slots
191of the AC97 codec.
192
193name='IEC958 Coaxial Capture Volume',index=0
194
195This control is used to attenuate samples from left and right IEC958 coaxial
196digital inputs. The result samples are forwarded to the ADC capture FIFO
197(thus to the standard capture PCM device).
198
199name='Line LiveDrive Playback Volume',index=0
200name='Line LiveDrive Playback Volume',index=1
201
202This control is used to attenuate samples from left and right I2S ADC
203inputs (on the LiveDrive). The result samples are forwarded to the front
204DAC PCM slots of the AC97 codec.
205
206name='Line LiveDrive Capture Volume',index=1
207name='Line LiveDrive Capture Volume',index=1
208
209This control is used to attenuate samples from left and right I2S ADC
210inputs (on the LiveDrive). The result samples are forwarded to the ADC
211capture FIFO (thus to the standard capture PCM device).
212
213name='Tone Control - Switch',index=0
214
215This control turns the tone control on or off. The samples for front, rear
216and center / LFE outputs are affected.
217
218name='Tone Control - Bass',index=0
219
220This control sets the bass intensity. There is no neutral value!!
221When the tone control code is activated, the samples are always modified.
222The closest value to pure signal is 20.
223
224name='Tone Control - Treble',index=0
225
226This control sets the treble intensity. There is no neutral value!!
227When the tone control code is activated, the samples are always modified.
228The closest value to pure signal is 20.
229
230name='IEC958 Optical Raw Playback Switch',index=0
231
232If this switch is on, then the samples for the IEC958 (S/PDIF) digital
233output are taken only from the raw FX8010 PCM, otherwise standard front
234PCM samples are taken.
235
236name='Headphone Playback Volume',index=1
237
238This control attenuates the samples for the headphone output.
239
240name='Headphone Center Playback Switch',index=1
241
242If this switch is on, then the sample for the center PCM is put to the
243left headphone output (useful for SB Live cards without separate center/LFE
244output).
245
246name='Headphone LFE Playback Switch',index=1
247
248If this switch is on, then the sample for the center PCM is put to the
249right headphone output (useful for SB Live cards without separate center/LFE
250output).
251
252
2533) PCM stream related controls
254------------------------------
255
256name='EMU10K1 PCM Volume',index 0-31
257
258Channel volume attenuation in range 0-0xffff. The maximum value (no
259attenuation) is default. The channel mapping for three values is
260as follows:
261
262	0 - mono, default 0xffff (no attenuation)
263	1 - left, default 0xffff (no attenuation)
264	2 - right, default 0xffff (no attenuation)
265
266name='EMU10K1 PCM Send Routing',index 0-31
267
268This control specifies the destination - FX-bus accumulators. There are
269twelve values with this mapping:
270
271	 0 -  mono, A destination (FX-bus 0-15), default 0
272	 1 -  mono, B destination (FX-bus 0-15), default 1
273	 2 -  mono, C destination (FX-bus 0-15), default 2
274	 3 -  mono, D destination (FX-bus 0-15), default 3
275	 4 -  left, A destination (FX-bus 0-15), default 0
276	 5 -  left, B destination (FX-bus 0-15), default 1
277	 6 -  left, C destination (FX-bus 0-15), default 2
278	 7 -  left, D destination (FX-bus 0-15), default 3
279	 8 - right, A destination (FX-bus 0-15), default 0
280	 9 - right, B destination (FX-bus 0-15), default 1
281	10 - right, C destination (FX-bus 0-15), default 2
282	11 - right, D destination (FX-bus 0-15), default 3
283
284Don't forget that it's illegal to assign a channel to the same FX-bus accumulator 
285more than once (it means 0=0 && 1=0 is an invalid combination).
286 
287name='EMU10K1 PCM Send Volume',index 0-31
288
289It specifies the attenuation (amount) for given destination in range 0-255.
290The channel mapping is following:
291
292	 0 -  mono, A destination attn, default 255 (no attenuation)
293	 1 -  mono, B destination attn, default 255 (no attenuation)
294	 2 -  mono, C destination attn, default 0 (mute)
295	 3 -  mono, D destination attn, default 0 (mute)
296	 4 -  left, A destination attn, default 255 (no attenuation)
297	 5 -  left, B destination attn, default 0 (mute)
298	 6 -  left, C destination attn, default 0 (mute)
299	 7 -  left, D destination attn, default 0 (mute)
300	 8 - right, A destination attn, default 0 (mute)
301	 9 - right, B destination attn, default 255 (no attenuation)
302	10 - right, C destination attn, default 0 (mute)
303	11 - right, D destination attn, default 0 (mute)
304
305
306
3074) MANUALS/PATENTS:
308-------------------
309
310ftp://opensource.creative.com/pub/doc
311-------------------------------------
312
313        Files:
314        LM4545.pdf      AC97 Codec
315
316        m2049.pdf       The EMU10K1 Digital Audio Processor
317
318        hog63.ps        FX8010 - A DSP Chip Architecture for Audio Effects
319
320
321WIPO Patents
322------------
323        Patent numbers:
324        WO 9901813 (A1) Audio Effects Processor with multiple asynchronous (Jan. 14, 1999)
325                        streams
326
327        WO 9901814 (A1) Processor with Instruction Set for Audio Effects (Jan. 14, 1999)
328
329        WO 9901953 (A1) Audio Effects Processor having Decoupled Instruction
330                        Execution and Audio Data Sequencing (Jan. 14, 1999)
331
332
333US Patents (http://www.uspto.gov/)
334----------------------------------
335
336        US 5925841      Digital Sampling Instrument employing cache memory (Jul. 20, 1999)
337
338        US 5928342      Audio Effects Processor integrated on a single chip (Jul. 27, 1999)
339                        with a multiport memory onto which multiple asynchronous
340                        digital sound samples can be concurrently loaded
341
342        US 5930158      Processor with Instruction Set for Audio Effects (Jul. 27, 1999)
343
344        US 6032235      Memory initialization circuit (Tram) (Feb. 29, 2000)
345
346        US 6138207      Interpolation looping of audio samples in cache connected to    (Oct. 24, 2000)
347                        system bus with prioritization and modification of bus transfers
348                        in accordance with loop ends and minimum block sizes
349
350        US 6151670      Method for conserving memory storage using a (Nov. 21, 2000)
351                        pool of  short term memory registers
352
353        US 6195715      Interrupt control for multiple programs communicating with      (Feb. 27, 2001)
354                        a common interrupt by associating programs to GP registers,
355                        defining interrupt register, polling GP registers, and invoking
356                        callback routine associated with defined interrupt register
357