Notifications
Clear all

OSC functionality?

6 Posts
3 Users
6 Likes
548 Views
thsve
(@thsve)
Member
Joined: 3 years ago
Posts: 302
Topic starter  

EDIT:

I think I have figured it out. I have managed to send these messages in TouchOSC and got the /presetLoaded back. Now I "only" have to implement a OSC reciever in my juce app.

END EDIT

@getdunne

As you may have seen, I am experimenting with the added OSC capabilities in Unify. At the moment I'm writing a small utility with juce to load and embed random patches. Everything works fine, I'm able to load (and embed) patches with these lines of code:

        if (!sender.send("/load", (float)getID))
            showConnectionErrorMessage("Error: could not send OSC message.");

 

 

My problem is the Bidirectional messaging:

Bidirectional messaging for patch-loading commands

As described above, the /init, /load, and /embed commands allow a remote-control program to trigger loading of patches. Because this is often a time-consuming operation, it's desirable to have a way for Unify to let the remote-control program know when the load operation completes. Unify supports a very limited bi-directional messaging protocol for this purpose.

A remote-control program can optionally send the OSC message /hello/IP address to Unify, with an integer value (format-code “i”). The IP-address string indicates the address on which the remote-control program itself is listening for OSC messages, and the integer value indicates the port-number. An example might be /hello/127.0.0.1 with value (port number) 9000.

If Unify has received a valid/hello messages, it will acknowledge the completion of any patch-load command (including /init) by sending an OSC message /presetLoaded to the specified UDP address and port number. This message includes an integer argument (format-code “i”), whose value is always zero. Note that Unify will also send these messages even when patches are loaded manually by the user, through theGUI.

Before shutting down, a remote-control program which has previously sent a/hellomessage should also send a/goodbye message, to indicate that Unify should no longer send out /presetLoaded messages. The /goodbye message also requires an integer value (format-code “i”), but the actual value is ignored.

I'm not sure how to send the "hello message". In the description it says port number 9000, shouldn't it be 9001?

I've tried different message formats without luck. Should it be something like this?

int getID = 9000
send("/hello/127.0.0.1", (float)getID)

Any advice?

Win 10 and 11/Cubase Pro 12/Unify/Wavelab 8/Vienna Pro 7/Spectrasonics all/NI 13 Ultimate/Izotope MPS2/Serum/Cthulhu/Scaler 2.5/MusicLab guitar vsts/BIAB 2022/TouchOSC/Metagrid Pro etc


   
Quote
getdunne
(@getdunne)
Illustrious Member Admin
Joined: 3 years ago
Posts: 3683
 

@thsve

The bit you're missing is: The IP-address string indicates the address on which the remote-control program itself is listening for OSC messages, and the integer value indicates the port-number.

Your program can choose its own receiving port-number, which should be different from the port-number Unify is listening on, if the IP addresses are the same (i.e., if your remote-control program and Unify are running on the same machine). If you try to listen on the same port as Unify, you will not be able to open the port, because Unify has already claimed it.

I will try to get some demo code up on GitHub soon, but for now, you simply need to declare a member object of class juce::OSCReceiver, set your main object as a listener on it, and connect to the port you want to listen on, e.g.:

OSCReceiver oscReceiver;
...
oscReceiver.addListener(this);
oscReceiver.connect(9000);
...
oscSender.send("/hello/" + "127.0.0.1", 9000);
...
oscSender.send("/goodbye", 0);

I'm leaving out a great deal of setup here, but this is the basic idea.


   
JeremyH reacted
ReplyQuote
getdunne
(@getdunne)
Illustrious Member Admin
Joined: 3 years ago
Posts: 3683
 

@thsve

It's great that you have decided to learn JUCE, but for everyone else out there, please understand: one of the main reasons I implemented OSC in Unify is so that you can program in any language that supports simple networking.

After more than 40 years of programming, I have to say C++/JUCE has the worst learning-curve I have ever climbed, and I'm not over it yet. Something like Microsoft C#, or even Python, will be far more productive and enjoyable.


   
JeremyH reacted
ReplyQuote
thsve
(@thsve)
Member
Joined: 3 years ago
Posts: 302
Topic starter  

@getdunne 

I did solve the osc reciever bit just after I posted so that works now. 

As I have said before, I'm doing this to learn juce/c++, challenge myself and have fun😀.  I have used C# and Python before, and I really agree that C++ is a challenge (at least for me). Productivity isn't a goal for me.

I've published a short video showing the status of the app now. https://youtu.be/E8sJJrCcwDQ.

Now I will challenge myself and try reading the preset database directly from the app. At moment the program reads a textfile extracted from the database with a Python script.

Win 10 and 11/Cubase Pro 12/Unify/Wavelab 8/Vienna Pro 7/Spectrasonics all/NI 13 Ultimate/Izotope MPS2/Serum/Cthulhu/Scaler 2.5/MusicLab guitar vsts/BIAB 2022/TouchOSC/Metagrid Pro etc


   
JeremyH reacted
ReplyQuote
getdunne
(@getdunne)
Illustrious Member Admin
Joined: 3 years ago
Posts: 3683
 

@thsve

Now I will challenge myself and try reading the preset database directly from the app.

I recommend SQLite-CPP by Vincent La.


   
JeremyH and thsve reacted
ReplyQuote
craigr68
(@craigr68)
Member
Joined: 2 years ago
Posts: 172
 
Posted by: @getdunne

I will try to get some demo code up on GitHub soon

Thanks for the tips.  I'm looking forward to the demo code when you get a chance.


   
getdunne reacted
ReplyQuote
Share: