Started implementing date/time common control.
[wine] / include / multimedia.h
1 /* -*- tab-width: 8; c-basic-offset: 4 -*- */
2
3 /*****************************************************************************
4  * Copyright 1998, Luiz Otavio L. Zorzella
5  *           1999, Eric Pouech
6  *
7  * File:      multimedia.h
8  * Purpose:   multimedia declarations (internal to multimedia DLLs)
9  *
10  *****************************************************************************
11  */
12 #ifndef __WINE_MULTIMEDIA_H 
13 #define __WINE_MULTIMEDIA_H
14
15 #include "mmsystem.h"
16 #include "winbase.h"
17
18 #define MAX_MIDIINDRV   (16)
19 /* For now I'm making 16 the maximum number of midi devices one can
20  * have. This should be more than enough for everybody. But as a purist,
21  * I intend to make it unbounded in the future, as soon as I figure
22  * a good way to do so.
23  */
24 #define MAX_MIDIOUTDRV  (16)
25
26 #if defined(HAVE_SYS_SOUNDCARD_H)
27 # include <sys/soundcard.h>
28 #elif defined(HAVE_MACHINE_SOUNDCARD_H)
29 # include <machine/soundcard.h>
30 #elif defined(HAVE_SOUNDCARD_H)
31 # include <soundcard.h>
32 #endif
33
34 #ifdef HAVE_SYS_ERRNO_H
35 #include <sys/errno.h>
36 #endif
37
38 #ifdef HAVE_OSS
39 #define MIDI_SEQ "/dev/sequencer"
40 #else
41 #define MIDI_DEV "/dev/midi"
42 #endif
43
44 #ifdef SOUND_VERSION
45 #define IOCTL(a,b,c)            ioctl(a,b,&c)
46 #else
47 #define IOCTL(a,b,c)            (c = ioctl(a,b,c))
48 #endif
49
50 #define WINE_MMTHREAD_CREATED   0x4153494C      /* "BSIL" */
51 #define WINE_MMTHREAD_DELETED   0xDEADDEAD
52
53 typedef struct {
54        DWORD                    dwSignature;            /* 00 "BSIL" when ok, 0xDEADDEAD when being deleted */
55        DWORD                    dwCounter;              /* 04 > 1 when in mmThread functions */
56        HANDLE                   hThread;                /* 08 hThread */
57        DWORD                    dwThreadID;             /* 0C */
58        FARPROC16                fpThread;               /* 10 address of thread proc (segptr or lin depending on dwFlags) */
59        DWORD                    dwThreadPmt;            /* 14 parameter to be passed upon thread creation to fpThread */
60        DWORD                    dwSignalCount;          /* 18 counter used for signaling */
61        HANDLE                   hEvent;                 /* 1C event */
62        HANDLE                   hVxD;                   /* 20 return from OpenVxDHandle */
63        DWORD                    dwStatus;               /* 24 0x00, 0x10, 0x20, 0x30 */
64        DWORD                    dwFlags;                /* 28 dwFlags upon creation */
65        HANDLE16                 hTask;                  /* 2C handle to created task */
66 } WINE_MMTHREAD;
67
68 typedef struct tagWINE_MCIDRIVER {
69         UINT                    wDeviceID;
70         UINT                    wType;
71         LPSTR                   lpstrElementName;
72         LPSTR                   lpstrDeviceType;
73         LPSTR                   lpstrAlias;
74         HDRVR                   hDrv;
75         DRIVERPROC16            driverProc;
76         DWORD                   dwPrivate;
77         YIELDPROC               lpfnYieldProc;
78         DWORD                   dwYieldData;
79         BOOL                    bIs32;
80         HTASK16                 hCreatorTask;
81         UINT                    uTypeCmdTable;
82         UINT                    uSpecificCmdTable;
83         struct tagWINE_MCIDRIVER*       lpNext;
84 } WINE_MCIDRIVER, *LPWINE_MCIDRIVER;
85
86 typedef enum {
87     MCI_MAP_NOMEM,      /* ko, memory problem */
88     MCI_MAP_MSGERROR,   /* ko, unknown message */
89     MCI_MAP_OK,         /* ok, no memory allocated. to be sent to 16 bit proc. */
90     MCI_MAP_OKMEM,      /* ok, some memory allocated, need to call MCI_UnMapMsg32ATo16. to be sent to 16 bit proc. */
91     MCI_MAP_PASS        /* ok, no memory allocated. to be sent to 32 bit proc */
92 } MCI_MapType;
93
94 #define WINE_TIMER_IS32 0x80
95
96 typedef struct tagTIMERENTRY {
97     UINT                        wDelay;
98     UINT                        wResol;
99     FARPROC16                   lpFunc;
100     DWORD                       dwUser;
101     UINT16                      wFlags;
102     UINT16                      wTimerID;
103     UINT                        wCurTime;
104     struct tagTIMERENTRY*       lpNext;
105 } WINE_TIMERENTRY, *LPWINE_TIMERENTRY;
106
107 typedef struct tagWINE_MM_IDATA {
108     /* iData reference */
109     DWORD                       dwThisProcess;
110     struct tagWINE_MM_IDATA*    lpNextIData;
111     /* winmm part */
112     HANDLE                      hWinMM32Instance;
113     HANDLE                      hWinMM16Instance;
114     HANDLE                      h16Module32;
115     CRITICAL_SECTION            cs;
116     /* mm timer part */
117     HANDLE                      hMMTimer;
118     DWORD                       mmSysTimeMS;
119     LPWINE_TIMERENTRY           lpTimerList;
120     int                         nSizeLpTimers;
121     LPWINE_TIMERENTRY           lpTimers;
122     /* mci part */
123     LPWINE_MCIDRIVER            lpMciDrv;
124 } WINE_MM_IDATA, *LPWINE_MM_IDATA;
125
126 /* function prototypes */
127
128 typedef LONG                    (*MCIPROC16)(DWORD, HDRVR16, WORD, DWORD, DWORD);
129 typedef LONG                    (*MCIPROC)(DWORD, HDRVR, DWORD, DWORD, DWORD);
130
131 extern LPWINE_MCIDRIVER         MCI_GetDriver(UINT16 uDevID);
132 extern UINT                     MCI_GetDriverFromString(LPCSTR str);
133 extern DWORD                    MCI_WriteString(LPSTR lpDstStr, DWORD dstSize, LPCSTR lpSrcStr);
134 extern const char*              MCI_MessageToString(UINT16 wMsg);
135
136 extern UINT16           WINAPI  MCI_DefYieldProc(UINT16 wDevID, DWORD data);
137
138 extern LRESULT                  MCI_CleanUp(LRESULT dwRet, UINT wMsg, DWORD dwParam2, BOOL bIs32);
139
140 extern DWORD                    MCI_SendCommand(UINT wDevID, UINT16 wMsg, DWORD dwParam1, DWORD dwParam2, BOOL bFrom32);
141 extern DWORD                    MCI_SendCommandFrom32(UINT wDevID, UINT16 wMsg, DWORD dwParam1, DWORD dwParam2);
142 extern DWORD                    MCI_SendCommandFrom16(UINT wDevID, UINT16 wMsg, DWORD dwParam1, DWORD dwParam2);
143 extern DWORD                    MCI_SendCommandAsync(UINT wDevID, UINT wMsg, DWORD dwParam1, DWORD dwParam2, UINT size);
144
145 HINSTANCE16             WINAPI  mmTaskCreate16(SEGPTR spProc, HINSTANCE16 *lphMmTask, DWORD dwPmt);
146 void                    WINAPI  mmTaskBlock16(HINSTANCE16 hInst);
147 LRESULT                 WINAPI  mmTaskSignal16(HTASK16 ht);
148 void                    WINAPI  mmTaskYield16(void);
149
150 void            CALLBACK        WINE_mmThreadEntryPoint(DWORD _pmt);
151 LRESULT                 WINAPI  mmThreadCreate16(FARPROC16 fpThreadAddr, LPHANDLE lpHndl, DWORD dwPmt, DWORD dwFlags);
152 void                    WINAPI  mmThreadSignal16(HANDLE16 hndl);
153 void                    WINAPI  mmThreadBlock16(HANDLE16 hndl);
154 HANDLE16                WINAPI  mmThreadGetTask16(HANDLE16 hndl);
155 BOOL16                  WINAPI  mmThreadIsValid16(HANDLE16 hndl);
156 BOOL16                  WINAPI  mmThreadIsCurrent16(HANDLE16 hndl);
157
158 BOOL                            MULTIMEDIA_MciInit(void);
159 LPWINE_MM_IDATA                 MULTIMEDIA_GetIData(void);
160
161 BOOL                            MULTIMEDIA_MidiInit(void);
162
163 #endif /* __WINE_MULTIMEDIA_H */