User Tools

Site Tools


ai:examples:midilayerselect:midilayerselect

Ai Example

Midi Layer Select

Lets you select the current layer by MIDI.

by: Sebastian Beutel, Oct. 2018
published: here
tested in version: 10.2
download: midi_layer_select.scb

Background

On the performance page you can easily trigger the media tiles by MIDI (Ctrl-M is your friend here) - tiles which are triggered this way appear on the currently selected layer. It is also possible to add MIDI controls to the current layer (open a layer adjustments window by double-clicking a layer on the performance page - you can right-click the controls there and select Edit Midi Map [this is not completely operational in Ai v10.3]).

However you are still required to select the layer via the GUI - there is no default way implemented to select a layer by MIDI. This is what this patch adds.

Used Modules and Patches

Description

The essential idea is to use several Midi triggers (i.e. buttons on your launchpad) to set one parameter - the selected layer - to different values:

  • the constants 0~3 are exposed as buttons (which can be triggered by Midi - right-click, Edit Midi Map), and are either 0 (default) or 1 (triggered)
  • the first formula calculates the target result (i.e. if the first button is triggered, the target result is 1, if the third button is triggered, the target result is 3)
  • this is then fed to the Latch module which, as soon as the trigger reaches 1 (or more) latches the Input. This way the output is always kept, even if a button is released again (standard behaviour on Midi pads)
  • as the expected value for Layer Select is 0-based another formula decreases the latched output by 1
  • AiMediaTileTrigger is the module which lets us connect to some aspects of the performance page (you can easily extend this example to select Media banks and Fixtures by Midi). Here we set the Layer Select port to the target value, which finally switches the layer.
  • finally, it is required to be linked to a Render Path to have any effect - hence we expose the Render Out to the surface

While creating this I noticed that the AiMediaTileTrigger module doesn't like decimal numbers in the Layer Select port. If you experiment with this, e.g. with a knob, make sure the values are always rounded, e.g with a formula module using rint().

Deployment

In order to make use of this patch:

  • drop it in your stage patch
  • connect the Render Out port to a render chain:
    • either insert a window module and open the window
    • or - with the render merge module - hook it into the main render path (see below)
  • finally map the buttons to your Midi device (right-click, Edit Midi Map)

You could leave a comment if you were logged in.
ai/examples/midilayerselect/midilayerselect.txt · Last modified: 2018/10/20 17:52 by icke_siegen

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki