Trying to fix loudness...

pull/4/head
Holger Wirtz 6 years ago
parent 992fce9e4a
commit 66dab0bdbd
  1. 13
      MicroDexed.ino
  2. 12
      UI.cpp
  3. 1
      dexed_sysex.cpp

@ -555,11 +555,12 @@ void set_volume(float v, float vr, float vl)
vol_right = vr;
vol_left = vl;
#ifndef I2C_DISPLAY
EEPROM.update(EEPROM_OFFSET + EEPROM_MASTER_VOLUME_ADDR, uint8_t(vol * UCHAR_MAX));
EEPROM.update(EEPROM_OFFSET + EEPROM_VOLUME_RIGHT_ADDR, uint8_t(vol_right * UCHAR_MAX));
EEPROM.update(EEPROM_OFFSET + EEPROM_VOLUME_LEFT_ADDR, uint8_t(vol_left * UCHAR_MAX));
update_eeprom_checksum();
#endif
#ifdef DEBUG
uint8_t tmp;
Serial.print(F("Setting volume: VOL="));
@ -587,11 +588,13 @@ void set_volume(float v, float vr, float vl)
#endif
#ifdef TEENSY_AUDIO_BOARD
sgtl5000_1.dacVolume(log(vol * vol_left), log(vol * vol_right));
//sgtl5000_1.dacVolume(log(vol * vol_left)+1, log(vol * vol_right)+1); // https://stackoverflow.com/questions/19472747/convert-linear-scale-to-logarithmic
sgtl5000_1.dacVolume(vol * vol_left, vol * vol_right);
#else
volume_master.gain(log(vol));
volume_r.gain(log(vr));
volume_l.gain(log(vl));
volume_master.gain(lvol);
volume_r.gain(lvr);
volume_l.gain(vl);
#endif
}

@ -24,6 +24,7 @@
*/
#include <Arduino.h>
#include <limits.h>
#include "config.h"
#include "dexed.h"
#include "dexed_sysex.h"
@ -36,7 +37,13 @@ elapsedMillis ui_back_to_main;
void handle_ui(void)
{
if (ui_back_to_main >= UI_AUTO_BACK_MS && ui_state != UI_MAIN)
{
ui_show_main();
EEPROM.update(EEPROM_OFFSET + EEPROM_MASTER_VOLUME_ADDR, uint8_t(vol * UCHAR_MAX));
EEPROM.update(EEPROM_OFFSET + EEPROM_VOLUME_RIGHT_ADDR, uint8_t(vol_right * UCHAR_MAX));
EEPROM.update(EEPROM_OFFSET + EEPROM_VOLUME_LEFT_ADDR, uint8_t(vol_left * UCHAR_MAX));
update_eeprom_checksum();
}
for (uint8_t i = 0; i < NUM_ENCODER; i++)
{
@ -121,6 +128,11 @@ void handle_ui(void)
break;
case UI_MAIN_VOICE_SELECTED:
ui_main_state = UI_MAIN_VOICE;
if (enc[i].read() <= 0)
enc[i].write(0);
else if (enc[i].read() >= MAX_VOICES)
enc[i].write(MAX_VOICES);
voice = enc[i].read();
break;
}
get_bank_voice_name(bank, voice);

@ -129,7 +129,6 @@ bool load_sysex(uint8_t b, uint8_t v)
{
#ifdef DEBUG
char n[11];
bool r;
strncpy(n, (char*)&data[118], 10);
Serial.print("Loading sysex ");

Loading…
Cancel
Save