// Wacom graphics tablet support

TabletAxis : ExternalControlSource {
 var <>axis = 0;
 var <>device = 0;
 
 // tablet axis codes - these are set for you by the particular subclass
 // 0 - x coordinate
 // 1 - y coordinate
 // 2 - z coordinate = 4D mouse thumbwheel
 // 3 - x tilt
 // 4 - y tilt
 // 5 - pressure
 // 6 - 4D mouse rotation
 // 7 - airbrush wheel
 // 8 - proximity
 // 9 - button
 
 // device may be either 0 or 1
 // 0 is the first cursor device brought in proximity
 // 1 is the second cursor device brought in proximity
 
 *new { arg minval = 0.0, maxval = 1.0, warp = 'linear', axis = 0, device = 0;
  ^super.new.setRange(minval, maxval, warp).axis_(axis).device_(device);
 }
 
 *kr { arg minval = 0.0, maxval = 1.0, warp = 'linear', device = 0, lagTime = 0.1;
  ^Plug.kr(this.new(minval, maxval, warp, device), lagTime)
 }
}

TabletX : TabletAxis {
 *new { arg minval = 0.0, maxval = 1.0, warp = 'linear', device = 0;
  ^super.new(minval, maxval, warp, 0, device);
 }
}

TabletY : TabletAxis {
 *new { arg minval = 0.0, maxval = 1.0, warp = 'linear', device = 0;
  ^super.new(minval, maxval, warp, 1, device);
 }
}

TabletZ : TabletAxis {
 *new { arg minval = 0.0, maxval = 1.0, warp = 'linear', device = 0;
  ^super.new(minval, maxval, warp, 2, device);
 }
}
TabletXTilt : TabletAxis {
 *new { arg minval = -1.0, maxval = 1.0, warp = 'linear', device = 0;
  ^super.new(minval, maxval, warp, 3, device);
 }
}

TabletYTilt : TabletAxis {
 *new { arg minval = -1.0, maxval = 1.0, warp = 'linear', device = 0;
  ^super.new(minval, maxval, warp, 4, device);
 }
}

TabletPressure : TabletAxis {
 *new { arg minval = 0.0, maxval = 1.0, warp = 'linear', device = 0;
  ^super.new(minval, maxval, warp, 5, device);
 }
}

TabletTurn : TabletAxis {
 *new { arg minval = -1.0, maxval = 1.0, warp = 'linear', device = 0;
  ^super.new(minval, maxval, warp, 6, device);
 }
}

TabletWheel : TabletAxis {
 *new { arg minval = -1.0, maxval = 1.0, warp = 'linear', device = 0;
  ^super.new(minval, maxval, warp, 7, device);
 }
}

TabletProximity : TabletAxis {
 *new { arg minval = 0.0, maxval = 1.0, warp = 'linear', device = 0;
  ^super.new(minval, maxval, warp, 8, device);
 }
}

TabletButton : TabletAxis {
 var <>button = 0;
 
 // button numbers:
 //  pen:
 //  0 - tip or eraser contact
 //  1 - top side button
 //  2 - bottom side button
 //  4D mouse:
 //  0 - front right button
 //  1 - front middle button
 //  2 - front left button
 //  3 - back left button
 //  4 - back right button
 
 
 *new { arg button = 0, minval = 0.0, maxval = 1.0, warp = 'linear', device = 0;
  ^super.new(minval, maxval, warp, 9, device).button_(button);
 }
 *kr { arg button = 0,  minval = 0.0, maxval = 1.0, warp = 'linear', device = 0, lagTime = 0.1;
  ^Plug.kr(this.new(button, minval, maxval, warp, device), lagTime)
 }
}



This page was created by SimpleText2Html 1.0.3 on 22-Feb-100.