gaGetOSCMessage(string,int)

Syntax

gaGetOSCMessage(string,int)

Example

/* 
   
 GAmuza 0428 examples
 ---------------------
 Protocols/oscReceiving.ga
 
 This example show how to receive OSC message from outside GAmuza.
 
 created by n3m3da | www.d3cod3.org
 
*/

faderValue = {}
faderLabel = "/fader"
toggleValue = {}
toggleLabel = "/toggle"

function setup()
	ofSetCircleResolution(3)
	// init OSC receiving labels
    gaGetOSCMessage(faderLabel,1)
    gaGetOSCMessage(toggleLabel,1)
    
    for i=0, gaGetOSCNumVars(faderLabel) do
        faderValue[i] = ""
    end
    
    for i=0, gaGetOSCNumVars(toggleLabel) do
        toggleValue[i] = ""
    end
    
end

function update()
	// capture OSC values
    for i=0, gaGetOSCNumVars(faderLabel)-1 do
    	faderValue[i] = gaGetOSCValue(faderLabel,i)
    end
    for i=0, gaGetOSCNumVars(toggleLabel)-1 do
    	toggleValue[i] = gaGetOSCValue(toggleLabel,i)
    end
end

function draw()
    gaBackground(0.0,1.0)
    
    ofSetColor(34,217,179)
    ofDrawBitmapString(string.format("Receiving OSC data at Port: %s",OSC_RECEIVING_PORT),20,200)
    ofDrawBitmapString(string.format("Message labeled \"%s\" value: %s", faderLabel, faderValue[0]),20,260)

    if toggleValue[0] == "0" then
        ofSetColor(255)
    else
        ofSetColor(34,217,179)
    end
    
    ofCircle(OUTPUT_W/2,OUTPUT_H/2,ofToFloat(faderValue[0])*400)
end

Description

Initialize a new receiving OSC message container, with the label specified as parameter, and with the specified size

Parameters

string,int