Help, function to enable/disable OSC Server for a checkbox

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)

It’s not possible.

There is also no failsafe function to check the status of the server at the moment. It is certainly not possible to enable/disable it from a tool.

(over and out)

It’s not possible.

There is also no failsafe function to check the status of the server at the moment. It is certainly not possible to enable/disable it from a tool.

(over and out)

Maybe I was confused.There is no choice but to warn in some way that the OSC is active.A pop-up window or even an invention: a button that lights (green/red) up if it detects an instrument sounds from the tool ^_^.

I’ve suggested a possible approach to Danoise for checking the connection status, also covering UDP. I trust his judgement if it (and what) would be sensible to add in his OSC class (or not).

The current approach is to warn the user once that (s)he must enable the server manually.

PS. In either case, you “should” add a preference section in your tool for the user to enter server/port/protocol.

I’ve suggested a possible approach to Danoise for checking the connection status, also covering UDP. I trust his judgement if it (and what) would be sensible to add in his OSC class (or not).

The current approach is to warn the user once that (s)he must enable the server manually.

PS. In either case, you “should” add a preference section in your tool for the user to enter server/port/protocol.

Ok, Thanks!I will build an “invention” of button para to cover this, at least by way of information…