diff --git a/MicroDexed.ino b/MicroDexed.ino index cfb50dd..21bdf6b 100644 --- a/MicroDexed.ino +++ b/MicroDexed.ino @@ -43,6 +43,9 @@ #include "UI.hpp" #if NUM_DRUMS > 0 #include "drums.h" +#if NUM_DRUMS > 4 +#include "mixer8.h" +#endif #endif // Audio engines @@ -89,11 +92,21 @@ AudioMixer4 audio_thru_mixer_l; AudioPlaySdRaw* Drum[NUM_DRUMS]; AudioAmplifier* drum_volume[NUM_DRUMS]; AudioEffectMonoStereo* drum_mono2stereo[NUM_DRUMS]; +#if NUM_DRUMS < 5 AudioMixer4 drum_mixer_r; AudioMixer4 drum_mixer_l; +#else +AudioMixer8 drum_mixer_r; +AudioMixer8 drum_mixer_l; +#endif #ifdef USE_FX +#if NUM_DRUMS < 5 AudioMixer4 drum_reverb_send_mixer_r; AudioMixer4 drum_reverb_send_mixer_l; +#else +AudioMixer8 drum_reverb_send_mixer_r; +AudioMixer8 drum_reverb_send_mixer_l; +#endif #endif #endif @@ -585,7 +598,7 @@ void setup() master_mixer_r.gain(2, 0.0); master_mixer_l.gain(2, 0.0); #endif - master_mixer_r.gain(3, 1.0); + master_mixer_r.gain(3, 1.0); master_mixer_l.gain(3, 1.0); #if defined(TEENSY_AUDIO_BOARD) && defined(SGTL5000_AUDIO_THRU) @@ -810,6 +823,8 @@ void handleNoteOn(byte inChannel, byte inNumber, byte inVelocity) if (inNumber == drum_config[d].midinote) { uint8_t slot = drum_get_slot(drum_config[d].type); + if (Drum[slot]->isPlaying()) + Drum[slot]->stop(); drum_volume[slot]->gain(pseudo_log_curve(mapfloat(inVelocity, 0, 127, drum_config[d].vol_min, drum_config[d].vol_max))); drum_mono2stereo[slot]->panorama(drum_config[d].pan); drum_reverb_send_mixer_r.gain(slot, pseudo_log_curve(drum_config[d].reverb_send)); diff --git a/config.h b/config.h index 8e946f2..2d3eae3 100644 --- a/config.h +++ b/config.h @@ -110,7 +110,7 @@ #define USE_FX 1 // NUMBER OF SAMPLEDRUMS -#define NUM_DRUMS 4 +#define NUM_DRUMS 8 #define DRUM_MIDI_CHANNEL 1 // CHORUS parameters