/* * Instantiate /classes/. */ static void allocAll () { if (! (inst.state = allocRunningConfig())) { fprintf (stderr, "FATAL: memory allocation failed for state memory.\n"); exit(1); } if (! (inst.progs = allocProgs())) { fprintf (stderr, "FATAL: memory allocation failed for program config.\n"); exit(1); } if (! (inst.reverb = allocReverb())) { fprintf (stderr, "FATAL: memory allocation failed for reverb.\n"); exit(1); } if (! (inst.whirl = allocWhirl())) { fprintf (stderr, "FATAL: memory allocation failed for whirl.\n"); exit(1); } if (! (inst.synth = allocTonegen())) { fprintf (stderr, "FATAL: memory allocation failed for tonegen.\n"); exit(1); } if (! (inst.midicfg = allocMidiCfg(inst.state))) { fprintf (stderr, "FATAL: memory allocation failed for midi config.\n"); exit(1); } if (! (inst.preamp = allocPreamp())) { fprintf (stderr, "FATAL: memory allocation failed for midi config.\n"); exit(1); } }
static LV2_Handle instantiate (const LV2_Descriptor* descriptor, double rate, const char* bundle_path, const LV2_Feature* const* features) { B3O* b3o = (B3O*)calloc (1, sizeof (B3O)); b3o->o_bias = b3o->o_feedback = b3o->o_sagtobias = b3o->o_postfeed = b3o->o_globfeed = b3o->o_gainin = b3o->o_gainout = -1; b3o->pa = allocPreamp (); initPreamp (b3o->pa, NULL); return (LV2_Handle)b3o; }
void allocSynth(struct b_instance *inst) { inst->state = allocRunningConfig(); inst->progs = allocProgs(); inst->reverb = allocReverb(); inst->whirl = allocWhirl(); inst->midicfg = allocMidiCfg(inst->state); inst->synth = allocTonegen(); inst->preamp = allocPreamp(); initControllerTable (inst->midicfg); #if 1 midiPrimeControllerMapping (inst->midicfg); #endif }
int main (int argc, char**argv) { int osc_port=0; void *pa = allocPreamp(); initPreamp(pa, NULL); int c; const char *optstring = "hi:o:O:p:V"; struct option long_options[] = { { "help", no_argument, 0, 'h' }, { "input", no_argument, 0, 'i' }, { "output", no_argument, 0, 'o' }, { "parameter", required_argument, 0, 'p' }, { "version", no_argument, 0, 'V' }, { 0, 0, 0, 0 } }; while ((c = getopt_long(argc, argv, optstring, long_options, NULL)) != -1) { switch (c) { case 'h': usage("jboverdrive", 0); return (0); break; case 'i': jack_inport_name=optarg; break; case 'o': jack_outport_name=optarg; break; case 'O': osc_port=atoi(optarg); break; case 'p': { int ok=0; char *t = strchr(optarg, '='); if (t) { *t='\0'; if (!strcasecmp(optarg, "bias")) {ok=1; p_bias =pp(t+1);} if (!strcasecmp(optarg, "feedback")) {ok=1; p_feedback =pp(t+1);} if (!strcasecmp(optarg, "sagtobias")) {ok=1; p_sagtobias=pp(t+1);} if (!strcasecmp(optarg, "postfeed")) {ok=1; p_postfeed =pp(t+1);} if (!strcasecmp(optarg, "globfeed")) {ok=1; p_globfeed =pp(t+1);} if (!strcasecmp(optarg, "gainin")) {ok=1; p_gainin =pp(t+1);} if (!strcasecmp(optarg, "gainout")) {ok=1; p_gainout =pp(t+1);} *t='='; } if (!ok) { fprintf(stderr, "invalid parameter '%s' given.\n", optarg); } } break; case 'V': printf ("%s %s\n\n", "jboverdrive", VERSION); printf( "Copyright (C) 2003-2004 Fredrik Kilander <*****@*****.**>\n" "Copyright (C) 2012 Robin Gareus <*****@*****.**>\n" "\n" "This is free software; see the source for copying conditions. There is NO\n" "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\n" ); return(0); default: fprintf(stderr, "invalid argument.\n"); usage("jboverdrive", 1); } } if (osc_port) { #ifdef HAVE_LIBLO if (init_osc(osc_port)) osc_port=0; #else fprintf(stderr, "This version has not been compiled with liblo.\nOSC is not available.\n"); #endif } j_client = jack_client_open ("b_overdrive", JackNullOption, NULL); if (!j_client) { fprintf(stderr, "could not connect to jack.\n"); return(1); } j_input_port = jack_port_register (j_client, "in", JACK_DEFAULT_AUDIO_TYPE, JackPortIsInput, 0); j_output_port = jack_port_register (j_client, "out", JACK_DEFAULT_AUDIO_TYPE, JackPortIsOutput, 0); if (!j_output_port || !j_input_port) { fprintf(stderr, "no more jack ports available.\n"); jack_client_close (j_client); return(1); } jack_on_shutdown (j_client, jack_shutdown_callback, NULL); jack_set_process_callback(j_client,jack_audio_callback, pa); #ifndef _WIN32 signal (SIGHUP, catchsig); signal (SIGINT, catchsig); #endif fctl_biased (pa, p_bias); fctl_biased_fb (pa, p_feedback); fctl_sagtoBias (pa, p_sagtobias); fctl_biased_fb2 (pa, p_postfeed); fctl_biased_gfb (pa, p_globfeed); fsetInputGain (pa, p_gainin); fsetOutputGain (pa, p_gainout); jack_activate(j_client); connect_jack_ports(); while (j_client) { // TODO interaction; allow to change parameters // via terminal I/O sleep (1); } #ifdef HAVE_LIBLO if (osc_port) { shutdown_osc(); } #endif freePreamp(pa); return (0); }