win-ffi 0.3.1 → 0.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. checksums.yaml +4 -4
  2. data/lib/win-ffi/enums/comdlg32/find_replace.rb +27 -27
  3. data/lib/win-ffi/enums/comdlg32/font.rb +32 -32
  4. data/lib/win-ffi/enums/system_info.rb +53 -53
  5. data/lib/win-ffi/enums/user32/pointer_flags.rb +81 -81
  6. data/lib/win-ffi/functions/advapi32/process.rb +32 -32
  7. data/lib/win-ffi/functions/advapi32/system_info.rb +16 -16
  8. data/lib/win-ffi/functions/comdlg32.rb +6 -6
  9. data/lib/win-ffi/functions/comdlg32/error.rb +5 -5
  10. data/lib/win-ffi/functions/comdlg32/find_replace.rb +9 -9
  11. data/lib/win-ffi/functions/msvcrt/handle.rb +12 -12
  12. data/lib/win-ffi/functions/ntdll/system_info.rb +13 -13
  13. data/lib/win-ffi/functions/secur32/system_info.rb +29 -29
  14. data/lib/win-ffi/functions/thread.rb +229 -229
  15. data/lib/win-ffi/functions/user32/cursor.rb +2 -0
  16. data/lib/win-ffi/functions/user32/mouse.rb +1 -1
  17. data/lib/win-ffi/functions/user32/window/window.rb +12 -11
  18. data/lib/win-ffi/functions/winmm.rb +546 -546
  19. data/lib/win-ffi/functions/wtsapi32/process.rb +11 -11
  20. data/lib/win-ffi/struct.rb +15 -15
  21. data/lib/win-ffi/structs/comdlg32/choose_color.rb +22 -22
  22. data/lib/win-ffi/structs/comdlg32/choose_font.rb +27 -27
  23. data/lib/win-ffi/structs/comdlg32/find_replace.rb +23 -23
  24. data/lib/win-ffi/structs/gdi32/abc.rb +8 -8
  25. data/lib/win-ffi/structs/gdi32/abcfloat.rb +10 -10
  26. data/lib/win-ffi/structs/gdi32/bitmap.rb +12 -12
  27. data/lib/win-ffi/structs/gdi32/bitmap_info.rb +10 -10
  28. data/lib/win-ffi/structs/gdi32/bitmap_info_header.rb +16 -16
  29. data/lib/win-ffi/structs/gdi32/blend_function.rb +9 -9
  30. data/lib/win-ffi/structs/gdi32/display_device.rb +11 -11
  31. data/lib/win-ffi/structs/gdi32/handle_table.rb +6 -6
  32. data/lib/win-ffi/structs/gdi32/kerning_pair.rb +8 -8
  33. data/lib/win-ffi/structs/gdi32/log_brush.rb +10 -10
  34. data/lib/win-ffi/structs/gdi32/meta_file_pict.rb +9 -9
  35. data/lib/win-ffi/structs/gdi32/palette_entry.rb +9 -9
  36. data/lib/win-ffi/structs/gdi32/pixel_format_descriptor.rb +56 -56
  37. data/lib/win-ffi/structs/gdi32/rgb_quad.rb +9 -9
  38. data/lib/win-ffi/structs/os_version_info.rb +9 -9
  39. data/lib/win-ffi/structs/point.rb +9 -9
  40. data/lib/win-ffi/structs/rect.rb +41 -27
  41. data/lib/win-ffi/structs/size.rb +5 -5
  42. data/lib/win-ffi/structs/user32/controls/combobox_info.rb +14 -12
  43. data/lib/win-ffi/structs/user32/controls/scroll_info.rb +12 -12
  44. data/lib/win-ffi/structs/user32/controls/scrollbar_info.rb +14 -12
  45. data/lib/win-ffi/structs/user32/cursor_info.rb +11 -9
  46. data/lib/win-ffi/structs/user32/display_device.rb +11 -11
  47. data/lib/win-ffi/structs/user32/draw_text_params.rb +10 -10
  48. data/lib/win-ffi/structs/user32/icon_info.rb +10 -10
  49. data/lib/win-ffi/structs/user32/icon_info_ex.rb +14 -14
  50. data/lib/win-ffi/structs/user32/last_input_info.rb +7 -7
  51. data/lib/win-ffi/structs/user32/mouse_move_point.rb +9 -9
  52. data/lib/win-ffi/structs/user32/msg.rb +18 -16
  53. data/lib/win-ffi/structs/user32/pointer_info.rb +24 -24
  54. data/lib/win-ffi/structs/user32/pointer_pen_info.rb +18 -18
  55. data/lib/win-ffi/structs/user32/pointer_touch_info.rb +18 -17
  56. data/lib/win-ffi/structs/user32/raw_input_device_list.rb +9 -9
  57. data/lib/win-ffi/structs/user32/raw_input_header.rb +9 -9
  58. data/lib/win-ffi/structs/user32/touch_hit_testing_input.rb +13 -10
  59. data/lib/win-ffi/structs/user32/touch_hit_testing_proximity_evaluation.rb +9 -7
  60. data/lib/win-ffi/structs/user32/track_mouse_event.rb +9 -9
  61. data/lib/win-ffi/structs/user32/window/alt_tab_info.rb +17 -17
  62. data/lib/win-ffi/structs/user32/window/bs_info.rb +11 -11
  63. data/lib/win-ffi/structs/user32/window/dlg_template.rb +13 -13
  64. data/lib/win-ffi/structs/user32/window/flashw_info.rb +1 -1
  65. data/lib/win-ffi/structs/user32/window/gui_thread_info.rb +17 -17
  66. data/lib/win-ffi/structs/user32/window/luid.rb +7 -7
  67. data/lib/win-ffi/structs/user32/window/menu_info.rb +12 -12
  68. data/lib/win-ffi/structs/user32/window/menu_item_info.rb +17 -17
  69. data/lib/win-ffi/structs/user32/window/menu_item_template.rb +8 -8
  70. data/lib/win-ffi/structs/user32/window/menubar_info.rb +13 -11
  71. data/lib/win-ffi/structs/user32/window/msgbox_params.rb +15 -15
  72. data/lib/win-ffi/structs/user32/window/title_bar_info.rb +3 -1
  73. data/lib/win-ffi/structs/user32/window/tpm_params.rb +9 -7
  74. data/lib/win-ffi/structs/user32/window/update_layered_window_info.rb +21 -21
  75. data/lib/win-ffi/structs/user32/window/window_placement.rb +32 -32
  76. data/lib/win-ffi/structs/user32/window/window_pos.rb +46 -46
  77. data/lib/win-ffi/version.rb +1 -1
  78. metadata +5 -6
@@ -1,5 +1,7 @@
1
1
  require 'win-ffi/functions/user32'
2
2
 
3
+ require 'win-ffi/structs/rect'
4
+ require 'win-ffi/structs/point'
3
5
  require 'win-ffi/structs/user32/cursor_info'
4
6
 
5
7
  module WinFFI
@@ -3,7 +3,7 @@ require 'win-ffi/functions/user32'
3
3
  require 'win-ffi/enums/user32/mouse_keys_flags'
4
4
  require 'win-ffi/enums/user32/mouse_event_flags'
5
5
 
6
- require 'lib/win-ffi/structs/point'
6
+ require 'win-ffi/structs/point'
7
7
  require 'win-ffi/structs/user32/mouse_move_point'
8
8
  require 'win-ffi/structs/user32/track_mouse_event'
9
9
 
@@ -1,5 +1,6 @@
1
1
  require 'win-ffi/functions/user32'
2
2
 
3
+ require 'win-ffi/enums/color_types'
3
4
  require 'win-ffi/enums/user32/window/animate_window_flags'
4
5
  require 'win-ffi/enums/user32/window/get_window_flags'
5
6
  require 'win-ffi/enums/user32/window/set_window_pos_flags'
