/* * Ask each module to initialize itself. */ static void initAll () { fprintf (stderr, "init.. "); fprintf (stderr, "Audio : "); fflush (stderr); /* Open the JACK connection and get samplerate. */ if (open_jack()) { perror ("could not connect to JACK."); exit(1); } fprintf (stderr, "Oscillators : "); fflush (stderr); initToneGenerator (inst.synth, inst.midicfg); fprintf (stderr, "Scanner : "); fflush (stderr); initVibrato (inst.synth, inst.midicfg); fprintf (stderr, "Overdrive : "); fflush (stderr); initPreamp (inst.preamp, inst.midicfg); fprintf (stderr, "Reverb : "); fflush (stderr); initReverb (inst.reverb, inst.midicfg, SampleRateD); fprintf (stderr, "Whirl : "); fflush (stderr); initWhirl (inst.whirl, inst.midicfg, SampleRateD); #ifdef HAVE_ZITACONVOLVE fprintf (stderr, "Convolve : "); fflush (stderr); int s_policy= 0; struct sched_param s_param; memset (&s_param, 0, sizeof(struct sched_param)); if (jack_client_thread_id(j_client)) { pthread_getschedparam(jack_client_thread_id(j_client), &s_policy, &s_param); } else { fprintf(stderr, "zita-convolver: not using RT scheduling\n"); } initConvolution(NULL, inst.midicfg, AUDIO_CHANNELS, BUFFER_SIZE_SAMPLES, s_param.sched_priority, s_policy); #endif fprintf (stderr, "RC : "); fflush (stderr); initRunningConfig(inst.state, inst.midicfg); fprintf (stderr, "..done.\n"); }
void xapi_open_jack(void *d) { #ifdef HAVE_MIDI midi_close(); #endif #if defined (HAVE_LTCSMPTE) || defined (HAVE_LTC) close_ltcjack(); #endif open_jack(); if (jack_client) remote_printf(100,"connected to jack server."); else remote_printf(405,"failed to connect to jack server"); }
static int oscb_jackconnect (const char *path, const char *types, lo_arg **argv, int argc, lo_message msg, void *user_data){ open_jack(); return(0); }
int main (int argc, char **argv) { int run; char *filename = NULL; long frame, pframe; program_name = argv[0]; if (argc>3) usage(1); if (argc==3) { filename=argv[2]; frames=atol(argv[1]); } else if (argc>1) filename=argv[1]; if (frames < 1 || duration < 1) usage(1); if (!filename) usage(1); framerate = (double) frames / (double) duration; struct timeval tv; fd_set set; //TODO: trap some signals.. -> run=0; if (jack) { open_jack(); run= jack_connected(); } else{ #ifdef HAVE_MIDI midi_open(midiid); #endif run= midi_connected(); } printf ("jack disconnect\n"); printf ("load %s\n",filename); printf ("window mouse off\n"); printf ("window letterbox on\n"); printf ("window fullscreen on\n"); // printf ("window resize 880x545\n"); printf ("osd font /usr/share/fonts/truetype/freefont/FreeMonoBold.ttf\n"); printf ("osd off\n"); printf ("osd smpte 100\n"); printf ("set fps %.0f\n",framerate); pframe=-1; while (run) { tv.tv_sec = 0; tv.tv_usec = 1000000/framerate; FD_ZERO(&set); if (readfromstdin) FD_SET(0, &set); if (select(0+readfromstdin, &set, NULL, NULL, &tv) ) if (readfromstdin) { size_t rv; char buf[BUFSIZ]; if ((rv=read(0,buf,BUFSIZ)) > 0) { if (!strncmp(buf,"exit",3)) { printf ("quit\n"); run=0; }else write(1,buf,rv); } } if (jack) frame= jack_poll_frame(NULL); #ifdef HAVE_MIDI else frame= midi_poll_frame(); #else else exit (1); #endif if (pframe!=frame) printf ("seek %li\n",frame); pframe=frame; fflush(stdout); }