Small fixes.

pull/4/head
Holger Wirtz 6 years ago
parent 1a63a4e58e
commit 5cee620f4a
  1. 21
      MicroDexed.ino
  2. 2
      config.h
  3. 2
      dexed.cpp

@ -487,31 +487,35 @@ int8_t num_key_base_c(uint8_t midi_note)
} }
#endif #endif
void set_volume(float master_vol, float vol_right, float vol_left) void set_volume(float v, float vr, float vl)
{ {
EEPROM.update(EEPROM_OFFSET + EEPROM_MASTER_VOLUME_ADDR, master_vol * UCHAR_MAX); vol=v;
EEPROM.update(EEPROM_OFFSET + EEPROM_VOLUME_RIGHT_ADDR, vol_right * UCHAR_MAX); vol_right=vr;
EEPROM.update(EEPROM_OFFSET + EEPROM_VOLUME_LEFT_ADDR, vol_left * UCHAR_MAX); vol_left=vl;
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(); update_eeprom_checksum();
#ifdef DEBUG #ifdef DEBUG
uint8_t tmp; uint8_t tmp;
Serial.print(F("Setting volume: VOL=")); Serial.print(F("Setting volume: VOL="));
Serial.print(master_vol, DEC); Serial.print(v, DEC);
Serial.print(F("[")); Serial.print(F("["));
tmp = EEPROM.read(EEPROM_OFFSET + EEPROM_MASTER_VOLUME_ADDR); tmp = EEPROM.read(EEPROM_OFFSET + EEPROM_MASTER_VOLUME_ADDR);
Serial.print(tmp, DEC); Serial.print(tmp, DEC);
Serial.print(F("/")); Serial.print(F("/"));
Serial.print(float(tmp) / UCHAR_MAX, DEC); Serial.print(float(tmp) / UCHAR_MAX, DEC);
Serial.print(F("] VOL_L=")); Serial.print(F("] VOL_L="));
Serial.print(vol_left, DEC); Serial.print(vl, DEC);
Serial.print(F("[")); Serial.print(F("["));
tmp = EEPROM.read(EEPROM_OFFSET + EEPROM_VOLUME_LEFT_ADDR); tmp = EEPROM.read(EEPROM_OFFSET + EEPROM_VOLUME_LEFT_ADDR);
Serial.print(tmp, DEC); Serial.print(tmp, DEC);
Serial.print(F("/")); Serial.print(F("/"));
Serial.print(float(tmp) / UCHAR_MAX, DEC); Serial.print(float(tmp) / UCHAR_MAX, DEC);
Serial.print(F("] VOL_R=")); Serial.print(F("] VOL_R="));
Serial.print(vol_right, DEC); Serial.print(vr, DEC);
Serial.print(F("[")); Serial.print(F("["));
tmp = EEPROM.read(EEPROM_OFFSET + EEPROM_VOLUME_RIGHT_ADDR); tmp = EEPROM.read(EEPROM_OFFSET + EEPROM_VOLUME_RIGHT_ADDR);
Serial.print(tmp, DEC); Serial.print(tmp, DEC);
@ -519,7 +523,8 @@ void set_volume(float master_vol, float vol_right, float vol_left)
Serial.print(float(tmp) / UCHAR_MAX, DEC); Serial.print(float(tmp) / UCHAR_MAX, DEC);
Serial.println(F("]")); Serial.println(F("]"));
#endif #endif
sgtl5000_1.dacVolume(master_vol * vol_left, master_vol * vol_right);
sgtl5000_1.dacVolume(vol * vol_left, vol * vol_right);
} }
void handle_sysex_parameter(const uint8_t* sysex, uint8_t len) void handle_sysex_parameter(const uint8_t* sysex, uint8_t len)

@ -59,7 +59,7 @@
// Some optimizations // Some optimizations
#define USE_TEENSY_DSP 1 #define USE_TEENSY_DSP 1
#define SUM_UP_AS_INT 1 #define SUM_UP_AS_INT 1
#define REDUCE_LOUDNESS 0 #define REDUCE_LOUDNESS 1
// Enable TEST_NOTE for adding code to drop some midi notes for testing without keyboard // Enable TEST_NOTE for adding code to drop some midi notes for testing without keyboard
//#define TEST_NOTE MIDI_E2 //#define TEST_NOTE MIDI_E2

@ -222,7 +222,7 @@ bool Dexed::processMidiMessage(uint8_t type, uint8_t data1, uint8_t data2)
break; break;
case 7: // Volume case 7: // Volume
vol = float(value) / 0x7f; vol = float(value) / 0x7f;
sgtl5000_1.dacVolume(vol * vol_left, vol * vol_right); set_volume(vol, vol_left, vol_right);
break; break;
case 10: // Pan case 10: // Pan
if (value < 64) if (value < 64)

Loading…
Cancel
Save