[Request] OSC Library from CNMAT/OSC

Would it be possible to port the OSC library from CNMAT/OSC ?

@lightx, from a quick look of the repo I would say absolutely it can be ported. I have a couple of other ports to do but I would be glad to add this one to my list. What’s your timeline?

Great. Thank you @peekay123! After I posted the this, I got some of it to work already which was very easy. I only copied and pasted the OSC* into the WebIDE. I removed the arduino.h references. I tried the example OSCSend example. As I’m new to this, I think if you or someone else can check the code it would be great. In terms of timeline, Im playing with this for my work, integrating sensors to control sounds/lights etc. I work in the performing arts. So long story short, no rush.

Oh and I also added the following myUDP.h based on trying to port the arduinolifx experience.

//----- UDP + overloading the inappropriate UDP functions of the Spark Core (REQUIRED !)
class myUDP : public UDP {
private :
    uint8_t myBuffer[128];
    int offset = 0;
public :
    virtual int beginPacket(IPAddress ip, uint16_t port){
        offset = 0;
        return UDP::beginPacket(ip, port);
    };
    virtual int endPacket(){
        return UDP::write(myBuffer, offset);
    };
    virtual size_t write(uint8_t buffer) {
        write(&buffer, 1);
        return 1;
    }
    virtual size_t write(const uint8_t *buffer, size_t size) {
        memcpy(&myBuffer[offset], buffer, size);
        offset += size;
        return size;
    }
        UDP myUDP;
};

@lightx, great job! I never know how much members know about porting libraries. This OSC library is well written and mostly straight forward to port so I’m glad to see things are going well. Let me know if anything is stumping you :stuck_out_tongue:

@peekay123 or anyone else…

could you take a look at OSCMatch.c, I’m trying to compile UDPOscuino.ino example and I’m getting

OSCMatch.cpp: In function 'int osc_match(const char*, const char*, int*, int*)':
OSCMatch.cpp:39:10: error: 'OSC_MATCH_ADDRESS_COMPLETE' was not declared in this scope
return OSC_MATCH_ADDRESS_COMPLETE | OSC_MATCH_PATTERN_COMPLETE;
^
OSCMatch.cpp:39:39: error: 'OSC_MATCH_PATTERN_COMPLETE' was not declared in this scope
return OSC_MATCH_ADDRESS_COMPLETE | OSC_MATCH_PATTERN_COMPLETE;
^
OSCMatch.cpp:99:8: error: 'OSC_MATCH_ADDRESS_COMPLETE' was not declared in this scope
r |= OSC_MATCH_ADDRESS_COMPLETE;
^
OSCMatch.cpp:103:8: error: 'OSC_MATCH_PATTERN_COMPLETE' was not declared in this scope
r |= OSC_MATCH_PATTERN_COMPLETE;
^
make: *** [OSCMatch.o] Error 1

Hi,
I too am intereseted in compiling UDPOscuino.ino for use with the puredata example given by cnmat,
did you succeed with this?
Ive succeeded with trublions port, but only managed to compile firmware 0.2.1 as posted here https://community.spark.io/t/osc-library-oscuino-for-the-spark-core-with-puredata-and-max-msp-example-patches/5089/5
I am an artist working with sound and kinetic installations, im not a programmer. in the past ive worked with firmata, so I would greatly appreciate that functionality but wirelessly with OSC.
any help would be greatly appreciated and full credit/funding given.