Empty OSC messages should be allowed


#1

I have noticed that if I try to send an OSC message without adding any “values” (arguments) then my NAP application crashes on the call to “send” the event, specifically:

Assertion failed: (oscEvent.getCount() > 0), function writeToPacket, file /Users/coenklosters/Documents/dev/nap/modules/naposc/src/oscsender.cpp, line 111.

OSC messages with no arguments are sensible and supported explicitly by the OSC spec (http://opensoundcontrol.org/spec-1_0):

An OSC message consists of an OSC Address Pattern followed by an OSC Type Tag String followed by zero or more OSC Arguments.

I believe that this is a bug. There are a number of systems using OSC (including 4DSound) which expect zero-argument OSC messages for certain operations. An arbitrary argument can be added, as a workaround, but this should be unnecessary.


#2

I’ll look into this, sounds like an oversight. Thanks for letting me know, i’ll shoot in a bug report.


#3

Quickly looked at the code, I think simply removing the assert should fix your issue. The output buffer size is calculated based on the address + additional arguments. When no arguments are associated with an event it simply uses the address and sends that over the udp socket without arguments, if the assert wouldn’t go off.

The assert should be stripped in release builds, worth a shot.


#4

Thanks for looking into this!


#5

Removing the assert indeed allows for empty osc events to be sent. I have just pushed this change to the source repository. Verified and tested using the oscmidi demo.