jean-emmanuel / open-stage-control

Libre and modular OSC / MIDI controller
https://openstagecontrol.ammd.net
GNU General Public License v3.0
702 stars 88 forks source link

send to default host and port in custom modules #785

Closed jgastonraoul closed 2 years ago

jgastonraoul commented 2 years ago

Hi !

I'd like to use default host and port (the one I configure in the "send" textfield of the GUI) to send OSC from my custom module. How can I do that ?

Currently I have to define them in every "send" method of my custom module, and it's not very practical when the IP of the receiver changes...

Regards,

Jérémie

mr-plaid commented 2 years ago

You can already access any of the server config options within a custom module using settings.read(name). Custom Module - Documentation

jgastonraoul commented 2 years ago

Thanks for the tip! In the doc, I read that host/port parameters are optional on receive method... Is there something equivalent on send method?

jean-emmanuel commented 2 years ago

This is what I usually do : https://github.com/PlagiatBros/PlagiatSetupII/blob/master/OpenStageControl/custom-module.js#L4-L6

jean-emmanuel commented 2 years ago

And yes, it would make sense to make the 2 first arguments optional !

jgastonraoul commented 2 years ago

I've tried your solution and it works great, thanks ! Let me know if you decide to add the optional arguments in the API method so I can update my custom module.

Regards,

Jérémie