main/alles.c
esp_err_t voices_init() {
    // FM init happens later for mem reason
    oscillators_init();
    filters_init();
    events = (struct event*) malloc(sizeof(struct event) * EVENT_FIFO_LEN);
    synth = (struct event*) malloc(sizeof(struct event) * VOICES);
    msynth = (struct mod_event*) malloc(sizeof(struct mod_event) * VOICES);
    floatblock = (float*) malloc(sizeof(float) * BLOCK_SIZE);
    block = (int16_t *) malloc(sizeof(int16_t) * BLOCK_SIZE);

    reset_voices();
    // Fill the FIFO with default events, as the audio thread reads from it immediately
    for(int i=0;i<EVENT_FIFO_LEN;i++) {
        // First clear out the malloc'd events so it doesn't seem like the queue is full
        events[i].status = EMPTY;
    }
    for(int i=0;i<EVENT_FIFO_LEN;i++) {
        add_event(default_event());
    }
    return ESP_OK;
}
// The synth object keeps held state, whereas events are only deltas/changes
The synth object keeps held state, whereas events are only deltas/changes
The synth object keeps held state whereas events are only deltas / changes
esp_err_t voices_init() {
    oscillators_init();
    filters_init();
    events = (struct event*) malloc(sizeof(struct event) * EVENT_FIFO_LEN);
    synth = (struct event*) malloc(sizeof(struct event) * VOICES);
    msynth = (struct mod_event*) malloc(sizeof(struct mod_event) * VOICES);
    floatblock = (float*) malloc(sizeof(float) * BLOCK_SIZE);
    block = (int16_t *) malloc(sizeof(int16_t) * BLOCK_SIZE);
    reset_voices();
    for(int i=0;i<EVENT_FIFO_LEN;i++) {
        events[i].status = EMPTY;
    }
    for(int i=0;i<EVENT_FIFO_LEN;i++) {
        add_event(default_event());
    }
    return ESP_OK;
}
esp_err_t voices_init ( ) { oscillators_init ( ) ; filters_init ( ) ; events = ( struct event * ) malloc ( sizeof ( struct event ) * EVENT_FIFO_LEN ) ; synth = ( struct event * ) malloc ( sizeof ( struct event ) * VOICES ) ; msynth = ( struct mod_event * ) malloc ( sizeof ( struct mod_event ) * VOICES ) ; floatblock = ( float * ) malloc ( sizeof ( float ) * BLOCK_SIZE ) ; block = ( int16_t * ) malloc ( sizeof ( int16_t ) * BLOCK_SIZE ) ; reset_voices ( ) ; for ( int i = 0 ; i < EVENT_FIFO_LEN ; i ++ ) { events [ i ] . status = EMPTY ; } for ( int i = 0 ; i < EVENT_FIFO_LEN ; i ++ ) { add_event ( default_event ( ) ) ; } return ESP_OK ; }
The synth object keeps held state, whereas events are only deltas/changes
The synth object keeps held state whereas events are only deltas / changes
// FM init happens later for mem reason // Fill the FIFO with default events, as the audio thread reads from it immediately // First clear out the malloc'd events so it doesn't seem like the queue is full