Old 01-10-2013, 12:32 PM   #1
Jeffos
Mortal
 
Jeffos's Avatar
 
Join Date: Dec 2008
Location: France
Posts: 1,969
Default OSC++

I have some troubles with the API and OSC. I would really appreciate some help about that...


1) OSC client/sever and "LocalOscHandler" API functions

I coded my own server (i.e. with my own IP/port settings, etc..) to deal with that prob but I would like to make really sure I understood the new "LocalOscHandler" API functions (of course, what I want to do here can't be achieved with simple OSC layout editions).

There is a callback "problem" I already reported in this thread: http://forum.cockos.com/showthread.php?t=99616 (same prob when using an OSC layout or not).
=> either there is a bug (schwa stated there "it is not really tested") or I totally miss the point I think it is the latter: *Local*OscHandler. That for sure, it is "local" ! ATM, I am only notified of my own messages (i.e. I only get "mirroring" messages of my own calls to SendLocalOscMessage()). I don't understand. Why is that useful? What are the intended appliactions?

But, instead of re-reporting things, here is what I would expect: when I register an OSC handler I'd like to be notified of all OSC messages sent to REAPER -or- all remaining messages (those that have not being processed by REAPER: out of OSC layout bounds, not defined in the layout, etc..).

Qs:
=> Does someone here uses "LocalOscHandler" API funcs? Are they buggy or am I missing the point here?
=> Do I indeed have to run my own server?


2) Implementing "learnable" OSC actions

Today, when an action is learned/triggered via OSC I get callbacks through KbdSectionInfo:nAction(). Excellent.
However I'm not able to support both MIDI pitch and OSC learn, because I can't find a way to distinguish both (since they both use the same "path" -I mean, from an API point of view).

Q: Is it possible to distinguish PITCH from OSC with the current API?
(I know how to workaround that but this would be a bummer for the user).

Optional Qs [to document things]:
- from my tests, it seems we can only learn *rounded* OSC float messages with the current API. Is that true?
i.e. I mean, if the user sends float values with decimals, things go wrong + although the user can learn OSC int, bool and string messages, related data are never forwarded to KbdSectionInfo:nAction(), is this right?
- since pitch & osc both use the same "path", this would mean we "only" have a resolution of 14 bit for OSC. Is this assumption right?

In case it can help, my code looks like that (as you can see, things will go wrong for pitch):
Code:
// this func is called through a KbdSectionInfo::onAction()
void Stuff(MIDI_COMMAND_T* _ct, int _val, int _valhw, int _relmode, HWND _hwnd)
{
		if (_valhw>=0) // osc & pitch
		{
//			m_absolute = BOUNDED(_valhw|_val<<7, 0, 16383); // ok for pitch
			m_absolute = _valhw || _val ? BOUNDED(16384 - (_valhw|_val<<7), 0, 16383) : 0; // ok for osc
		}
		else if (_valhw==-1 && _val>=0 && _val<=127) // absolute/relative cc midi events
		{
	        [...]
Thanks for any input!

Last edited by Jeffos; 01-13-2013 at 05:02 AM. Reason: fixed bug in example code ;-)
Jeffos is offline   Reply With Quote
Old 01-22-2013, 02:52 PM   #2
Jeffos
Mortal
 
Jeffos's Avatar
 
Join Date: Dec 2008
Location: France
Posts: 1,969
Default

Oh no... Please do not tell me this nice thread will turn into a remake of "A Venezuelian guy walking alone in the desert".
Nice thriller too BTW.. The end sucks though. You know, when the main character ends speaking alone
Jeffos is offline   Reply With Quote
Old 01-22-2013, 06:30 PM   #3
musicbynumbers
Human being with feelings
 
musicbynumbers's Avatar
 
Join Date: Jun 2009
Location: South, UK
Posts: 14,218
Default

Just to say I have read through the post but can't help I'm afraid but I wanted you to know that for you and all you've added to this community, I'll at least try!
musicbynumbers is online now   Reply With Quote
Old 01-22-2013, 07:24 PM   #4
schwa
Administrator
 
schwa's Avatar
 
Join Date: Mar 2007
Location: NY
Posts: 15,814
Default

Hi Jeffos, sorry, I've been away for a bit.

I'll look at the local handler issues tomorrow. I can confirm that the feature has never been tested (well, until now that is).

Regarding your second question -- currently, the architecture for using OSC or MIDI to trigger REAPER actions looks like this:

Code:
[OSC input] ---------->|
                       |->-[REAPER actions]->-[extension onAction callbacks]
[MIDI control input] ->|
.. so no, there is no way for the callback to know if the action was triggered via OSC or MIDI. As you surmised, a secondary effect is that only OSC float messages will trigger CC-aware actions, and the resolution is 14 bit.


... this is the code within REAPER that translates an OSC message to a REAPER action:

Code:
        int ival=(int)(*arg*16383.0);
        int ret=sec->onAction(cmd, (ival>>7)&0x7F, ival&0x7F, 0, 0);
schwa is offline   Reply With Quote
Old 01-22-2013, 08:01 PM   #5
schwa
Administrator
 
schwa's Avatar
 
Join Date: Mar 2007
Location: NY
Posts: 15,814
Default

To answer the first question, the local OSC handler is intended to be analogous to an individual OSC device that exists on the network, using the default pattern config file. In theory, the local "device" should get feedback messages as defined in the default pattern config file.

The intent was not to have the local handler be a generic listener for all incoming OSC messages, although it would not technically be difficult to implement something like that.
schwa is offline   Reply With Quote
Old 01-23-2013, 12:10 AM   #6
Anton9
Human being with feelings
 
Anton9's Avatar
 
Join Date: Jun 2009
Location: Earth
Posts: 1,340
Default

Quote:
Originally Posted by schwa View Post
As you surmised, a secondary effect is that only OSC float messages will trigger CC-aware actions, and the resolution is 14 bit.
There is also a bug that Jeffos and I uncovered related to OSC float mesages triggering CC-aware actions.., I have posted here http://forum.cockos.com/project.php?issueid=4589 maybe you can have a look.

Thanks.
Anton9 is offline   Reply With Quote
Old 01-24-2013, 01:20 AM   #7
Jeffos
Mortal
 
Jeffos's Avatar
 
Join Date: Dec 2008
Location: France
Posts: 1,969
Default

Good to see you back schwa!
Thank you very much for clarifying/confirming things and for all the details, it's clear now.

1) LocalOscHandler callbacks
Ah.. I indeed misunderstood then.. But I also have to confirm the bug I described above then..
Personally, for "local callbacks", we already have IReaperControlSurface and so I was more interested in incoming messages ->REAPER, so yes it would be great to add this at some point (personally I already have a server up & running -private project)

2) OSC learn
Thanks (this was just to make sure what I said in the last sws_whatsnew was correct). "MIDI CC/OSC only" !

____

OT @ Anton9:
I tried to contact you..
Just to let you know (in case it is not intentional) that you have not enabled private messaging in your forum account...

Last edited by Jeffos; 01-24-2013 at 02:31 AM.
Jeffos is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 06:49 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.