PowerMate
Inherits from: Object
(Brought to you by http://LFSaw.de)
Built on GeneralHID
Attention
To use this HID object, and the Griffin PowerMate at all in a useful fashion as a HID object on osx, you need the PowerMate kext provided here:
http://www.oatbit.com/~jg/index.php?w=newsite/files/knob_drivers/
Load the kext by evaluating this line
"cd /Users/tboverma/Documents/myProjects/sc/wiki/tools/PowerMate-KnobKext; ./load".runInTerminal;
Currently, this class only supports one PowerMate at a time. More to come.
Creation / Class Methods
*new
create a new Instance
Accessing Instance and Class Variables
downAction
downAction_ (func)
define action to be evaluated when PowerMate is pressed
upAction
upAction_ (func)
define action to be evaluated when PowerMate is released
turnAction
turnAction_ (func)
define action to be evaluated when PowerMate is rotated
downTurnAction
downTurnAction_ (func)
define action to be evaluated when PowerMate is rotated while pressed
Example
q = q ? (); // a dictonary
// Build device list.
// Make sure the Powermate is plugged in before evaluating this line
GeneralHID.buildDeviceList;
// create the PowerMate and start the HID event loop
q.knob = PowerMate.new;
GeneralHID.startEventLoop
// define some actions
(
q.knob.downAction = {"down".postln};
q.knob.upAction = {"up".postln};
q.knob.turnAction = {|k, vel| (vel > 0).if({
"right for %\n".postf(vel)
},{
"left for %\n".postf(vel.abs)
})
};
q.knob.downTurnAction = {|k, vel| (vel > 0).if({
"down right for %\n".postf(vel)
},{
"down left for %\n".postf(vel.abs)
})
};
)
// stop everything
q.knob.downAction = nil;
q.knob.upAction = nil;
q.knob.turnAction = nil;
q.knob.downTurnAction = nil;
GeneralHID.stopEventLoop