From d309fbf2cf321f0f42809fac85175c438e195312 Mon Sep 17 00:00:00 2001 From: Holger Wirtz Date: Sun, 25 Jul 2021 08:59:04 +0200 Subject: [PATCH] Now drum-volume can be controlled by velocity. Small fixes for sequencer. --- MicroDexed.ino | 6 +++++- UI.hpp | 11 +++++----- config.h | 2 +- drums.h | 58 +++++++++++++++++++++++++++++++++----------------- 4 files changed, 50 insertions(+), 27 deletions(-) diff --git a/MicroDexed.ino b/MicroDexed.ino index 7a4eb77..069dddf 100644 --- a/MicroDexed.ino +++ b/MicroDexed.ino @@ -316,6 +316,10 @@ extern uint8_t drum_type[NUM_DRUMS]; extern drum_config_t drum_config[NUM_DRUMCONFIG]; #endif +uint8_t seqdata[3][16]; +uint8_t seqsteptimer; +bool seq_running; + #ifdef ENABLE_LCD_UI extern LCDMenuLib2 LCDML; #endif @@ -742,7 +746,7 @@ void handleNoteOn(byte inChannel, byte inNumber, byte inVelocity) if (inNumber == drum_config[d].midinote) { uint8_t slot = drum_get_slot(drum_config[d].type); - drum_volume[slot]->gain(drum_config[d].vol); + 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[slot]->play(drum_config[d].filename); break; diff --git a/UI.hpp b/UI.hpp index 1ccfea6..19f048c 100644 --- a/UI.hpp +++ b/UI.hpp @@ -3536,15 +3536,16 @@ void UI_handle_OP(uint8_t param) void UI_func_sequencer(uint8_t param) { bool foundsound = false; - String displayname = String(8); + char displayname[9]; + if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); seq_button_r = false; // setup function lcd.setCursor(1, 0); - displayname = drum_config[activesample].filename; - lcd.print(displayname.substring(5, 11) ); + strcpy(displayname, drum_config[activesample].filename); + lcd.print(*displayname + 5); lcd.setCursor(8, 0); lcd.print("["); lcd.setCursor(9, 0); @@ -3647,8 +3648,8 @@ void UI_func_sequencer(uint8_t param) lcd.setCursor(0, 0); lcd.print("["); lcd.setCursor(1, 0); - displayname = drum_config[activesample].filename; - lcd.print(displayname.substring(5, 11) ); + strcpy(displayname, drum_config[activesample].filename); + lcd.print(*displayname + 5); lcd.setCursor(7, 0); lcd.print("]"); } diff --git a/config.h b/config.h index 703ec18..d178619 100644 --- a/config.h +++ b/config.h @@ -99,7 +99,7 @@ //* DEXED AND EFFECTS SETTINGS //************************************************************************************************* // Number of Dexed instances -#if defined(TEENSY3_6) && NUM_DEXED > 1 +#if defined(TEENSY3_6) #warning >>> Sorry, only one instance possible for Teensy-3.6 #define NUM_DEXED 1 // 1 or 2 - nothing else! #else diff --git a/drums.h b/drums.h index 0016121..2a1e517 100644 --- a/drums.h +++ b/drums.h @@ -34,7 +34,8 @@ typedef struct drum_config_s { char filename[18]; // 44.1kHz mono LSB raw-sample to play char shortname[2]; // 1 char name for sequencer float32_t pan; // Panorama (-1.0 - +1.0) - float32_t vol; // Volume (0.0 - 1.0) + float32_t vol_max; // max. Volume (0.0 - 1.0) + float32_t vol_min; // min. Volume (0.0 - 1.0, should be <= vol_max) } drum_config_t; #define NUM_DRUMCONFIG 15 @@ -43,9 +44,10 @@ drum_config_t drum_config[NUM_DRUMCONFIG] = { DRUM_BASS, MIDI_C3, "/drm/bd01.raw", - "B", + "B", 0.0, - 0.8 + 0.8, + 0.0 }, { DRUM_HANDCLAP, @@ -53,7 +55,8 @@ drum_config_t drum_config[NUM_DRUMCONFIG] = { "/drm/cp02.raw", "C", -0.4, - 0.6 + 0.6, + 0.0 }, { DRUM_SNARE, @@ -61,7 +64,8 @@ drum_config_t drum_config[NUM_DRUMCONFIG] = { "/drm/sd15.raw", "S", 0.2, - 0.8 + 0.6, + 0.2 }, { DRUM_HIHAT, @@ -69,7 +73,8 @@ drum_config_t drum_config[NUM_DRUMCONFIG] = { "/drm/hh01.raw", "h", 0.8, - 0.2 + 0.2, + 0.0 }, { DRUM_HIHAT, @@ -77,7 +82,8 @@ drum_config_t drum_config[NUM_DRUMCONFIG] = { "/drm/hh02.raw", "h", 0.8, - 0.2 + 0.2, + 0.0 }, { DRUM_HIHAT, @@ -85,7 +91,8 @@ drum_config_t drum_config[NUM_DRUMCONFIG] = { "/drm/oh02.raw", "H", 0.8, - 0.2 + 0.2, + 0.0 }, { DRUM_LOWTOM, @@ -93,7 +100,8 @@ drum_config_t drum_config[NUM_DRUMCONFIG] = { "/drm/lt01.raw", "T", -0.7, - 0.8 + 0.8, + 0.0 }, { DRUM_HIGHTOM, @@ -101,45 +109,53 @@ drum_config_t drum_config[NUM_DRUMCONFIG] = { "/drm/ht01.raw", "T", -0.5, - 0.8 + 0.8, + 0.0 }, { DRUM_RIDE, MIDI_CIS4, "/drm/rd01.raw", + "R", -0.6, - 0.3 + 0.3, + 0.0 }, { DRUM_RIDE, MIDI_DIS4, "/drm/rd02.raw", + "R", -0.6, - 0.3 + 0.3, + 0.0 }, { DRUM_BASS, MIDI_C5, - "/drm/PHKick1.raw", - "B", + "/drm/PHKick1.raw", + "B", 0.0, - 0.9 + 0.9, + 0.0 }, - { + { DRUM_HANDCLAP, MIDI_DIS5, "/drm/808Clap1.raw", "C", 0.0, - 0.9 + 0.9, + 0.0 }, -{ + { DRUM_SNARE, MIDI_CIS5, "/drm/808RimS1.raw", "R", -0.3, - 0.5 + 0.5, + 0.0 }, { DRUM_HIHAT, @@ -147,7 +163,8 @@ drum_config_t drum_config[NUM_DRUMCONFIG] = { "/drm/808HHCL1.raw", "H", 0.4, - 0.6 + 0.6, + 0.0 }, { DRUM_SNARE, @@ -155,6 +172,7 @@ drum_config_t drum_config[NUM_DRUMCONFIG] = { "/drm/EMPTY ", "-", 0.0, + 0.0, 0.0 } };