Пример #1
0
void initSynth(struct b_instance *inst, double rate) {
  // equivalent to ../src/main.c main()
  unsigned int defaultPreset[9] = {8,8,6, 0,0,0,0, 0,0};

  /* initAll() */
  initToneGenerator (inst->synth, inst->midicfg);
  initVibrato (inst->synth, inst->midicfg);
  initPreamp (inst->preamp, inst->midicfg);
  initReverb (inst->reverb, inst->midicfg, rate);
  initWhirl (inst->whirl, inst->midicfg, rate);
  initRunningConfig(inst->state, inst->midicfg);
  /* end - initAll() */

  initMidiTables(inst->midicfg);

  setDrawBars (inst, 0, defaultPreset);
#if 0
  setDrawBars (inst, 1, defaultPreset);
  setDrawBars (inst, 2, defaultPreset);
#endif

#ifdef DEBUGPRINT
  if (walkProgrammes(inst->progs, 0)) {
    listProgrammes (inst->progs, stderr);
  }
  listCCAssignments(inst->midicfg, stderr);
#endif
}
Пример #2
0
/*
 * 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");
}