Import 1.3.39
[davej-history.git] / drivers / sound / experimental.txt
blob456de53fd1894c2c282e1d546237c3ddc99527c3
1 This version contains some features which is may NOT be enabled by default. 
2 I'm trying to release an official/reliable version soon so that the
3 Linux version of Doom (and other games) becomes possible. For that reason
4 I have disabled some features which are not reliable enough to be
5 released for wide public. If you are interested to try them, please
6 read this file carefully.
8 1) ECHO PSS (Personal Sound System support)
10 This version contains support for soundcards based on the AD20msp614
11 chipset made by Analog Devices. This chipset consist of the
12 AD1848 codec, ADSP-21xx DSP chip and a ESC614 ASIC and is used in some
13 soundcards made by Orchid, Cardinal, Echo Speech Corporation, Western
14 Digital and Wearnes Technology. The PSS support is by Marc M. Hoffman
15 (marc.hoffman@analog.com). I received this stuff about a week ago and
16 have not been able to test it yet.
17 If you are interested, remove the B(OPT_PSS) from the DISABLED_OPTIONS
18 (see above).
19 You have also to enable the MSS support since I have not integrated
20 the AD1848 driver with the PSS one yet.
22 2) /dev/music (/dev/sequencer2)
24 This version has a new device file called /dev/music. I have not
25 implemented all parts of it but it's there. It's only interesting if
26 you are writing a sequencer program yourself. Enable by creating
27 the device file /dev/music. Use the script at the end of linux/Readme
29 3) /dev/midi##
31 These are tty like raw devices for MIDI ports. Since there is a minor
32 incompatibility between different versions of Linux, I have disabled
33 this feature by default. You just need to create the device files yourself.
35 4) Support for hardware based u-Law/A-Law and ADPCM formats.
37 The AD1848 (and compatibles) are able to do compression and
38 decompression by hardware. This version has experimental support
39 for some of them. Currently they are implemented just in the
40 AD1848 driver. The GUS MAX (and the 16 bit daughtercard) support
41 also 16->4 bit ADPCM (the IMA one) but it don't work yet.
42 The argument ioctl(SNDCTL_DSP_SAMPLESIZE) can have some new values
43 in addition to the 8 and 16 supported earlier. Look at soundcard.h
44 for more info.
45 (In case somebody dares to ask: The ASP chip of SB16 is not supported
46 so the hardware compression/decompression doesn't work with it. Also
47 the ADPCM format is different than the standard (IMA) one (I guess).
48 This feature is enabled by default.
50 5) Real time fix to /dev/dsp and /dev/audio drivers
52 The following feature should help game writers. This stuff is enabled
53 by default.
54 ---------------- cut here ---------------------
55 There is a new ioctl called SNDCTL_DSP_SETFRAGMENT. It accepts a
56 int parameter which has format 0x00nn00ss where the nn is max number of 
57 buffer fragments (between 0x02 and 0xff) and the ss gives indirectly the 
58 size of a buffer fragment (fragment_size = (1 << ss)). Valid sizes are 
59 between (ss=0x07 -> 128 bytes and ss=0x11 (17 dec) -> 128k).
61 This ioctl must be used ONCE between open() and first call to 
62 read()/write() or ioctl(SNDCTL_DSP_GETBLKSIZE). 
64 You need just to force the fragment size to a value which is sufficiently 
65 short (gives the 1/20th of sec with the speed/#channels/#bits you are using).
67 Using a small number of fragments offers (I guess) a significant advantage.
68 For example with 2 fragments the driver works as the following (at least 
69 I hope so). Assuming that the process writes exactly 'fragment_size' of 
70 bytes each time (this is really important).
72         1) When the process writes the first fragment, it will be copied to
73         the DMA buffer area and the playback begins. The write() returns
74         immediately and the process is free to continue.
77         2a) If the fragment gets played before the application writes a new
78         one, the device will be stoppen and restarted which causes a click.
79         When the process calls write next time, it will be processes as 
80         in step 1.
82         2b) If the process calls write before the buffer underflows, the
83         data will be queued and the process is free to continue. (There
84         is now one full and one partially played fragment in the kernel
85         buffers. This gives average delay of 1.5*fragment_time (for 
86         example 1/20th sec) before the last byte in the buffer gets played.
89         3a) If the device gets both fragments played before the next write
90         (underflow), there will be a click. The write will be processed as
91         in step 1.
93         3b) If the 1st fragment gets played before next write (the process
94         calls write during playback of the second fragment), it will be
95         processed as step 2b.
97         3c) If the process writes 3rd fragment when there is already 2
98         fragments in the queue (1 playing and 1 waiting), the process
99         will block until the 1st fragment gets played. It will then be
100         woken up and it continues as in step 2b. This means that
101         the process blocks for at most the time required to play a
102         buffer fragment.
104 This method syncronizes the process and the audio device together 
105 automaticly. The process will block at most the 'fragment_time'. Usually 
106 less, depending on how much it needs time to do other things. The maximum
107 delay between writing a byte and the time when it finally plays is
108 at most 3 times the 'fragment_time'. 
110 The delay depends on how much time the program needs to do it's 
111 computations for the next sample (updating screen etc). If it's about
112 80% of the 'fragment_time' the game will run almost without delays. If it 
113 uses more time, there is a risk that the audio buffer gets empty.
114         
115 The application code should be something like the following:
117 int frag = 0x00020008;  /* 2 fragments of 2^8=256 bytes */
118 int frag_size;
120 int fd=open("/dev/dsp");
121 ioctl(fd, SNDCTL_DSP_SETFRAGMENT, &frag);
122 ioctl(NDCTL_DSP_SPEED); /* And #channels & #bits if required */
125  * Query the actual fragment sice since the driver may refuse
126  * the requested one (unlikely but possible?)
127  */
129 ioctl(fd, SNDCTL_DSP_GETBLKSIZE, &frag_size);
131 while(True)
133         do_computations();
134         write(fd, buf, frag_size);      /* Always the same size!!!!!!! */
137 I have tested this with a modified version of str.c. The algorithm works 
138 as long as the playing program gets enough time to run. Hitting ENTER on 
139 another virtual console causes a pause/click (with 2 frags of 64 bytes).
141 NOTE! It's important to know that this call may be called just once and
142 it must be done immediately after open(). The fragment size will remain
143 in effect until the device is closed.
144 ------------------- cut here ---------------------
146 6)      Detection and initialization code for Ensoniq Soundscape
148 This version is able to initialize SoundScape (almost). However
149 PCM recording and playback don't work. Also MIDI playback sounds wierd
150 since the driver is not able to set volume controls properly.
151 The soundscape support is disabled. You need to enable it by editing
152 beginning of configure.c. Also read comments in sndscape/README.
154 7)      select() support for /dev/audio and /dev/dsp. (/dev/midi## and
155         /dev/sequencer had it already in v2.90).
157 There is now select() support in the audio/dsp driver (for Linux only).
158 However I have not tried this feature yet. 
159 There are also some new ioctl() calls (please look at soundcard.h).
161 8)      MIDI recording in /dev/music (/dev/sequencer2)
163 MIDI recording was earlier implemented only with full MPU-401 devices.
164 This version has it also for dumb MIDI ports. However I have not tested it
165 yet.