Jump to content


Photo

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

OSC Server activate Open Sound Control

  • Please log in to reply
4 replies to this topic

#1 Raul (ulneiz)

Raul (ulneiz)

    Guruh Motha Fakka is Levitating and Knows Everything About Renoise Member

  • Normal Members
  • PipPipPipPipPipPipPipPipPipPipPipPipPip
  • 1001 posts
  • Gender:Male
  • Location:Spain

Posted 21 December 2016 - 13:58

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 checkbox to 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)

Edited by Raul (ulneiz), 21 December 2016 - 14:03.

:excl: Development of my tool: GT16-Colors

 

:excl: My API wishlist R3.1 (updated 24 July 2017):

Spoiler

 

:excl: My Renoise 3.1 wishlist (updated 26 September 2017):

Spoiler

#2 joule

joule

    Guruh Motha Fakka is Levitating and Knows Everything About Renoise Member

  • Normal Members
  • PipPipPipPipPipPipPipPipPipPipPipPipPip
  • 1487 posts
  • Gender:Not Telling
  • Location:Sweden
  • Interests:music, philosophy, engineering

Posted 21 December 2016 - 14:09

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)

#3 Raul (ulneiz)

Raul (ulneiz)

    Guruh Motha Fakka is Levitating and Knows Everything About Renoise Member

  • Normal Members
  • PipPipPipPipPipPipPipPipPipPipPipPipPip
  • 1001 posts
  • Gender:Male
  • Location:Spain

Posted 21 December 2016 - 14:18

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  ^_^.


:excl: Development of my tool: GT16-Colors

 

:excl: My API wishlist R3.1 (updated 24 July 2017):

Spoiler

 

:excl: My Renoise 3.1 wishlist (updated 26 September 2017):

Spoiler

#4 joule

joule

    Guruh Motha Fakka is Levitating and Knows Everything About Renoise Member

  • Normal Members
  • PipPipPipPipPipPipPipPipPipPipPipPipPip
  • 1487 posts
  • Gender:Not Telling
  • Location:Sweden
  • Interests:music, philosophy, engineering

Posted 21 December 2016 - 14:23

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.

Edited by joule, 21 December 2016 - 14:28.


#5 Raul (ulneiz)

Raul (ulneiz)

    Guruh Motha Fakka is Levitating and Knows Everything About Renoise Member

  • Normal Members
  • PipPipPipPipPipPipPipPipPipPipPipPipPip
  • 1001 posts
  • Gender:Male
  • Location:Spain

Posted 21 December 2016 - 15:12

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...


:excl: Development of my tool: GT16-Colors

 

:excl: My API wishlist R3.1 (updated 24 July 2017):

Spoiler

 

:excl: My Renoise 3.1 wishlist (updated 26 September 2017):

Spoiler





Also tagged with one or more of these keywords: OSC Server activate, Open Sound Control