Closed antpb closed 4 years ago
@stella3d Here's a draft PR of what I'm doing with the reinit function :)
Makes total sense. I like that way better! I'll play around with it and test that the socket is closed when null. From what I remember, when I traced things backwards it seemed safe. It's crazy fast swapping between two OSC hosts!
Will set this ready to review when ready. Thanks! :)
Alrighty! I went ahead and marked ready for review. Curious what you think about Port. I imagine folks could want to change that as well at runtime. I added that to this PR as it seems in line with the changes.
Let me know what you think about the IP validation condition. I think it's okay but feel like that's the weakest part of this PR.
oh, hell yeah, pulling and testing
Alrighty! I factored in the changes and tested in my OSC controller app. Built the app with an invalid IP address defaulted into the input field and left a debug log in the valid IP check. As expected on open no statement, and when proper IP was set, it gave the log. I also verified that Renoise successfully connected and received messages after. Yay!
I was adding an input control to my project for the IP of the OscSender component and needed a way to reinitialize the client. The value of the input is sent to the component's
m_IpAddress
string, then it runs Setup() again.I have a Property Output controller script that is doing the following to reinitilize the client and connect to the new IP.
The input component then sends it's value to the above function when users finishes editing the input field.
One thing to note that may not be ideal, the m_IpAddress object is set public in this PR. When redefining the pubic
IpAddress
string, it fails to use the new IP in the setup function unless changes happen tom_IpAddress
directly. Maybe I'm just doing this wrong. And maybe my controller script can just do this on it's own by setting the client null and running Setup. The IP still fails to update though. Would really appreciate any thoughts. :)