Browse Source

Fix wavetable crash on instrument change after stop

dds
PaulStoffregen 6 years ago
parent
commit
84073ecbfd
1 changed files with 6 additions and 4 deletions
  1. +6
    -4
      synth_wavetable.cpp

+ 6
- 4
synth_wavetable.cpp View File

*/ */
void AudioSynthWavetable::stop(void) { void AudioSynthWavetable::stop(void) {
cli(); cli();
env_state = STATE_RELEASE;
env_count = current_sample->RELEASE_COUNT;
if (env_count == 0) env_count = 1;
env_incr = -(env_mult) / (env_count * ENVELOPE_PERIOD);
if (env_state != STATE_IDLE) {
env_state = STATE_RELEASE;
env_count = current_sample->RELEASE_COUNT;
if (env_count == 0) env_count = 1;
env_incr = -(env_mult) / (env_count * ENVELOPE_PERIOD);
}
PRINT_ENV(STATE_RELEASE); PRINT_ENV(STATE_RELEASE);
sei(); sei();
} }

Loading…
Cancel
Save