|
|
@ -153,8 +153,6 @@ elapsedMillis eeprom_master_volume_update_timer; |
|
|
|
elapsedMillis cpu_mem_millis; |
|
|
|
elapsedMillis cpu_mem_millis; |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
// Number of samples in each delay line
|
|
|
|
|
|
|
|
#define CHORUS_DELAY_LENGTH (16*AUDIO_BLOCK_SAMPLES) |
|
|
|
|
|
|
|
// Allocate the delay lines for left and right channels
|
|
|
|
// Allocate the delay lines for left and right channels
|
|
|
|
short l_delayline[CHORUS_DELAY_LENGTH]; |
|
|
|
short l_delayline[CHORUS_DELAY_LENGTH]; |
|
|
|
short r_delayline[CHORUS_DELAY_LENGTH]; |
|
|
|
short r_delayline[CHORUS_DELAY_LENGTH]; |
|
|
@ -215,8 +213,13 @@ void setup() |
|
|
|
Serial.println(F("PT8211 enabled.")); |
|
|
|
Serial.println(F("PT8211 enabled.")); |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// set master volume
|
|
|
|
set_master_volume(master_volume); |
|
|
|
set_master_volume(master_volume); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// internal mixing of original signal(0), reverb(1) and chorus(2)
|
|
|
|
|
|
|
|
mixer_r.gain(0, 1.0); |
|
|
|
|
|
|
|
mixer_l.gain(0, 1.0); |
|
|
|
|
|
|
|
|
|
|
|
#if defined (DEBUG) && defined (SHOW_CPU_LOAD_MSEC) |
|
|
|
#if defined (DEBUG) && defined (SHOW_CPU_LOAD_MSEC) |
|
|
|
// Initialize processor and memory measurements
|
|
|
|
// Initialize processor and memory measurements
|
|
|
|
AudioProcessorUsageMaxReset(); |
|
|
|
AudioProcessorUsageMaxReset(); |
|
|
@ -241,7 +244,7 @@ void setup() |
|
|
|
// chorus modulation fixed
|
|
|
|
// chorus modulation fixed
|
|
|
|
memset(r_delayline, 0, sizeof(short)*CHORUS_DELAY_LENGTH); |
|
|
|
memset(r_delayline, 0, sizeof(short)*CHORUS_DELAY_LENGTH); |
|
|
|
memset(l_delayline, 0, sizeof(short)*CHORUS_DELAY_LENGTH); |
|
|
|
memset(l_delayline, 0, sizeof(short)*CHORUS_DELAY_LENGTH); |
|
|
|
modulator.begin(WAVEFORM_TRIANGLE); |
|
|
|
modulator.begin(CHORUS_WAVEFORM); |
|
|
|
modulator.amplitude(0.1); |
|
|
|
modulator.amplitude(0.1); |
|
|
|
modulator.frequency(1.0); |
|
|
|
modulator.frequency(1.0); |
|
|
|
modulator.phase(0); |
|
|
|
modulator.phase(0); |
|
|
@ -508,8 +511,8 @@ void set_master_volume(uint8_t value) |
|
|
|
|
|
|
|
|
|
|
|
// float v = (float)(a * (a + 2))/(float)(1 << 20); // (pseudo-) logarithmic curve for volume control
|
|
|
|
// float v = (float)(a * (a + 2))/(float)(1 << 20); // (pseudo-) logarithmic curve for volume control
|
|
|
|
// http://files.csound-tutorial.net/floss_manual/Release03/Cs_FM_03_ScrapBook/b-panning-and-spatialization.html
|
|
|
|
// http://files.csound-tutorial.net/floss_manual/Release03/Cs_FM_03_ScrapBook/b-panning-and-spatialization.html
|
|
|
|
mixer_r.gain(0, tmp3 * sinf(tmp2 * PI / 2)); |
|
|
|
volume_r.gain(tmp3 * sinf(tmp2 * PI / 2)); |
|
|
|
mixer_l.gain(0, tmp3 * cosf(tmp2 * PI / 2)); |
|
|
|
volume_l.gain(tmp3 * cosf(tmp2 * PI / 2)); |
|
|
|
|
|
|
|
|
|
|
|
eeprom_master_volume_update_flag = true; |
|
|
|
eeprom_master_volume_update_flag = true; |
|
|
|
eeprom_master_volume_update_timer = 0; |
|
|
|
eeprom_master_volume_update_timer = 0; |
|
|
|