- Output display now shows generic event info, rather than a MIDI out event.
- Tidy up MidiRules section into separate function calls. - Add new script file mtjFunctions.ahk - Ignore .bak files
This commit is contained in:
parent
bd175b7812
commit
fec32c6b82
|
@ -5,63 +5,52 @@
|
|||
|
||||
/*
|
||||
The MidiRules section is for modifying midi input from some other source.
|
||||
See hotkeys below if you wish to generate midi messages from hotkeys.
|
||||
|
||||
Write your own MidiRules and put them in this section.
|
||||
Keep rules together under proper section, notes, cc, program change etc.
|
||||
Keep them after the statusbyte has been determined.
|
||||
Examples for each type of rule will be shown.
|
||||
The example below is for note type message.
|
||||
|
||||
Remember byte1 for a noteon/off is the note number, byte2 is the velocity of that note.
|
||||
|
||||
Example:
|
||||
|
||||
ifequal, byte1, 20 ; if the note number coming in is note # 20
|
||||
{
|
||||
byte1 := (do something in here) ; could be do something to the velocity(byte2)
|
||||
gosub, SendNote ; send the note out.
|
||||
}
|
||||
Alter the ProcessNote, ProcessCC, or ProcessPC functions as desired.
|
||||
*/
|
||||
|
||||
MidiRules:
|
||||
; *** New rule handler functions ***
|
||||
ProcessNote(device, channel, note, velocity, isNoteOn) {
|
||||
/*
|
||||
Add your own note filters here.
|
||||
|
||||
; =============== Note On/Off ===============
|
||||
if statusbyte between 128 and 159
|
||||
{
|
||||
/*
|
||||
Add your own note filters here.
|
||||
byte1 is the note number, byte2 is the velocity.
|
||||
|
||||
Example:
|
||||
|
||||
ifequal, byte1, 20 ; if the note number coming in is note # 20
|
||||
{
|
||||
byte1 := (do something in here) ; could be do something to the velocity(byte2)
|
||||
gosub, SendNote ; send the note out.
|
||||
Example:
|
||||
if (isNoteOn and note == 20)
|
||||
{
|
||||
; Clamp the velocity to 80
|
||||
if (velocity > 80) {
|
||||
velocity := 80
|
||||
}
|
||||
*/
|
||||
} ; end of note block
|
||||
gosub, SendNote ; send the note out.
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
; =============== CCs (continuous controllers) ===============
|
||||
if statusbyte between 176 and 191
|
||||
{
|
||||
tmp_axis_val := Floor((byte2 / max_cc_val) * AxisMax_X)
|
||||
ProcessCC(device, channel, cc, value) {
|
||||
global AxisMax_X, max_cc_val, iInterface, HID_USAGE_X
|
||||
if (cc == 7) {
|
||||
tmp_axis_val := Floor((value / max_cc_val) * AxisMax_X)
|
||||
VJoy_SetAxis(tmp_axis_val, iInterface, HID_USAGE_X)
|
||||
|
||||
; Default action code below
|
||||
cc := byte1 ; pass them as is, no change.
|
||||
;gosub, ShowMidiInMessage
|
||||
GuiControl,12:, MidiMsOut, CC %statusbyte% %chan% %cc% %byte2%
|
||||
gosub, ShowMidiOutMessage
|
||||
;gosub, sendCC
|
||||
DisplayOutput("Axis X", value)
|
||||
}
|
||||
}
|
||||
|
||||
; Is midi input a Program Change?
|
||||
if statusbyte between 192 and 208
|
||||
{
|
||||
gosub, sendPC
|
||||
ProcessPC(device, channel, note, velocity) {
|
||||
}
|
||||
|
||||
MidiRules:
|
||||
if (statusbyte between 128 and 143) { ; Note off
|
||||
ProcessNote(0, statusbyte - 127, byte1, byte2, false)
|
||||
}
|
||||
if (statusbyte between 144 and 159) { ; Note on
|
||||
ProcessNote(0, statusbyte - 127, byte1, byte2, true)
|
||||
}
|
||||
if (statusbyte between 176 and 191) { ; CC
|
||||
ProcessCC(0, statusbyte - 175, byte1, byte2)
|
||||
}
|
||||
if (statusbyte between 192 and 208) { ; PC
|
||||
ProcessPC(0, statusbyte - 191, byte1, byte2)
|
||||
}
|
||||
; Maybe TODO: Key aftertouch, channel aftertouch, pitch wheel
|
||||
Return
|
||||
|
||||
;*************************************************
|
||||
|
@ -83,5 +72,3 @@ SendPC:
|
|||
midiOutShortMsg(h_midiout, statusbyte, pc, byte2)
|
||||
Return
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -89,7 +89,7 @@ gui,14:add,text, x80 y5, Midi Input ; %TheChoice%
|
|||
gui,14:add,text, x305 y5, Midi Ouput ; %TheChoice2%
|
||||
Gui,14:Add, DropDownList, x270 y20 w140 Choose%TheChoice2% vMidiOutPort gDoneOutChange altsubmit , %MoList%
|
||||
Gui,14:Add, ListView, x5 r11 w220 Backgroundblack caqua Count10 vIn1, EventType|StatB|Ch|Byte1|Byte2|
|
||||
gui,14:Add, ListView, x+5 r11 w220 Backgroundblack cyellow Count10 vOut1, EventType|StatB|Ch|Byte1|Byte2|
|
||||
gui,14:Add, ListView, x+5 r11 w220 Backgroundblack cyellow Count10 vOut1, Event|Value|
|
||||
gui,14:Show, autosize xcenter y5, MidiMonitor
|
||||
|
||||
Return
|
|
@ -15,6 +15,7 @@ Sections with ++++++++++++++++++++ Edit between these marks. You won't break it,
|
|||
*/
|
||||
|
||||
#Include VJoy_lib.ahk
|
||||
#Include mtjFunctions.ahk
|
||||
|
||||
#Persistent
|
||||
#SingleInstance
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
|
||||
DisplayOutput(event, value) {
|
||||
Gui,14:default
|
||||
Gui,14:ListView, Out1 ; see the second listview midi out monitor
|
||||
LV_Add("",event,value)
|
||||
LV_ModifyCol(1,"center")
|
||||
LV_ModifyCol(2,"center")
|
||||
LV_ModifyCol(3,"center")
|
||||
LV_ModifyCol(4,"center")
|
||||
LV_ModifyCol(5,"center")
|
||||
If (LV_GetCount() > 10)
|
||||
{
|
||||
LV_Delete(1)
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user