Fixes for voice auto-shutdown.

pull/4/head
Holger Wirtz 6 years ago
parent 3637e9c807
commit 09037e4c73
  1. 14
      MicroDexed.ino
  2. 13
      dexed.cpp

@ -124,7 +124,7 @@ uint8_t effect_delay_volume = 0;
bool effect_delay_sync = 0;
elapsedMicros fill_audio_buffer;
elapsedMillis control_rate;
uint8_t shutdown_voices = 0;
uint8_t active_voices = 0;
#ifdef SHOW_CPU_LOAD_MSEC
elapsedMillis cpu_mem_millis;
@ -340,16 +340,8 @@ void loop()
// Shutdown unused voices
if (control_rate > CONTROL_RATE_MS)
{
uint8_t tmp = shutdown_voices;
control_rate = 0;
dexed->getNumNotesPlaying();
if (tmp != shutdown_voices)
{
Serial.print(F("Active voices ["));
Serial.print(shutdown_voices);
Serial.println(F("]"));
}
active_voices = dexed->getNumNotesPlaying();
}
#ifdef I2C_DISPLAY
@ -954,6 +946,8 @@ void show_cpu_and_mem_usage(void)
Serial.print(peak, DEC);
Serial.print(F(" BLOCKSIZE: "));
Serial.print(AUDIO_BLOCK_SAMPLES, DEC);
Serial.print(F(" ACTIVE_VOICES: "));
Serial.print(active_voices, DEC);
Serial.println();
AudioProcessorUsageMaxReset();
AudioMemoryUsageMaxReset();

@ -405,18 +405,17 @@ uint8_t Dexed::getNumNotesPlaying(void)
uint8_t op_carrier_num = 0;
memset(&voiceStatus, 0, sizeof(VoiceStatus));
voices[i].dx7_note->peekVoiceStatus(voiceStatus);
for (uint8_t op = 0; op < 6; op++)
{
if ((op_carrier & (1 >> op)) == 1)
{
if ((op_carrier & (1 << op)))
{
// this voice is a carrier!
op_carrier_num++;
if (voiceStatus.amp[op] <= 1069 && voiceStatus.ampStep[op] == 4) // this voice produces no audio output
if (voiceStatus.amp[op] <= 1069 && voiceStatus.ampStep[op] == 4)
{
// this voice produces no audio output
op_amp++;
}
}
@ -428,8 +427,10 @@ uint8_t Dexed::getNumNotesPlaying(void)
voices[i].live = false;
voices[i].sustained = false;
voices[i].keydown = false;
Serial.print(F("Voice shutdown: "));
#ifdef DEBUG
Serial.print(F("Shutdown voice: "));
Serial.println(i, DEC);
#endif
}
else
count_playing_voices++;

Loading…
Cancel
Save