@@ -186,7 +187,7 @@ module WinFFI
186
187
  attach_function 'FlashWindow', [:hwnd, :bool], :bool
187
188
 
188
189
  #BOOL WINAPI FlashWindowEx( _In_ PFLASHWINFO pfwi )
189
- attach_function 'FlashWindowEx', [FlashwInfo.ptr], :bool
190
+ attach_function 'FlashWindowEx', [FLASHWINFO.ptr], :bool
190
191
 
191
192
  #BOOL WINAPI GetAltTabInfo(
192
193
  # _In_opt_ HWND hwnd,
@@ -194,8 +195,8 @@ module WinFFI
194
195
  # _Inout_ PALTTABINFO pati,
195
196
  # _Out_opt_ LPTSTR pszItemText,
196
197
  # _In_ UINT cchItemText )
197
- attach_function 'GetAltTabInfoA', [:hwnd, :int, AltTabInfo.ptr, :string, :uint], :bool
198
- attach_function 'GetAltTabInfoW', [:hwnd, :int, AltTabInfo.ptr, :string, :uint], :bool
198
+ attach_function 'GetAltTabInfoA', [:hwnd, :int, ALTTABINFO.ptr, :string, :uint], :bool
199
+ attach_function 'GetAltTabInfoW', [:hwnd, :int, ALTTABINFO.ptr, :string, :uint], :bool
199
200
 
200
201
  #HWND WINAPI GetAncestor(
201
202
  # _In_ HWND hwnd,
@@ -216,7 +217,7 @@ module WinFFI
216
217
  #BOOL WINAPI GetGUIThreadInfo(
217
218
  # _In_ DWORD idThread,
218
219
  # _Inout_ LPGUITHREADINFO lpgui )
219
- attach_function 'GetGUIThreadInfo', [:dword, GuiThreadInfo.ptr], :bool
220
+ attach_function 'GetGUIThreadInfo', [:dword, GUITHREADINFO.ptr], :bool
220
221
 
221
222
  #HWND WINAPI GetLastActivePopup( _In_ HWND hWnd )
222
223
  attach_function 'GetLastActivePopup', [:hwnd], :hwnd
@@ -236,7 +237,7 @@ module WinFFI
236
237
  attach_function 'GetShellWindow', [], :hwnd
237
238
 
238
239
  #DWORD WINAPI GetSysColor( _In_ int nIndex )
239
- attach_function 'GetSysColor', [WinFFI::ColorTypes], :dword
240
+ attach_function 'GetSysColor', [ColorTypes], :dword
240
241
 
241
242
  #int WINAPI GetSystemMetrics( _In_ int nIndex )
242
243
  attach_function 'GetSystemMetrics', [SystemMetricsFlags], :int
@@ -244,7 +245,7 @@ module WinFFI
244
245
  #BOOL WINAPI GetTitleBarInfo(
245
246
  # _In_ HWND hwnd,
246
247
  # _Inout_ PTITLEBARINFO pti )
247
- attach_function 'GetTitleBarInfo', [:hwnd, TitleBarInfo.ptr], :bool
248
+ attach_function 'GetTitleBarInfo', [:hwnd, TITLEBARINFO.ptr], :bool
248
249
 
249
250
  #HWND WINAPI GetTopWindow( _In_opt_ HWND hWnd )
250
251
  attach_function 'GetTopWindow', [:hwnd], :hwnd
@@ -271,7 +272,7 @@ module WinFFI
271
272
  #BOOL GetWindowPlacement(
272
273
  # __in HWND hWnd,
273
274
  # __inout WINDOWPLACEMENT *lpwndpl)
274
- attach_function 'GetWindowPlacement', [:hwnd, WindowPlacement.ptr], :bool
275
+ attach_function 'GetWindowPlacement', [:hwnd, WINDOWPLACEMENT.ptr], :bool
275
276
 
276
277
  #BOOL GetWindowRect(
277
278
  # __in HWND hWnd,
@@ -391,7 +392,7 @@ module WinFFI
391
392
  #BOOL SetWindowPlacement(
392
393
  # __in HWND hWnd,
393
394
  # __inout WINDOWPLACEMENT *lpwndpl)
394
- attach_function 'SetWindowPlacement', [:hwnd, WindowPlacement.ptr], :bool
395
+ attach_function 'SetWindowPlacement', [:hwnd, WINDOWPLACEMENT.ptr], :bool
395
396
 
396
397
  #BOOL WINAPI SetWindowText(
397
398
  # __in HWND hWnd,
@@ -496,7 +497,7 @@ module WinFFI
496
497
  #BOOL WINAPI UpdateLayeredWindowIndirect(
497
498
  # _In_ HWND hwnd,
498
499
  # _In_ const UPDATELAYEREDWINDOWINFO *pULWInfo )
499
- attach_function 'UpdateLayeredWindowIndirect', [:hwnd, UpdateLayeredWindowInfo.ptr], :bool
500
+ attach_function 'UpdateLayeredWindowIndirect', [:hwnd, UPDATELAYEREDWINDOWINFO.ptr], :bool
500
501
 
501
502
  #HWND WINAPI WindowFromPhysicalPoint( _In_ POINT Point )
502
503
  attach_function 'WindowFromPhysicalPoint', [WinFFI::POINT], :hwnd
@@ -533,11 +534,11 @@ module WinFFI
533
534
  #HRESULT WINAPI GetProcessDPIAwareness(
534
535
  # _In_ HANDLE hprocess,
535
536
  # _Out_ PROCESS_DPI_AWARENESS *value )
536
- attach_function 'GetProcessDPIAwareness', [:handle, :pointer], :hresult
537
+ # attach_function 'GetProcessDPIAwareness', [:handle, :pointer], :hresult
537
538
 
538
539
  #HRESULT WINAPI SetProcessDPIAwareness(
539
540
  # _In_ PROCESS_DPI_AWARENESS value )
540
- attach_function 'SetProcessDPIAwareness', [:pointer], :hresult
541
+ # attach_function 'SetProcessDPIAwareness', [:pointer], :hresult
541
542
  end
542
543
  end
543
544
  end
