-
Notifications
You must be signed in to change notification settings - Fork 2
/
MidiInDllTest.ahk
62 lines (47 loc) · 1.11 KB
/
MidiInDllTest.ahk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#NoEnv
SendMode Input
SetWorkingDir %A_ScriptDir%
Gui +LastFound
hWnd := WinExist()
OpenCloseMidiDLL()
OnExit, Sub_Exit
result := DllCall("midi_in.dll\open", UInt,hWnd, Int,0, Int)
If result
{
MsgBox, midi_in.dll\open(%hWnd%, %0%) returned:`n%result%
GoSub, Sub_Exit
}
DllCall("midi_in.dll\listenWheel", Int,0, Int,0x1000)
OnMessage(0x1000, "PitchWheel")
OnMessage(0x200, "RemoveToolTip") ; WM_MOUSEMOVE
DllCall("midi_in.dll\start")
return
;--------End of auto-execute section-----
;----------------------------------------
sub_exit:
OpenCloseMidiDLL()
ExitApp
return ; unnecessary redundancy?
RemoveToolTip:
SetTimer, RemoveToolTip, Off
ToolTip
return
OpenCloseMidiDLL() {
Static hModule
If hModule
DllCall("FreeLibrary", UInt,hModule), hModule := ""
If (0 = hModule := DllCall("LoadLibrary",Str, A_ScriptDir . "\midi_in.dll")) {
MsgBox Cannot load library midi_in.dll
ExitApp
}
}
PitchWheel(wParam)
{
ToolTip, %wParam%
SetTimer, RemoveToolTip, 100
}
Esc::GoSub, sub_exit
^.::
value := DllCall("midi_in.dll\getChanAT", Int,1, Int)
MsgBox, getChanAT(1) returned %value%
return