Small fixes.

pull/4/head
Holger Wirtz 6 years ago
parent ba84fbc9d6
commit b7240fec2e
  1. 9
      UI.cpp
  2. 4
      dexed.cpp

@ -292,11 +292,12 @@ void handle_ui(void)
switch (ui_main_state) switch (ui_main_state)
{ {
case UI_MAIN_FILTER_FRQ: case UI_MAIN_FILTER_FRQ:
/* if (enc[i].read() <= 0) if (enc[i].read() <= 0)
enc[i].write(0); enc[i].write(0);
else if (enc[i].read() > ENC_FILTER_FRQ_STEPS) else if (enc[i].read() > ENC_FILTER_FRQ_STEPS)
enc[i].write(ENC_FILTER_FRQ_STEPS); enc[i].write(ENC_FILTER_FRQ_STEPS);
effect_filter_frq = enc[i].read(); effect_filter_frq = enc[i].read();
/*
if (effect_filter_frq == ENC_FILTER_FRQ_STEPS) if (effect_filter_frq == ENC_FILTER_FRQ_STEPS)
{ {
// turn "off" filter // turn "off" filter
@ -317,11 +318,12 @@ void handle_ui(void)
*/ */
break; break;
case UI_MAIN_FILTER_RES: case UI_MAIN_FILTER_RES:
/* if (enc[i].read() <= 0) if (enc[i].read() <= 0)
enc[i].write(0); enc[i].write(0);
else if (enc[i].read() > ENC_FILTER_RES_STEPS) else if (enc[i].read() > ENC_FILTER_RES_STEPS)
enc[i].write(ENC_FILTER_RES_STEPS); enc[i].write(ENC_FILTER_RES_STEPS);
effect_filter_resonance = enc[i].read(); effect_filter_resonance = enc[i].read();
/*
//filter1.resonance(mapfloat(effect_filter_resonance, 0, ENC_FILTER_RES_STEPS, 0.7, 5.0)); //filter1.resonance(mapfloat(effect_filter_resonance, 0, ENC_FILTER_RES_STEPS, 0.7, 5.0));
filter1.resonance(EXP_FUNC(mapfloat(effect_filter_resonance, 0, ENC_FILTER_RES_STEPS, 0.7, 5.0)) * 0.044 + 0.61); filter1.resonance(EXP_FUNC(mapfloat(effect_filter_resonance, 0, ENC_FILTER_RES_STEPS, 0.7, 5.0)) * 0.044 + 0.61);
@ -332,11 +334,12 @@ void handle_ui(void)
*/ */
break; break;
case UI_MAIN_FILTER_OCT: case UI_MAIN_FILTER_OCT:
/* if (enc[i].read() <= 0) if (enc[i].read() <= 0)
enc[i].write(0); enc[i].write(0);
else if (enc[i].read() > ENC_FILTER_OCT_STEPS) else if (enc[i].read() > ENC_FILTER_OCT_STEPS)
enc[i].write(ENC_FILTER_OCT_STEPS); enc[i].write(ENC_FILTER_OCT_STEPS);
effect_filter_octave = enc[i].read(); effect_filter_octave = enc[i].read();
/*
filter1.octaveControl(mapfloat(effect_filter_octave, 0, ENC_FILTER_OCT_STEPS, 0.0, 7.0)); filter1.octaveControl(mapfloat(effect_filter_octave, 0, ENC_FILTER_OCT_STEPS, 0.0, 7.0));
#ifdef DEBUG #ifdef DEBUG
Serial.print(F("Setting filter octave control to: ")); Serial.print(F("Setting filter octave control to: "));

@ -152,7 +152,7 @@ void Dexed::getSamples(uint16_t n_samples, int16_t* buffer)
int32_t clip_val = val < -(1 << 24) ? 0x8000 : val >= (1 << 24) ? 0x7fff : val >> 9; int32_t clip_val = val < -(1 << 24) ? 0x8000 : val >= (1 << 24) ? 0x7fff : val >> 9;
#endif #endif
float f = static_cast<float>(clip_val >> REDUCE_LOUDNESS) / 0x8000; float f = static_cast<float>(clip_val >> REDUCE_LOUDNESS) / 0x7fff;
if (f > 1.0) if (f > 1.0)
{ {
f = 1.0; f = 1.0;
@ -173,7 +173,7 @@ void Dexed::getSamples(uint16_t n_samples, int16_t* buffer)
fx.process(sumbuf, n_samples); fx.process(sumbuf, n_samples);
for (i = 0; i < n_samples; ++i) for (i = 0; i < n_samples; ++i)
buffer[i] = static_cast<int16_t>(sumbuf[i] * 0x8000); buffer[i] = static_cast<int16_t>(sumbuf[i] * 0x7fff);
} }
void Dexed::keydown(uint8_t pitch, uint8_t velo) { void Dexed::keydown(uint8_t pitch, uint8_t velo) {

Loading…
Cancel
Save