Added DebugBreak.
[wine] / documentation / status / multimedia
1 This file contains information about the implementation of the multimedia
2 layer of WINE.
3
4 The libraries consist of MMSYSTEM.DLL (win16), WINMM.DLL (win32) and some
5 (abstracted, not Windows compatible) lowlevel drivers. The implementation
6 can be found in the multimedia/ subdirectory.
7
8 The multimedia stuff is split into 3 layers. The lowlevel (device drivers),
9 midlevel (MCI commands) and highlevel abstraction layers.
10
11 The lowlevel may depend on current hardware and OS services (like OSS). 
12 Mid-level and high-level must be written independantly from the hardware and OS
13 services.
14
15 1. Lowlevel layers
16
17    Following lowlevel layers are implemented:
18
19 1.1 (Waveform) Audio
20
21    The API consists of the waveIn*/waveOut* functions found in
22    multimedia/mmsystem.c. They call the real lowlevel audiodriver using
23    the wodMessage/widMessage function in multimedia/audio.c, which handles
24    the different requests.
25
26    The lowlevel audio driver is currently only implemented for the
27    OpenSoundSystem (OSS) as supplied in the Linux and FreeBSD kernels by
28    4Front Technologies (http://www.4front-tech.com/). The presence of this
29    driver is checked by configure (depends on the <sys/soundcard.h> file).
30
31    The implementation contains all features commonly used, but has several
32    problems. For instance:
33       Writes are not done asynchronously as they are supposed to be done.
34    This breaks some programs (soundrec.exe from the Windows applets),
35    but doesn't worry other programs. 
36
37    TODO:
38         - add asynchronous writes (must use threads)
39         - verify all functions for correctness
40         - add drivers for other soundsystems (Sun Audio, remote audio systems
41           (using X extensions, ...), ALSA
42         - WaveHdr must be sent though mmsystem.c to get the linear address
43           set correctly. An application calling directly (wod|wid)Message
44           will fail
45
46 1.2 Mixer
47
48    The API consists of the mixer* functions found in multimedia/mmsystem.c.
49    They call the lowlevel driver functions in multimedia/mixer.c using the
50    mixMessage function.
51
52    The current implementation tries to use the OpenSoundSystem mixer, but is
53    missing nearly everything. There is no report of a working application.
54    
55    TODO:
56         - implement mixing functionality for OSS correctly.
57         - implement mixing lowlevel drivers for other mixers.
58
59 1.3 MIDI
60         
61    The API consists of the midi* functions found in multimedia/mmsystem.c.
62    They call the lowlevel driver functions in multimedia/midi.c using the
63    midMessage and the modMessage functions.
64
65    The lowlevel audio driver is currently only implemented for the
66    OpenSoundSystem (OSS) as supplied in the Linux and FreeBSD kernels by
67    4Front Technologies (http://www.4front-tech.com/). The presence of this
68    driver is checked by configure (depends on the <sys/soundcard.h> file).
69    Both Midi in and Midi out are provided. The type of MIDI devices supported
70    is external MIDI port (requires an MIDI capable device - keyboard...) and
71    OPL/2 synthesis (the OPL/2 patches for all instruments are in midiPatch.c).
72
73    TODO:
74         - Do not implement a software synthesizer. This should be done
75           using MIDI loopback devices in an external program (like timidity).
76           the only trouble is that timidity is GPL'ed...
77         - use better instrument definition for OPL/2 (midiPatch.c) or
78           use existing instrument definition (from playmidi or kmid)
79           with a .winerc option
80         - have a look at OPL/3 ?
81         - MidiHdr must be sent though mmsystem.c to get the linear address
82           set correctly. An application calling directly (wod|wid)Message
83           will fail
84         - implement asynchronous playback of MidiHdr 
85
86 1.4 Timers
87
88    The API consists of the timer* functions found in multimedia/timer.c. 
89    There is currently only one implementation, which uses normal windows timers.
90    The implementation works for most cases found. The only problem is that
91    it doesn't support asynchronous timer events (as it is supposed to do).
92
93    There is a workaround for this lack in timeGetTime() to make Diablo work
94    and 'Pinball! SpaceCadet' at least start up.
95
96    TODO:
97         - Implemented asynchronous timers (using the service thread)
98
99 1.5 MMIO
100    
101    The API consists of the mmio* functions found in multimedia/mmio.c.
102
103    FIXME: I am not sure about the status of this implementation.
104
105    TODO:
106         - add win32 support.
107         - ...
108
109 1.6 AUX
110    
111    The API consists of the aux* functions found in multimedia/mmsystem.c.
112    They call auxMessage in multimedia/mmaux.c.
113
114    The aux* functions are the predecessor of the mixer* functions.
115
116    The implementation uses the OSS mixer API, and is incomplete.
117
118    TODO:
119         - verify the implementation
120
121 1.7 JOYSTICK
122    
123    The API consists of the joy* functions found in multimedia/joystick.c.
124    The implementation currently uses the Linux joystick device driver API.
125    It is lacking support for enhanced joysticks and has not been extensively
126    tested.
127
128    TODO:
129         - better support of enhanced joysticks
130         - support more joystick drivers (like the XInput extension)
131
132 2. Midlevel drivers (MCI)
133    
134    The midlevel drivers are represented by some common API functions, 
135    mostly mciSendCommand and mciSendString. The mciSendString function
136    uses commandstrings, which are translated into normal MCI commands as
137    used by mciSendCommand. The API can be found in multimedia/mmsystem.c
138    and multimedia/mcistring.c.
139    The functions there (mciOpen,mciSysInfo) handle midlevel driver
140    allocation and calls.
141
142    The implementation is not complete.
143  
144    MCI drivers are seen as regular WINE modules, and can be loaded 
145    (with a correct loadorder between builtin, native, elfdll, so), as
146    any other DLL. Please note, that MCI drivers module names must
147    bear the .drv extension to be correctly understood.
148
149    The list of available MCI drivers is obtained as follows:
150         1/ key 'mci' in [option] section from .winerc (or wineconf)
151                 mci=CDAUDIO:SEQUENCER
152           gives the list of MCI drivers (names, in uppercase only) to
153           be used in WINE.
154         2/ This list, when defined, supercedes the mci
155           key in c:\windows\system.ini
156
157    TODO:
158         - support windows MCI drivers (should be possible for they usually 
159           do not use lowlevel calls)
160         - MCI command loading support
161         - better implement non waiting command (without the MCI_WAIT flag). 
162           First shot is present in midi.c but requires much more work (and
163           will impact sndPlaySound() as well which shall be written as
164           as set of MCI commands).
165         - implement other stuff as yet unknown
166         - in mciString(), make use of hiword from mciSendMessage
167           return value to convert value into string...
168         - move mci drivers as regular DLLs (loading in wine, elfglue...)
169
170    WINE implements several MCI midlevel drivers:
171
172 2.1 CDAUDIO
173    
174    The currently best implementation is the MCI CDAUDIO driver that can
175    be found in multimedia/mcicda.c. The implementation is mostly complete,
176    there have been no reports of errors.
177
178    It makes use of misc/cdrom.c Wine internal cdrom interface. This
179    interface has been ported on Linux, FreeBSD and NetBSD.
180    (Sun should be similair, but are not implemented.)
181
182    A very small example of a cdplayer consists just of the line
183    mciSendString("play cdaudio",NULL,0,0);
184
185    Native MCICDA is starting to output sounds... It uses the mscdex
186    traps (on int 2f).
187
188    TODO:
189         - add support for other cdaudio drivers
190
191 2.2 MCIWAVE
192    
193    The implementation is rather complete and can be found in 
194    multimedia/audio.c.
195    It uses the lowlevel audio API (although not abstracted correctly).
196    FIXME: The MCI_STATUS command is broken.
197
198    TODO: 
199         - check for correctness
200         - better use of asynchronous playback from low level
201    
202    Native MCIWAVE has been working but is currently blocked by
203    scheduling issues.
204
205 2.3 MIDI/SEQUENCER
206    
207    The implementation can be found in multimedia/midi.c. Except from the
208    Record command, should be close to completion (except for non blocking
209    commands).
210
211    TODO: 
212         - implement it correctly
213         - finish asynchronous commands
214
215    Native MCIMIDI has been working but is currently blocked by
216    scheduling issues.
217
218 2.4 MCIANIM
219
220    The implementation consists of stubs and is in multimedia/mcianim.c.
221
222    TODO: 
223         - implement it, probably using xanim or something similair. Could
224           also be implemented by using the Windows MCI video drivers.
225
226 2.5 MCIAVI
227
228    The implementation consists of stubs and is in multimedia/mciavi.c.
229
230    TODO: 
231         - implement it, probably using xanim or something similair. Could
232           also be implemented by using the Windows MCI video drivers.
233
234 3 High-level layers
235
236    The rest (basically the MMSYSTEM and WINMM DLLs entry points).