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