@@ -1,547 +1,547 @@
1
- module WinFFI
2
- module WinMM
3
-
4
- typedef :pointer, :hwaveout
5
- typedef :pointer, :hwavein
6
- typedef :uint, :mmversion
7
-
8
- MMRESULT = enum :mm_result, [
9
- :MMSYSERR_NOERROR, 0,
10
- :MMSYSERR_ERROR, 1,
11
- :MMSYSERR_BADDEVICEID, 2,
12
- :MMSYSERR_NOTENABLED, 3,
13
- :MMSYSERR_ALLOCATED, 4,
14
- :MMSYSERR_INVALHANDLE, 5,
15
- :MMSYSERR_NODRIVER, 6,
16
- :MMSYSERR_NOMEM, 7,
17
- :MMSYSERR_NOTSUPPORTED, 8,
18
- :MMSYSERR_BADERRNUM, 9,
19
- :MMSYSERR_INVALFLAG, 10,
20
- :MMSYSERR_INVALPARAM, 11,
21
- :MMSYSERR_HANDLEBUSY, 12,
22
- :MMSYSERR_INVALIDALIAS, 13,
23
- :MMSYSERR_BADDB, 14,
24
- :MMSYSERR_KEYNOTFOUND, 15,
25
- :MMSYSERR_READERROR, 16,
26
- :MMSYSERR_WRITEERROR, 17,
27
- :MMSYSERR_DELETEERROR, 18,
28
- :MMSYSERR_VALNOTFOUND, 19,
29
- :MMSYSERR_NODRIVERCB, 20,
30
- :WAVERR_BADFORMAT, 32,
31
- :WAVERR_STILLPLAYING, 33,
32
- :WAVERR_UNPREPARED, 34
33
- ]
34
-
35
- module Waveform
36
- ffi_lib 'winmm.dll'
37
- extend LibBase
38
-
39
- # typedef struct {
40
- # WORD wMid;
41
- # WORD wPid;
42
- # MMVERSION vDriverVersion;
43
- # TCHAR szPname[MAXPNAMELEN];
44
- # WORD wTechnology;
45
- # WORD wReserved1;
46
- # DWORD dwSupport;
47
- # } AUXCAPS;
48
- class AUXCAPS < FFIStruct
49
- layout :wMid, :word,
50
- :wPid, :word,
51
- :vDriverVersion, :mmversion,
52
- :szPname, :string,
53
- :wTechnology, :word,
54
- :wReserved1, :word,
55
- :dwSupport, :dword
56
- end
57
-
58
- SND = enum :sound_flags, [
59
- :SYNC, 0x0000,
60
- :ASYNC, 0x0001,
61
- :NODEFAULT, 0x0002,
62
- :MEMORY, 0x0004,
63
-
64
- #loop the sound until next sndPlaySound
65
- :LOOP, 0x0008,
66
- :NOSTOP, 0x0010,
67
- :PURGE, 0x40,
68
-
69
- #The pszSound parameter is an application-specific alias in the registry. You can combine this flag with the
70
- # SND_ALIAS or SND_ALIAS_ID flag to specify an application-defined sound alias.
71
- :APPLICATION, 0x80,
72
- :NOWAIT, 0x00002000,
73
- :ALIAS, 0x00010000,
74
- :ALIAS_ID, 0x00110000,
75
- :FILENAME, 0x00020000,
76
- :RESOURCE, 0x00040004
77
- ]
78
-
79
- WHDR = enum :whdr_flags, [
80
- :DONE, 1,
81
- :PREPARED, 2,
82
- :BEGINLOOP, 4,
83
- :ENDLOOP, 8,
84
- :INQUEUE, 16
85
- ]
86
-
87
- # typedef struct wavehdr_tag {
88
- # LPSTR lpData;
89
- # DWORD dwBufferLength;
90
- # DWORD dwBytesRecorded;
91
- # DWORD_PTR dwUser;
92
- # DWORD dwFlags;
93
- # DWORD dwLoops;
94
- # struct wavehdr_tag *lpNext;
95
- # DWORD_PTR reserved;
96
- # } WAVEHDR, *LPWAVEHDR;
97
- class WAVEHDR < FFIStruct
98
- layout :lpData, :pointer,
99
- :dwBufferLength, :dword,
100
- :dwBytesRecorded, :dword,
101
- :dwUser, :pointer,
102
- :dwFlags, WHDR,
103
- :dwLoops, :dword,
104
- :lpNext, :pointer,
105
- :reserved, :pointer
106
- end
107
-
108
- # typedef struct {
109
- # WORD wMid;
110
- # WORD wPid;
111
- # MMVERSION vDriverVersion;
112
- # TCHAR szPname[MAXPNAMELEN];
113
- # DWORD dwFormats;
114
- # WORD wChannels;
115
- # WORD wReserved1;
116
- # } WAVEINCAPS;
117
- class WAVEINCAPS < FFIStruct
118
- layout :wMid, :word,
119
- :wPid, :word,
120
- :vDriverVersion, :mmversion,
121
- :szPname, :string,
122
- :dwFormats, :dword,
123
- :wChannels, :word,
124
- :wReserved1, :word
125
- end
126
-
127
- # typedef struct {
128
- # WORD wMid;
129
- # WORD wPid;
130
- # MMVERSION vDriverVersion;
131
- # TCHAR szPname[MAXPNAMELEN];
132
- # DWORD dwFormats;
133
- # WORD wChannels;
134
- # WORD wReserved1;
135
- # DWORD dwSupport;
136
- # } WAVEOUTCAPS;
137
- class WAVEOUTCAPS < FFIStruct
138
- layout wMid, :word,
139
- wPid, :word,
140
- vDriverVersion, :mmversion,
141
- szPname, :string,
142
- dwFormats, :dword,
143
- wChannels, :word,
144
- wReserved1, :word,
145
- dwSupport, :dword
146
- end
147
-
148
- # typedef struct {
149
- # WORD wFormatTag;
150
- # WORD nChannels;
151
- # DWORD nSamplesPerSec;
152
- # DWORD nAvgBytesPerSec;
153
- # WORD nBlockAlign;
154
- # WORD wBitsPerSample;
155
- # WORD cbSize;
156
- # } WAVEFORMATEX;
157
- class WAVEFORMATEX < FFIStruct
158
- layout :wFormatTag, :word,
159
- :nChannels, :word,
160
- :nSamplesPerSec, :dword,
161
- :nAvgBytesPerSec, :dword,
162
- :nBlockAlign, :word,
163
- :wBitsPerSample, :word,
164
- :cbSize, :word
165
- end
166
-
167
- # MMRESULT auxGetDevCaps(
168
- # UINT_PTR uDeviceID,
169
- # LPAUXCAPS lpCaps,
170
- # UINT cbCaps);
171
- attach_function 'auxGetDevCapsA', [:pointer, AUXCAPS.ptr, :uint], MMRESULT
172
- attach_function 'auxGetDevCapsW', [:pointer, AUXCAPS.ptr, :uint], MMRESULT
173
-
174
- # UINT auxGetNumDevs(void);
175
- attach_function 'auxGetNumDevs', [], :uint
176
-
177
- # MMRESULT auxGetVolume(
178
- # UINT uDeviceID,
179
- # LPDWORD lpdwVolume);
180
- attach_function 'auxGetVolume', [:uint, :pointer], MMRESULT
181
-
182
- # DWORD auxOutMessage(
183
- # UINT uDeviceID,
184
- # UINT uMsg,
185
- # DWORD_PTR dwParam1,
186
- # DWORD_PTR dwParam2);
187
- attach_function 'auxOutMessage', [:uint, :uint, :pointer, :pointer], :dword
188
-
189
- # MMRESULT auxSetVolume(
190
- # UINT uDeviceID,
191
- # DWORD dwVolume);
192
- attach_function 'auxSetVolume', [:uint, :dword], MMRESULT
193
-
194
- #BOOL PlaySound(
195
- # LPCTSTR pszSound,
196
- # HMODULE hmod,
197
- # DWORD fdwSound )
198
- attach_function 'PlaySound', [:string, :hmodule, SoundFlags], :bool
199
- attach_function 'PlaySoundA', [:string, :hmodule, SoundFlags], :bool
200
- attach_function 'PlaySoundW', [:string, :hmodule, SoundFlags], :bool
201
-
202
- # BOOL sndPlaySound(
203
- # LPCTSTR lpszSound,
204
- # UINT fuSound)
205
- attach_function 'sndPlaySound', [:string, SND], :bool
206
-
207
- # MMRESULT waveInAddBuffer(
208
- # HWAVEIN hwi,
209
- # LPWAVEHDR pwh,
210
- # UINT cbwh)
211
- attach_function 'waveInAddBuffer', [:hwavein, WAVEHDR.ptr, :uint], MMRESULT
212
-
213
- # MMRESULT waveInClose( HWAVEIN hwi )
214
- attach_fuunction 'waveInClose', [:hwavein], MMRESULT
215
-
216
- # MMRESULT waveInGetDevCaps(
217
- # UINT_PTR uDeviceID,
218
- # LPWAVEINCAPS pwic,
219
- # UINT cbwic)
220
- attach_function 'waveInGetDevCapsA', [:pointer, WAVEINCAPS.ptr, :uint], MMRESULT
221
- attach_function 'waveInGetDevCapsW', [:pointer, WAVEINCAPS.ptr, :uint], MMRESULT
222
-
223
- # MMRESULT waveInGetErrorText(
224
- # MMRESULT mmrError,
225
- # LPTSTR pszText,
226
- # UINT cchText)
227
- attach_function 'waveInGetErrorTextA', [MMRESULT, :string, :uint], MMRESULT
228
- attach_function 'waveInGetErrorTextW', [MMRESULT, :string, :uint], MMRESULT
229
-
230
- # MMRESULT waveInGetID(
231
- # HWAVEIN hwi,
232
- # LPUINT puDeviceID);
233
- attach_function 'waveInGetID', [:hwavein, :pointer], MMRESULT
234
-
235
- # UINT waveInGetNumDevs(void)
236
- attach_function 'waveInGetNumDevs', [], :uint
237
-
238
- # UINT waveInGetNumDevs(void);
239
- attach_function 'waveInGetNumDevs', [], :uint
240
-
241
- #TODO MMTIME structure
242
- # MMRESULT waveInGetPosition(
243
- # HWAVEIN hwi,
244
- # LPMMTIME pmmt,
245
- # UINT cbmmt)
246
- # attach_function 'waveInGetPosition', [:hwavein, ], MMRESULT
247
-
248
- # DWORD waveInMessage(
249
- # HWAVEIN deviceID,
250
- # UINT uMsg,
251
- # DWORD_PTR dwParam1,
252
- # DWORD_PTR dwParam2);
253
- attach_function 'waveInMessage', [:hwavein, :uint, :pointer, :pointer], :dword
254
-
255
- # MMRESULT waveInOpen(
256
- # LPHWAVEIN phwi,
257
- # UINT uDeviceID,
258
- # LPCWAVEFORMATEX pwfx,
259
- # DWORD_PTR dwCallback,
260
- # DWORD_PTR dwCallbackInstance,
261
- # DWORD fdwOpen);
262
- attach_function 'waveInOpen', [:hwavein.ptr, :uint, WAVEFORMATEX.ptr, :pointer, :pointer, :dword], MMRESULT
263
-
264
- # MMRESULT waveInPrepareHeader(
265
- # HWAVEIN hwi,
266
- # LPWAVEHDR pwh,
267
- # UINT cbwh);
268
- attach_function 'waveInPrepareHeader', [:hwavein, WAVEHDR.ptr, :uint], MMRESULT
269
-
270
- #TODO Callback
271
- # void CALLBACK waveInProc(
272
- # HWAVEIN hwi,
273
- # UINT uMsg,
274
- # DWORD_PTR dwInstance,
275
- # DWORD_PTR dwParam1,
276
- # DWORD_PTR dwParam2);
277
- WaveInProc = callback :waveInProc, [:hwavein, :uint, :pointer, :pointer, :pointer], :void
278
-
279
- # MMRESULT waveInReset( HWAVEIN hwi );
280
- attach_function 'waveInReset', [:hwavein], MMRESULT
281
-
282
- # MMRESULT waveInStart( HWAVEIN hwi );
283
- attach_function 'waveInStart', [:hwavein], MMRESULT
284
-
285
- # MMRESULT waveInStop( HWAVEIN hwi );
286
- attach_function 'waveInStop', [:hwavein], MMRESULT
287
-
288
- # MMRESULT waveInUnprepareHeader(
289
- # HWAVEIN hwi,
290
- # LPWAVEHDR pwh,
291
- # UINT cbwh);
292
- attach_function 'waveInUnprepareHeader', [:hwavein, WAVEHDR.ptr, :uint], MMRESULT
293
-
294
- # MMRESULT waveOutBreakLoop( HWAVEOUT hwo );
295
- attach_function 'waveOutBreakLoop', [:hwaveout], MMRESULT
296
-
297
- # MMRESULT waveOutClose( HWAVEOUT hwo );
298
- attach_function 'waveOutClose', [:hwaveout], MMRESULT
299
-
300
- # MMRESULT waveOutGetDevCaps(
301
- # UINT_PTR uDeviceID,
302
- # LPWAVEOUTCAPS pwoc,
303
- # UINT cbwoc);
304
- attach_function 'waveOutGetDevCapsA', [:pointer, WAVEOUTCAPS.ptr, :uint], MMRESULT
305
- attach_function 'waveOutGetDevCapsW', [:pointer, WAVEOUTCAPS.ptr, :uint], MMRESULT
306
-
307
- # MMRESULT waveOutGetErrorText(
308
- # MMRESULT mmrError,
309
- # LPTSTR pszText,
310
- # UINT cchText);
311
- attach_function 'waveOutGetErrorTextA', [MMRESULT, :string, :uint], MMRESULT
312
- attach_function 'waveOutGetErrorTextW', [MMRESULT, :string, :uint], MMRESULT
313
-
314
- # MMRESULT waveOutGetID(
315
- # HWAVEOUT hwo,
316
- # LPUINT puDeviceID);
317
- attach_function 'waveOutGetID' , [:hwaveout, :pointer], MMRESULT
318
-
319
- # UINT waveOutGetNumDevs(void);
320
- attach_function 'waveOutGetNumDevs', [], :uint
321
-
322
- # MMRESULT waveOutGetPitch(
323
- # HWAVEOUT hwo,
324
- # LPDWORD pdwPitch);
325
- attach_function 'waveOutGetPitch', [:hwaveout, :pointer], MMRESULT
326
-
327
- # MMRESULT waveOutGetPlaybackRate(
328
- # HWAVEOUT hwo,
329
- # LPDWORD pdwRate);
330
- attach_function 'waveOutGetPlaybackRate', [:hwaveout, :pointer], MMRESULT
331
-
332
- #TODO MMTIME
333
- # MMRESULT waveOutGetPosition(
334
- # HWAVEOUT hwo,
335
- # LPMMTIME pmmt,
336
- # UINT cbmmt);
337
- # attach_function 'waveOutGetPosition', [:hwaveout, :]
338
-
339
- # MMRESULT waveOutGetVolume(
340
- # HWAVEOUT hwo,
341
- # LPDWORD pdwVolume);
342
- attach_function 'waveOutGetVolume', [:hwaveout, :pointer], MMRESULT
343
-
344
- # DWORD waveOutMessage(
345
- # HWAVEOUT deviceID,
346
- # UINT uMsg,
347
- # DWORD_PTR dwParam1,
348
- # DWORD_PTR dwParam2);
349
- attach_function 'waveOutMessage', [:hwaveout, :uint, :pointer, :pointer], :dword
350
-
351
- # MMRESULT waveOutOpen(
352
- # LPHWAVEOUT phwo,
353
- # UINT_PTR uDeviceID,
354
- # LPWAVEFORMATEX pwfx,
355
- # DWORD_PTR dwCallback,
356
- # DWORD_PTR dwCallbackInstance,
357
- # DWORD fdwOpen);
358
- attach_function 'waveOutOpen', [:pointer, :pointer, WAVEFORMATEX.ptr, :pointer, :pointer, :dword], MMRESULT
359
-
360
- # MMRESULT waveOutPause( HWAVEOUT hwo );
361
- attach_function 'waveOutPause', [:hwaveout], MMRESULT
362
-
363
- #MMRESULT waveOutSetVolume(
364
- # HWAVEOUT hwo,
365
- # DWORD dwVolume )
366
- attach_function 'waveOutSetVolume', [:hwaveout, :dword], :int
367
-
368
- #UINT waveOutGetNumDevs(void)
369
- attach_function 'waveOutGetNumDevs', [], :uint
370
-
371
- #UINT waveInGetNumDevs(void)
372
- attach_function 'waveInGetNumDevs', [], :uint
373
-
374
- #UINT midiOutGetNumDevs(void)
375
- attach_function 'midiOutGetNumDevs', [], :uint
376
-
377
- #UINT midiInGetNumDevs(void)
378
- attach_function 'midiInGetNumDevs', [], :uint
379
-
380
- #UINT auxGetNumDevs(void)
381
- attach_function 'auxGetNumDevs', [], :uint
382
-
383
- #UINT mixerGetNumDevs(void)
384
- attach_function 'mixerGetNumDevs', [], :int
385
-
386
- end
387
-
388
- module Joystick
389
- ffi_lib 'winmm.dll'
390
- extend LibBase
391
-
392
- # typedef struct {
393
- # UINT wXpos;
394
- # UINT wYpos;
395
- # UINT wZpos;
396
- # UINT wButtons;
397
- # } JOYINFO;
398
- class JOYINFO < FFIStruct
399
- layout :wXpos, :uint,
400
- :wYpos, :uint,
401
- :wZpos, :uint,
402
- :wButtons, :uint
403
- end
404
-
405
- # typedef struct joyinfoex_tag {
406
- # DWORD dwSize;
407
- # DWORD dwFlags;
408
- # DWORD dwXpos;
409
- # DWORD dwYpos;
410
- # DWORD dwZpos;
411
- # DWORD dwRpos;
412
- # DWORD dwUpos;
413
- # DWORD dwVpos;
414
- # DWORD dwButtons;
415
- # DWORD dwButtonNumber;
416
- # DWORD dwPOV;
417
- # DWORD dwReserved1;
418
- # DWORD dwReserved2;
419
- # } JOYINFOEX;
420
- class JOYINFOEX < FFIStruct
421
- layout :dwSize, :dword,
422
- :dwFlags, :dword,
423
- :dwXpos, :dword,
424
- :dwYpos, :dword,
425
- :dwZpos, :dword,
426
- :dwRpos, :dword,
427
- :dwUpos, :dword,
428
- :dwVpos, :dword,
429
- :dwButtons, :dword,
430
- :dwButtonNumber, :dword,
431
- :dwPOV, :dword,
432
- :dwReserved1, :dword,
433
- :dwReserved2, :dword,
434
- end
435
-
436
- # typedef struct {
437
- # WORD wMid;
438
- # WORD wPid;
439
- # TCHAR szPname[MAXPNAMELEN];
440
- # UINT wXmin;
441
- # UINT wXmax;
442
- # UINT wYmin;
443
- # UINT wYmax;
444
- # UINT wZmin;
445
- # UINT wZmax;
446
- # UINT wNumButtons;
447
- # UINT wPeriodMin;
448
- # UINT wPeriodMax;
449
- # UINT wRmin;
450
- # UINT wRmax;
451
- # UINT wUmin;
452
- # UINT wUmax;
453
- # UINT wVmin;
454
- # UINT wVmax;
455
- # UINT wCaps;
456
- # UINT wMaxAxes;
457
- # UINT wNumAxes;
458
- # UINT wMaxButtons;
459
- # TCHAR szRegKey[MAXPNAMELEN];
460
- # TCHAR szOEMVxD[MAX_JOYSTICKOEMVXDNAME];
461
- # } JOYCAPS;
462
-
463
- class JOYCAPS < FFIStruct
464
- layout :wMid, :word,
465
- :wPid, :word,
466
- :szPname, :string,
467
- :wXmin, :uint,
468
- :wXmax, :uint,
469
- :wYmin, :uint,
470
- :wYmax, :uint,
471
- :wZmin, :uint,
472
- :wZmax, :uint,
473
- :wNumButtons, :uint,
474
- :wPeriodMin, :uint,
475
- :wPeriodMax, :uint,
476
- :wRmin, :uint,
477
- :wRmax, :uint,
478
- :wUmin, :uint,
479
- :wUmax, :uint,
480
- :wVmin, :uint,
481
- :wVmax, :uint,
482
- :wCaps, :uint,
483
- :wMaxAxes, :uint,
484
- :wNumAxes, :uint,
485
- :wMaxButtons, :uint,
486
- :szRegKey, :string,
487
- :szOEMVxD, :string,
488
- end
489
-
490
- JoyCapsFlags = enum :joy_caps_flags, [
491
- :HASZ, # Joystick has z-coordinate information.
492
- :HASR, # Joystick has rudder (fourth axis) information.
493
- :HASU, # Joystick has u-coordinate (fifth axis) information.
494
- :HASV, # Joystick has v-coordinate (sixth axis) information.
495
- :HASPOV, # Joystick has point-of-view information.
496
- :POV4DIR, # Joystick point-of-view supports discrete values (centered, forward, backward, left, and right).
497
- :POVCTS , # Joystick point-of-view supports continuous degree bearings.
498
- ]
499
-
500
- # MMRESULT joyConfigChanged( DWORD dwFlags )
501
- attach_function 'joyConfigChanged', [:dword], MMRESULT
502
-
503
- # MMRESULT joyGetDevCaps(
504
- # UINT_PTR uJoyID,
505
- # LPJOYCAPS pjc,
506
- # UINT cbjc);
507
- attach_function 'joyGetDevCapsA', [:pointer, JOYCAPS.ptr, :uint], MMRESULT
508
- attach_function 'joyGetDevCapsW', [:pointer, JOYCAPS.ptr, :uint], MMRESULT
509
-
510
- # UINT joyGetNumDevs(void);
511
- attach_function 'joyGetNumDevs', [], :uint
512
-
513
- # MMRESULT joyGetPos(
514
- # UINT uJoyID,
515
- # LPJOYINFO pji);
516
- attach_function 'joyGetPos', [:uint, JOYINFO.ptr], MMRESULT
517
-
518
- # MMRESULT joyGetPosEx(
519
- # UINT uJoyID,
520
- # LPJOYINFOEX pji);
521
- attach_function 'joyGetPosEx', [:uint, JOYINFOEX.ptr], MMRESULT
522
-
523
- # MMRESULT joyGetThreshold(
524
- # UINT uJoyID,
525
- # LPUINT puThreshold);
526
- attach_function 'joyGetThreshold', [:uint, :pointer], MMRESULT
527
-
528
- # MMRESULT joyReleaseCapture( UINT uJoyID );
529
- attach_function 'joyReleaseCapture', [:uint], MMRESULT
530
-
531
- # MMRESULT joySetCapture(
532
- # HWND hwnd,
533
- # UINT uJoyID,
534
- # UINT uPeriod,
535
- # BOOL fChanged);
536
- attach_function 'joySetCapture', [:hwnd, :uint, :uint, :bool], MMRESULT
537
-
538
- # MMRESULT joySetThreshold(
539
- # UINT uJoyID,
540
- # UINT uThreshold);
541
- attach_function 'joySetThreshold', [:uint, :uint], MMRESULT
542
-
543
-
544
-
545
- end
546
- end
1
+ module WinFFI
2
+ module WinMM
3
+
4
+ typedef :pointer, :hwaveout
5
+ typedef :pointer, :hwavein
6
+ typedef :uint, :mmversion
7
+
8
+ MMRESULT = enum :mm_result, [
9
+ :MMSYSERR_NOERROR, 0,
10
+ :MMSYSERR_ERROR, 1,
11
+ :MMSYSERR_BADDEVICEID, 2,
12
+ :MMSYSERR_NOTENABLED, 3,
13
+ :MMSYSERR_ALLOCATED, 4,
14
+ :MMSYSERR_INVALHANDLE, 5,
15
+ :MMSYSERR_NODRIVER, 6,
16
+ :MMSYSERR_NOMEM, 7,
17
+ :MMSYSERR_NOTSUPPORTED, 8,
18
+ :MMSYSERR_BADERRNUM, 9,
19
+ :MMSYSERR_INVALFLAG, 10,
20
+ :MMSYSERR_INVALPARAM, 11,
21
+ :MMSYSERR_HANDLEBUSY, 12,
22
+ :MMSYSERR_INVALIDALIAS, 13,
23
+ :MMSYSERR_BADDB, 14,
24
+ :MMSYSERR_KEYNOTFOUND, 15,
25
+ :MMSYSERR_READERROR, 16,
26
+ :MMSYSERR_WRITEERROR, 17,
27
+ :MMSYSERR_DELETEERROR, 18,
28
+ :MMSYSERR_VALNOTFOUND, 19,
29
+ :MMSYSERR_NODRIVERCB, 20,
30
+ :WAVERR_BADFORMAT, 32,
31
+ :WAVERR_STILLPLAYING, 33,
32
+ :WAVERR_UNPREPARED, 34
33
+ ]
34
+
35
+ module Waveform
36
+ ffi_lib 'winmm.dll'
37
+ extend LibBase
38
+
39
+ # typedef struct {
40
+ # WORD wMid;
41
+ # WORD wPid;
42
+ # MMVERSION vDriverVersion;
43
+ # TCHAR szPname[MAXPNAMELEN];
44
+ # WORD wTechnology;
45
+ # WORD wReserved1;
46
+ # DWORD dwSupport;
47
+ # } AUXCAPS;
48
+ class AUXCAPS < FFIStruct
49
+ layout :wMid, :word,
50
+ :wPid, :word,
51
+ :vDriverVersion, :mmversion,
52
+ :szPname, :string,
53
+ :wTechnology, :word,
54
+ :wReserved1, :word,
55
+ :dwSupport, :dword
56
+ end
57
+
58
+ SND = enum :sound_flags, [
59
+ :SYNC, 0x0000,
60
+ :ASYNC, 0x0001,
61
+ :NODEFAULT, 0x0002,
62
+ :MEMORY, 0x0004,
63
+
64
+ #loop the sound until next sndPlaySound
65
+ :LOOP, 0x0008,
66
+ :NOSTOP, 0x0010,
67
+ :PURGE, 0x40,
68
+
69
+ #The pszSound parameter is an application-specific alias in the registry. You can combine this flag with the
70
+ # SND_ALIAS or SND_ALIAS_ID flag to specify an application-defined sound alias.
71
+ :APPLICATION, 0x80,
72
+ :NOWAIT, 0x00002000,
73
+ :ALIAS, 0x00010000,
74
+ :ALIAS_ID, 0x00110000,
75
+ :FILENAME, 0x00020000,
76
+ :RESOURCE, 0x00040004
77
+ ]
78
+
79
+ WHDR = enum :whdr_flags, [
80
+ :DONE, 1,
81
+ :PREPARED, 2,
82
+ :BEGINLOOP, 4,
83
+ :ENDLOOP, 8,
84
+ :INQUEUE, 16
85
+ ]
86
+
87
+ # typedef struct wavehdr_tag {
88
+ # LPSTR lpData;
89
+ # DWORD dwBufferLength;
90
+ # DWORD dwBytesRecorded;
91
+ # DWORD_PTR dwUser;
92
+ # DWORD dwFlags;
93
+ # DWORD dwLoops;
94
+ # struct wavehdr_tag *lpNext;
95
+ # DWORD_PTR reserved;
96
+ # } WAVEHDR, *LPWAVEHDR;
97
+ class WAVEHDR < FFIStruct
98
+ layout :lpData, :pointer,
99
+ :dwBufferLength, :dword,
100
+ :dwBytesRecorded, :dword,
101
+ :dwUser, :pointer,
102
+ :dwFlags, WHDR,
103
+ :dwLoops, :dword,
104
+ :lpNext, :pointer,
105
+ :reserved, :pointer
106
+ end
107
+
108
+ # typedef struct {
109
+ # WORD wMid;
110
+ # WORD wPid;
111
+ # MMVERSION vDriverVersion;
112
+ # TCHAR szPname[MAXPNAMELEN];
113
+ # DWORD dwFormats;
114
+ # WORD wChannels;
115
+ # WORD wReserved1;
116
+ # } WAVEINCAPS;
117
+ class WAVEINCAPS < FFIStruct
118
+ layout :wMid, :word,
119
+ :wPid, :word,
120
+ :vDriverVersion, :mmversion,
121
+ :szPname, :string,
122
+ :dwFormats, :dword,
123
+ :wChannels, :word,
124
+ :wReserved1, :word
125
+ end
126
+
127
+ # typedef struct {
128
+ # WORD wMid;
129
+ # WORD wPid;
130
+ # MMVERSION vDriverVersion;
131
+ # TCHAR szPname[MAXPNAMELEN];
132
+ # DWORD dwFormats;
133
+ # WORD wChannels;
134
+ # WORD wReserved1;
135
+ # DWORD dwSupport;
136
+ # } WAVEOUTCAPS;
137
+ class WAVEOUTCAPS < FFIStruct
138
+ layout wMid, :word,
139
+ wPid, :word,
140
+ vDriverVersion, :mmversion,
141
+ szPname, :string,
142
+ dwFormats, :dword,
143
+ wChannels, :word,
144
+ wReserved1, :word,
145
+ dwSupport, :dword
146
+ end
147
+
148
+ # typedef struct {
149
+ # WORD wFormatTag;
150
+ # WORD nChannels;
151
+ # DWORD nSamplesPerSec;
152
+ # DWORD nAvgBytesPerSec;
153
+ # WORD nBlockAlign;
154
+ # WORD wBitsPerSample;
155
+ # WORD cbSize;
156
+ # } WAVEFORMATEX;
157
+ class WAVEFORMATEX < FFIStruct
158
+ layout :wFormatTag, :word,
159
+ :nChannels, :word,
160
+ :nSamplesPerSec, :dword,
161
+ :nAvgBytesPerSec, :dword,
162
+ :nBlockAlign, :word,
163
+ :wBitsPerSample, :word,
164
+ :cbSize, :word
165
+ end
166
+
167
+ # MMRESULT auxGetDevCaps(
168
+ # UINT_PTR uDeviceID,
169
+ # LPAUXCAPS lpCaps,
170
+ # UINT cbCaps);
171
+ attach_function 'auxGetDevCapsA', [:pointer, AUXCAPS.ptr, :uint], MMRESULT
172
+ attach_function 'auxGetDevCapsW', [:pointer, AUXCAPS.ptr, :uint], MMRESULT
173
+
174
+ # UINT auxGetNumDevs(void);
175
+ attach_function 'auxGetNumDevs', [], :uint
176
+
177
+ # MMRESULT auxGetVolume(
178
+ # UINT uDeviceID,
179
+ # LPDWORD lpdwVolume);
180
+ attach_function 'auxGetVolume', [:uint, :pointer], MMRESULT
181
+
182
+ # DWORD auxOutMessage(
183
+ # UINT uDeviceID,
184
+ # UINT uMsg,
185
+ # DWORD_PTR dwParam1,
186
+ # DWORD_PTR dwParam2);
187
+ attach_function 'auxOutMessage', [:uint, :uint, :pointer, :pointer], :dword
188
+
189
+ # MMRESULT auxSetVolume(
190
+ # UINT uDeviceID,
191
+ # DWORD dwVolume);
192
+ attach_function 'auxSetVolume', [:uint, :dword], MMRESULT
193
+
194
+ #BOOL PlaySound(
195
+ # LPCTSTR pszSound,
196
+ # HMODULE hmod,
197
+ # DWORD fdwSound )
198
+ attach_function 'PlaySound', [:string, :hmodule, SoundFlags], :bool
199
+ attach_function 'PlaySoundA', [:string, :hmodule, SoundFlags], :bool
200
+ attach_function 'PlaySoundW', [:string, :hmodule, SoundFlags], :bool
201
+
202
+ # BOOL sndPlaySound(
203
+ # LPCTSTR lpszSound,
204
+ # UINT fuSound)
205
+ attach_function 'sndPlaySound', [:string, SND], :bool
206
+
207
+ # MMRESULT waveInAddBuffer(
208
+ # HWAVEIN hwi,
209
+ # LPWAVEHDR pwh,
210
+ # UINT cbwh)
211
+ attach_function 'waveInAddBuffer', [:hwavein, WAVEHDR.ptr, :uint], MMRESULT
212
+
213
+ # MMRESULT waveInClose( HWAVEIN hwi )
214
+ attach_fuunction 'waveInClose', [:hwavein], MMRESULT
215
+
216
+ # MMRESULT waveInGetDevCaps(
217
+ # UINT_PTR uDeviceID,
218
+ # LPWAVEINCAPS pwic,
219
+ # UINT cbwic)
220
+ attach_function 'waveInGetDevCapsA', [:pointer, WAVEINCAPS.ptr, :uint], MMRESULT
221
+ attach_function 'waveInGetDevCapsW', [:pointer, WAVEINCAPS.ptr, :uint], MMRESULT
222
+
223
+ # MMRESULT waveInGetErrorText(
224
+ # MMRESULT mmrError,
225
+ # LPTSTR pszText,
226
+ # UINT cchText)
227
+ attach_function 'waveInGetErrorTextA', [MMRESULT, :string, :uint], MMRESULT
228
+ attach_function 'waveInGetErrorTextW', [MMRESULT, :string, :uint], MMRESULT
229
+
230
+ # MMRESULT waveInGetID(
231
+ # HWAVEIN hwi,
232
+ # LPUINT puDeviceID);
233
+ attach_function 'waveInGetID', [:hwavein, :pointer], MMRESULT
234
+
235
+ # UINT waveInGetNumDevs(void)
236
+ attach_function 'waveInGetNumDevs', [], :uint
237
+
238
+ # UINT waveInGetNumDevs(void);
239
+ attach_function 'waveInGetNumDevs', [], :uint
240
+
241
+ #TODO MMTIME structure
242
+ # MMRESULT waveInGetPosition(
243
+ # HWAVEIN hwi,
244
+ # LPMMTIME pmmt,
245
+ # UINT cbmmt)
246
+ # attach_function 'waveInGetPosition', [:hwavein, ], MMRESULT
247
+
248
+ # DWORD waveInMessage(
249
+ # HWAVEIN deviceID,
250
+ # UINT uMsg,
251
+ # DWORD_PTR dwParam1,
252
+ # DWORD_PTR dwParam2);
253
+ attach_function 'waveInMessage', [:hwavein, :uint, :pointer, :pointer], :dword
254
+
255
+ # MMRESULT waveInOpen(
256
+ # LPHWAVEIN phwi,
257
+ # UINT uDeviceID,
258
+ # LPCWAVEFORMATEX pwfx,
259
+ # DWORD_PTR dwCallback,
260
+ # DWORD_PTR dwCallbackInstance,
261
+ # DWORD fdwOpen);
262
+ attach_function 'waveInOpen', [:hwavein.ptr, :uint, WAVEFORMATEX.ptr, :pointer, :pointer, :dword], MMRESULT
263
+
264
+ # MMRESULT waveInPrepareHeader(
265
+ # HWAVEIN hwi,
266
+ # LPWAVEHDR pwh,
267
+ # UINT cbwh);
268
+ attach_function 'waveInPrepareHeader', [:hwavein, WAVEHDR.ptr, :uint], MMRESULT
269
+
270
+ #TODO Callback
271
+ # void CALLBACK waveInProc(
272
+ # HWAVEIN hwi,
273
+ # UINT uMsg,
274
+ # DWORD_PTR dwInstance,
275
+ # DWORD_PTR dwParam1,
276
+ # DWORD_PTR dwParam2);
277
+ WaveInProc = callback :waveInProc, [:hwavein, :uint, :pointer, :pointer, :pointer], :void
278
+
279
+ # MMRESULT waveInReset( HWAVEIN hwi );
280
+ attach_function 'waveInReset', [:hwavein], MMRESULT
281
+
282
+ # MMRESULT waveInStart( HWAVEIN hwi );
283
+ attach_function 'waveInStart', [:hwavein], MMRESULT
284
+
285
+ # MMRESULT waveInStop( HWAVEIN hwi );
286
+ attach_function 'waveInStop', [:hwavein], MMRESULT
287
+
288
+ # MMRESULT waveInUnprepareHeader(
289
+ # HWAVEIN hwi,
290
+ # LPWAVEHDR pwh,
291
+ # UINT cbwh);
292
+ attach_function 'waveInUnprepareHeader', [:hwavein, WAVEHDR.ptr, :uint], MMRESULT
293
+
294
+ # MMRESULT waveOutBreakLoop( HWAVEOUT hwo );
295
+ attach_function 'waveOutBreakLoop', [:hwaveout], MMRESULT
296
+
297
+ # MMRESULT waveOutClose( HWAVEOUT hwo );
298
+ attach_function 'waveOutClose', [:hwaveout], MMRESULT
299
+
300
+ # MMRESULT waveOutGetDevCaps(
301
+ # UINT_PTR uDeviceID,
302
+ # LPWAVEOUTCAPS pwoc,
303
+ # UINT cbwoc);
304
+ attach_function 'waveOutGetDevCapsA', [:pointer, WAVEOUTCAPS.ptr, :uint], MMRESULT
305
+ attach_function 'waveOutGetDevCapsW', [:pointer, WAVEOUTCAPS.ptr, :uint], MMRESULT
306
+
307
+ # MMRESULT waveOutGetErrorText(
308
+ # MMRESULT mmrError,
309
+ # LPTSTR pszText,
310
+ # UINT cchText);
311
+ attach_function 'waveOutGetErrorTextA', [MMRESULT, :string, :uint], MMRESULT
312
+ attach_function 'waveOutGetErrorTextW', [MMRESULT, :string, :uint], MMRESULT
313
+
314
+ # MMRESULT waveOutGetID(
315
+ # HWAVEOUT hwo,
316
+ # LPUINT puDeviceID);
317
+ attach_function 'waveOutGetID' , [:hwaveout, :pointer], MMRESULT
318
+
319
+ # UINT waveOutGetNumDevs(void);
320
+ attach_function 'waveOutGetNumDevs', [], :uint
321
+
322
+ # MMRESULT waveOutGetPitch(
323
+ # HWAVEOUT hwo,
324
+ # LPDWORD pdwPitch);
325
+ attach_function 'waveOutGetPitch', [:hwaveout, :pointer], MMRESULT
326
+
327
+ # MMRESULT waveOutGetPlaybackRate(
328
+ # HWAVEOUT hwo,
329
+ # LPDWORD pdwRate);
330
+ attach_function 'waveOutGetPlaybackRate', [:hwaveout, :pointer], MMRESULT
331
+
332
+ #TODO MMTIME
333
+ # MMRESULT waveOutGetPosition(
334
+ # HWAVEOUT hwo,
335
+ # LPMMTIME pmmt,
336
+ # UINT cbmmt);
337
+ # attach_function 'waveOutGetPosition', [:hwaveout, :]
338
+
339
+ # MMRESULT waveOutGetVolume(
340
+ # HWAVEOUT hwo,
341
+ # LPDWORD pdwVolume);
342
+ attach_function 'waveOutGetVolume', [:hwaveout, :pointer], MMRESULT
343
+
344
+ # DWORD waveOutMessage(
345
+ # HWAVEOUT deviceID,
346
+ # UINT uMsg,
347
+ # DWORD_PTR dwParam1,
348
+ # DWORD_PTR dwParam2);
349
+ attach_function 'waveOutMessage', [:hwaveout, :uint, :pointer, :pointer], :dword
350
+
351
+ # MMRESULT waveOutOpen(
352
+ # LPHWAVEOUT phwo,
353
+ # UINT_PTR uDeviceID,
354
+ # LPWAVEFORMATEX pwfx,
355
+ # DWORD_PTR dwCallback,
356
+ # DWORD_PTR dwCallbackInstance,
357
+ # DWORD fdwOpen);
358
+ attach_function 'waveOutOpen', [:pointer, :pointer, WAVEFORMATEX.ptr, :pointer, :pointer, :dword], MMRESULT
359
+
360
+ # MMRESULT waveOutPause( HWAVEOUT hwo );
361
+ attach_function 'waveOutPause', [:hwaveout], MMRESULT
362
+
363
+ #MMRESULT waveOutSetVolume(
364
+ # HWAVEOUT hwo,
365
+ # DWORD dwVolume )
366
+ attach_function 'waveOutSetVolume', [:hwaveout, :dword], :int
367
+
368
+ #UINT waveOutGetNumDevs(void)
369
+ attach_function 'waveOutGetNumDevs', [], :uint
370
+
371
+ #UINT waveInGetNumDevs(void)
372
+ attach_function 'waveInGetNumDevs', [], :uint
373
+
374
+ #UINT midiOutGetNumDevs(void)
375
+ attach_function 'midiOutGetNumDevs', [], :uint
376
+
377
+ #UINT midiInGetNumDevs(void)
378
+ attach_function 'midiInGetNumDevs', [], :uint
379
+
380
+ #UINT auxGetNumDevs(void)
381
+ attach_function 'auxGetNumDevs', [], :uint
382
+
383
+ #UINT mixerGetNumDevs(void)
384
+ attach_function 'mixerGetNumDevs', [], :int
385
+
386
+ end
387
+
388
+ module Joystick
389
+ ffi_lib 'winmm.dll'
390
+ extend LibBase
391
+
392
+ # typedef struct {
393
+ # UINT wXpos;
394
+ # UINT wYpos;
395
+ # UINT wZpos;
396
+ # UINT wButtons;
397
+ # } JOYINFO;
398
+ class JOYINFO < FFIStruct
399
+ layout :wXpos, :uint,
400
+ :wYpos, :uint,
401
+ :wZpos, :uint,
402
+ :wButtons, :uint
403
+ end
404
+
405
+ # typedef struct joyinfoex_tag {
406
+ # DWORD dwSize;
407
+ # DWORD dwFlags;
408
+ # DWORD dwXpos;
409
+ # DWORD dwYpos;
410
+ # DWORD dwZpos;
411
+ # DWORD dwRpos;
412
+ # DWORD dwUpos;
413
+ # DWORD dwVpos;
414
+ # DWORD dwButtons;
415
+ # DWORD dwButtonNumber;
416
+ # DWORD dwPOV;
417
+ # DWORD dwReserved1;
418
+ # DWORD dwReserved2;
419
+ # } JOYINFOEX;
420
+ class JOYINFOEX < FFIStruct
421
+ layout :dwSize, :dword,
422
+ :dwFlags, :dword,
423
+ :dwXpos, :dword,
424
+ :dwYpos, :dword,
425
+ :dwZpos, :dword,
426
+ :dwRpos, :dword,
427
+ :dwUpos, :dword,
428
+ :dwVpos, :dword,
429
+ :dwButtons, :dword,
430
+ :dwButtonNumber, :dword,
431
+ :dwPOV, :dword,
432
+ :dwReserved1, :dword,
433
+ :dwReserved2, :dword,
434
+ end
435
+
436
+ # typedef struct {
437
+ # WORD wMid;
438
+ # WORD wPid;
439
+ # TCHAR szPname[MAXPNAMELEN];
440
+ # UINT wXmin;
441
+ # UINT wXmax;
442
+ # UINT wYmin;
443
+ # UINT wYmax;
444
+ # UINT wZmin;
445
+ # UINT wZmax;
446
+ # UINT wNumButtons;
447
+ # UINT wPeriodMin;
448
+ # UINT wPeriodMax;
449
+ # UINT wRmin;
450
+ # UINT wRmax;
451
+ # UINT wUmin;
452
+ # UINT wUmax;
453
+ # UINT wVmin;
454
+ # UINT wVmax;
455
+ # UINT wCaps;
456
+ # UINT wMaxAxes;
457
+ # UINT wNumAxes;
458
+ # UINT wMaxButtons;
459
+ # TCHAR szRegKey[MAXPNAMELEN];
460
+ # TCHAR szOEMVxD[MAX_JOYSTICKOEMVXDNAME];
461
+ # } JOYCAPS;
462
+
463
+ class JOYCAPS < FFIStruct
464
+ layout :wMid, :word,
465
+ :wPid, :word,
466
+ :szPname, :string,
467
+ :wXmin, :uint,
468
+ :wXmax, :uint,
469
+ :wYmin, :uint,
470
+ :wYmax, :uint,
471
+ :wZmin, :uint,
472
+ :wZmax, :uint,
473
+ :wNumButtons, :uint,
474
+ :wPeriodMin, :uint,
475
+ :wPeriodMax, :uint,
476
+ :wRmin, :uint,
477
+ :wRmax, :uint,
478
+ :wUmin, :uint,
479
+ :wUmax, :uint,
480
+ :wVmin, :uint,
481
+ :wVmax, :uint,
482
+ :wCaps, :uint,
483
+ :wMaxAxes, :uint,
484
+ :wNumAxes, :uint,
485
+ :wMaxButtons, :uint,
486
+ :szRegKey, :string,
487
+ :szOEMVxD, :string,
488
+ end
489
+
490
+ JoyCapsFlags = enum :joy_caps_flags, [
491
+ :HASZ, # Joystick has z-coordinate information.
492
+ :HASR, # Joystick has rudder (fourth axis) information.
493
+ :HASU, # Joystick has u-coordinate (fifth axis) information.
494
+ :HASV, # Joystick has v-coordinate (sixth axis) information.
495
+ :HASPOV, # Joystick has point-of-view information.
496
+ :POV4DIR, # Joystick point-of-view supports discrete values (centered, forward, backward, left, and right).
497
+ :POVCTS , # Joystick point-of-view supports continuous degree bearings.
498
+ ]
499
+
500
+ # MMRESULT joyConfigChanged( DWORD dwFlags )
501
+ attach_function 'joyConfigChanged', [:dword], MMRESULT
502
+
503
+ # MMRESULT joyGetDevCaps(
504
+ # UINT_PTR uJoyID,
505
+ # LPJOYCAPS pjc,
506
+ # UINT cbjc);
507
+ attach_function 'joyGetDevCapsA', [:pointer, JOYCAPS.ptr, :uint], MMRESULT
508
+ attach_function 'joyGetDevCapsW', [:pointer, JOYCAPS.ptr, :uint], MMRESULT
509
+
510
+ # UINT joyGetNumDevs(void);
511
+ attach_function 'joyGetNumDevs', [], :uint
512
+
513
+ # MMRESULT joyGetPos(
514
+ # UINT uJoyID,
515
+ # LPJOYINFO pji);
516
+ attach_function 'joyGetPos', [:uint, JOYINFO.ptr], MMRESULT
517
+
518
+ # MMRESULT joyGetPosEx(
519
+ # UINT uJoyID,
520
+ # LPJOYINFOEX pji);
521
+ attach_function 'joyGetPosEx', [:uint, JOYINFOEX.ptr], MMRESULT
522
+
523
+ # MMRESULT joyGetThreshold(
524
+ # UINT uJoyID,
525
+ # LPUINT puThreshold);
526
+ attach_function 'joyGetThreshold', [:uint, :pointer], MMRESULT
527
+
528
+ # MMRESULT joyReleaseCapture( UINT uJoyID );
529
+ attach_function 'joyReleaseCapture', [:uint], MMRESULT
530
+
531
+ # MMRESULT joySetCapture(
532
+ # HWND hwnd,
533
+ # UINT uJoyID,
534
+ # UINT uPeriod,
535
+ # BOOL fChanged);
536
+ attach_function 'joySetCapture', [:hwnd, :uint, :uint, :bool], MMRESULT
537
+
538
+ # MMRESULT joySetThreshold(
539
+ # UINT uJoyID,
540
+ # UINT uThreshold);
541
+ attach_function 'joySetThreshold', [:uint, :uint], MMRESULT
542
+
543
+
544
+
545
+ end
546
+ end
547
547
  end