*****Part of main prograrm file containing two classes*********
Define Class Hndl_MidiIn_cme As Custom
stts=0
Procedure Init
*Bindevent(ptrCallback_cme, MIM_DATA,This,'Handleevent',1)
Bindevent(ptrCallback_cme, MIM_DATA,This,'Handleevent')
Endproc
Procedure Handleevent &&Split to manual detecting status byte.
Lparameters HWnd, Msg, wParam, DataByte1
If Bitand(DataByte1,240)<>240 Then
This.stts=Bitand(DataByte1,255) && Status
Do Case
Case This.stts=144
This.Handle01(HWnd, Msg, wParam, DataByte1)
Case This.stts=145
This.Handle02(HWnd, Msg, wParam, DataByte1)
Case This.stts=147
This.Handle04(HWnd, Msg, wParam, DataByte1)
Case This.stts=176
This.Handle_dyn1(HWnd, Msg, wParam, DataByte1)
Case This.stts=177
This.Handle_cresc(HWnd, Msg, wParam, DataByte1)
Case This.stts=179
This.Handle_dyn4(HWnd, Msg, wParam, DataByte1)
Endcase
Endif
Endproc
PROCEDURE Handle01
Lparameters HWnd, Msg, wParam, DataByte1
ENDPROC
PROCEDURE Handle02
Lparameters HWnd, Msg, wParam, DataByte1
ENDPROC
PROCEDURE Handle04
Lparameters HWnd, Msg, wParam, DataByte1
ENDPROC
PROCEDURE Handle_cresc
Lparameters HWnd, Msg, wParam, DataByte1
ENDPROC
PROCEDURE Handle_dyn1
Lparameters HWnd, Msg, wParam, DataByte1
ENDPROC
PROCEDURE Handle_dyn4
Lparameters HWnd, Msg, wParam, DataByte1
ENDPROC
ENDDEFINE
Define Class Hndl_MidiIn_mpl As Custom
stts=0
Procedure Init
*Bindevent(ptrCallback_mpl, MIM_DATA,This,'Handleevent',1)
Bindevent(ptrCallback_mpl, MIM_DATA,This,'Handleevent')
Endproc
Procedure Handleevent
Lparameters HWnd, Msg, wParam, DataByte1
If Bitand(DataByte1,240)<>240 Then
This.stts=Bitand(DataByte1,255) && Status
If This.stts=144 OR (This.stts=128) Then
This.Handle01(HWnd, Msg, wParam, DataByte1)
Endif
Endif
Endproc
PROCEDURE Handle01
Lparameters HWnd, Msg, wParam, DataByte1
ENDPROC
Enddefine
*****************
***Load method CallbackWindow_mpl***********
#Define CALLBACK_FUNCTION 0x30000
#Define CALLBACK_WINDOW 0x10000
#Define MIM_DATA 963
#Define MIDI_IO_STATUS 32
ptrCallback_mpl=Thisform.HWnd
nResult_open = midiInOpen(@hDevice, nMpIn-1, ptrCallback_mpl, 0, CALLBACK_WINDOW+MIDI_IO_STATUS)
If nResult_open=0
arrInHandles(1,2)=nMpIn-1
arrInHandles(2,2)=hDevice
nResult_start = midiInStart(arrInHandles(2,2))
Else
nResult_start = -1
Messagebox("Failed to load MIDIPLUS61U Keyboard")
Thisform.einde
Endif
If nResult_start = 0
PUBLIC oHndl_MidiIn_mpl AS OBJECT
oHndl_MidiIn_mpl=CREATEOBJECT("Hndl_MidiIn_mpl")
Else
Messagebox("Failed to start MIDIPLUS61U Keyboard")
Thisform.einde
Endif
**********
***Load method CallbackWindow_mpl+CME***********
#Define CALLBACK_FUNCTION 0x30000
#Define CALLBACK_WINDOW 0x10000
#Define MIDI_IO_STATUS 32
ptrCallback_cme=Thisform.HWnd
nResult_open = midiInOpen(@hDevice, nCmeIn-1, ptrCallback_cme, 0, CALLBACK_WINDOW+MIDI_IO_STATUS)
If nResult_open=0
arrInHandles(1,1)=nCmeIn-1
arrInHandles(2,1)=hDevice
nResult_start = midiInStart(arrInHandles(2,1))
Else
nResult_start = -1
Messagebox("Failed to load Domus Vivace organ")
Thisform.einde
Endif
If nResult_start = 0
PUBLIC oHndl_MidiIn_cme AS OBJECT
oHndl_MidiIn_cme=CREATEOBJECT("Hndl_MidiIn_cme")
Else
Messagebox("Failed to start Domus Vivace organ")
Thisform.einde
Endif
**********************************************
************Part Init method button class Stop*************************
IF this.Active=1
If Alltrim(This.cme_mpl)=="CME" Then
DO CASE
CASE This.klavier=0
Bindevent(oHndl_MidiIn_cme,"Handle01",This,'hndlvnt_cme',1)
CASE This.klavier=1
Bindevent(oHndl_MidiIn_cme,"Handle02",This,'hndlvnt_cme',1)
CASE This.klavier=3
Bindevent(oHndl_MidiIn_cme,"Handle04",This,'hndlvnt_cme',1)
ENDCASE
ELSE
IF This.klavier=0 Then
UnBindevents(oHndl_MidiIn_mpl,"Handle01",This,'hndlvnt_mpl',1)
Endif
ENDIF
ELSE
If Alltrim(This.cme_mpl)=="CME" Then
DO CASE
CASE This.klavier=0
UnBindevents(oHndl_MidiIn_cme,"Handle01",This,'hndlvnt_cme')
CASE This.klavier=1
UnBindevents(oHndl_MidiIn_cme,"Handle02",This,'hndlvnt_cme')
CASE This.klavier=3
UnBindevents(oHndl_MidiIn_cme,"Handle04",This,'hndlvnt_cme')
ENDCASE
ELSE
IF This.klavier=0 Then
UnBindevents(oHndl_MidiIn_mpl,"Handle01",This,'hndlvnt_mpl')
Endif
ENDIF
ENDIF
****************************