Graham Wakefield's C++ template question

Dec 2, 2010 at 2:12am

Graham Wakefield's C++ template question

Hi there:

I’m attempting to understand Graham Wakefield’s C++ template for developing externals, but I’m stuck on the “perform” method defined in the sample MSP object.

// signal processing example: inverts sign of inputs
        void perform(int vs, t_sample ** inputs, t_sample ** outputs) {
                for (int channel = 0; channel < 2; channel++) {
                        t_sample * in = inputs[channel];
                        t_sample * out = outputs[channel];
                        for (int i=0; i

The other methods provided, test and bang, are bound to text symbols in by the use of REGISTER_METHOD(Example, bang) and REGISTER_METHOD_GIMME(Example, test), but perform is not. In order to use this function, should I somehow "register" it first? Attempts at adding REGISTER_METHOD_GIMME(Example, perform), REGISTER_METHOD_FLOAT(Example, perform), etc. to main() are not working out.

I'm getting two errors

1. could not convert template argument '&Example::perform' to 'void (Example::*)(long int, t_symbol*, long int, t_atom*)'
2. 'call' is not a member of ''

Source code for template is at

Dec 2, 2010 at 1:34pm

no, just implement it:

#include “maxcpp5.h”

class myob : public MspCpp5

myob(t_symbol * sym, long ac, t_atom * av)
setupIO(&myob::perform, 1, 1);


// methods:
void bang(long inlet)

void dsp() {}

void perform(int vs, t_sample ** inputs, t_sample ** outputs)
t_sample * triggerIn = inputs[0];
t_sample * out = outputs[0];

// do stuff to samples

extern “C” int main(void)
REGISTER_METHOD(myob, bang);


You must be logged in to reply to this topic.