Re: [LAD] jack and c++

From: Paul Davis <paul@email-addr-hidden>
Date: Mon Nov 10 2008 - 11:24:05 EET

On Mon, 2008-11-10 at 20:10 +1100, cal wrote:
> Malte Steiner wrote:
> > For a new audio application I need to code a JACK client with C++. So
> > far I did it only with C and have a problem with giving the pointer to
> > the callback process function, which is a method now. So what is the
> > best performing solution? Is a delegate function a good idea, being
> > static and triggering the method in the objectinstance?
>
> No idea what the best solution might be, but here's an approach I've used...
>
> class AudioOutputJACK
> {
> public:
> [ ... ]
> private:
> static int ProcessJackCallback(jack_nframes_t nframes, void* arg);
> }

i like to add
         static int _process_callback (jack_nframes_t nframes, void*
arg) {
                  ThisObjectType* foo = (ThisObjectType*) arg;
                  return foo->process_callback (nframes);
         }
         int process_callback (jack_nframes_t nframes) {
                /* the real thing, as a normal member function */
         }

the code is a bit cleaner that way.
      

_______________________________________________
Linux-audio-dev mailing list
Linux-audio-dev@email-addr-hidden
http://lists.linuxaudio.org/mailman/listinfo/linux-audio-dev
Received on Tue Nov 11 00:15:07 2008

This archive was generated by hypermail 2.1.8 : Tue Nov 11 2008 - 00:15:07 EET