|
|
|
@ -90,8 +90,8 @@ AudioMixer4 audio_thru_mixer_l; |
|
|
|
|
#ifdef NUM_DRUMS |
|
|
|
|
AudioPlaySdRaw* Drum[NUM_DRUMS]; |
|
|
|
|
AudioEffectMonoStereo* drum_mono2stereo[NUM_DRUMS]; |
|
|
|
|
AudioMixer8 drum_mixer_r; |
|
|
|
|
AudioMixer8 drum_mixer_l; |
|
|
|
|
AudioMixer4 drum_mixer_r; |
|
|
|
|
AudioMixer4 drum_mixer_l; |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
// Audio chain tail
|
|
|
|
@ -174,6 +174,8 @@ AudioConnection patchCord24(audio_thru_mixer_l, 0, i2s1, 1); |
|
|
|
|
#ifdef USE_FX |
|
|
|
|
AudioConnection patchCord25(drum_mixer_r, 0, reverb_mixer_r, 4); |
|
|
|
|
AudioConnection patchCord26(drum_mixer_l, 0, reverb_mixer_l, 4); |
|
|
|
|
AudioConnection patchCord27(drum_mixer_r, 0, master_mixer_r, 2); |
|
|
|
|
AudioConnection patchCord28(drum_mixer_l, 0, master_mixer_l, 2); |
|
|
|
|
#else |
|
|
|
|
AudioConnection patchCord25(drum_mixer_r, 0, master_mixer_r, 2); |
|
|
|
|
AudioConnection patchCord26(drum_mixer_l, 0, master_mixer_l, 2); |
|
|
|
@ -248,10 +250,6 @@ void create_audio_drum_chain(uint8_t instance_id) |
|
|
|
|
dynamicDrumConnections[nDrumDynamic++] = new AudioConnection(*Drum[instance_id], 0, *drum_mono2stereo[instance_id], 0); |
|
|
|
|
dynamicDrumConnections[nDrumDynamic++] = new AudioConnection(*drum_mono2stereo[instance_id], 0, drum_mixer_r, instance_id); |
|
|
|
|
dynamicDrumConnections[nDrumDynamic++] = new AudioConnection(*drum_mono2stereo[instance_id], 1, drum_mixer_l, instance_id); |
|
|
|
|
|
|
|
|
|
drum_mono2stereo[instance_id]->panorama(0.0); |
|
|
|
|
drum_mixer_r.gain(instance_id, 1.0); |
|
|
|
|
drum_mixer_l.gain(instance_id, 1.0); |
|
|
|
|
} |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
@ -446,6 +444,9 @@ void setup() |
|
|
|
|
Serial.println(instance_id, DEC); |
|
|
|
|
#endif |
|
|
|
|
create_audio_drum_chain(instance_id); |
|
|
|
|
|
|
|
|
|
drum_mixer_r.gain(instance_id, 1.0); |
|
|
|
|
drum_mixer_l.gain(instance_id, 1.0); |
|
|
|
|
} |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
@ -709,44 +710,64 @@ void handleNoteOn(byte inChannel, byte inNumber, byte inVelocity) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
#ifdef NUM_DRUMS |
|
|
|
|
static uint8_t drum_counter; |
|
|
|
|
|
|
|
|
|
// Check for Drum
|
|
|
|
|
if (inChannel == DRUM_MIDI_CHANNEL) |
|
|
|
|
{ |
|
|
|
|
if (drum_counter >= NUM_DRUMS) |
|
|
|
|
drum_counter = 0; |
|
|
|
|
|
|
|
|
|
#ifdef DEBUG |
|
|
|
|
Serial.print(F("Drum ")); |
|
|
|
|
Serial.println(inNumber - 48, DEC); |
|
|
|
|
char note_name[4]; |
|
|
|
|
getNoteName(note_name, inNumber); |
|
|
|
|
Serial.print(F("=> Drum[")); |
|
|
|
|
Serial.print(drum_counter, DEC); |
|
|
|
|
Serial.print(F("]: ")); |
|
|
|
|
Serial.println(note_name); |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
switch (inNumber - 48) |
|
|
|
|
{ |
|
|
|
|
case 0: |
|
|
|
|
Drum[0]->play("drm/bd01.raw"); |
|
|
|
|
Drum[drum_counter % 4]->play("/DRM/BD01.RAW"); |
|
|
|
|
drum_counter++; |
|
|
|
|
break; |
|
|
|
|
case 1: |
|
|
|
|
Drum[1]->play("drm/cp02.raw"); |
|
|
|
|
Drum[drum_counter % 4]->play("/drm/cp02.raw"); |
|
|
|
|
drum_counter++; |
|
|
|
|
break; |
|
|
|
|
case 2: |
|
|
|
|
Drum[2]->play("drm/sd15.raw"); |
|
|
|
|
Drum[drum_counter % 4]->play("/drm/sd15.raw"); |
|
|
|
|
drum_counter++; |
|
|
|
|
break; |
|
|
|
|
case 6: |
|
|
|
|
Drum[3]->play("drm/hh01.wav"); |
|
|
|
|
Drum[drum_counter % 4]->play("/drm/hh01.wav"); |
|
|
|
|
drum_counter++; |
|
|
|
|
break; |
|
|
|
|
case 8: |
|
|
|
|
Drum[3]->play("drm/hh02.wav"); |
|
|
|
|
Drum[drum_counter % 4]->play("/drm/hh02.wav"); |
|
|
|
|
drum_counter++; |
|
|
|
|
break; |
|
|
|
|
case 10: |
|
|
|
|
Drum[3]->play("drm/oh02.wav"); |
|
|
|
|
Drum[drum_counter % 4]->play("/drm/oh02.wav"); |
|
|
|
|
drum_counter++; |
|
|
|
|
break; |
|
|
|
|
case 5: |
|
|
|
|
Drum[4]->play("drm/lt01.raw"); |
|
|
|
|
Drum[drum_counter % 4]->play("/drm/lt01.raw"); |
|
|
|
|
drum_counter++; |
|
|
|
|
break; |
|
|
|
|
case 7: |
|
|
|
|
Drum[5]->play("drm/ht01.raw"); |
|
|
|
|
Drum[drum_counter % 4]->play("/drm/ht01.raw"); |
|
|
|
|
drum_counter++; |
|
|
|
|
break; |
|
|
|
|
case 13: |
|
|
|
|
Drum[6]->play("drm/rd01.raw"); |
|
|
|
|
Drum[drum_counter % 4]->play("/drm/rd01.raw"); |
|
|
|
|
drum_counter++; |
|
|
|
|
break; |
|
|
|
|
case 15: |
|
|
|
|
Drum[7]->play("drm/rd02.raw"); |
|
|
|
|
Drum[drum_counter % 4]->play("/drm/rd02.raw"); |
|
|
|
|
drum_counter++; |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|