A few questions about ofxOsc

I’m testing ofxOsc since a few days and I have a few questions:

  • Why is it not possible that 2 différent application can receive osc data from the same port ?
    I tried that because I wanted a second application to display my messages as a kind of debugging tool for the messages, but when I try to start a second application it crashes immediately. Same behaviour in windows and mac.

  • I find the format of the osc arguments very interesting, and I think it could be interesting to use the same or similar format with ofEvents (as internal messages between classes of the same application)
    I’m relatively new to c++ and don’t know all the tricks but I understand that to have data of different type in one vector you need to store the pointers of a base class for all the different types in the vector an not the data itself. What I don’t understand when looking at the file “ofxOscMessage.cpp” is this :

  
  
void ofxOscMessage::addIntArg( int32_t argument )  
{  
args.push_back( new ofxOscArgInt32( argument ) );  
  
ofxOscMessage& ofxOscMessage::copy( const ofxOscMessage& other )  
{  
......  
args.push_back( new ofxOscArgInt32( other.getArgAsInt32( i ) ) );  
  

I dont see nowhere a delete. When will this memory be freed ?

  • SwingOsc seems to be a nice GUI for supercollider. Would it be possible to use it also as a GUI for an OF application by sending osc messages to it ?

Thanks in advance,
Bernard

delete: presumably in the destructor of ofxOscMessage:

  
ofxOscMessage::~ofxOscMessage()  

(Line 38)
although I have to admit i don’t fully understand the clear routine, especially line 47:

  
args.clear();  

why call a clear function (which is btw not mentioned in the ofxOscArg class) when all the entries in args are already deleted (as per the preceding line)??

hi bilderbuchi,

the loop on lines 45-46 of ofxOscMessage.cpp goes through all the elements in the vector and deletes them. but, it doesn’t actually remove the pointers to those elements from the vector. to do that you have to call clear() on the vector. otherwise, the vector would still be full of pointers that point nowhere, which would be very bad.