The mtif Reference Manual

Table of Contents

Next: , Previous: , Up: (dir)   [Contents][Index]

The mtif Reference Manual

This is the mtif Reference Manual, version 0.1.0, generated automatically by Declt version 2.4 "Will Decker" on Wed Jun 20 12:18:52 2018 GMT+0.


Next: , Previous: , Up: Top   [Contents][Index]

1 Introduction

MTIF

Quicklisp License: MIT

This is a Common Lisp interface to the Apple multitouch trackpad.

Usage:

Calling #'start spawns a thread which repeatedly calls #'callback-fn, passing the latest "frame" of multitouch data. No processing is done -- you'll just get a list of finger data at each frame. If you want gesture recognition, watch this repo.

Example: https://github.com/rmhsilva/mtif/tree/master/examples.

Data Format

An example callback function:

(defun print-all-touches (finger-data timestamp frame)
  "Example callback which just prints all touches to *standard-output*"
  (format t "~A [~{~A~%  ~}]~%" (length finger-data) finger-data))

The finger data struct has the following slots:

  id                 -- Numeric identifier for this finger
  state              -- The finger state
  size               -- A measure of the area covered
  pos-x              -- Normalised X position, 
  pos-y              -- Normalised Y position
  vel-x              -- Normalised X velocity
  vel-y              -- Normalised Y velocity
  ellipse-angle      -- Angle of the finger ellipsoid
  ellipse-major-axis -- Major axis of the finger ellipsoid
  ellipse-minor-axis -- Minor axis of the finger ellipsoid

Coordinate System

Positions (pos-x and pos-y) have the origin in the bottom left corner:

    (0,1)              (1,1)
        +--------------+
        |              |
        |   trackpad   |
        |              |
        +--------------+
    (0,0)              (1,0)

The ellipse angle takes a value in the interval [0, pi] radians, where 0 radians means the finger is angled to right right hand edge of the trackpad:

              pi/2
               ^
               |
               |
      pi ------|------> 0 rad
               |
               |
              pi/2

Background Info

This uses the "private" (undocumented) MacOS MultiTouch framework. See https://gist.github.com/rmhsilva/61cc45587ed34707da34818a76476e11 for more info.

License

MIT


Next: , Previous: , Up: Top   [Contents][Index]

2 Systems

The main system appears first, followed by any subsystem dependency.


Previous: , Up: Systems   [Contents][Index]

2.1 mtif

Author

Ric da Silva <ric@rmhsilva.com>

License

MIT

Description

An interface to the MacOS MultiTouch framework

Version

0.1.0

Dependency

cffi

Source

mtif.asd (file)

Components

Next: , Previous: , Up: Top   [Contents][Index]

3 Files

Files are sorted by type and then listed depth-first from the systems components trees.


Previous: , Up: Files   [Contents][Index]

3.1 Lisp


Next: , Previous: , Up: Lisp files   [Contents][Index]

3.1.1 mtif.asd

Location

mtif.asd

Systems

mtif (system)


Next: , Previous: , Up: Lisp files   [Contents][Index]

3.1.2 mtif/package.lisp

Parent

mtif (system)

Location

package.lisp

Packages

Next: , Previous: , Up: Lisp files   [Contents][Index]

3.1.3 mtif/mtif-ffi.lisp

Parent

mtif (system)

Location

mtif-ffi.lisp

Internal Definitions

Previous: , Up: Lisp files   [Contents][Index]

3.1.4 mtif/mtif.lisp

Parent

mtif (system)

Location

mtif.lisp

Exported Definitions
Internal Definitions

Next: , Previous: , Up: Top   [Contents][Index]

4 Packages

Packages are listed by definition order.


Next: , Previous: , Up: Packages   [Contents][Index]

4.1 mtif-user

Source

package.lisp (file)

Use List

Previous: , Up: Packages   [Contents][Index]

4.2 mtif

Source

package.lisp (file)

Use List
Used By List

mtif-user

Exported Definitions
Internal Definitions

Next: , Previous: , Up: Top   [Contents][Index]

5 Definitions

Definitions are sorted by export status, category, package, and then by lexicographic order.


Next: , Previous: , Up: Definitions   [Contents][Index]

5.1 Exported definitions


Next: , Previous: , Up: Exported definitions   [Contents][Index]

5.1.1 Special variables

Special Variable: *frame-count*

The number of frames received since last call to ‘start’

Package

mtif

Source

mtif.lisp (file)

Special Variable: *mtif-started*

Whether we have started using a device or not

Package

mtif

Source

mtif.lisp (file)


Next: , Previous: , Up: Exported definitions   [Contents][Index]

