1 /* 2 * file w32_mm.h - prototypes for winmm library 3 * 4 * $Id: w32_mm.h,v 1.3 2006/02/09 18:31:47 fzago Exp $ 5 * 6 * Program XBLAST 7 * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) 8 * 9 * This program is free software; you can redistribute it and/or modify 10 * it under the terms of the GNU General Public License as published 11 * by the Free Software Foundation; either version 2; or (at your option) 12 * any later version 13 * 14 * This program is distributed in the hope that it will be entertaining, 15 * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General 17 * Public License for more details. 18 * 19 * You should have received a copy of the GNU General Public License along 20 * with this program; if not, write to the Free Software Foundation, Inc. 21 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 22 */ 23 #ifndef _W32_MM_H 24 #define _W32_MM_H 25 26 #include <windows.h> 27 28 #ifdef UNICODE 29 #define joyGetDevCaps joyGetDevCapsW 30 #else 31 #define joyGetDevCaps joyGetDevCapsA 32 #endif 33 34 #define MAXPNAMELEN 32 35 36 /* 37 * type definitions 38 */ 39 DECLARE_HANDLE (HWAVE); 40 DECLARE_HANDLE (HWAVEOUT); 41 42 typedef UINT MMRESULT; 43 44 typedef struct 45 { 46 UINT wXpos; 47 UINT wYpos; 48 UINT wZpos; 49 UINT wButtons; 50 } PACKED JOYINFO, *LPJOYINFO; 51 52 typedef struct tag_joycaps 53 { 54 UINT wMid; 55 UINT wPid; 56 char szPname[MAXPNAMELEN]; 57 UINT wXmin; 58 UINT wXmax; 59 UINT wYmin; 60 UINT wYmax; 61 UINT wZmin; 62 UINT wZmax; 63 UINT wNumButtons; 64 UINT wPeriodMin; 65 UINT wPeriodMax; 66 } PACKED JOYCAPS, *LPJOYCAPS; 67 68 typedef struct tag_waveformat 69 { 70 WORD wFormatTag; 71 WORD nChannels; 72 DWORD nSamplesPerSec; 73 DWORD nAvgBytesPerSec; 74 WORD nBlockAlign; 75 } PACKED WAVEFORMAT, *LPWAVEFORMAT; 76 77 typedef struct 78 { 79 WORD wFormatTag; 80 WORD nChannels; 81 DWORD nSamplesPerSec; 82 DWORD nAvgBytesPerSec; 83 WORD nBlockAlign; 84 WORD wBitsPerSample; 85 WORD cbSize; 86 } WAVEFORMATEX; 87 88 typedef struct tag_pcmwaveformat 89 { 90 WAVEFORMAT wf; 91 WORD wBitsPerSample; 92 } PACKED PCMWAVEFORMAT, *LPPCMWAVEFORMAT; 93 94 typedef struct tag_wavehdr 95 { 96 LPSTR lpData; 97 DWORD dwBufferLength; 98 DWORD dwBytesRecorded; 99 DWORD dwUser; 100 DWORD dwFlags; 101 DWORD dwLoops; 102 struct tag_wavehdr *lpNext; 103 DWORD reserved; 104 } PACKED WAVEHDR; 105 106 /* 107 * constants 108 */ 109 /* joystick ID */ 110 #define JOYSTICKID1 0 111 #define JOYSTICKID2 1 112 /* error codes */ 113 #define JOYERR_NOERROR 0 114 #define JOYERR_PARMS 165 115 #define JOYERR_NOCANDO 166 116 #define JOYERR_UNPLUGGED 167 117 /* messages */ 118 #define MM_JOY1MOVE 0x3A0 119 #define MM_JOY2MOVE 0x3A1 120 #define MM_JOY1ZMOVE 0x3A2 121 #define MM_JOY2ZMOVE 0x3A3 122 #define MM_JOY1BUTTONDOWN 0x3B5 123 #define MM_JOY2BUTTONDOWN 0x3B6 124 #define MM_JOY1BUTTONUP 0x3B7 125 #define MM_JOY2BUTTONUP 0x3B8 126 /* joystick button flags */ 127 #define JOY_BUTTON1CHG 0x0100 128 #define JOY_BUTTON2CHG 0x0200 129 #define JOY_BUTTON3CHG 0x0400 130 #define JOY_BUTTON4CHG 0x0800 131 132 /* flags for dwFlags parameter in waveOutOpen() and waveInOpen() */ 133 #define WAVE_FORMAT_QUERY 0x0001 134 #define WAVE_ALLOWSYNC 0x0002 135 #define CALLBACK_WINDOW 0x00010000l /* dwCallback is a HWND */ 136 #define CALLBACK_FUNCTION 0x00030000l /* dwCallback is a FARPROC */ 137 /* device ID for wave device mapper */ 138 #define WAVE_MAPPER (-1) 139 /* flags for wFormatTag field of WAVEFORMAT */ 140 #define WAVE_FORMAT_PCM 1 141 /* messages */ 142 #define MM_WOM_OPEN 0x3BB /* waveform output */ 143 #define MM_WOM_CLOSE 0x3BC 144 #define MM_WOM_DONE 0x3BD 145 /* flags for dwFlags field of WAVEHDR */ 146 #define WHDR_DONE 0x00000001 /* done bit */ 147 #define WHDR_PREPARED 0x00000002 /* set if this header has been prepared */ 148 #define WHDR_BEGINLOOP 0x00000004 /* loop start block */ 149 #define WHDR_ENDLOOP 0x00000008 /* loop end block */ 150 #define WHDR_INQUEUE 0x00000010 /* reserved for driver */ 151 152 /* KOEN SHIT */ 153 154 #define WINMMAPI 155 156 #define TIMERR_NOERROR (0) /* no error */ 157 #define TIMERR_NOCANDO (TIMERR_BASE+1) /* request not completed */ 158 #define TIMERR_STRUCT (TIMERR_BASE+33) /* time struct size */ 159 160 /* timer data types */ 161 typedef void (CALLBACK TIMECALLBACK) (UINT uTimerID, UINT uMsg, DWORD dwUser, DWORD dw1, DWORD dw2); 162 163 typedef TIMECALLBACK FAR *LPTIMECALLBACK; 164 165 /* MMTIME data structure */ 166 typedef struct mmtime_tag 167 { 168 UINT wType; /* indicates the contents of the union */ 169 union 170 { 171 DWORD ms; /* milliseconds */ 172 DWORD sample; /* samples */ 173 DWORD cb; /* byte count */ 174 DWORD ticks; /* ticks in MIDI stream */ 175 176 /* SMPTE */ 177 struct 178 { 179 BYTE hour; /* hours */ 180 BYTE min; /* minutes */ 181 BYTE sec; /* seconds */ 182 BYTE frame; /* frames */ 183 BYTE fps; /* frames per second */ 184 BYTE dummy; /* pad */ 185 #ifdef _WIN32 186 BYTE pad[2]; 187 #endif 188 } smpte; 189 190 /* MIDI */ 191 struct 192 { 193 DWORD songptrpos; /* song pointer position */ 194 } midi; 195 } u; 196 } MMTIME, *PMMTIME, *NPMMTIME, *LPMMTIME; 197 198 /* flags for fuEvent parameter of timeSetEvent() function */ 199 #define TIME_ONESHOT 0x0000 /* program timer for single event */ 200 #define TIME_PERIODIC 0x0001 /* program for continuous periodic event */ 201 202 #ifdef _WIN32 203 #define TIME_CALLBACK_FUNCTION 0x0000 /* callback is function */ 204 #define TIME_CALLBACK_EVENT_SET 0x0010 /* callback is event - use SetEvent */ 205 #define TIME_CALLBACK_EVENT_PULSE 0x0020 /* callback is event - use PulseEvent */ 206 #endif 207 208 /* timer device capabilities data structure */ 209 typedef struct timecaps_tag 210 { 211 UINT wPeriodMin; /* minimum period supported */ 212 UINT wPeriodMax; /* maximum period supported */ 213 } TIMECAPS, *PTIMECAPS, *NPTIMECAPS, *LPTIMECAPS; 214 215 /* timer function prototypes */ 216 WINMMAPI MMRESULT WINAPI timeGetSystemTime (LPMMTIME pmmt, UINT cbmmt); 217 WINMMAPI DWORD WINAPI timeGetTime (void); 218 WINMMAPI MMRESULT WINAPI timeSetEvent (UINT uDelay, UINT uResolution, LPTIMECALLBACK fptc, 219 DWORD dwUser, UINT fuEvent); 220 WINMMAPI MMRESULT WINAPI timeKillEvent (UINT uTimerID); 221 WINMMAPI MMRESULT WINAPI timeGetDevCaps (LPTIMECAPS ptc, UINT cbtc); 222 WINMMAPI MMRESULT WINAPI timeBeginPeriod (UINT uPeriod); 223 WINMMAPI MMRESULT WINAPI timeEndPeriod (UINT uPeriod); 224 225 /* 226 * function prototypes 227 */ 228 extern UINT STDCALL joyGetNumDevs (void); 229 extern MMRESULT STDCALL joyGetDevCaps (UINT, LPJOYCAPS, UINT); 230 extern MMRESULT STDCALL joyGetPos (UINT, LPJOYINFO); 231 extern MMRESULT STDCALL joySetCapture (HWND, UINT, UINT, BOOL); 232 extern MMRESULT STDCALL joySetThreshold (UINT, UINT); 233 extern MMRESULT STDCALL joyReleaseCapture (UINT uJoyID); 234 235 extern UINT STDCALL waveOutOpen (HWAVEOUT FAR * lphWaveOut, UINT uDeviceID, 236 const WAVEFORMAT FAR * lpFormat, DWORD dwCallback, 237 DWORD dwInstance, DWORD dwFlags); 238 extern UINT STDCALL waveOutClose (HWAVEOUT hWaveOut); 239 extern UINT STDCALL waveOutReset (HWAVEOUT hWaveOut); 240 extern UINT STDCALL waveOutPrepareHeader (HWAVEOUT hWaveOut, WAVEHDR FAR * lpWaveOutHdr, 241 UINT uSize); 242 extern UINT STDCALL waveOutUnprepareHeader (HWAVEOUT hWaveOut, WAVEHDR FAR * lpWaveOutHdr, 243 UINT uSize); 244 extern UINT STDCALL waveOutWrite (HWAVEOUT hWaveOut, WAVEHDR FAR * lpWaveOutHdr, UINT uSize); 245 #endif 246 /* 247 * end of file w32_mm.h 248 */ 249