Fixed volume handlying for Teensy-Audio-Adapter.

Enabled Teensy-Audio-Adapter (SGTL5000) buildin compressor/limiter.
pull/4/head
Holger Wirtz 6 years ago
parent 13b5a55fff
commit 5ad4c2471f
  1. 16
      MicroDexed.ino
  2. 4
      config.h

@ -170,13 +170,17 @@ void setup()
#ifdef TEENSY_AUDIO_BOARD
sgtl5000_1.enable();
sgtl5000_1.dacVolumeRamp();
//sgtl5000_1.dacVolumeRampLinear();
//sgtl5000_1.dacVolumeRamp();
sgtl5000_1.dacVolumeRampLinear();
//sgtl5000_1.dacVolumeRampDisable();
sgtl5000_1.unmuteHeadphone();
sgtl5000_1.unmuteLineout();
sgtl5000_1.autoVolumeDisable(); // turn off AGC
sgtl5000_1.volume(1.0, 1.0);
sgtl5000_1.lineOutLevel(31);
sgtl5000_1.audioPostProcessorEnable();
sgtl5000_1.autoVolumeControl(1, 1, 1, 0.9, 0.01, 0.05);
sgtl5000_1.autoVolumeEnable();
Serial.println(F("Teensy-Audio-Board enabled."));
#elif defined(TGA_AUDIO_BOARD)
wm8731_1.enable();
@ -684,11 +688,15 @@ void set_volume(float v, float p)
Serial.print(tmp, DEC);
Serial.print(F("/"));
Serial.print(float(tmp) / SCHAR_MAX, DEC);
Serial.println(F("]"));
Serial.print(F("] "));
Serial.print(sinf(p * PI / 2), 3);
Serial.print(F("/"));
Serial.println(cosf(p * PI / 2), 3);
#endif
// http://files.csound-tutorial.net/floss_manual/Release03/Cs_FM_03_ScrapBook/b-panning-and-spatialization.html
#ifdef TEENSY_AUDIO_BOARD
sgtl5000_1.dacVolume(v * sinf(p * PI / 2), v * cosf(p * PI / 2));
sgtl5000_1.dacVolume(pow(v * sinf(p * PI / 2), 0.1), pow(v * cosf(p * PI / 2), 0.1));
#else
volume_master.gain(v);
volume_r.gain(sinf(p * PI / 2));

@ -76,6 +76,7 @@
#define AUDIO_MEM 225
#endif
#define DELAY_MAX_TIME 600.0
#define REDUCE_LOUDNESS 1
#else
#if AUDIO_BLOCK_SAMPLES == 64
#define AUDIO_MEM 900
@ -83,9 +84,10 @@
#define AUDIO_MEM 450
#endif
#define DELAY_MAX_TIME 1200.0
#define REDUCE_LOUDNESS 0
#endif
#define SAMPLE_RATE 44100
#define REDUCE_LOUDNESS 1
//*************************************************************************************************
//* DEBUG OUTPUT SETTINGS

Loading…
Cancel
Save