Reply to External USB Touchpad as XY-type Controller
External USB Touchpad as XY-type Controller i've searched and found a lot of people discussing this type of thing, but not quite the same. i wanted to use my external usb touchpad as an XY type controller while not messing with the windows mouse cursor at all - letting me use the touchpad on my laptop as normal. (so then i can buy an lpd8 and not a nanopad ) on a different thread someone mentioned some software for windows called glovepie.org that allows you to use custom scripts to do exactly what you need. i'm using loopMIDI for the virtual midi port (tho midiyoke would work too i presume). this script assumes the virtual midi device is number 8. clicking the right touchpad button will make it reset the X and Y vals to the center after 1.5 seconds - left button click to reset that behaviour. outputs X as CC0 and Y as CC1. it's not an overly complex script but pasting here in case it's any use to anyone. i did start out with a much simpler script but this seems to work better. i'll probably tweak it more - but this at least does work ok. i'm using it to control params 1 and 2 of a 'single' effect. it does seem to eat some cpu when i go crazy on the touchpad so might need to see if i can make more efficient. i guess you could do some cunning bomes type translations with this glovepie software too. Code:
if (var.XYpadInit == 0) then midi.DeviceOut = 8 // device number to use debug = midi.OutDevName // show device name in use midi.GeneralMidi = False midi.DefaultChannel = 1 var.XYpadXres = 500 var.XYpadYres = 320 var.XYpadXborder = 10 var.XYpadYborder = 10 var.XYpadXmax = var.XYpadXres + var.XYpadXborder * 2 var.XYpadYmax = var.XYpadYres + var.XYpadYborder * 2 var.XYpadXmidiMin = 0 var.XYpadXmidiMax = 100 var.XYpadYmidiMin = 0 var.XYpadYmidiMax = 100 var.XYpadMode1Time = 1.5 var.XYpadInit = 1 endif mouse.Swallow = true fakemouse.DirectInputX = mouse1.DirectInputX fakemouse.DirectInputY = mouse1.DirectInputY mouse.LeftButton = mouse1.LeftButton mouse.RightButton = mouse1.RightButton mouse.MiddleButton = mouse1.MiddleButton mouse.XButton1 = mouse1.XButton1 mouse.XButton2 = mouse1.XButton2 if mouse2.present then if (mouse2.LeftButton) then var.XYpadMode = 0 endif if (mouse2.RightButton) then var.XYpadMode = 1 endif var.XYpadXdelta = Delta(mouse2.DirectInputX) var.XYpadYdelta = Delta(mouse2.DirectInputY) if (var.XYpadXdelta != 0 || var.XYpadYdelta != 0) then var.XYpadTime = TimeStamp() if (var.XYpadXdelta != 0) then var.XYpadX = var.XYpadX + var.XYpadXdelta if (var.XYpadX < 0) then var.XYpadX = 0 if (var.XYpadX > var.XYpadXmax) then var.XYpadX = var.XYpadXmax if (var.XYpadX < var.XYpadXborder) then var.XYpadXmidiCC = var.XYpadXmidiMin elseif (var.XYpadX > var.XYpadXres + var.XYpadXborder) then var.XYpadXmidiCC = var.XYpadXmidiMax else var.XYpadXmidiCC = floor(MapRange(var.XYpadX, 0, var.XYpadXmax, var.XYpadXmidiMin, var.XYpadXmidiMax)) endif midi.Control0Coarse = var.XYpadXmidiCC% endif if (var.XYpadYdelta != 0) then var.XYpadY = var.XYpadY - var.XYpadYdelta if (var.XYpadY < 0) then var.XYpadY = 0 if (var.XYpadY > var.XYpadYmax) then var.XYpadY = var.XYpadYmax if (var.XYpadY < var.XYpadYborder) then var.XYpadYmidiCC = var.XYpadYmidiMin elseif (var.XYpadY > var.XYpadYres + var.XYpadYborder) then var.XYpadYmidiCC = var.XYpadYmidiMax else var.XYpadYmidiCC = floor(MapRange(var.XYpadY, 0, var.XYpadYmax, var.XYpadYmidiMin, var.XYpadYmidiMax)) endif midi.Control1Coarse = var.XYpadYmidiCC% endif else if (var.XYpadMode == 1 && var.XYpadTime < TimeStamp() - var.XYpadMode1Time) then var.XYpadX = floor(var.XYpadXres / 2) var.XYpadY = floor(var.XYpadYres / 2) endif endif endif | |
You need to login in order to write on our forum |
<< Cancel