void SYSTEM_init() { initialize_board(); // board configurations SCHEDULER_init(); uint8_t message[] = "hola"; // test message /*------------------------------------------------------------------------------ tasks inits ------------------------------------------------------------------------------*/ PC_LINK_init(115200); CLOCK_task_init(message); LED_toggle_task_init(); LED_toggle_task_init2(); modes_flag = NORMAL; button_state4 = BUTTON_UP; button_state3 = BUTTON_UP; button_state2 = BUTTON_UP; button_state1 = BUTTON_UP; buttonMefInit(button_state1); buttonMefInit(button_state2); buttonMefInit(button_state3); buttonMefInit(button_state4); }
bool InitProgram(void){ // GC_INIT(); bool ret; #if !defined(FOR_MACOSX) RADIUM_ensure_bin_packages_gc_is_used(); #endif printf("Initializing...\n"); printf("...Error handler\n"); Error_init(); printf("...Memory handler\n"); init_memory(); root=tralloc(sizeof(struct Root)); if(root==NULL){ fprintf(stderr,"Not enough memory\n"); return false; } root->keyoct=36; root->quantitize_options = Quantitize_get_default_options(); root->grid_numerator=1; root->grid_denominator=1; root->min_standardvel=MAX_VELOCITY*40/100; root->standardvel=MAX_VELOCITY*80/100; ATOMIC_SET(root->editonoff, true); ATOMIC_SET(root->play_cursor_onoff, false); ATOMIC_SET(root->editor_follows_play_cursor_onoff, true); root->song=talloc(sizeof(struct Song)); pc=tralloc(sizeof(PlayerClass)); if(root->song==NULL || pc==NULL){ fprintf(stderr,"Not enough memory\n"); return false; } pc->pfreq = 48000; // Default value. Should be overridden in MIXER_start(). /* if( ( ! InitPEQmempool(1000) ) || ( ! Input_Init(4000) ) ){ // 1000 and 4000 are hardcoded values. Not good. return false; } */ printf("...Midi\n"); MIDI_input_init(); SCHEDULER_init(); PATCH_init(); printf("...Sound\n"); if(MIXER_start()==false){ fprintf(stderr,"Could not open Sound\n"); return false; } printf("...Player 1/2\n"); if( ( ! InitPEQmempool() ) ){ // 1000 and 4000 are hardcoded values. Not good. return false; } printf("...Clock handler\n"); if( ! InitClock() ) return false; printf("...Player 2/2\n"); PEQ_GetType_Init(); printf("...Instrument\n"); if( OpenInstruments()==false ){ return false; } printf("...Kebang\n"); ret=NewSong(); #if !USE_OPENGL printf("...Blitting\n"); if(ret==true){ Blt_blt(root->song->tracker_windows); } #endif printf("Initialization finished.\n"); return ret; }