5.1.2 Functions

Function: finger-ellipse-angle INSTANCE
Function: (setf finger-ellipse-angle) VALUE INSTANCE
Package

mtif

Source

mtif.lisp (file)

Function: finger-ellipse-major-axis INSTANCE
Function: (setf finger-ellipse-major-axis) VALUE INSTANCE
Package

mtif

Source

mtif.lisp (file)

Function: finger-ellipse-minor-axis INSTANCE
Function: (setf finger-ellipse-minor-axis) VALUE INSTANCE
Package

mtif

Source

mtif.lisp (file)

Function: finger-id INSTANCE
Function: (setf finger-id) VALUE INSTANCE
Package

mtif

Source

mtif.lisp (file)

Function: finger-pos-x INSTANCE
Function: (setf finger-pos-x) VALUE INSTANCE
Package

mtif

Source

mtif.lisp (file)

Function: finger-pos-y INSTANCE
Function: (setf finger-pos-y) VALUE INSTANCE
Package

mtif

Source

mtif.lisp (file)

Function: finger-size INSTANCE
Function: (setf finger-size) VALUE INSTANCE
Package

mtif

Source

mtif.lisp (file)

Function: finger-state INSTANCE
Function: (setf finger-state) VALUE INSTANCE
Package

mtif

Source

mtif.lisp (file)

Function: finger-vel-x INSTANCE
Function: (setf finger-vel-x) VALUE INSTANCE
Package

mtif

Source

mtif.lisp (file)

Function: finger-vel-y INSTANCE
Function: (setf finger-vel-y) VALUE INSTANCE
Package

mtif

Source

mtif.lisp (file)

Function: print-all-touches FINGER-DATA TIMESTAMP FRAME

Example callback which just prints all touches to *standard-output*

Package

mtif

Source

mtif.lisp (file)

Function: start CALLBACK &optional FRAME-LIMIT

Start the MT interface with ‘callback’ receiving the data

Package

mtif

Source

mtif.lisp (file)

Function: stop ()

Stop the MT interface

Package

mtif

Source

mtif.lisp (file)


Previous: , Up: Exported definitions   [Contents][Index]

5.1.3 Conditions

Condition: err-already-started ()
Package

mtif

Source

mtif.lisp (file)

Direct superclasses

simple-error (condition)

Condition: err-not-started ()
Package

mtif

Source

mtif.lisp (file)

Direct superclasses

simple-error (condition)


Previous: , Up: Definitions   [Contents][Index]

5.2 Internal definitions


Next: , Previous: , Up: Internal definitions   [Contents][Index]

5.2.1 Special variables

Special Variable: *frame-limit*

Maximum number of frames to process (ignored if nil)

Package

mtif

Source

mtif.lisp (file)

Special Variable: *init-complete*

Signal whether things have been setup

Package

mtif

Source

mtif.lisp (file)

Special Variable: *mtif-callback*

User callback to call with the touchpad data

Package

mtif

Source

mtif.lisp (file)

Special Variable: *mtif-handle*

Handle to the MT device, used for stopping/starting

Package

mtif

Source

mtif.lisp (file)


Next: , Previous: , Up: Internal definitions   [Contents][Index]

5.2.2 Functions

Function: copy-finger INSTANCE
Package

mtif

Source

mtif.lisp (file)

Function: finger-p OBJECT
Package

mtif

Source

mtif.lisp (file)

Function: get-readout MTREADOUT SLOT1 SLOT2
Package

mtif

Source

mtif.lisp (file)

Function: init-device ()

Initial setup - create device, register callback

Package

mtif

Source

mtif.lisp (file)

Function: make-finger &key (ID ID) (STATE STATE) (SIZE SIZE) (POS-X POS-X) (POS-Y POS-Y) (VEL-X VEL-X) (VEL-Y VEL-Y) (ELLIPSE-ANGLE ELLIPSE-ANGLE) (ELLIPSE-MAJOR-AXIS ELLIPSE-MAJOR-AXIS) (ELLIPSE-MINOR-AXIS ELLIPSE-MINOR-AXIS)
Package

mtif

Source

mtif.lisp (file)

Function: mtdevicecreatedefault ()
Package

mtif

Source

mtif-ffi.lisp (file)

Function: mtdevicestart DEVICE UNUSED
Package

mtif

Source

mtif-ffi.lisp (file)

Function: mtdevicestop DEVICE
Package

mtif

Source

mtif-ffi.lisp (file)

Function: mtregistercontactframecallback DEVICE CALLBACK
Package

mtif

Source

mtif-ffi.lisp (file)

Function: mtunregistercontactframecallback DEVICE CALLBACK
Package

mtif

Source

mtif-ffi.lisp (file)

Function: reset ()

Reset the device

Package

mtif

Source

mtif.lisp (file)


Next: , Previous: , Up: Internal definitions   [Contents][Index]

5.2.3 Structures

Structure: finger ()

Finger data

Package

mtif

Source

mtif.lisp (file)

Direct superclasses

structure-object (structure)

Direct slots
Slot: id
Initform

"numeric identifier for this finger"

Readers

finger-id (function)

Writers

(setf finger-id) (function)

Slot: state
Initform

"the finger state"

Readers

finger-state (function)

Writers

(setf finger-state) (function)

Slot: size
Initform

"measure of the area covered by the finger"

Readers

finger-size (function)

Writers

(setf finger-size) (function)

Slot: pos-x
Initform

"normalised x position"

Readers

finger-pos-x (function)

Writers

(setf finger-pos-x) (function)

Slot: pos-y
Initform

"normalised y position"

Readers

finger-pos-y (function)

Writers

(setf finger-pos-y) (function)

Slot: vel-x
Initform

"normalised x velocity"

Readers

finger-vel-x (function)

Writers

(setf finger-vel-x) (function)

Slot: vel-y
Initform

"normalised y velocity"

Readers

finger-vel-y (function)

Writers

(setf finger-vel-y) (function)

Slot: ellipse-angle
Initform

"angle of the finger ellipsoid"

Readers

finger-ellipse-angle (function)

Writers

(setf finger-ellipse-angle) (function)

Slot: ellipse-major-axis
Initform

"major axis of the finger ellipsoid"

Readers

finger-ellipse-major-axis (function)

Writers

(setf finger-ellipse-major-axis) (function)

Slot: ellipse-minor-axis
Initform

"minor axis of the finger ellipsoid"

Readers

finger-ellipse-minor-axis (function)

Writers

(setf finger-ellipse-minor-axis) (function)


Previous: , Up: Internal definitions   [Contents][Index]

5.2.4 Classes

Class: c-finger ()
Package

mtif

Source

mtif-ffi.lisp (file)

Direct superclasses
  • translatable-foreign-type (class)
  • foreign-struct-type (class)
Direct methods

translate-from-foreign (method)

Class: mtpoint-tclass ()
Package

mtif

Source

mtif-ffi.lisp (file)

Direct superclasses
  • translatable-foreign-type (class)
  • foreign-struct-type (class)
Class: mtreadout-tclass ()
Package

mtif

Source

mtif-ffi.lisp (file)

Direct superclasses
  • translatable-foreign-type (class)
  • foreign-struct-type (class)

Previous: , Up: Top   [Contents][Index]

Appendix A Indexes


Next: , Previous: , Up: Indexes   [Contents][Index]

A.1 Concepts

Jump to:   F   L   M  
Index Entry  Section

F
File, Lisp, mtif.asd: The mtif<dot>asd file
File, Lisp, mtif/mtif-ffi.lisp: The mtif/mtif-ffi<dot>lisp file
File, Lisp, mtif/mtif.lisp: The mtif/mtif<dot>lisp file
File, Lisp, mtif/package.lisp: The mtif/package<dot>lisp file

L
Lisp File, mtif.asd: The mtif<dot>asd file
Lisp File, mtif/mtif-ffi.lisp: The mtif/mtif-ffi<dot>lisp file
Lisp File, mtif/mtif.lisp: The mtif/mtif<dot>lisp file
Lisp File, mtif/package.lisp: The mtif/package<dot>lisp file

M
mtif.asd: The mtif<dot>asd file
mtif/mtif-ffi.lisp: The mtif/mtif-ffi<dot>lisp file
mtif/mtif.lisp: The mtif/mtif<dot>lisp file
mtif/package.lisp: The mtif/package<dot>lisp file

Jump to:   F   L   M  

Next: , Previous: , Up: Indexes   [Contents][Index]

A.2 Functions

