|
|
|
@ -42,85 +42,70 @@ |
|
|
|
|
AudioPlayQueue queue1; |
|
|
|
|
AudioAnalyzePeak peak1; |
|
|
|
|
AudioEffectDelay delay1; |
|
|
|
|
#ifdef USE_REVERB |
|
|
|
|
AudioEffectFreeverbStereo freeverbs1; |
|
|
|
|
#endif |
|
|
|
|
AudioEffectModulatedDelay modchorus; |
|
|
|
|
#if MOD_FILTER_OUTPUT != MOD_NO_FILTER_OUTPUT |
|
|
|
|
AudioFilterBiquad modchorus_filter; |
|
|
|
|
#endif |
|
|
|
|
AudioSynthWaveform modulator; |
|
|
|
|
AudioMixer4 chorus_mixer; |
|
|
|
|
AudioMixer4 delay_mixer; |
|
|
|
|
AudioMixer4 delay_fb_mixer; |
|
|
|
|
AudioMixer4 reverb_mixer_r; |
|
|
|
|
AudioMixer4 reverb_mixer_l; |
|
|
|
|
AudioMixer4 master_mixer_r; |
|
|
|
|
AudioMixer4 master_mixer_l; |
|
|
|
|
AudioAmplifier volume_r; |
|
|
|
|
AudioAmplifier volume_l; |
|
|
|
|
#ifdef MIDI_DEVICE_USB |
|
|
|
|
AudioOutputUSB usb1; |
|
|
|
|
#endif |
|
|
|
|
AudioConnection patchCord0(queue1, peak1); |
|
|
|
|
AudioConnection patchCord1(queue1, 0, chorus_mixer, 0); |
|
|
|
|
AudioConnection patchCord3(queue1, 0, delay_mixer, 0); |
|
|
|
|
AudioConnection patchCord4(queue1, 0, delay_fb_mixer, 0); |
|
|
|
|
#ifdef USE_REVERB |
|
|
|
|
AudioConnection patchCord5(queue1, 0, reverb_mixer_r, 0); |
|
|
|
|
AudioConnection patchCord6(queue1, 0, reverb_mixer_l, 0); |
|
|
|
|
#endif |
|
|
|
|
AudioConnection patchCord7(queue1, 0, modchorus, 0); |
|
|
|
|
AudioConnection patchCord8(modulator, 0, modchorus, 1); |
|
|
|
|
AudioConnection patchCord1(queue1, 0, delay_fb_mixer, 0); |
|
|
|
|
AudioConnection patchCord2(queue1, 0, modchorus, 0); |
|
|
|
|
AudioConnection patchCord3(queue1, 0 , master_mixer_r, 0); |
|
|
|
|
AudioConnection patchCord4(queue1, 0 , master_mixer_l, 0); |
|
|
|
|
AudioConnection patchCord5(modulator, 0, modchorus, 1); |
|
|
|
|
#if MOD_FILTER_OUTPUT != MOD_NO_FILTER_OUTPUT |
|
|
|
|
AudioConnection patchCord9(modchorus, modchorus_filter); |
|
|
|
|
AudioConnection patchCord10(modchorus_filter, 0, chorus_mixer, 1); |
|
|
|
|
AudioFilterBiquad modchorus_filter; |
|
|
|
|
AudioConnection patchCord6(modchorus, modchorus_filter); |
|
|
|
|
AudioConnection patchCord7(modchorus_filter, 0, master_mixer_r, 3); |
|
|
|
|
AudioConnection patchCord8(modchorus_filter, 0, master_mixer_l, 3); |
|
|
|
|
#else |
|
|
|
|
AudioConnection patchCord9(modchorus, 0, chorus_mixer, 1); |
|
|
|
|
AudioConnection patchCord9(modchorus, 0, master_mixer_r, 3); |
|
|
|
|
AudioConnection patchCord10(modchorus, 0, master_mixer_l, 3); |
|
|
|
|
#endif |
|
|
|
|
AudioConnection patchCord11(chorus_mixer, 0, delay_mixer, 1); |
|
|
|
|
AudioConnection patchCord12(delay_fb_mixer, 0, delay_mixer, 1); |
|
|
|
|
AudioConnection patchCord13(delay_mixer, 0, reverb_mixer_r, 0); |
|
|
|
|
AudioConnection patchCord14(delay_mixer, 0, reverb_mixer_l, 0); |
|
|
|
|
AudioConnection patchCord15(delay1, 0, delay_mixer, 2); |
|
|
|
|
AudioConnection patchCord16(delay_fb_mixer, delay1); |
|
|
|
|
#ifdef USE_REVERB |
|
|
|
|
AudioConnection patchCord17(delay_mixer, 0, freeverbs1, 0); |
|
|
|
|
AudioConnection patchCord18(delay_mixer, 0, freeverbs1, 1); |
|
|
|
|
AudioConnection patchCord19(freeverbs1, 0, reverb_mixer_r, 1); |
|
|
|
|
AudioConnection patchCord20(freeverbs1, 1, reverb_mixer_l, 1); |
|
|
|
|
AudioConnection patchCord21(reverb_mixer_r, volume_r); |
|
|
|
|
AudioConnection patchCord22(reverb_mixer_l, volume_l); |
|
|
|
|
#else |
|
|
|
|
AudioConnection patchCord17(delay_mixer, volume_r); |
|
|
|
|
AudioConnection patchCord18(delay_mixer, volume_l); |
|
|
|
|
AudioEffectFreeverbStereo freeverbs1; |
|
|
|
|
AudioConnection patchCord11(queue1, 0, freeverbs1, 0); |
|
|
|
|
AudioConnection patchCord12(queue1, 0, freeverbs1, 1); |
|
|
|
|
AudioConnection patchCord13(freeverbs1, 0, master_mixer_r, 1); |
|
|
|
|
AudioConnection patchCord14(freeverbs1, 1, master_mixer_l, 1); |
|
|
|
|
#endif |
|
|
|
|
AudioConnection patchCord15(delay_fb_mixer, delay1); |
|
|
|
|
AudioConnection patchCord16(delay1, 0, delay_fb_mixer, 1); |
|
|
|
|
AudioConnection patchCord17(delay1, 0, master_mixer_r, 2); |
|
|
|
|
AudioConnection patchCord18(delay1, 0, master_mixer_l, 2); |
|
|
|
|
AudioConnection patchCord19(master_mixer_r, volume_r); |
|
|
|
|
AudioConnection patchCord20(master_mixer_l, volume_l); |
|
|
|
|
#ifdef MIDI_DEVICE_USB |
|
|
|
|
AudioConnection patchCord23(volume_r, 0, usb1, 0); |
|
|
|
|
AudioConnection patchCord24(volume_l, 0, usb1, 1); |
|
|
|
|
AudioOutputUSB usb1; |
|
|
|
|
AudioConnection patchCord21(volume_r, 0, usb1, 0); |
|
|
|
|
AudioConnection patchCord22(volume_l, 0, usb1, 1); |
|
|
|
|
#endif |
|
|
|
|
#if defined(TEENSY_AUDIO_BOARD) |
|
|
|
|
AudioOutputI2S i2s1; |
|
|
|
|
AudioConnection patchCord25(volume_r, 0, i2s1, 0); |
|
|
|
|
AudioConnection patchCord26(volume_l, 0, i2s1, 1); |
|
|
|
|
AudioConnection patchCord23(volume_r, 0, i2s1, 0); |
|
|
|
|
AudioConnection patchCord24(volume_l, 0, i2s1, 1); |
|
|
|
|
AudioControlSGTL5000 sgtl5000_1; |
|
|
|
|
#elif defined(TGA_AUDIO_BOARD) |
|
|
|
|
AudioOutputI2S i2s1; |
|
|
|
|
AudioConnection patchCord27(volume_r, 0, i2s1, 0); |
|
|
|
|
AudioConnection patchCord28(volume_l, 0, i2s1, 1); |
|
|
|
|
AudioConnection patchCord25(volume_r, 0, i2s1, 0); |
|
|
|
|
AudioConnection patchCord26(volume_l, 0, i2s1, 1); |
|
|
|
|
AudioControlWM8731master wm8731_1; |
|
|
|
|
#elif defined(TEENSY_DAC) |
|
|
|
|
AudioOutputAnalogStereo dacOut; |
|
|
|
|
AudioConnection patchCord11(volume_r, 0, dacOut, 0); |
|
|
|
|
AudioConnection patchCord12(volume_l, 0, dacOut, 1); |
|
|
|
|
#elif defined(PT8211_AUDIO) |
|
|
|
|
AudioOutputPT8211 pt8211_1; |
|
|
|
|
AudioConnection patchCord27(volume_r, 0, pt8211_1, 0); |
|
|
|
|
AudioConnection patchCord28(volume_l, 0, pt8211_1, 1); |
|
|
|
|
#elif defined(TEENSY_DAC_SYMMETRIC) |
|
|
|
|
AudioOutputAnalogStereo dacOut; |
|
|
|
|
AudioMixer4 invMixer; |
|
|
|
|
AudioConnection patchCord11(volume_l, 0, dacOut , 0); |
|
|
|
|
AudioConnection patchCord12(volume_l, 0, invMixer, 0); |
|
|
|
|
AudioConnection patchCord13(invMixer, 0, dacOut , 1); |
|
|
|
|
AudioConnection patchCord29(volume_l, 0, dacOut , 0); |
|
|
|
|
AudioConnection patchCord30(volume_l, 0, invMixer, 0); |
|
|
|
|
AudioConnection patchCord31(invMixer, 0, dacOut , 1); |
|
|
|
|
#else |
|
|
|
|
AudioOutputPT8211 pt8211_1; |
|
|
|
|
AudioConnection patchCord29(volume_r, 0, pt8211_1, 0); |
|
|
|
|
AudioConnection patchCord30(volume_l, 0, pt8211_1, 1); |
|
|
|
|
AudioOutputAnalogStereo dacOut; |
|
|
|
|
AudioConnection patchCord32(volume_r, 0, dacOut, 0); |
|
|
|
|
AudioConnection patchCord33(volume_l, 0, dacOut, 1); |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
Dexed* MicroDexed[NUM_DEXED]; |
|
|
|
@ -244,7 +229,7 @@ void setup() |
|
|
|
|
AudioNoInterrupts(); |
|
|
|
|
AudioMemory(AUDIO_MEM); |
|
|
|
|
|
|
|
|
|
#ifdef TEENSY_AUDIO_BOARD |
|
|
|
|
#if defined(TEENSY_AUDIO_BOARD) |
|
|
|
|
sgtl5000_1.enable(); |
|
|
|
|
sgtl5000_1.dacVolumeRamp(); |
|
|
|
|
//sgtl5000_1.dacVolumeRampLinear();
|
|
|
|
@ -277,13 +262,13 @@ void setup() |
|
|
|
|
wm8731_1.enable(); |
|
|
|
|
wm8731_1.volume(1.0); |
|
|
|
|
Serial.println(F("TGA board enabled.")); |
|
|
|
|
#elif defined(TEENSY_DAC) |
|
|
|
|
Serial.println(F("Internal DAC enabled.")); |
|
|
|
|
#elif defined(PT8211_AUDIO) |
|
|
|
|
Serial.println(F("PT8211 enabled.")); |
|
|
|
|
#elif defined(TEENSY_DAC_SYMMETRIC) |
|
|
|
|
invMixer.gain(0, -1.f); |
|
|
|
|
Serial.println(F("Internal DAC using symmetric outputs enabled.")); |
|
|
|
|
#else |
|
|
|
|
Serial.println(F("PT8211 enabled.")); |
|
|
|
|
Serial.println(F("Internal DAC enabled.")); |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
// start SD card
|
|
|
|
@ -338,6 +323,21 @@ void setup() |
|
|
|
|
Serial.print(MOD_DELAY_SAMPLE_BUFFER, DEC); |
|
|
|
|
Serial.println(F(" samples")); |
|
|
|
|
#endif |
|
|
|
|
master_mixer_r.gain(0, 1.0); |
|
|
|
|
master_mixer_l.gain(0, 1.0); |
|
|
|
|
|
|
|
|
|
freeverbs1.roomsize(configuration.reverb_roomsize / 100.0); |
|
|
|
|
freeverbs1.damping(configuration.reverb_damping / 100.0); |
|
|
|
|
master_mixer_r.gain(1, 0.0); |
|
|
|
|
master_mixer_l.gain(1, 0.0); |
|
|
|
|
|
|
|
|
|
delay1.delay(0, 0.0); |
|
|
|
|
// delay_fb_mixer is the feedback-adding mixer
|
|
|
|
|
delay_fb_mixer.gain(0, 1.0 - configuration.delay_feedback / 100.0); // original signal
|
|
|
|
|
delay_fb_mixer.gain(1, configuration.delay_feedback / 100.0); // amount of feedback
|
|
|
|
|
master_mixer_r.gain(2, 0.0); |
|
|
|
|
master_mixer_l.gain(2, 0.0); |
|
|
|
|
|
|
|
|
|
modulator.begin(MOD_WAVEFORM); |
|
|
|
|
modulator.phase(0); |
|
|
|
|
modulator.amplitude(0.5); |
|
|
|
@ -356,24 +356,8 @@ void setup() |
|
|
|
|
modchorus_filter.setLowpass(2, MOD_FILTER_CUTOFF_HZ, 0.54); |
|
|
|
|
modchorus_filter.setLowpass(3, MOD_FILTER_CUTOFF_HZ, 1.3); |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
chorus_mixer.gain(0, 1.0); |
|
|
|
|
chorus_mixer.gain(1, 0.0); |
|
|
|
|
|
|
|
|
|
delay1.delay(0, 0.0); |
|
|
|
|
// delay_fb_mixer is the feedback-adding mixer, delay_mixer_r the whole delay (with/without feedback) mixer
|
|
|
|
|
delay_fb_mixer.gain(0, 1.0); // original signal
|
|
|
|
|
delay_fb_mixer.gain(1, mapfloat(effect_delay_feedback, 0, ENC_DELAY_FB_STEPS, 0.0, 1.0)); // amount of feedback
|
|
|
|
|
delay_mixer.gain(0, 1.0 - mapfloat(effect_delay_volume, 0, ENC_DELAY_VOLUME_STEPS, 0.0, 1.0)); // original signal
|
|
|
|
|
delay_mixer.gain(1, mapfloat(effect_delay_volume, 0, ENC_DELAY_VOLUME_STEPS, 0.0, 1.0)); // delayed signal (including feedback)
|
|
|
|
|
delay_mixer.gain(2, mapfloat(effect_delay_volume, 0, ENC_DELAY_VOLUME_STEPS, 0.0, 1.0)); // only delayed signal (without feedback)
|
|
|
|
|
|
|
|
|
|
reverb_mixer_r.gain(0, 1.0); |
|
|
|
|
reverb_mixer_l.gain(0, 1.0); |
|
|
|
|
reverb_mixer_r.gain(1, 0.0); |
|
|
|
|
reverb_mixer_l.gain(1, 0.0); |
|
|
|
|
|
|
|
|
|
freeverbs1.roomsize(configuration.reverb_roomsize / 100); |
|
|
|
|
master_mixer_r.gain(3, 0.0); |
|
|
|
|
master_mixer_l.gain(3, 0.0); |
|
|
|
|
|
|
|
|
|
for (uint8_t i = 0; i < NUM_DEXED; i++) |
|
|
|
|
{ |
|
|
|
|