From fe556bebb5a722d99e509348eccaea854689836c Mon Sep 17 00:00:00 2001 From: Holger Wirtz Date: Thu, 12 Aug 2021 11:04:28 +0200 Subject: [PATCH] Fix for drum panorama problems. --- MicroDexed.ino | 14 ++++++++------ drums.h | 17 ++++++++++++++--- 2 files changed, 22 insertions(+), 9 deletions(-) diff --git a/MicroDexed.ino b/MicroDexed.ino index 99ede4b..ccb51a7 100644 --- a/MicroDexed.ino +++ b/MicroDexed.ino @@ -276,10 +276,10 @@ void create_audio_drum_chain(uint8_t instance_id) Drum[instance_id] = new AudioPlayMemory(); dynamicConnections[nDynamic++] = new AudioConnection(*Drum[instance_id], 0, drum_mixer_r, instance_id); - dynamicConnections[nDynamic++] = new AudioConnection(*Drum[instance_id], 1, drum_mixer_l, instance_id); + dynamicConnections[nDynamic++] = new AudioConnection(*Drum[instance_id], 0, drum_mixer_l, instance_id); #ifdef USE_FX dynamicConnections[nDynamic++] = new AudioConnection(*Drum[instance_id], 0, drum_reverb_send_mixer_r, instance_id); - dynamicConnections[nDynamic++] = new AudioConnection(*Drum[instance_id], 1, drum_reverb_send_mixer_l, instance_id); + dynamicConnections[nDynamic++] = new AudioConnection(*Drum[instance_id], 0, drum_reverb_send_mixer_l, instance_id); #endif #ifdef DEBUG @@ -783,10 +783,10 @@ void handleNoteOn(byte inChannel, byte inNumber, byte inVelocity) 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); - 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, (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, 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)); + 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_l.gain(slot, (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_l.gain(slot, pan * pseudo_log_curve(drum_config[d].reverb_send)); if (drum_config[d].drum_data != NULL) Drum[slot]->play(drum_config[d].drum_data); @@ -802,6 +802,8 @@ void handleNoteOn(byte inChannel, byte inNumber, byte inVelocity) Serial.print(mapfloat(inVelocity, 0, 127, drum_config[d].vol_min, drum_config[d].vol_max), 2); Serial.print(F(" P")); Serial.print(drum_config[d].pan, 2); + Serial.print(F(" PAN")); + Serial.print(pan, 2); Serial.print(F(" RS")); Serial.println(drum_config[d].reverb_send, 2); #endif diff --git a/drums.h b/drums.h index 890e28c..8dc3c82 100644 --- a/drums.h +++ b/drums.h @@ -46,7 +46,7 @@ typedef struct drum_config_s { enum {DRUM_NONE, DRUM_BASS, DRUM_SNARE, DRUM_HIHAT, DRUM_HANDCLAP, DRUM_RIDE, DRUM_CHRASH, DRUM_LOWTOM, DRUM_MIDTOM, DRUM_HIGHTOM, DRUM_PERCUSSION}; -#define NUM_DRUMSET_CONFIG 15 +#define NUM_DRUMSET_CONFIG 16 drum_config_t drum_config[NUM_DRUMSET_CONFIG] = { { @@ -63,10 +63,21 @@ drum_config_t drum_config[NUM_DRUMSET_CONFIG] = { DRUM_HANDCLAP, MIDI_CIS3, - "cp02", + "cp02l", AudioSampleCp02, "C", - -0.4, + -1.0, + 0.6, + 0.0, + 0.4 + }, + { + DRUM_HANDCLAP, + MIDI_DIS3, + "cp02r", + AudioSampleCp02, + "C", + 1.0, 0.6, 0.0, 0.4