/* this is called instead of sys_main() to start things */ int libpd_init(void) { static int initialized = 0; if (initialized) return -1; // only allow init once (for now) initialized = 1; signal(SIGFPE, SIG_IGN); libpd_start_message(32); // allocate array for message assembly sys_printhook = (t_printhook) libpd_printhook; sys_soundin = NULL; sys_soundout = NULL; // are all these settings necessary? sys_schedblocksize = DEFDACBLKSIZE; sys_externalschedlib = 0; sys_printtostderr = 0; sys_usestdpath = 0; // don't use pd_extrapath, only sys_searchpath sys_debuglevel = 0; sys_verbose = 0; sys_noloadbang = 0; sys_nogui = 1; sys_hipriority = 0; sys_nmidiin = 0; sys_nmidiout = 0; sys_init_fdpoll(); #ifdef HAVE_SCHED_TICK_ARG sys_time = 0; #endif pd_init(); libpdreceive_setup(); sys_set_audio_api(API_DUMMY); sys_searchpath = NULL; #ifdef LIBPD_EXTRA bob_tilde_setup(); bonk_tilde_setup(); choice_setup(); expr_setup(); fiddle_tilde_setup(); loop_tilde_setup(); lrshift_tilde_setup(); pique_setup(); sigmund_tilde_setup(); stdout_setup(); #endif return 0; }
void cpd_init() { int devices = 0; int ioputs = 2; static char initialized = 0; assert("Pure Data is already initialized." && !initialized); if(!initialized) { cpd_mutex_init(&c_mutex); sys_soundin = NULL; sys_soundout = NULL; c_current_instance = NULL; sys_printhook = (t_printhook)(cpd_print); signal(SIGFPE, SIG_IGN); sys_soundin = NULL; sys_soundout = NULL; sys_schedblocksize = DEFDACBLKSIZE; sys_externalschedlib = 0; sys_printtostderr = 0; sys_usestdpath = 0; sys_debuglevel = 1; sys_verbose = 4; sys_noloadbang = 0; sys_nogui = 1; sys_hipriority = 0; sys_nmidiin = 0; sys_nmidiout = 0; sys_init_fdpoll(); pd_init(); sys_startgui(NULL); sys_set_audio_api(API_DUMMY); sys_searchpath = NULL; sys_set_audio_settings(1, &devices, 1, &ioputs, 1, &devices, 1, &ioputs, 44100, -1, 1, DEFDACBLKSIZE); sched_set_using_audio(SCHED_AUDIO_CALLBACK); sys_reopen_audio(); c_sample_ins = sys_soundin; c_sample_outs = sys_soundout; c_first_instance = pd_this; c_sym_bng = gensym("bng"); c_sym_hsl = gensym("hsl"); c_sym_vsl = gensym("vsl"); c_sym_tgl = gensym("tgl"); c_sym_nbx = gensym("nbx"); c_sym_vradio = gensym("vradio"); c_sym_hradio = gensym("hradio"); c_sym_vu = gensym("vu"); c_sym_cnv = gensym("cnv"); c_sym_empty = gensym("empty"); bob_tilde_setup(); bonk_tilde_setup(); choice_setup(); fiddle_tilde_setup(); loop_tilde_setup(); lrshift_tilde_setup(); pique_setup(); sigmund_tilde_setup(); stdout_setup(); initialized = 1; } }