gaGetMidiChannel()

Syntax

gaGetMidiChannel()

Example

font = ofTrueTypeFont()
midiIndex = 11
midiValue = 0

function setup()
   // load your font here, located inside the script data/ folder
   font:loadFont(gaImportFile("fonts/Anonymous_Pro_B.ttf"),64, true, false)
end

function update()
   if gaGetMidiByteOne() == midiIndex then
      midiValue = gaGetMidiByteTwo()
   end
end

function draw()
   gaBackground(0.0,0.8)
 
   ofSetColor(255)
   ofDrawBitmapString(string.format("Testing MIDI Index %i: ", midiIndex),20,OUTPUT_H/2 - 80)
   ofRect(20,OUTPUT_H/2 - 40,midiValue,20)
 
   ofPushMatrix()
   ofTranslate(20,OUTPUT_H/2 + 80,0)

   ofSetColor(23,169,210)
   // midi channel (midi device/program)
   font:drawString(string.format("Device: %i",gaGetMidiChannel()),0,0)
   // midi byte one (midi index, a knob, or trigger, or pad, etc..)
   font:drawString(string.format("Index: %i",gaGetMidiByteOne()),0,100)
   // midi byte two (midi value, 0-127)
   font:drawString(string.format("Value: %i",gaGetMidiByteTwo()),0,200)

   ofPopMatrix()
end

Description

This is a reference to the actual MIDI device (or MIDI program in case of using a more advanced device) connected and communicating. You can change the MIDI setting and choose your device in GAmuza/Preferences/MIDI tab.

Returns

«Int, The selected MIDI device or program