Skip to content

Pd abstractions reference

Carles F. Julià edited this page May 14, 2014 · 28 revisions

The interface logic and all drawings are made by pd abstractions that you can find into the PD folder when the project id downloaded. In this section are commented the most used ones. You can also find them into mtcf-help.pd object [mtcf-help].

mtcf-basics

These objects allows to modify the global behavior of the MTCF.

  • [mtcf-comm] Is the object that manages all the communication between the graphical front-end and the PD client. There must exist one and only one instance of this abstraction at the same time.
    • Inlets: A configuration and control inlet. The address of the graphical front-end can be changed by sending a message such as [ip 192.168.1.30 (. Other valid messages are [controlPort $1 ( and [interfacePort ( to change incoming and outgoing ports (not recommended) or [connect ( and [disconnect ( to control the connection.
    • Outlets: a bang signal after initializing mtcf externals.
  • [mtcf-reset] Sends a reset signal to the MTCF graphic engine. It clears all graphics.
    • Inlets: a bang signal to call the reset.
    • Outlets: a bang signal when a reset is called.
  • [mtcf-send] Sends messages directly to the graphic engine. Do not use it unless you are familiar with the sent messages.
    • Inlets: a list with the message.
    • Outlets: none.
  • [mtcf-receive] Receives messages directly from the graphic engine. Do not use it unless you are familiar with the sent messages.
    • Inlets: none.
    • Outlets: a list with the message.
  • [mtcf-color] Generic color adapter. It gets a RGBA values and encapsulates them to a mtcf-color.
    • Inlets: red value, green value, blue value, alpha value.
    • Outlets: a mtcf-color.
    • It also can be called passing the rgba values as aguments [mtcf-color red geen blue alpha]
  • [mtcf-background] Modifies the MTCF background color
    • Inlets: mtcf-color (see [mtcf-color] object).
    • Outlets: none.
  • [mtcf-fingercolor] Modifies the MTCF finger trace color
    • Inlets: mtcf-color (see [mtcf-color] object).
    • Outlets: none.
  • [mtcf-init] a loadbang like object to synchronize the initialization of every MTCF object when needed.
    • Inlets: none
    • Outlets: a bang.
  • [mtcf-textsize] modifies the MTCF text size.
    • Inlets: size
    • Outlets: none.

mtcf-graphics

graphic modifiers

  • [mtcf-rgbcolor] Generic color adapter. It gets a RGB values and encapsulates them to a mtcf-color.
    • Inlets: red value, green value, blue value.
    • Outlets: a mtcf-color message.
    • It also can be called passing the rgb values as arguments [mtcf-color red geen blue]
  • [mtcf-stroke] generates a draw stroke message.
    • Inlets: enable 1 or 0, mtcf-color and strokezise in pixels.
    • Outlets: a mtcf-stroke message.
  • [mtcf-rectangle] generates a rectangle encapsulated into a mtcf-polygon-primitive message.
    • Inlets: width and height.
    • Outlets: a mtcf-polygon-primitive message.
    • It also can be called passing the values as arguments [mtcf-rectangle width height]
  • [mtcf-square] generates a square encapsulated into a mtcf-polygon-primitive message.
    • Inlets: width.
    • Outlets: a mtcf-polygon-primitive message.
    • It also can be called passing the values as arguments [mtcf-square width]
  • [mtcf-circle] generates a circle encapsulated into a mtcf-polygon-primitive message.
    • Inlets: radius and vertex resolution.
    • Outlets: a mtcf-polygon-primitive message.
    • It also can be called passing the values as arguments [mtcf-circle radius vertex_resolution]
  • [mtcf-hide] Hides or shows a mtcf-graphic object.
    • Inlets: state 1 to show the object 0 to hide it.
    • Outlets: a mtcf-hide message.
  • [mtcf-visibility] Modifies the mtcf-graphic paint order.
    • Inlets: hide, 1 to hide 0 to unhide. Layer a number that represents the layer where the object will be drawn. BringTop a bang to bing the graphic to the highest position into its layer.
    • Outlets: a mtcf-visibility message.
  • [mtcf-scale] scales a mtcf-graphic.
    • Inlets: mtcf-transforation message, X scale factor, Y scale factor.
    • Outlets: a mtcf-transforation message.
    • It also can be called passing the X and Y values as arguments [mtcf-scale XX YY]
  • [mtcf-scalexy] scales a mtcf-graphic.
    • Inlets: mtcf-transforation message, scale factor.
    • Outlets: a mtcf-transforation message.
    • It also can be called passing the scale factor as an argument [mtcf-scalexy factor]
  • [mtcf-rotate] rotates a mtcf-graphic.
    • Inlets: mtcf-transforation message, angle (in degrees).
    • Outlets: a mtcf-transforation message.
    • It also can be called passing the angle as an argument [mtcf-rotate angle]
  • [mtcf-translate] translates a mtcf-graphic.
    • Inlets: mtcf-transforation message, X position, Y position.
    • Outlets: a mtcf-transforation message.
    • It also can be called passing X and Y values as arguments [mtcf-translate X Y]

The [mtcf-scale], [mtcf-scalexy], [mtcf-rotate], [mtcf-translate] can be linked in cascade.

matrix modifiers

  • [mtcf-matrix] receives a 4x4 opengl matrix as a list of numbers and checks its integrity.
    • Inlets: a 16 numbers list.
    • Outlets: the input matrix or the identity matrix if the input wasn't correct.
  • [mtcf-itransformpoint] multiplies a point by the inverse of the given matrix.
    • Inlets: a 16 numbers list, X coordinate and Y coordinate.
    • Outlets: X result and Y result.
  • [mtcf-transformpoint] multiplies a point by a given matrix.
    • Inlets: a 16 numbers list, X coordinate and Y coordinate.
    • Outlets: X result and Y result.

graphic objects

  • [mtcf-text] writes a text into mtcf.
    • Inlets: a mtcf-message.
      • mtcf-translate.
      • mtcf-rotate.
      • mtcf-scale, mtcf-scalexy.
      • mtcf-color, mtcf-rgbcolor.
      • mtcf-hide, mtcf-visibility.
      • a message containing write text-to-write to write a test.
      • a message containing clear to clear the text.
    • Outlets: none.
  • [mtcf-polygon] Draws a polygon.
    • Inlets: a mtcf-message.
      • mtcf-translate.
      • mtcf-rotate.
      • mtcf-scale, mtcf-scalexy.
      • mtcf-color, mtcf-rgbcolor.
      • mtcf-hide, mtcf-visibility.
      • mtcf-stroke
      • mtcf-polygon-primitive
      • a message containing addvertex xvalue yvalue to add a vertex.
      • a message containing clearvertex to clear the vertices.
      • a message containing drawpolygon 1_or_0 to draw or not the polygon (1 by default).
      • a message containing texture texturename.png to load a texture in the data/ directory.
    • Outlets: mtcf-finger and a transformation matrix.
      • use [route /finger matrix] to get these values

mtcf-fingers

  • [mtcf-fingers] receives the finger events from the MTCF.
    • Inlets: none.
    • Outlets: mtcf-finger message.
  • [mtcf-finger] opens a mtcf-fimger message.
    • Inlets: mtcf-finger message.
    • Outlets: mtcf-finger message, finger enabled (1 or 0), X position, Y position, size.

To open all mtcf-finger messages you can put [mtcf-finger] on cascade.

mtcf-sensors

This patch is only available for the mMTCF version.

  • [mtcf-sensors] receives the sensor (passed by argument) data
    • Inlets: togle (enable/disable).
    • Outlets: a list with the sensor data.
    • Available sensors:
      • accelerometer.
      • rotationvector.
      • light.
      • magneticfield.
      • proximity.
      • gyroscope.
      • gravity (from android fused sensor api)
      • linearacceleration (from android fused sensor api)

mtcf-tabletop

These patches are only available for the MTCF tabletop version.

  • [mtcf-object] receives the tabletop object data.
    • Inlets: mtcf-slider_param message, object identification.
      • pd message with slider 1 draws a slider around the object.
      • pd message with param 1 draws a rotatory slider around the object.
    • Outlets: presence, x, y, angle, parameter_value, slider_value
    • This also accept the object ID by argument: [mtcf-object ID].
  • [mtcf-object-distance] distance between two objects
    • Inlets: toggle draw
    • Outlets: presence, distance and angle between the two objects.
    • The objects IDs are passed by argument: [mtcf-object-distance ID1 ID2].
  • [mtcf-draw-wave] draws a wave between two points
    • Inlets: Toggle enable/disable, audio, x1, y1, x2, y2
    • Outlets: none
  • [mtcf-connect-wave] draws a wave between two objects
    • Inlets: audio, toggle enable/disable.
    • Outlets: audio.
    • The object ID's are passed by argument: [mtcf-connect-wave ID1 ID2]