I’m thinking of updating the api to match the official libpd api. There is interest from the libpd devs to include the ofxPd architecture as the official C++ wrapper. I can do this without changing the ofxPd api, but I think it makes more sense in the long run to do so.
Let me know what y’all think.
The main changes would be:
Have the receiver set on finish:
void startMsg(const std::string& dest, const std::string& msg);
void addFloat(const float value);
void addSymbol(const std::string& symbol);
void finish();
become
void startMsg();
void addFloat(const float value);
void addSymbol(const std::string& symbol);
void finishList(const std::string& dest);
void finishMsg(const std::string& dest, const std::string& msg);
channels are the first arguments in midi functions:
void sendNote(const int pitch, const int velocity=64, const int channel=1);
void sendCtl(const int controller, const int value, const int channel=1);
void sendPgm(const int value, const int channel=1);
void sendBend(const int value, const int channel=1);
void sendTouch(const int value, const int channel=1);
void sendPolyTouch(const int pitch, const int value, const int channel=1);
become
void sendNote(const int channel, const int pitch, const int velocity=64, );
void sendCtl(const int channel, const int controller, const int value);
void sendPgm(const int channel, const int value);
void sendBend(const int channel, const int value);
void sendTouch(const int channel, const int value);
void sendPolyTouch(const int channel, const int pitch, const int value);
The *source functions become un/subscribe functions:
void addSource(const std::string& source);
void removeSource(const std::string& source);
bool sourceExists(const std::string& source);
void clearSources(); /// listeners will be unsubscribed from *all* sources
become
void subscribe(const std::string& source);
void unsubscribe(const std::string& source);
bool isSubscribed(const std::string& source);
void unsubscribeAll(); /// listeners will be unsubscribed from *all* sources
The un/subscribe functions would become *Listener functions:
void subscribe(ofxPdListener& listener, const std::string& source="");
void unsubscribe(ofxPdListener& listener, const std::string& source="");
bool isSubscribed(ofxPdListener& listener, const std::string& source="");
become
void addListener(ofxPdListener& listener, const std::string& source="");
void removeListener(ofxPdListener& listener, const std::string& source="");
bool listenerExists(ofxPdListener& listener, const std::string& source="");
A pd:: namespace:
Owing to the number of small utility objects (Patch, List, etc), I’d like to encapsulate everything within a pd namespace. Does this make sense?