GoOSC is an application for creating and editing GUI interfaces to send and receive OSC data. It is written using the Qt toolkit and Qt Quick, and currently runs on Android.
Editing GUIs
Interfaces are created and edited on the phone itself using two edit modes. To create and set the properties of a widget:
- Enter the red edit mode by clicking on the edit button on the bottom left corner
- Tap and hold anywhere on the screen where you want the widget created
- A selection menu will appear, and select the widget type you's like to add
- The widget will be created and you can move it around simply by dragging while in the red mode
- Now tap and hold on the widget itself to enter the properties dialog for that widget
To resize a widget go to the blue edit mode by pressing the bottom left button again. While in the blue mode you'll be able to resize any widget.
Creating widgets from a computer
You can send special OSC messages to GoOSC to have it create widgets. The message data is QML, so it is actually interpreted and run by GoOSC, which means you can create your own widgets with any special functionality (using javascript) that you need. To create a slider, you need to send to path:
/goosc/create
The following string:
OSCSlider{x:50;y:350; width:250;height:60; min:0;max:1; val:0.5; channel:"/slider"; widgetColor:"#ffff00"; centered:false; defaultValue:0; showValue:false; displayDecimals:1; widgetid: "csound1";}
You can also create an OSCButton, OSCController, OSCLabel and OSCImage.
Deleting widgets remotely
You can delete a widget remotely if the "widgetid" property has been set (i.e. it has to have been created remotely), by sending to path:
/delete
The widget's id as message data. All widgets with that id will be deleted.
Example
Here's a simple example of how to interact with GoOSC widgets using Csound:
<CsoundSynthesizer>
<CsOptions>
</CsOptions>
<CsInstruments>
giosc OSCinit 9002
opcode connectWidget, 0, SSi
Sname, Shost, iport xin
kval invalue Sname
ktrig changed kval
Spath sprintf "/%s", Sname
OSCsend ktrig, Shost, iport, Spath, "f", kval
kans OSClisten giosc,Spath, "f", kval
if (kans == 1) then
outvalue Sname, kval
endif
endop
instr 1 ;Trigger this instrument to create a slider
Stext = {{ OSCSlider{x:50;y:350; width:250;height:60; min:0;max:1; val:0.5; channel:"/slider"; widgetColor:"#ffff00"; centered:false; defaultValue:0; showValue:false; displayDecimals:1; widgetid: "csound1";}
}}
OSCsend 1, "192.168.0.5", 9001, "/goosc/create", "s", Stext
turnoff
endin
instr 2 ;Trigger this instrument to delete it
OSCsend 1, "192.168.0.5", 9001, "/goosc/delete", "s", "csound1"
turnoff
endin
instr 100 ; receive data
Sin = ""
kans OSClisten giosc, "/goosc/create", "s", Sin
if kans == 1 then
outvalue "oscin", Sin
endif
Shost = "192.168.0.5"
iport = 9001
connectWidget "slider", Shost, iport
connectWidget "slider1", Shost, iport
connectWidget "slider2", Shost, iport
connectWidget "slider3", Shost, iport
connectWidget "button1", Shost, iport
endin
</CsInstruments>
<CsScore>
i 100 0 3600
</CsScore>
</CsoundSynthesizer>