I have a checkbox with the idea of using it to activate/disable the OSC Server since the tool (without having to execute the preference box of Renoise).
I’ve been looking at some tools, but I do not find a concrete function.I think Danoise mentioned that it could be activated the OSC Server directly from a tool, with a function.I would take advantage of the checkboxto warn to user that the OSC server is active.
At the point where I am, the virtual piano I have built works perfectly, writes the notes and also sounds with active OSC server (It works very well, although timer that causes a flicker in the red frame of the edit_mode). Foul add this checkbox “Enable OSC Server”.In this way, the tool is visible if the OSC Server is enabled or disabled.
What would be the function?
EDIT:I forgot the related code that I use in my tool:
--------------------------------------------------------------------------------
-- OSC SERVER
--------------------------------------------------------------------------------
class 'OscClient'
function OscClient:__init( osc_host, osc_port, protocol )
self._connection = nil
local client, socket_error = renoise.Socket.create_client( osc_host, osc_port, protocol )
if ( socket_error ) then
renoise.app():show_warning( "Warning: Failed to start the internal OSC client" )
self._connection = nil
else
self._connection = client
end
end
-- Trigger instrument-note
--- note_on (bool), true when note-on and false when note-off
--- instr (int), the Renoise instrument index 1-254
--- track (int), the Renoise track index
--- note (int), the desired pitch, 0-120
--- velocity (int), the desired velocity, 0-127
function OscClient:trigger_instrument( note_on, instr, track, note, velocity )
if not self._connection then
return false
end
local osc_vars = { }
osc_vars[1] = { tag = "i", value = instr }
osc_vars[2] = { tag = "i", value = track }
osc_vars[3] = { tag = "i", value = note }
local header = nil
if ( note_on ) then
header = "/renoise/trigger/note_on"
osc_vars[4] = { tag = "i", value = velocity }
else
header = "/renoise/trigger/note_off"
end
self._connection:send( renoise.Osc.Message( header,osc_vars ) )
return true
end
osc_client = OscClient("127.0.0.1", 8000, 2)