diff --git a/MicroDexed.ino b/MicroDexed.ino index 2ea45ce..bfd2d36 100644 --- a/MicroDexed.ino +++ b/MicroDexed.ino @@ -258,12 +258,11 @@ void setup() pinMode(U8X8_CS_PIN, OUTPUT); #endif - delay(320); // necessary, because before no serial output is done :( - #ifdef ENABLE_LCD_UI setup_ui(); #else #ifdef DEBUG + delay(320); // necessary, because before no serial output is done :( Serial.println(F("NO LCD DISPLAY ENABLED!")); #endif #endif diff --git a/dexed.cpp b/dexed.cpp index ef560e2..4264000 100644 --- a/dexed.cpp +++ b/dexed.cpp @@ -111,7 +111,8 @@ void Dexed::deactivate(void) void Dexed::getSamples(uint16_t n_samples, int16_t* buffer) { - uint16_t i; + uint16_t i,j; + uint8_t note; float sumbuf[n_samples]; if (refreshVoice) @@ -121,7 +122,6 @@ void Dexed::getSamples(uint16_t n_samples, int16_t* buffer) if ( voices[i].live ) voices[i].dx7_note->update(data, voices[i].midi_note, voices[i].velocity, voices[i].porta); } - lfo.reset(data + 137); refreshVoice = false; } @@ -139,37 +139,15 @@ void Dexed::getSamples(uint16_t n_samples, int16_t* buffer) int32_t lfovalue = lfo.getsample(); int32_t lfodelay = lfo.getdelay(); - for (uint8_t note = 0; note < max_notes; note++) + for (note = 0; note < max_notes; note++) { if (voices[note].live) { voices[note].dx7_note->compute(audiobuf.get(), lfovalue, lfodelay, &controllers); - for (uint8_t j = 0; j < _N_; ++j) + for (j = 0; j < _N_; ++j) { - int32_t val = audiobuf.get()[j]; - val = val >> 4; -#ifdef USE_TEENSY_DSP - int32_t clip_val = signed_saturate_rshift(val, 24, 9); -#else - int32_t clip_val = val < -(1 << 24) ? 0x8000 : val >= (1 << 24) ? 0x7fff : val >> 9; -#endif - - float f = static_cast(clip_val >> REDUCE_LOUDNESS) / 0x7fff; -#if defined(REDUCE_LOUDNESS_FACTOR) - f *= REDUCE_LOUDNESS_FACTOR; -#endif - if (f > 1.0) - { - f = 1.0; - overload++; - } - else if (f < -1.0) - { - f = -1.0; - overload++; - } - sumbuf[i + j] += f; + sumbuf[i + j] += static_cast(signed_saturate_rshift(audiobuf.get()[j] >> 4, 24, 9)) / 0x8000; audiobuf.get()[j] = 0; } } @@ -178,16 +156,9 @@ void Dexed::getSamples(uint16_t n_samples, int16_t* buffer) #ifdef USE_FX fx.process(sumbuf, n_samples); -// #else -// arm_scale_f32(sumbuf, fx.getGain(), sumbuf, n_samples); #endif - //#ifdef USE_TEENSY_DSP arm_float_to_q15(sumbuf, buffer, AUDIO_BLOCK_SAMPLES); - //#else - //for (i = 0; i < n_samples; ++i) - //buffer[i] = static_cast(sumbuf[i] * 0x7fff); - //#endif } void Dexed::keydown(int16_t pitch, uint8_t velo) {