Hi again, I'm back with this callback problem quick summary: a jack client have to set a callback so the jack server can call it when the client is supposed to do something. Here, the callback call is supposed to trigger some scheme code execution.
Today I tried a different approach: writing the callback in C, and then calling back to scheme from this function. > // C part > extern int process (jack_nframes_t); > > int callback(jack_nframes_t nframes, void* arg) > { > int i; > printf("callback\n"); > for (i = 0 ; i < nframes ; i++) { > process(now); > now++; > } > return 0; > } > ;; Scheme part > (define-external (process (unsigned-long now)) int > (display now)(newline) > now) A manual call to callback shows the expected behaviour : printing callback, and then the successive values of now. > (define callback > (foreign-safe-lambda int "callback" jack_nframes (c-pointer void) )) > (callback 5 #f) Now, if I let the jack server do the job ... > ((foreign-lambda* > void () > "jack_set_process_callback(client, callback, NULL);")) > > (jack_activate client) this is what I get : > Error: call of non-procedure: #<unspecified> > > Call history: > > client.scm:58: display > client.scm:58: newline > client.scm:71: jack_activate > ##sys#gc > g2930 > client.scm:72: jack_deactivate > client.scm:74: jack_client_close > ##sys#implicit-exit-handler <-- And there I am, completely lost. Any clue ? thanks for reading tom
#include <jack/jack.h> #include "chicken.h" extern int process (jack_nframes_t); extern unsigned long int now; int callback(jack_nframes_t nframes, void* arg) { int i; printf("callback\n"); for (i = 0 ; i < nframes ; i++) { process(now); now++; } return 0; }
client.scm
Description: Binary data
_______________________________________________ Chicken-users mailing list Chicken-users@nongnu.org http://lists.nongnu.org/mailman/listinfo/chicken-users