|
|
@ -61,30 +61,24 @@ AudioConnection patchCord3(delay1, 0, mixer1, 1); |
|
|
|
AudioConnection patchCord4(delay1, 0, mixer2, 2); |
|
|
|
AudioConnection patchCord4(delay1, 0, mixer2, 2); |
|
|
|
AudioConnection patchCord5(mixer1, delay1); |
|
|
|
AudioConnection patchCord5(mixer1, delay1); |
|
|
|
AudioConnection patchCord6(mixer1, 0, mixer2, 1); |
|
|
|
AudioConnection patchCord6(mixer1, 0, mixer2, 1); |
|
|
|
|
|
|
|
AudioAmplifier volume_r; |
|
|
|
|
|
|
|
AudioAmplifier volume_l; |
|
|
|
|
|
|
|
AudioConnection patchCord7(mixer2, volume_r); |
|
|
|
|
|
|
|
AudioConnection patchCord8(mixer2, volume_l); |
|
|
|
#if defined(TEENSY_AUDIO_BOARD) |
|
|
|
#if defined(TEENSY_AUDIO_BOARD) |
|
|
|
AudioOutputI2S i2s1; |
|
|
|
AudioOutputI2S i2s1; |
|
|
|
AudioConnection patchCord7(mixer2, 0, i2s1, 0); |
|
|
|
AudioConnection patchCord9(volume_r, 0, i2s1, 0); |
|
|
|
AudioConnection patchCord8(mixer2, 0, i2s1, 1); |
|
|
|
AudioConnection patchCord10(volume_l, 0, i2s1, 1); |
|
|
|
AudioControlSGTL5000 sgtl5000_1; |
|
|
|
AudioControlSGTL5000 sgtl5000_1; |
|
|
|
#elif defined(TGA_AUDIO_BOARD) |
|
|
|
#elif defined(TGA_AUDIO_BOARD) |
|
|
|
AudioOutputI2S i2s1; |
|
|
|
AudioOutputI2S i2s1; |
|
|
|
AudioAmplifier volume_r; |
|
|
|
|
|
|
|
AudioAmplifier volume_l; |
|
|
|
|
|
|
|
AudioConnection patchCord7(mixer2, volume_r); |
|
|
|
|
|
|
|
AudioConnection patchCord8(mixer2, volume_l); |
|
|
|
|
|
|
|
AudioConnection patchCord9(volume_r, 0, i2s1, 1); |
|
|
|
AudioConnection patchCord9(volume_r, 0, i2s1, 1); |
|
|
|
AudioConnection patchCord10(volume_l, 0, i2s1, 0); |
|
|
|
AudioConnection patchCord10(volume_l, 0, i2s1, 0); |
|
|
|
AudioControlWM8731master wm8731_1; |
|
|
|
AudioControlWM8731master wm8731_1; |
|
|
|
#else |
|
|
|
#else |
|
|
|
AudioOutputPT8211 pt8211_1; |
|
|
|
AudioOutputPT8211 pt8211_1; |
|
|
|
AudioAmplifier volume_master; |
|
|
|
AudioConnection patchCord9(volume_r, 0, pt8211_1, 0); |
|
|
|
AudioAmplifier volume_r; |
|
|
|
AudioConnection patchCord10(volume_l, 0, pt8211_1, 1); |
|
|
|
AudioAmplifier volume_l; |
|
|
|
|
|
|
|
AudioConnection patchCord7(mixer2, 0, volume_master, 0); |
|
|
|
|
|
|
|
AudioConnection patchCord8(volume_master, volume_r); |
|
|
|
|
|
|
|
AudioConnection patchCord9(volume_master, volume_l); |
|
|
|
|
|
|
|
AudioConnection patchCord10(volume_r, 0, pt8211_1, 0); |
|
|
|
|
|
|
|
AudioConnection patchCord11(volume_l, 0, pt8211_1, 1); |
|
|
|
|
|
|
|
#endif |
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
Dexed* dexed = new Dexed(SAMPLE_RATE); |
|
|
|
Dexed* dexed = new Dexed(SAMPLE_RATE); |
|
|
@ -157,8 +151,8 @@ void setup() |
|
|
|
|
|
|
|
|
|
|
|
#ifdef TEENSY_AUDIO_BOARD |
|
|
|
#ifdef TEENSY_AUDIO_BOARD |
|
|
|
sgtl5000_1.enable(); |
|
|
|
sgtl5000_1.enable(); |
|
|
|
//sgtl5000_1.dacVolumeRamp();
|
|
|
|
sgtl5000_1.dacVolumeRamp(); |
|
|
|
sgtl5000_1.dacVolumeRampLinear(); |
|
|
|
//sgtl5000_1.dacVolumeRampLinear();
|
|
|
|
//sgtl5000_1.dacVolumeRampDisable();
|
|
|
|
//sgtl5000_1.dacVolumeRampDisable();
|
|
|
|
sgtl5000_1.unmuteHeadphone(); |
|
|
|
sgtl5000_1.unmuteHeadphone(); |
|
|
|
sgtl5000_1.unmuteLineout(); |
|
|
|
sgtl5000_1.unmuteLineout(); |
|
|
@ -182,8 +176,6 @@ void setup() |
|
|
|
Serial.println(F("PT8211 enabled.")); |
|
|
|
Serial.println(F("PT8211 enabled.")); |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
set_volume(configuration.vol, configuration.pan); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// start SD card
|
|
|
|
// start SD card
|
|
|
|
SPI.setMOSI(SDCARD_MOSI_PIN); |
|
|
|
SPI.setMOSI(SDCARD_MOSI_PIN); |
|
|
|
SPI.setSCK(SDCARD_SCK_PIN); |
|
|
|
SPI.setSCK(SDCARD_SCK_PIN); |
|
|
@ -222,6 +214,10 @@ void setup() |
|
|
|
} |
|
|
|
} |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// load default SYSEX data
|
|
|
|
|
|
|
|
load_sysex(configuration.bank, configuration.voice); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Init effects
|
|
|
|
// Init effects
|
|
|
|
delay1.delay(0, mapfloat(effect_delay_feedback, 0, ENC_DELAY_TIME_STEPS, 0.0, DELAY_MAX_TIME)); |
|
|
|
delay1.delay(0, mapfloat(effect_delay_feedback, 0, ENC_DELAY_TIME_STEPS, 0.0, DELAY_MAX_TIME)); |
|
|
|
// mixer1 is the feedback-adding mixer, mixer2 the whole delay (with/without feedback) mixer
|
|
|
|
// mixer1 is the feedback-adding mixer, mixer2 the whole delay (with/without feedback) mixer
|
|
|
@ -234,9 +230,8 @@ void setup() |
|
|
|
dexed->fx.Reso = 1.0 - float(effect_filter_resonance) / ENC_FILTER_RES_STEPS; |
|
|
|
dexed->fx.Reso = 1.0 - float(effect_filter_resonance) / ENC_FILTER_RES_STEPS; |
|
|
|
dexed->fx.Cutoff = 1.0 - float(effect_filter_cutoff) / ENC_FILTER_CUT_STEPS; |
|
|
|
dexed->fx.Cutoff = 1.0 - float(effect_filter_cutoff) / ENC_FILTER_CUT_STEPS; |
|
|
|
|
|
|
|
|
|
|
|
// load default SYSEX data
|
|
|
|
// set initial volume and pan (read from EEPROM)
|
|
|
|
load_sysex(configuration.bank, configuration.voice); |
|
|
|
set_volume(configuration.vol, configuration.pan); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef I2C_DISPLAY |
|
|
|
#ifdef I2C_DISPLAY |
|
|
|
enc[0].write(map(configuration.vol * 100, 0, 100, 0, ENC_VOL_STEPS)); |
|
|
|
enc[0].write(map(configuration.vol * 100, 0, 100, 0, ENC_VOL_STEPS)); |
|
|
@ -721,14 +716,11 @@ void set_volume(float v, float p) |
|
|
|
Serial.println(pow(configuration.vol * cosf( configuration.pan * PI / 2), VOLUME_CURVE), 3); |
|
|
|
Serial.println(pow(configuration.vol * cosf( configuration.pan * PI / 2), VOLUME_CURVE), 3); |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
dexed->fx.Gain = v; |
|
|
|
|
|
|
|
|
|
|
|
// 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
|
|
|
|
#ifdef TEENSY_AUDIO_BOARD |
|
|
|
|
|
|
|
sgtl5000_1.dacVolume(pow(v * sinf(p * PI / 2), VOLUME_CURVE), pow(v * cosf(p * PI / 2), VOLUME_CURVE)); |
|
|
|
|
|
|
|
#else |
|
|
|
|
|
|
|
volume_master.gain(VOLUME_CURVE); |
|
|
|
|
|
|
|
volume_r.gain(sinf(p * PI / 2)); |
|
|
|
volume_r.gain(sinf(p * PI / 2)); |
|
|
|
volume_l.gain(cosf(p * PI / 2)); |
|
|
|
volume_l.gain(cosf(p * PI / 2)); |
|
|
|
#endif |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// https://www.dr-lex.be/info-stuff/volumecontrols.html#table1
|
|
|
|
// https://www.dr-lex.be/info-stuff/volumecontrols.html#table1
|
|
|
|