From b2459d980d97205fabdc08fae04d556d5ede8983 Mon Sep 17 00:00:00 2001 From: Holger Wirtz Date: Tue, 10 Aug 2021 16:25:42 +0200 Subject: [PATCH] Fixing drums panning. --- MicroDexed.ino | 15 +++++++-------- drums.h | 14 +++++++------- 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/MicroDexed.ino b/MicroDexed.ino index ccca730..3986eb3 100644 --- a/MicroDexed.ino +++ b/MicroDexed.ino @@ -466,6 +466,7 @@ void setup() setup_debug_message(); #endif Serial.begin(SERIAL_SPEED); + Serial.println(CrashReport); #endif #ifndef ENABLE_LCD_UI #ifdef DEBUG @@ -878,14 +879,12 @@ void handleNoteOn(byte inChannel, byte inNumber, byte inVelocity) if (inNumber == drum_config[d].midinote) { uint8_t slot = drum_get_slot(drum_config[d].drum_class); - float fsin = mapfloat(arm_sin_f32(drum_config[d].pan * PI / 2.0), -1.0, 1.0, 0.0, 1.0); - - //drum_mixer_r.gain(slot, (1.0 - fsin) * pseudo_log_curve(mapfloat(inVelocity, 0, 127, drum_config[d].vol_min, drum_config[d].vol_max))); - //drum_mixer_l.gain(slot, fsin * pseudo_log_curve(mapfloat(inVelocity, 0, 127, drum_config[d].vol_min, drum_config[d].vol_max))); - drum_mixer_r.gain(slot, (1.0 - fsin) * mapfloat(inVelocity, 0, 127, drum_config[d].vol_min, drum_config[d].vol_max)); - drum_mixer_l.gain(slot, fsin * mapfloat(inVelocity, 0, 127, drum_config[d].vol_min, drum_config[d].vol_max)); - drum_reverb_send_mixer_r.gain(slot, (1.0 - fsin) * pseudo_log_curve(drum_config[d].reverb_send)); - drum_reverb_send_mixer_l.gain(slot, fsin * pseudo_log_curve(drum_config[d].reverb_send)); + 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_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); diff --git a/drums.h b/drums.h index 377df35..20a5f37 100644 --- a/drums.h +++ b/drums.h @@ -89,8 +89,8 @@ drum_config_t drum_config[NUM_DRUMSET_CONFIG] = AudioSampleHh01, "h", 0.8, - 0.8, - 0.0, + 1.0, + 0.5, 0.0 }, { @@ -100,8 +100,8 @@ drum_config_t drum_config[NUM_DRUMSET_CONFIG] = AudioSampleHh02, "h", 0.8, - 0.8, - 0.0, + 1.0, + 0.5, 0.0 }, { @@ -110,9 +110,9 @@ drum_config_t drum_config[NUM_DRUMSET_CONFIG] = "oh02", AudioSampleOh02, "H", - 0.8, - 0.8, - 0.0, + -0.8, + 1.0, + 0.5, 0.0 }, {