Media control script
This commit is contained in:
parent
33da05e5e9
commit
5e06493275
|
@ -9,27 +9,37 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ProcessNote(device, channel, note, velocity, isNoteOn) {
|
ProcessNote(device, channel, note, velocity, isNoteOn) {
|
||||||
global iInterface
|
|
||||||
|
|
||||||
if (note >= 1 and note <= 32) {
|
|
||||||
VJoy_SetBtn(isNoteOn, iInterface, note)
|
|
||||||
button_state_text := isNoteOn ? "On" : "Off"
|
|
||||||
DisplayOutput("Button " + button_state_text, note)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ProcessCC(device, channel, cc, value) {
|
ProcessCC(device, channel, cc, value) {
|
||||||
global iInterface, HID_USAGE_X, HID_USAGE_Y, AxisMax_X, AxisMax_Y
|
global iInterface, HID_USAGE_X, HID_USAGE_Y, AxisMax_X, AxisMax_Y
|
||||||
if (cc == 7) {
|
if (cc = 21 or cc = 29) {
|
||||||
scaled_value := ConvertCCValueToScale(value, 8, 120)
|
scaled_value := ConvertCCValueToScale(value, 0, 127)
|
||||||
new_axis_value := ConvertToAxis(scaled_value, AxisMax_X)
|
vol := scaled_value * 100
|
||||||
VJoy_SetAxis(new_axis_value, iInterface, HID_USAGE_X)
|
SoundSet, vol
|
||||||
DisplayOutput("Axis X", scaled_value)
|
DisplayOutput("Volume", vol)
|
||||||
} else if (cc == 27) {
|
} else if (cc = 51) {
|
||||||
scaled_value := ConvertCCValueToScale(value, 8, 112)
|
Send {Volume_Mute}
|
||||||
new_axis_value := ConvertToAxis(scaled_value, AxisMax_Y)
|
DisplayOutput("Volume", "Mute")
|
||||||
VJoy_SetAxis(new_axis_value, iInterface, HID_USAGE_Y)
|
} else if (cc = 52 and value != 0) {
|
||||||
DisplayOutput("Axis Y", scaled_value)
|
Send {Volume_Down}
|
||||||
|
DisplayOutput("Volume", "Down")
|
||||||
|
} else if (cc = 53 and value != 0) {
|
||||||
|
Send {Volume_Up}
|
||||||
|
DisplayOutput("Volume", "Up")
|
||||||
|
} else if (cc = 54 and value != 0) {
|
||||||
|
Send {Media_Play_Pause}
|
||||||
|
DisplayOutput("Media", "Play/Pause")
|
||||||
|
} else if (cc = 55 and value != 0) {
|
||||||
|
Send {Media_Stop}
|
||||||
|
DisplayOutput("Media", "Stop")
|
||||||
|
} else if (cc = 56 and value != 0) {
|
||||||
|
Send {Media_Prev}
|
||||||
|
DisplayOutput("Media", "Previous")
|
||||||
|
} else if (cc = 57 and value != 0) {
|
||||||
|
Send {Media_Next}
|
||||||
|
DisplayOutput("Media", "Next")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ Sections with ++++++++++++++++++++ Edit between these marks. You won't break it,
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#Include VJoy_lib.ahk
|
|
||||||
#Include mtjFunctions.ahk
|
#Include mtjFunctions.ahk
|
||||||
|
|
||||||
#Persistent
|
#Persistent
|
||||||
|
@ -28,9 +28,7 @@ if A_OSVersion in WIN_NT4,WIN_95,WIN_98,WIN_ME ; if not xp or 2000 quit
|
||||||
ExitApp
|
ExitApp
|
||||||
}
|
}
|
||||||
|
|
||||||
version = midi_to_joy_2
|
version = midi_to_joy_3
|
||||||
VJoy_Init()
|
|
||||||
gosub VJoyInitMaxValues
|
|
||||||
readini() ; load values from the ini file, via the readini function - see Midi_under_the_hood.ahk file
|
readini() ; load values from the ini file, via the readini function - see Midi_under_the_hood.ahk file
|
||||||
gosub, MidiPortRefresh ; used to refresh the input and output port lists - see Midi_under_the_hood.ahk file
|
gosub, MidiPortRefresh ; used to refresh the input and output port lists - see Midi_under_the_hood.ahk file
|
||||||
port_test(numports,numports2) ; test the ports - check for valid ports? - see Midi_under_the_hood.ahk file
|
port_test(numports,numports2) ; test the ports - check for valid ports? - see Midi_under_the_hood.ahk file
|
||||||
|
@ -46,18 +44,6 @@ gosub, midiMon ; see below - a monitor gui - see Midi_In_and_Gu
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
VJoyInitMaxValues:
|
|
||||||
global AxisMax_X, AxisMax_Y, AxisMax_Z, AxisMax_RX, AxisMax_RY, AxisMax_RZ, AxisMax_SL0, AxisMax_SL1, AxisMax_WHL
|
|
||||||
AxisMax_X := VJoy_GetVJDAxisMax(iInterface, HID_USAGE_X)
|
|
||||||
AxisMax_Y := VJoy_GetVJDAxisMax(iInterface, HID_USAGE_Y)
|
|
||||||
AxisMax_Z := VJoy_GetVJDAxisMax(iInterface, HID_USAGE_Z)
|
|
||||||
AxisMax_RX := VJoy_GetVJDAxisMax(iInterface, HID_USAGE_RX)
|
|
||||||
AxisMax_RY := VJoy_GetVJDAxisMax(iInterface, HID_USAGE_RY)
|
|
||||||
AxisMax_RZ := VJoy_GetVJDAxisMax(iInterface, HID_USAGE_RZ)
|
|
||||||
AxisMax_SL0 := VJoy_GetVJDAxisMax(iInterface, HID_USAGE_SL0)
|
|
||||||
AxisMax_SL1 := VJoy_GetVJDAxisMax(iInterface, HID_USAGE_SL1)
|
|
||||||
AxisMax_WHL := VJoy_GetVJDAxisMax(iInterface, HID_USAGE_WHL)
|
|
||||||
return
|
|
||||||
|
|
||||||
#Include Midi_In_and_GuiMonitor.ahk ; this file contains: the function to parse midi message into parts we can work with and a midi monitor.
|
#Include Midi_In_and_GuiMonitor.ahk ; this file contains: the function to parse midi message into parts we can work with and a midi monitor.
|
||||||
#Include MidiRules.ahk ; this file contains: Rules for manipulating midi input then sending modified midi output.
|
#Include MidiRules.ahk ; this file contains: Rules for manipulating midi input then sending modified midi output.
|
Loading…
Reference in New Issue
Block a user