|
1 | 1 | // Copyright © 2015, Peter Atashian
|
2 | 2 | // Licensed under the MIT License <LICENSE.md>
|
| 3 | +//! MM procedure declarations, constant definitions and macros |
| 4 | +//109 (Win 7 SDK) |
| 5 | +pub type MMVERSION = ::UINT; |
3 | 6 | pub type MMRESULT = ::UINT;
|
4 |
| - |
| 7 | +#[repr(C)] #[derive(Clone, Copy, Debug)] |
| 8 | +pub struct MMTIME { |
| 9 | + wType: ::UINT, |
| 10 | + u: MMTIME_u, |
| 11 | +} |
| 12 | +pub type PMMTIME = *mut MMTIME; |
| 13 | +pub type NPMMTIME = *mut MMTIME; |
| 14 | +pub type LPMMTIME = *mut MMTIME; |
| 15 | +#[repr(C)] #[derive(Clone, Copy, Debug)] |
| 16 | +pub struct MMTIME_u { |
| 17 | + data: [u8; 8], |
| 18 | +} |
| 19 | +impl MMTIME_u { |
| 20 | + pub unsafe fn ms(&mut self) -> *mut ::DWORD { |
| 21 | + ::std::mem::transmute(&self.data) |
| 22 | + } |
| 23 | + pub unsafe fn sample(&mut self) -> *mut ::DWORD { |
| 24 | + ::std::mem::transmute(&self.data) |
| 25 | + } |
| 26 | + pub unsafe fn cb(&mut self) -> *mut ::DWORD { |
| 27 | + ::std::mem::transmute(&self.data) |
| 28 | + } |
| 29 | + pub unsafe fn ticks(&mut self) -> *mut ::DWORD { |
| 30 | + ::std::mem::transmute(&self.data) |
| 31 | + } |
| 32 | + pub unsafe fn smpte(&mut self) -> *mut MMTIME_smpte { |
| 33 | + ::std::mem::transmute(&self.data) |
| 34 | + } |
| 35 | + pub unsafe fn midi(&mut self) -> *mut MMTIME_midi { |
| 36 | + ::std::mem::transmute(&self.data) |
| 37 | + } |
| 38 | +} |
| 39 | +#[repr(C)] #[derive(Clone, Copy, Debug)] |
| 40 | +pub struct MMTIME_smpte { |
| 41 | + pub hour: ::BYTE, |
| 42 | + pub min: ::BYTE, |
| 43 | + pub sec: ::BYTE, |
| 44 | + pub frame: ::BYTE, |
| 45 | + pub fps: ::BYTE, |
| 46 | + pub dummy: ::BYTE, |
| 47 | + pub pad: [::BYTE; 2], |
| 48 | +} |
| 49 | +#[repr(C)] #[derive(Clone, Copy, Debug)] |
| 50 | +pub struct MMTIME_midi { |
| 51 | + pub songptrpos: ::DWORD, |
| 52 | +} |
| 53 | +pub const TIME_MS: ::UINT = 0x0001; |
| 54 | +pub const TIME_SAMPLES: ::UINT = 0x0002; |
| 55 | +pub const TIME_BYTES: ::UINT = 0x0004; |
| 56 | +pub const TIME_SMPTE: ::UINT = 0x0008; |
| 57 | +pub const TIME_MIDI: ::UINT = 0x0010; |
| 58 | +pub const TIME_TICKS: ::UINT = 0x0020; |
| 59 | +pub const MM_JOY1MOVE: ::UINT = 0x3A0; |
| 60 | +pub const MM_JOY2MOVE: ::UINT = 0x3A1; |
| 61 | +pub const MM_JOY1ZMOVE: ::UINT = 0x3A2; |
| 62 | +pub const MM_JOY2ZMOVE: ::UINT = 0x3A3; |
| 63 | +pub const MM_JOY1BUTTONDOWN: ::UINT = 0x3B5; |
| 64 | +pub const MM_JOY2BUTTONDOWN: ::UINT = 0x3B6; |
| 65 | +pub const MM_JOY1BUTTONUP: ::UINT = 0x3B7; |
| 66 | +pub const MM_JOY2BUTTONUP: ::UINT = 0x3B8; |
| 67 | +pub const MM_MCINOTIFY: ::UINT = 0x3B9; |
| 68 | +pub const MM_WOM_OPEN: ::UINT = 0x3BB; |
| 69 | +pub const MM_WOM_CLOSE: ::UINT = 0x3BC; |
| 70 | +pub const MM_WOM_DONE: ::UINT = 0x3BD; |
| 71 | +pub const MM_WIM_OPEN: ::UINT = 0x3BE; |
| 72 | +pub const MM_WIM_CLOSE: ::UINT = 0x3BF; |
| 73 | +pub const MM_WIM_DATA: ::UINT = 0x3C0; |
| 74 | +pub const MM_MIM_OPEN: ::UINT = 0x3C1; |
| 75 | +pub const MM_MIM_CLOSE: ::UINT = 0x3C2; |
| 76 | +pub const MM_MIM_DATA: ::UINT = 0x3C3; |
| 77 | +pub const MM_MIM_LONGDATA: ::UINT = 0x3C4; |
| 78 | +pub const MM_MIM_ERROR: ::UINT = 0x3C5; |
| 79 | +pub const MM_MIM_LONGERROR: ::UINT = 0x3C6; |
| 80 | +pub const MM_MOM_OPEN: ::UINT = 0x3C7; |
| 81 | +pub const MM_MOM_CLOSE: ::UINT = 0x3C8; |
| 82 | +pub const MM_MOM_DONE: ::UINT = 0x3C9; |
| 83 | +pub const MMSYSERR_BASE: MMRESULT = 0; |
| 84 | +pub const WAVERR_BASE: MMRESULT = 32; |
| 85 | +pub const MIDIERR_BASE: MMRESULT = 64; |
| 86 | +pub const TIMERR_BASE: MMRESULT = 96; |
| 87 | +pub const JOYERR_BASE: MMRESULT = 160; |
| 88 | +pub const MCIERR_BASE: MMRESULT = 256; |
| 89 | +pub const MIXERR_BASE: MMRESULT = 1024; |
| 90 | +pub const MMSYSERR_NOERROR: MMRESULT = 0; |
| 91 | +pub const MMSYSERR_ERROR: MMRESULT = MMSYSERR_BASE + 1; |
| 92 | +pub const MMSYSERR_BADDEVICEID: MMRESULT = MMSYSERR_BASE + 2; |
| 93 | +pub const MMSYSERR_NOTENABLED: MMRESULT = MMSYSERR_BASE + 3; |
| 94 | +pub const MMSYSERR_ALLOCATED: MMRESULT = MMSYSERR_BASE + 4; |
| 95 | +pub const MMSYSERR_INVALHANDLE: MMRESULT = MMSYSERR_BASE + 5; |
| 96 | +pub const MMSYSERR_NODRIVER: MMRESULT = MMSYSERR_BASE + 6; |
| 97 | +pub const MMSYSERR_NOMEM: MMRESULT = MMSYSERR_BASE + 7; |
| 98 | +pub const MMSYSERR_NOTSUPPORTED: MMRESULT = MMSYSERR_BASE + 8; |
| 99 | +pub const MMSYSERR_BADERRNUM: MMRESULT = MMSYSERR_BASE + 9; |
| 100 | +pub const MMSYSERR_INVALFLAG: MMRESULT = MMSYSERR_BASE + 10; |
| 101 | +pub const MMSYSERR_INVALPARAM: MMRESULT = MMSYSERR_BASE + 11; |
| 102 | +pub const MMSYSERR_HANDLEBUSY: MMRESULT = MMSYSERR_BASE + 12; |
| 103 | +pub const MMSYSERR_INVALIDALIAS: MMRESULT = MMSYSERR_BASE + 13; |
| 104 | +pub const MMSYSERR_BADDB: MMRESULT = MMSYSERR_BASE + 14; |
| 105 | +pub const MMSYSERR_KEYNOTFOUND: MMRESULT = MMSYSERR_BASE + 15; |
| 106 | +pub const MMSYSERR_READERROR: MMRESULT = MMSYSERR_BASE + 16; |
| 107 | +pub const MMSYSERR_WRITEERROR: MMRESULT = MMSYSERR_BASE + 17; |
| 108 | +pub const MMSYSERR_DELETEERROR: MMRESULT = MMSYSERR_BASE + 18; |
| 109 | +pub const MMSYSERR_VALNOTFOUND: MMRESULT = MMSYSERR_BASE + 19; |
| 110 | +pub const MMSYSERR_NODRIVERCB: MMRESULT = MMSYSERR_BASE + 20; |
| 111 | +pub const MMSYSERR_MOREDATA: MMRESULT = MMSYSERR_BASE + 21; |
| 112 | +pub const MMSYSERR_LASTERROR: MMRESULT = MMSYSERR_BASE + 21; |
| 113 | +pub const CALLBACK_TYPEMASK: ::DWORD = 0x00070000; |
| 114 | +pub const CALLBACK_NULL: ::DWORD = 0x00000000; |
| 115 | +pub const CALLBACK_WINDOW: ::DWORD = 0x00010000; |
| 116 | +pub const CALLBACK_TASK: ::DWORD = 0x00020000; |
| 117 | +pub const CALLBACK_FUNCTION: ::DWORD = 0x00030000; |
| 118 | +pub const CALLBACK_THREAD: ::DWORD = CALLBACK_TASK; |
| 119 | +pub const CALLBACK_EVENT: ::DWORD = 0x00050000; |
| 120 | +//497 (Win 7 SDK) |
| 121 | +pub const WAVERR_BADFORMAT: MMRESULT = WAVERR_BASE + 0; |
| 122 | +pub const WAVERR_STILLPLAYING: MMRESULT = WAVERR_BASE + 1; |
| 123 | +pub const WAVERR_UNPREPARED: MMRESULT = WAVERR_BASE + 2; |
| 124 | +pub const WAVERR_SYNC: MMRESULT = WAVERR_BASE + 3; |
| 125 | +pub const WAVERR_LASTERROR: MMRESULT = WAVERR_BASE + 3; |
| 126 | +DECLARE_HANDLE!(HWAVEIN, HWAVEIN__); |
| 127 | +DECLARE_HANDLE!(HWAVEOUT, HWAVEOUT__); |
| 128 | +pub type LPHWAVEIN = *mut HWAVEIN; |
| 129 | +pub type LPHWAVEOUT = *mut HWAVEOUT; |
| 130 | +pub const WOM_OPEN: ::UINT = MM_WOM_OPEN; |
| 131 | +pub const WOM_CLOSE: ::UINT = MM_WOM_CLOSE; |
| 132 | +pub const WOM_DONE: ::UINT = MM_WOM_DONE; |
| 133 | +pub const WIM_OPEN: ::UINT = MM_WIM_OPEN; |
| 134 | +pub const WIM_CLOSE: ::UINT = MM_WIM_CLOSE; |
| 135 | +pub const WIM_DATA: ::UINT = MM_WIM_DATA; |
| 136 | +pub const WAVE_MAPPER: ::UINT = 0xFFFFFFFF; |
| 137 | +pub const WAVE_FORMAT_QUERY: ::DWORD = 0x0001; |
| 138 | +pub const WAVE_ALLOWSYNC: ::DWORD = 0x0002; |
| 139 | +pub const WAVE_MAPPED: ::DWORD = 0x0004; |
| 140 | +pub const WAVE_FORMAT_DIRECT: ::DWORD = 0x0008; |
| 141 | +pub const WAVE_FORMAT_DIRECT_QUERY: ::DWORD = WAVE_FORMAT_QUERY | WAVE_FORMAT_DIRECT; |
| 142 | +pub const WAVE_MAPPED_DEFAULT_COMMUNICATION_DEVICE: ::DWORD = 0x0010; |
| 143 | +#[repr(C)] #[derive(Clone, Copy, Debug)] |
| 144 | +pub struct WAVEHDR { |
| 145 | + pub lpData: ::LPSTR, |
| 146 | + pub dwBufferLength: ::DWORD, |
| 147 | + pub dwBytesRecorded: ::DWORD, |
| 148 | + pub dwUser: ::DWORD_PTR, |
| 149 | + pub dwFlags: ::DWORD, |
| 150 | + pub dwLoops: ::DWORD, |
| 151 | + pub lpNext: *mut WAVEHDR, |
| 152 | + pub reserved: ::DWORD_PTR, |
| 153 | +} |
| 154 | +pub type PWAVEHDR = *mut WAVEHDR; |
| 155 | +pub type NPWAVEHDR = *mut WAVEHDR; |
| 156 | +pub type LPWAVEHDR = *mut WAVEHDR; |
| 157 | +#[repr(C)] #[derive(Clone, Copy, Debug)] |
| 158 | +pub struct WAVEOUTCAPSW { |
| 159 | + pub wMid: ::WORD, |
| 160 | + pub wPid: ::WORD, |
| 161 | + pub vDriverVersion: MMVERSION, |
| 162 | + pub szPname: [::WCHAR; 32], |
| 163 | + pub dwFormats: ::DWORD, |
| 164 | + pub wChannels: ::WORD, |
| 165 | + pub wReserved1: ::WORD, |
| 166 | + pub dwSupport: ::DWORD, |
| 167 | +} |
| 168 | +pub type PWAVEOUTCAPSW = *mut WAVEOUTCAPSW; |
| 169 | +pub type NPWAVEOUTCAPSW = *mut WAVEOUTCAPSW; |
| 170 | +pub type LPWAVEOUTCAPSW = *mut WAVEOUTCAPSW; |
| 171 | +#[repr(C)] #[derive(Clone, Copy, Debug)] |
| 172 | +pub struct WAVEINCAPSW { |
| 173 | + pub wMid: ::WORD, |
| 174 | + pub wPid: ::WORD, |
| 175 | + pub vDriverVersion: MMVERSION, |
| 176 | + pub szPname: [::WCHAR; 32], |
| 177 | + pub dwFormats: ::DWORD, |
| 178 | + pub wChannels: ::WORD, |
| 179 | + pub wReserved1: ::WORD, |
| 180 | +} |
| 181 | +pub type PWAVEINCAPSW = *mut WAVEINCAPSW; |
| 182 | +pub type NPWAVEINCAPSW = *mut WAVEINCAPSW; |
| 183 | +pub type LPWAVEINCAPSW = *mut WAVEINCAPSW; |
| 184 | +pub const WAVE_INVALIDFORMAT: ::DWORD = 0x00000000; |
| 185 | +pub const WAVE_FORMAT_1M08: ::DWORD = 0x00000001; |
| 186 | +pub const WAVE_FORMAT_1S08: ::DWORD = 0x00000002; |
| 187 | +pub const WAVE_FORMAT_1M16: ::DWORD = 0x00000004; |
| 188 | +pub const WAVE_FORMAT_1S16: ::DWORD = 0x00000008; |
| 189 | +pub const WAVE_FORMAT_2M08: ::DWORD = 0x00000010; |
| 190 | +pub const WAVE_FORMAT_2S08: ::DWORD = 0x00000020; |
| 191 | +pub const WAVE_FORMAT_2M16: ::DWORD = 0x00000040; |
| 192 | +pub const WAVE_FORMAT_2S16: ::DWORD = 0x00000080; |
| 193 | +pub const WAVE_FORMAT_4M08: ::DWORD = 0x00000100; |
| 194 | +pub const WAVE_FORMAT_4S08: ::DWORD = 0x00000200; |
| 195 | +pub const WAVE_FORMAT_4M16: ::DWORD = 0x00000400; |
| 196 | +pub const WAVE_FORMAT_4S16: ::DWORD = 0x00000800; |
| 197 | +pub const WAVE_FORMAT_44M08: ::DWORD = 0x00000100; |
| 198 | +pub const WAVE_FORMAT_44S08: ::DWORD = 0x00000200; |
| 199 | +pub const WAVE_FORMAT_44M16: ::DWORD = 0x00000400; |
| 200 | +pub const WAVE_FORMAT_44S16: ::DWORD = 0x00000800; |
| 201 | +pub const WAVE_FORMAT_48M08: ::DWORD = 0x00001000; |
| 202 | +pub const WAVE_FORMAT_48S08: ::DWORD = 0x00002000; |
| 203 | +pub const WAVE_FORMAT_48M16: ::DWORD = 0x00004000; |
| 204 | +pub const WAVE_FORMAT_48S16: ::DWORD = 0x00008000; |
| 205 | +pub const WAVE_FORMAT_96M08: ::DWORD = 0x00010000; |
| 206 | +pub const WAVE_FORMAT_96S08: ::DWORD = 0x00020000; |
| 207 | +pub const WAVE_FORMAT_96M16: ::DWORD = 0x00040000; |
| 208 | +pub const WAVE_FORMAT_96S16: ::DWORD = 0x00080000; |
| 209 | +//782 (Win 7 SDK) |
| 210 | +pub type PWAVEFORMATEX = *mut ::WAVEFORMATEX; |
| 211 | +pub type NPWAVEFORMATEX = *mut ::WAVEFORMATEX; |
| 212 | +pub type LPWAVEFORMATEX = *mut ::WAVEFORMATEX; |
| 213 | +pub type LPCWAVEFORMATEX = *const ::WAVEFORMATEX; |
| 214 | +//2170 (Win 7 SDK) |
5 | 215 | pub const TIMERR_NOERROR: ::MMRESULT = 0;
|
6 |
| -pub const TIMERR_BASE: ::MMRESULT = 96; |
7 | 216 | pub const TIMERR_NOCANDO: ::MMRESULT = TIMERR_BASE + 1;
|
8 | 217 | pub const TIMERR_STRUCT: ::MMRESULT = TIMERR_BASE + 33;
|
| 218 | +//2198 (Win 7 SDK) |
| 219 | +#[repr(C)] #[derive(Clone, Copy, Debug)] |
| 220 | +pub struct TIMECAPS { |
| 221 | + pub wPeriodMin: ::UINT, |
| 222 | + pub wPeriodMax: ::UINT, |
| 223 | +} |
| 224 | +pub type PTIMECAPS = *mut TIMECAPS; |
| 225 | +pub type NPTIMECAPS = *mut TIMECAPS; |
| 226 | +pub type LPTIMECAPS = *mut TIMECAPS; |
0 commit comments