Jump to:   (  
C   F   G   I   M   P   R   S  
Index Entry  Section

(
(setf finger-ellipse-angle): Exported functions
(setf finger-ellipse-major-axis): Exported functions
(setf finger-ellipse-minor-axis): Exported functions
(setf finger-id): Exported functions
(setf finger-pos-x): Exported functions
(setf finger-pos-y): Exported functions
(setf finger-size): Exported functions
(setf finger-state): Exported functions
(setf finger-vel-x): Exported functions
(setf finger-vel-y): Exported functions

C
copy-finger: Internal functions

F
finger-ellipse-angle: Exported functions
finger-ellipse-major-axis: Exported functions
finger-ellipse-minor-axis: Exported functions
finger-id: Exported functions
finger-p: Internal functions
finger-pos-x: Exported functions
finger-pos-y: Exported functions
finger-size: Exported functions
finger-state: Exported functions
finger-vel-x: Exported functions
finger-vel-y: Exported functions
Function, (setf finger-ellipse-angle): Exported functions
Function, (setf finger-ellipse-major-axis): Exported functions
Function, (setf finger-ellipse-minor-axis): Exported functions
Function, (setf finger-id): Exported functions
Function, (setf finger-pos-x): Exported functions
Function, (setf finger-pos-y): Exported functions
Function, (setf finger-size): Exported functions
Function, (setf finger-state): Exported functions
Function, (setf finger-vel-x): Exported functions
Function, (setf finger-vel-y): Exported functions
Function, copy-finger: Internal functions
Function, finger-ellipse-angle: Exported functions
Function, finger-ellipse-major-axis: Exported functions
Function, finger-ellipse-minor-axis: Exported functions
Function, finger-id: Exported functions
Function, finger-p: Internal functions
Function, finger-pos-x: Exported functions
Function, finger-pos-y: Exported functions
Function, finger-size: Exported functions
Function, finger-state: Exported functions
Function, finger-vel-x: Exported functions
Function, finger-vel-y: Exported functions
Function, get-readout: Internal functions
Function, init-device: Internal functions
Function, make-finger: Internal functions
Function, mtdevicecreatedefault: Internal functions
Function, mtdevicestart: Internal functions
Function, mtdevicestop: Internal functions
Function, mtregistercontactframecallback: Internal functions
Function, mtunregistercontactframecallback: Internal functions
Function, print-all-touches: Exported functions
Function, reset: Internal functions
Function, start: Exported functions
Function, stop: Exported functions

G
get-readout: Internal functions

I
init-device: Internal functions

M
make-finger: Internal functions
mtdevicecreatedefault: Internal functions
mtdevicestart: Internal functions
mtdevicestop: Internal functions
mtregistercontactframecallback: Internal functions
mtunregistercontactframecallback: Internal functions

P
print-all-touches: Exported functions

R
reset: Internal functions

S
start: Exported functions
stop: Exported functions

Jump to:   (  
C   F   G   I   M   P   R   S  

Next: , Previous: , Up: Indexes   [Contents][Index]

A.3 Variables

Jump to:   *  
E   I   P   S   V  
Index Entry  Section

*
*frame-count*: Exported special variables
*frame-limit*: Internal special variables
*init-complete*: Internal special variables
*mtif-callback*: Internal special variables
*mtif-handle*: Internal special variables
*mtif-started*: Exported special variables

E
ellipse-angle: Internal structures
ellipse-major-axis: Internal structures
ellipse-minor-axis: Internal structures

I
id: Internal structures

P
pos-x: Internal structures
pos-y: Internal structures

S
size: Internal structures
Slot, ellipse-angle: Internal structures
Slot, ellipse-major-axis: Internal structures
Slot, ellipse-minor-axis: Internal structures
Slot, id: Internal structures
Slot, pos-x: Internal structures
Slot, pos-y: Internal structures
Slot, size: Internal structures
Slot, state: Internal structures
Slot, vel-x: Internal structures
Slot, vel-y: Internal structures
Special Variable, *frame-count*: Exported special variables
Special Variable, *frame-limit*: Internal special variables
Special Variable, *init-complete*: Internal special variables
Special Variable, *mtif-callback*: Internal special variables
Special Variable, *mtif-handle*: Internal special variables
Special Variable, *mtif-started*: Exported special variables
state: Internal structures

V
vel-x: Internal structures
vel-y: Internal structures

Jump to:   *  
E   I   P   S   V  

Previous: , Up: Indexes   [Contents][Index]

A.4 Data types

Jump to:   C   E   F   M   P   S  
Index Entry  Section

C
c-finger: Internal classes
Class, c-finger: Internal classes
Class, mtpoint-tclass: Internal classes
Class, mtreadout-tclass: Internal classes
Condition, err-already-started: Exported conditions
Condition, err-not-started: Exported conditions

E
err-already-started: Exported conditions
err-not-started: Exported conditions

F
finger: Internal structures

M
mtif: The mtif system
mtif: The mtif package
mtif-user: The mtif-user package
mtpoint-tclass: Internal classes
mtreadout-tclass: Internal classes

P
Package, mtif: The mtif package
Package, mtif-user: The mtif-user package

S
Structure, finger: Internal structures
System, mtif: The mtif system

Jump to:   C   E   F   M   P   S