Better patching of audio objects.

Small fixes for drum Ãpan and volume.
pull/68/head
Holger Wirtz 3 years ago
parent 3b6070f560
commit c5d785b9f3
  1. 140
      MicroDexed.ino
  2. 14
      drums.h

@ -110,7 +110,34 @@ AudioMixer8 drum_reverb_send_mixer_l;
#endif #endif
#endif #endif
/* // Outputs
#if defined(TEENSY_AUDIO_BOARD)
AudioOutputI2S i2s1;
AudioControlSGTL5000 sgtl5000_1;
#elif defined (I2S_AUDIO_ONLY)
AudioOutputI2S i2s1;
#elif defined(TGA_AUDIO_BOARD)
AudioOutputI2S i2s1;
AudioControlWM8731master wm8731_1;
#elif defined(PT8211_AUDIO)
AudioOutputPT8211 pt8211_1;
#elif defined(TEENSY_DAC_SYMMETRIC)
AudioOutputAnalogStereo dacOut;
AudioMixer4 invMixer;
#elif defined(TEENSY_DAC)
AudioOutputAnalogStereo dacOut;
#endif
#ifdef AUDIO_DEVICE_USB
AudioOutputUSB usb1;
#endif
#if defined(TEENSY_AUDIO_BOARD) && defined(SGTL5000_AUDIO_THRU)
AudioInputI2S i2s1in;
#endif
//
// Static patching of audio objects
//
AudioConnection patchCord[] = { AudioConnection patchCord[] = {
// Audio chain tail // Audio chain tail
#if defined(USE_FX) #if defined(USE_FX)
@ -126,8 +153,8 @@ AudioMixer8 drum_reverb_send_mixer_l;
{freeverb, 1, master_mixer_l, 3}, {freeverb, 1, master_mixer_l, 3},
#endif #endif
#endif #endif
{master_mixer_r,0, volume_r,0}, {master_mixer_r, volume_r},
{master_mixer_l,0, volume_l,0}, {master_mixer_l, volume_l},
{volume_r, 0, stereo2mono, 0}, {volume_r, 0, stereo2mono, 0},
{volume_l, 0, stereo2mono, 1}, {volume_l, 0, stereo2mono, 1},
{stereo2mono, 0, master_peak_r, 0}, {stereo2mono, 0, master_peak_r, 0},
@ -140,37 +167,28 @@ AudioMixer8 drum_reverb_send_mixer_l;
{stereo2mono, 1, i2s1, 1}, {stereo2mono, 1, i2s1, 1},
#endif #endif
#elif defined (I2S_AUDIO_ONLY) #elif defined (I2S_AUDIO_ONLY)
AudioOutputI2S i2s1;
{stereo2mono, 0, i2s1, 0}, {stereo2mono, 0, i2s1, 0},
{stereo2mono, 1, i2s1, 1}, {stereo2mono, 1, i2s1, 1},
#elif defined(TGA_AUDIO_BOARD) #elif defined(TGA_AUDIO_BOARD)
AudioOutputI2S i2s1;
{stereo2mono, 0, i2s1, 0}, {stereo2mono, 0, i2s1, 0},
{stereo2mono, 1, i2s1, 1}, {stereo2mono, 1, i2s1, 1},
AudioControlWM8731master wm8731_1;
#elif defined(PT8211_AUDIO) #elif defined(PT8211_AUDIO)
AudioOutputPT8211 pt8211_1;
{stereo2mono, 0, pt8211_1, 0}, {stereo2mono, 0, pt8211_1, 0},
{stereo2mono, 1, pt8211_1, 1}, {stereo2mono, 1, pt8211_1, 1},
#elif defined(TEENSY_DAC_SYMMETRIC) #elif defined(TEENSY_DAC_SYMMETRIC)
AudioOutputAnalogStereo dacOut;
AudioMixer4 invMixer;
{stereo2mono, 0, dacOut , 0}, {stereo2mono, 0, dacOut , 0},
{stereo2mono, 1, invMixer, 0}, {stereo2mono, 1, invMixer, 0},
{invMixer, 0, dacOut , 1}, {invMixer, 0, dacOut , 1},
#elif defined(TEENSY_DAC) #elif defined(TEENSY_DAC)
AudioOutputAnalogStereo dacOut;
{stereo2mono, 0, dacOut, 0}, {stereo2mono, 0, dacOut, 0},
{stereo2mono, 1, dacOut, 1}, {stereo2mono, 1, dacOut, 1},
#endif #endif
#ifdef AUDIO_DEVICE_USB #ifdef AUDIO_DEVICE_USB
AudioOutputUSB usb1;
{stereo2mono, 0, usb1, 0}, {stereo2mono, 0, usb1, 0},
{stereo2mono, 1, usb1, 1}, {stereo2mono, 1, usb1, 1},
#endif #endif
#if defined(TEENSY_AUDIO_BOARD) && defined(SGTL5000_AUDIO_THRU) #if defined(TEENSY_AUDIO_BOARD) && defined(SGTL5000_AUDIO_THRU)
AudioInputI2S i2s1in;
{stereo2mono, 0, audio_thru_mixer_r, 0}, {stereo2mono, 0, audio_thru_mixer_r, 0},
{stereo2mono, 1, audio_thru_mixer_l, 0}, {stereo2mono, 1, audio_thru_mixer_l, 0},
{i2s1in, 0, audio_thru_mixer_r, 1}, {i2s1in, 0, audio_thru_mixer_r, 1},
@ -190,95 +208,7 @@ AudioMixer8 drum_reverb_send_mixer_l;
{drum_mixer_l, 0, master_mixer_l, 2}, {drum_mixer_l, 0, master_mixer_l, 2},
#endif #endif
#endif #endif
};
AudioTimer audio_timer;
{reverb_mixer_r, audio_timer}
*/
// Audio chain tail
#if defined(USE_FX)
#ifdef USE_PLATEREVERB
AudioConnection patchCord0(reverb_mixer_r, 0, reverb, 0);
AudioConnection patchCord1(reverb_mixer_l, 0, reverb, 1);
AudioConnection patchCord2(reverb, 0, master_mixer_r, 3);
AudioConnection patchCord3(reverb, 1, master_mixer_l, 3);
#else
AudioConnection patchCord0(reverb_mixer_r, 0, freeverb, 0);
AudioConnection patchCord1(reverb_mixer_l, 0, freeverb, 1);
AudioConnection patchCord2(freeverb, 0, master_mixer_r, 3);
AudioConnection patchCord3(freeverb, 1, master_mixer_l, 3);
#endif
#endif
AudioConnection patchCord4(master_mixer_r, volume_r);
AudioConnection patchCord5(master_mixer_l, volume_l);
AudioConnection patchCord6(volume_r, 0, stereo2mono, 0);
AudioConnection patchCord7(volume_l, 0, stereo2mono, 1);
AudioConnection patchCord8(stereo2mono, 0, master_peak_r, 0);
AudioConnection patchCord9(stereo2mono, 0, master_peak_l, 0);
// Outputs
#if defined(TEENSY_AUDIO_BOARD)
AudioOutputI2S i2s1;
AudioControlSGTL5000 sgtl5000_1;
#ifndef SGTL5000_AUDIO_THRU
AudioConnection patchCord10(stereo2mono, 0, i2s1, 0);
AudioConnection patchCord11(stereo2mono, 1, i2s1, 1);
#endif
#elif defined (I2S_AUDIO_ONLY)
AudioOutputI2S i2s1;
AudioConnection patchCord10(stereo2mono, 0, i2s1, 0);
AudioConnection patchCord11(stereo2mono, 1, i2s1, 1);
#elif defined(TGA_AUDIO_BOARD)
AudioOutputI2S i2s1;
AudioConnection patchCord10(stereo2mono, 0, i2s1, 0);
AudioConnection patchCord11(stereo2mono, 1, i2s1, 1);
AudioControlWM8731master wm8731_1;
#elif defined(PT8211_AUDIO)
AudioOutputPT8211 pt8211_1;
AudioConnection patchCord10(stereo2mono, 0, pt8211_1, 0);
AudioConnection patchCord11(stereo2mono, 1, pt8211_1, 1);
#elif defined(TEENSY_DAC_SYMMETRIC)
AudioOutputAnalogStereo dacOut;
AudioMixer4 invMixer;
AudioConnection patchCord10(stereo2mono, 0, dacOut , 0);
AudioConnection patchCord11(stereo2mono, 1, invMixer, 0);
AudioConnection patchCord12(invMixer, 0, dacOut , 1);
#elif defined(TEENSY_DAC)
AudioOutputAnalogStereo dacOut;
AudioConnection patchCord10(stereo2mono, 0, dacOut, 0);
AudioConnection patchCord11(stereo2mono, 1, dacOut, 1);
#endif
#ifdef AUDIO_DEVICE_USB
AudioOutputUSB usb1;
AudioConnection patchCord13(stereo2mono, 0, usb1, 0);
AudioConnection patchCord14(stereo2mono, 1, usb1, 1);
#endif
#if defined(TEENSY_AUDIO_BOARD) && defined(SGTL5000_AUDIO_THRU)
AudioInputI2S i2s1in;
AudioConnection patchCord15(stereo2mono, 0, audio_thru_mixer_r, 0);
AudioConnection patchCord16(stereo2mono, 1, audio_thru_mixer_l, 0);
AudioConnection patchCord17(i2s1in, 0, audio_thru_mixer_r, 1);
AudioConnection patchCord18(i2s1in, 1, audio_thru_mixer_l, 1);
AudioConnection patchCord19(audio_thru_mixer_r, 0, i2s1, 0);
AudioConnection patchCord20(audio_thru_mixer_l, 0, i2s1, 1);
#endif
#if NUM_DRUMS > 0
#ifdef USE_FX
AudioConnection patchCord21(drum_reverb_send_mixer_r, 0, reverb_mixer_r, 2);
AudioConnection patchCord22(drum_reverb_send_mixer_l, 0, reverb_mixer_l, 2);
AudioConnection patchCord23(drum_mixer_r, 0, master_mixer_r, 2);
AudioConnection patchCord24(drum_mixer_l, 0, master_mixer_l, 2);
#else
AudioConnection patchCord21(drum_mixer_r, 0, master_mixer_r, 2);
AudioConnection patchCord22(drum_mixer_l, 0, master_mixer_l, 2);
#endif
#endif
//AudioTimer audio_timer;
//AudioConnection patchCord25(reverb_mixer_r, audio_timer);
// //
// Dynamic patching of MicroDexed objects // Dynamic patching of MicroDexed objects
@ -881,10 +811,10 @@ void handleNoteOn(byte inChannel, byte inNumber, byte inVelocity)
uint8_t slot = drum_get_slot(drum_config[d].drum_class); uint8_t slot = drum_get_slot(drum_config[d].drum_class);
float pan = mapfloat(drum_config[d].pan, -1.0, 1.0, 0.0, 1.0); float pan = mapfloat(drum_config[d].pan, -1.0, 1.0, 0.0, 1.0);
drum_mixer_r.gain(slot, (1.0 - pan) * pseudo_log_curve(mapfloat(inVelocity, 0, 127, drum_config[d].vol_min, drum_config[d].vol_max))); drum_mixer_r.gain(slot, pan * pseudo_log_curve(mapfloat(inVelocity, 0, 127, drum_config[d].vol_min, drum_config[d].vol_max)));
drum_mixer_l.gain(slot, pan * pseudo_log_curve(mapfloat(inVelocity, 0, 127, drum_config[d].vol_min, drum_config[d].vol_max))); drum_mixer_l.gain(slot, (1.0 - pan) * pseudo_log_curve(mapfloat(inVelocity, 0, 127, drum_config[d].vol_min, drum_config[d].vol_max)));
drum_reverb_send_mixer_r.gain(slot, (1.0 - pan) * pseudo_log_curve(drum_config[d].reverb_send)); drum_reverb_send_mixer_r.gain(slot, pan * pseudo_log_curve(drum_config[d].reverb_send));
drum_reverb_send_mixer_l.gain(slot, pan * pseudo_log_curve(drum_config[d].reverb_send)); drum_reverb_send_mixer_l.gain(slot, (1.0 - pan) * pseudo_log_curve(drum_config[d].reverb_send));
if (drum_config[d].drum_data != NULL) if (drum_config[d].drum_data != NULL)
Drum[slot]->play(drum_config[d].drum_data); Drum[slot]->play(drum_config[d].drum_data);

@ -89,8 +89,8 @@ drum_config_t drum_config[NUM_DRUMSET_CONFIG] =
AudioSampleHh01, AudioSampleHh01,
"h", "h",
0.8, 0.8,
1.0, 0.8,
0.5, 0.3,
0.0 0.0
}, },
{ {
@ -100,8 +100,8 @@ drum_config_t drum_config[NUM_DRUMSET_CONFIG] =
AudioSampleHh02, AudioSampleHh02,
"h", "h",
0.8, 0.8,
1.0, 0.8,
0.5, 0.3,
0.0 0.0
}, },
{ {
@ -110,9 +110,9 @@ drum_config_t drum_config[NUM_DRUMSET_CONFIG] =
"oh02", "oh02",
AudioSampleOh02, AudioSampleOh02,
"H", "H",
-0.8, 0.8,
1.0, 0.8,
0.5, 0.3,
0.0 0.0
}, },
{ {

Loading…
Cancel
Save