danomatika / ofxPd

(maintained) a Pure Data addon for OpenFrameworks using libpd
Other
202 stars 45 forks source link

simplify event listener system with message object and single callback #4

Closed danomatika closed 13 years ago

danomatika commented 13 years ago

Currently there is a simple callback-based event listener with a callback for each message type. I propose a single callback where a message object and type enum is used to determine the type and how to parse the data.

void pdMessageRecieved(ofxPdMessage& message) {

    switch(message.type) {
        case OFX_PD_BANG:
            ...
            break;

        case OFX_PD_NOTEON:
            ...
            break;
    ...
danomatika commented 13 years ago

This is not needed and best left to users.