| * | * | ||||
| */ | */ | ||||
| void AudioSynthWavetable::update(void) { | void AudioSynthWavetable::update(void) { | ||||
| cli(); | |||||
| // exit if nothing to do | // exit if nothing to do | ||||
| if (env_state == STATE_IDLE || (current_sample->LOOP == false && tone_phase >= current_sample->MAX_PHASE)) { | if (env_state == STATE_IDLE || (current_sample->LOOP == false && tone_phase >= current_sample->MAX_PHASE)) { | ||||
| env_state = STATE_IDLE; | env_state = STATE_IDLE; | ||||
| sei(); | |||||
| return; | return; | ||||
| } | } | ||||
| // else locally copy object state and continue | // else locally copy object state and continue | ||||
| int32_t mod_phase = this->mod_phase; | int32_t mod_phase = this->mod_phase; | ||||
| int32_t mod_pitch_offset_init = this->mod_pitch_offset_init; | int32_t mod_pitch_offset_init = this->mod_pitch_offset_init; | ||||
| int32_t mod_pitch_offset_scnd = this->mod_pitch_offset_scnd; | int32_t mod_pitch_offset_scnd = this->mod_pitch_offset_scnd; | ||||
| sei(); | |||||
| audio_block_t* block; | audio_block_t* block; | ||||
| block = allocate(); | block = allocate(); | ||||
| } | } | ||||
| // copy state back, unless there was a state change | // copy state back, unless there was a state change | ||||
| cli(); | |||||
| if (this->state_change == false) { | if (this->state_change == false) { | ||||
| this->tone_phase = tone_phase; | this->tone_phase = tone_phase; | ||||
| this->env_state = env_state; | this->env_state = env_state; | ||||
| this->vib_phase = this->mod_phase = TRIANGLE_INITIAL_PHASE; | this->vib_phase = this->mod_phase = TRIANGLE_INITIAL_PHASE; | ||||
| } | } | ||||
| } | } | ||||
| sei(); | |||||
| transmit(block); | transmit(block); | ||||
| release(block); | release(block); |