From 8125a895e45b3767ced5adec2d6bf3b0e01b2010 Mon Sep 17 00:00:00 2001 From: Holger Wirtz Date: Thu, 5 Aug 2021 10:30:21 +0200 Subject: [PATCH] Drums folder organization changed for using different drumsets later. --- MicroDexed.ino | 8 ++- addon/SD/drm/{CFGDrums.json => StdDrums.json} | 0 addon/SD/drm/{ => StdDrums}/808Clap1.wav | Bin addon/SD/drm/{ => StdDrums}/808HHCL1.wav | Bin addon/SD/drm/{ => StdDrums}/808RimS1.wav | Bin addon/SD/drm/{ => StdDrums}/PHKick1.wav | Bin addon/SD/drm/{ => StdDrums}/bd01.wav | Bin addon/SD/drm/{ => StdDrums}/bd02.wav | Bin addon/SD/drm/{ => StdDrums}/bd03.wav | Bin addon/SD/drm/{ => StdDrums}/bd04.wav | Bin addon/SD/drm/{ => StdDrums}/bd05.wav | Bin addon/SD/drm/{ => StdDrums}/bd06.wav | Bin addon/SD/drm/{ => StdDrums}/bd07.wav | Bin addon/SD/drm/{ => StdDrums}/bd08.wav | Bin addon/SD/drm/{ => StdDrums}/bd09.wav | Bin addon/SD/drm/{ => StdDrums}/bd10.wav | Bin addon/SD/drm/{ => StdDrums}/cp01.wav | Bin addon/SD/drm/{ => StdDrums}/cp02.wav | Bin addon/SD/drm/{ => StdDrums}/cr01.wav | Bin addon/SD/drm/{ => StdDrums}/cr02.wav | Bin addon/SD/drm/{ => StdDrums}/hh01.wav | Bin addon/SD/drm/{ => StdDrums}/hh02.wav | Bin addon/SD/drm/{ => StdDrums}/ht01.wav | Bin addon/SD/drm/{ => StdDrums}/ht02.wav | Bin addon/SD/drm/{ => StdDrums}/lt01.wav | Bin addon/SD/drm/{ => StdDrums}/lt02.wav | Bin addon/SD/drm/{ => StdDrums}/mt01.wav | Bin addon/SD/drm/{ => StdDrums}/mt02.wav | Bin addon/SD/drm/{ => StdDrums}/oh01.wav | Bin addon/SD/drm/{ => StdDrums}/oh02.wav | Bin addon/SD/drm/{ => StdDrums}/rd01.wav | Bin addon/SD/drm/{ => StdDrums}/rd02.wav | Bin addon/SD/drm/{ => StdDrums}/rs01.wav | Bin addon/SD/drm/{ => StdDrums}/sd01.wav | Bin addon/SD/drm/{ => StdDrums}/sd02.wav | Bin addon/SD/drm/{ => StdDrums}/sd03.wav | Bin addon/SD/drm/{ => StdDrums}/sd04.wav | Bin addon/SD/drm/{ => StdDrums}/sd05.wav | Bin addon/SD/drm/{ => StdDrums}/sd06.wav | Bin addon/SD/drm/{ => StdDrums}/sd07.wav | Bin addon/SD/drm/{ => StdDrums}/sd08.wav | Bin addon/SD/drm/{ => StdDrums}/sd09.wav | Bin addon/SD/drm/{ => StdDrums}/sd10.wav | Bin addon/SD/drm/{ => StdDrums}/sd11.wav | Bin addon/SD/drm/{ => StdDrums}/sd12.wav | Bin addon/SD/drm/{ => StdDrums}/sd13.wav | Bin addon/SD/drm/{ => StdDrums}/sd14.wav | Bin addon/SD/drm/{ => StdDrums}/sd15.wav | Bin drums.cpp | 50 ++++++++++++------ drums.h | 2 +- 50 files changed, 42 insertions(+), 18 deletions(-) rename addon/SD/drm/{CFGDrums.json => StdDrums.json} (100%) rename addon/SD/drm/{ => StdDrums}/808Clap1.wav (100%) rename addon/SD/drm/{ => StdDrums}/808HHCL1.wav (100%) rename addon/SD/drm/{ => StdDrums}/808RimS1.wav (100%) rename addon/SD/drm/{ => StdDrums}/PHKick1.wav (100%) rename addon/SD/drm/{ => StdDrums}/bd01.wav (100%) rename addon/SD/drm/{ => StdDrums}/bd02.wav (100%) rename addon/SD/drm/{ => StdDrums}/bd03.wav (100%) rename addon/SD/drm/{ => StdDrums}/bd04.wav (100%) rename addon/SD/drm/{ => StdDrums}/bd05.wav (100%) rename addon/SD/drm/{ => StdDrums}/bd06.wav (100%) rename addon/SD/drm/{ => StdDrums}/bd07.wav (100%) rename addon/SD/drm/{ => StdDrums}/bd08.wav (100%) rename addon/SD/drm/{ => StdDrums}/bd09.wav (100%) rename addon/SD/drm/{ => StdDrums}/bd10.wav (100%) rename addon/SD/drm/{ => StdDrums}/cp01.wav (100%) rename addon/SD/drm/{ => StdDrums}/cp02.wav (100%) rename addon/SD/drm/{ => StdDrums}/cr01.wav (100%) rename addon/SD/drm/{ => StdDrums}/cr02.wav (100%) rename addon/SD/drm/{ => StdDrums}/hh01.wav (100%) rename addon/SD/drm/{ => StdDrums}/hh02.wav (100%) rename addon/SD/drm/{ => StdDrums}/ht01.wav (100%) rename addon/SD/drm/{ => StdDrums}/ht02.wav (100%) rename addon/SD/drm/{ => StdDrums}/lt01.wav (100%) rename addon/SD/drm/{ => StdDrums}/lt02.wav (100%) rename addon/SD/drm/{ => StdDrums}/mt01.wav (100%) rename addon/SD/drm/{ => StdDrums}/mt02.wav (100%) rename addon/SD/drm/{ => StdDrums}/oh01.wav (100%) rename addon/SD/drm/{ => StdDrums}/oh02.wav (100%) rename addon/SD/drm/{ => StdDrums}/rd01.wav (100%) rename addon/SD/drm/{ => StdDrums}/rd02.wav (100%) rename addon/SD/drm/{ => StdDrums}/rs01.wav (100%) rename addon/SD/drm/{ => StdDrums}/sd01.wav (100%) rename addon/SD/drm/{ => StdDrums}/sd02.wav (100%) rename addon/SD/drm/{ => StdDrums}/sd03.wav (100%) rename addon/SD/drm/{ => StdDrums}/sd04.wav (100%) rename addon/SD/drm/{ => StdDrums}/sd05.wav (100%) rename addon/SD/drm/{ => StdDrums}/sd06.wav (100%) rename addon/SD/drm/{ => StdDrums}/sd07.wav (100%) rename addon/SD/drm/{ => StdDrums}/sd08.wav (100%) rename addon/SD/drm/{ => StdDrums}/sd09.wav (100%) rename addon/SD/drm/{ => StdDrums}/sd10.wav (100%) rename addon/SD/drm/{ => StdDrums}/sd11.wav (100%) rename addon/SD/drm/{ => StdDrums}/sd12.wav (100%) rename addon/SD/drm/{ => StdDrums}/sd13.wav (100%) rename addon/SD/drm/{ => StdDrums}/sd14.wav (100%) rename addon/SD/drm/{ => StdDrums}/sd15.wav (100%) diff --git a/MicroDexed.ino b/MicroDexed.ino index 6eee3a5..d5efb09 100644 --- a/MicroDexed.ino +++ b/MicroDexed.ino @@ -109,6 +109,10 @@ AudioMixer8 drum_reverb_send_mixer_l; #endif #endif + +//AudioConnection patchCord[] = { +// {wavetable[0], 0, mixer[0], 0}, {wavetable[1], 0, mixer[0], 1}, {wavetable[2], 0, mixer[0], 2}, {wavetable[3], 0, mixer[0], 3}, {mixer[0], 0, mixer[TOTAL_MIXERS - 2], 0}, + // Audio chain tail #if defined(USE_FX) #ifdef USE_PLATEREVERB @@ -329,6 +333,7 @@ uint8_t num_drums = 0; drum_config_t drum_config[DRUM_MAX_INSTRUMENTS + 1]; uint8_t drum_counter; uint8_t drum_type[DRUM_MAX_INSTRUMENTS + 1]; +char drumset_name[26]; extern void sequencer(void); #endif @@ -516,7 +521,8 @@ void setup() } else { - num_drums = read_drum_config(); + strcpy(drumset_name,"StdDrums"); + num_drums = read_drum_config(drumset_name); check_and_create_directories(); diff --git a/addon/SD/drm/CFGDrums.json b/addon/SD/drm/StdDrums.json similarity index 100% rename from addon/SD/drm/CFGDrums.json rename to addon/SD/drm/StdDrums.json diff --git a/addon/SD/drm/808Clap1.wav b/addon/SD/drm/StdDrums/808Clap1.wav similarity index 100% rename from addon/SD/drm/808Clap1.wav rename to addon/SD/drm/StdDrums/808Clap1.wav diff --git a/addon/SD/drm/808HHCL1.wav b/addon/SD/drm/StdDrums/808HHCL1.wav similarity index 100% rename from addon/SD/drm/808HHCL1.wav rename to addon/SD/drm/StdDrums/808HHCL1.wav diff --git a/addon/SD/drm/808RimS1.wav b/addon/SD/drm/StdDrums/808RimS1.wav similarity index 100% rename from addon/SD/drm/808RimS1.wav rename to addon/SD/drm/StdDrums/808RimS1.wav diff --git a/addon/SD/drm/PHKick1.wav b/addon/SD/drm/StdDrums/PHKick1.wav similarity index 100% rename from addon/SD/drm/PHKick1.wav rename to addon/SD/drm/StdDrums/PHKick1.wav diff --git a/addon/SD/drm/bd01.wav b/addon/SD/drm/StdDrums/bd01.wav similarity index 100% rename from addon/SD/drm/bd01.wav rename to addon/SD/drm/StdDrums/bd01.wav diff --git a/addon/SD/drm/bd02.wav b/addon/SD/drm/StdDrums/bd02.wav similarity index 100% rename from addon/SD/drm/bd02.wav rename to addon/SD/drm/StdDrums/bd02.wav diff --git a/addon/SD/drm/bd03.wav b/addon/SD/drm/StdDrums/bd03.wav similarity index 100% rename from addon/SD/drm/bd03.wav rename to addon/SD/drm/StdDrums/bd03.wav diff --git a/addon/SD/drm/bd04.wav b/addon/SD/drm/StdDrums/bd04.wav similarity index 100% rename from addon/SD/drm/bd04.wav rename to addon/SD/drm/StdDrums/bd04.wav diff --git a/addon/SD/drm/bd05.wav b/addon/SD/drm/StdDrums/bd05.wav similarity index 100% rename from addon/SD/drm/bd05.wav rename to addon/SD/drm/StdDrums/bd05.wav diff --git a/addon/SD/drm/bd06.wav b/addon/SD/drm/StdDrums/bd06.wav similarity index 100% rename from addon/SD/drm/bd06.wav rename to addon/SD/drm/StdDrums/bd06.wav diff --git a/addon/SD/drm/bd07.wav b/addon/SD/drm/StdDrums/bd07.wav similarity index 100% rename from addon/SD/drm/bd07.wav rename to addon/SD/drm/StdDrums/bd07.wav diff --git a/addon/SD/drm/bd08.wav b/addon/SD/drm/StdDrums/bd08.wav similarity index 100% rename from addon/SD/drm/bd08.wav rename to addon/SD/drm/StdDrums/bd08.wav diff --git a/addon/SD/drm/bd09.wav b/addon/SD/drm/StdDrums/bd09.wav similarity index 100% rename from addon/SD/drm/bd09.wav rename to addon/SD/drm/StdDrums/bd09.wav diff --git a/addon/SD/drm/bd10.wav b/addon/SD/drm/StdDrums/bd10.wav similarity index 100% rename from addon/SD/drm/bd10.wav rename to addon/SD/drm/StdDrums/bd10.wav diff --git a/addon/SD/drm/cp01.wav b/addon/SD/drm/StdDrums/cp01.wav similarity index 100% rename from addon/SD/drm/cp01.wav rename to addon/SD/drm/StdDrums/cp01.wav diff --git a/addon/SD/drm/cp02.wav b/addon/SD/drm/StdDrums/cp02.wav similarity index 100% rename from addon/SD/drm/cp02.wav rename to addon/SD/drm/StdDrums/cp02.wav diff --git a/addon/SD/drm/cr01.wav b/addon/SD/drm/StdDrums/cr01.wav similarity index 100% rename from addon/SD/drm/cr01.wav rename to addon/SD/drm/StdDrums/cr01.wav diff --git a/addon/SD/drm/cr02.wav b/addon/SD/drm/StdDrums/cr02.wav similarity index 100% rename from addon/SD/drm/cr02.wav rename to addon/SD/drm/StdDrums/cr02.wav diff --git a/addon/SD/drm/hh01.wav b/addon/SD/drm/StdDrums/hh01.wav similarity index 100% rename from addon/SD/drm/hh01.wav rename to addon/SD/drm/StdDrums/hh01.wav diff --git a/addon/SD/drm/hh02.wav b/addon/SD/drm/StdDrums/hh02.wav similarity index 100% rename from addon/SD/drm/hh02.wav rename to addon/SD/drm/StdDrums/hh02.wav diff --git a/addon/SD/drm/ht01.wav b/addon/SD/drm/StdDrums/ht01.wav similarity index 100% rename from addon/SD/drm/ht01.wav rename to addon/SD/drm/StdDrums/ht01.wav diff --git a/addon/SD/drm/ht02.wav b/addon/SD/drm/StdDrums/ht02.wav similarity index 100% rename from addon/SD/drm/ht02.wav rename to addon/SD/drm/StdDrums/ht02.wav diff --git a/addon/SD/drm/lt01.wav b/addon/SD/drm/StdDrums/lt01.wav similarity index 100% rename from addon/SD/drm/lt01.wav rename to addon/SD/drm/StdDrums/lt01.wav diff --git a/addon/SD/drm/lt02.wav b/addon/SD/drm/StdDrums/lt02.wav similarity index 100% rename from addon/SD/drm/lt02.wav rename to addon/SD/drm/StdDrums/lt02.wav diff --git a/addon/SD/drm/mt01.wav b/addon/SD/drm/StdDrums/mt01.wav similarity index 100% rename from addon/SD/drm/mt01.wav rename to addon/SD/drm/StdDrums/mt01.wav diff --git a/addon/SD/drm/mt02.wav b/addon/SD/drm/StdDrums/mt02.wav similarity index 100% rename from addon/SD/drm/mt02.wav rename to addon/SD/drm/StdDrums/mt02.wav diff --git a/addon/SD/drm/oh01.wav b/addon/SD/drm/StdDrums/oh01.wav similarity index 100% rename from addon/SD/drm/oh01.wav rename to addon/SD/drm/StdDrums/oh01.wav diff --git a/addon/SD/drm/oh02.wav b/addon/SD/drm/StdDrums/oh02.wav similarity index 100% rename from addon/SD/drm/oh02.wav rename to addon/SD/drm/StdDrums/oh02.wav diff --git a/addon/SD/drm/rd01.wav b/addon/SD/drm/StdDrums/rd01.wav similarity index 100% rename from addon/SD/drm/rd01.wav rename to addon/SD/drm/StdDrums/rd01.wav diff --git a/addon/SD/drm/rd02.wav b/addon/SD/drm/StdDrums/rd02.wav similarity index 100% rename from addon/SD/drm/rd02.wav rename to addon/SD/drm/StdDrums/rd02.wav diff --git a/addon/SD/drm/rs01.wav b/addon/SD/drm/StdDrums/rs01.wav similarity index 100% rename from addon/SD/drm/rs01.wav rename to addon/SD/drm/StdDrums/rs01.wav diff --git a/addon/SD/drm/sd01.wav b/addon/SD/drm/StdDrums/sd01.wav similarity index 100% rename from addon/SD/drm/sd01.wav rename to addon/SD/drm/StdDrums/sd01.wav diff --git a/addon/SD/drm/sd02.wav b/addon/SD/drm/StdDrums/sd02.wav similarity index 100% rename from addon/SD/drm/sd02.wav rename to addon/SD/drm/StdDrums/sd02.wav diff --git a/addon/SD/drm/sd03.wav b/addon/SD/drm/StdDrums/sd03.wav similarity index 100% rename from addon/SD/drm/sd03.wav rename to addon/SD/drm/StdDrums/sd03.wav diff --git a/addon/SD/drm/sd04.wav b/addon/SD/drm/StdDrums/sd04.wav similarity index 100% rename from addon/SD/drm/sd04.wav rename to addon/SD/drm/StdDrums/sd04.wav diff --git a/addon/SD/drm/sd05.wav b/addon/SD/drm/StdDrums/sd05.wav similarity index 100% rename from addon/SD/drm/sd05.wav rename to addon/SD/drm/StdDrums/sd05.wav diff --git a/addon/SD/drm/sd06.wav b/addon/SD/drm/StdDrums/sd06.wav similarity index 100% rename from addon/SD/drm/sd06.wav rename to addon/SD/drm/StdDrums/sd06.wav diff --git a/addon/SD/drm/sd07.wav b/addon/SD/drm/StdDrums/sd07.wav similarity index 100% rename from addon/SD/drm/sd07.wav rename to addon/SD/drm/StdDrums/sd07.wav diff --git a/addon/SD/drm/sd08.wav b/addon/SD/drm/StdDrums/sd08.wav similarity index 100% rename from addon/SD/drm/sd08.wav rename to addon/SD/drm/StdDrums/sd08.wav diff --git a/addon/SD/drm/sd09.wav b/addon/SD/drm/StdDrums/sd09.wav similarity index 100% rename from addon/SD/drm/sd09.wav rename to addon/SD/drm/StdDrums/sd09.wav diff --git a/addon/SD/drm/sd10.wav b/addon/SD/drm/StdDrums/sd10.wav similarity index 100% rename from addon/SD/drm/sd10.wav rename to addon/SD/drm/StdDrums/sd10.wav diff --git a/addon/SD/drm/sd11.wav b/addon/SD/drm/StdDrums/sd11.wav similarity index 100% rename from addon/SD/drm/sd11.wav rename to addon/SD/drm/StdDrums/sd11.wav diff --git a/addon/SD/drm/sd12.wav b/addon/SD/drm/StdDrums/sd12.wav similarity index 100% rename from addon/SD/drm/sd12.wav rename to addon/SD/drm/StdDrums/sd12.wav diff --git a/addon/SD/drm/sd13.wav b/addon/SD/drm/StdDrums/sd13.wav similarity index 100% rename from addon/SD/drm/sd13.wav rename to addon/SD/drm/StdDrums/sd13.wav diff --git a/addon/SD/drm/sd14.wav b/addon/SD/drm/StdDrums/sd14.wav similarity index 100% rename from addon/SD/drm/sd14.wav rename to addon/SD/drm/StdDrums/sd14.wav diff --git a/addon/SD/drm/sd15.wav b/addon/SD/drm/StdDrums/sd15.wav similarity index 100% rename from addon/SD/drm/sd15.wav rename to addon/SD/drm/StdDrums/sd15.wav diff --git a/drums.cpp b/drums.cpp index 3cbbef2..d4f5463 100644 --- a/drums.cpp +++ b/drums.cpp @@ -33,19 +33,29 @@ extern drum_config_t drum_config[DRUM_MAX_INSTRUMENTS]; -uint8_t read_drum_config(void) +uint8_t read_drum_config(const char* drumset) { uint8_t config_drums = 0; + char ds[26]; File json; DynamicJsonDocument drums_json(4096); + sprintf(ds, "/DRM/%s.json", drumset); +#ifdef DEBUG + Serial.print(F("Searching for drum configuration file [")); + Serial.print(ds); + Serial.println(F("]")); +#endif + AudioNoInterrupts(); - if (SD.exists("/DRM/CFGDrums.json")) + if (SD.exists(ds)) { #ifdef DEBUG - Serial.println(F("Found drum configuration file.")); + Serial.print(F("Found drum configuration file [")); + Serial.print(ds); + Serial.println(F("]")); #endif - json = SD.open("/DRM/CFGDrums.json"); + json = SD.open(ds); if (json) { deserializeJson(drums_json, json); @@ -57,20 +67,28 @@ uint8_t read_drum_config(void) Serial.println(config_drums); if (config_drums > DRUM_MAX_INSTRUMENTS) Serial.println(F("*** Maximum number of drum samples exceeded! ***")); - //Serial.println(F("Drum Configuration:")); + //Serial.println(F("Drum Configuration: ")); //serializeJsonPretty(drums_json, Serial); //Serial.println(); #endif config_drums = constrain(config_drums, 0, DRUM_MAX_INSTRUMENTS); } } +#ifdef DEBUG + else + { + Serial.print(F("Drum configuration file [")); + Serial.print(ds); + Serial.println(F("] not found!")); + } +#endif AudioInterrupts(); uint8_t drum = 0; JsonObject root = drums_json["drums"].as(); for (JsonPair kv : root) { - sprintf(drum_config[drum].filename, "/drm/%s.wav", kv.key().c_str()); + sprintf(drum_config[drum].filename, "%s/%s.wav", ds, kv.key().c_str()); if (!SD.exists(drum_config[drum].filename)) { #ifdef DEBUG @@ -235,31 +253,31 @@ uint8_t read_drum_config(void) Serial.print(F("[Drum ")); Serial.print(drum, DEC); Serial.println(F("]")); - Serial.print(F("drum_class=")); + Serial.print(F("drum_class = ")); Serial.println(drum_config[drum].drum_class, DEC); - Serial.print(F("midinote=")); + Serial.print(F("midinote = ")); Serial.println(drum_config[drum].midinote, DEC); - Serial.print(F("filename=")); + Serial.print(F("filename = ")); Serial.println(drum_config[drum].filename); - Serial.print(F("shortname=")); + Serial.print(F("shortname = ")); Serial.println(drum_config[drum].shortname); - Serial.print(F("pan=")); + Serial.print(F("pan = ")); Serial.println(drum_config[drum].pan); - Serial.print(F("vol_max=")); + Serial.print(F("vol_max = ")); Serial.println(drum_config[drum].vol_max); - Serial.print(F("vol_min=")); + Serial.print(F("vol_min = ")); Serial.println(drum_config[drum].vol_min); - Serial.print(F("reverb_send=")); + Serial.print(F("reverb_send = ")); Serial.println(drum_config[drum].reverb_send); #endif drum++; } - + drum++; drum_config[drum].drum_class = DRUM_NONE; drum_config[drum].midinote = 0; strcpy(drum_config[drum].filename, "EMPTY"); - strcpy(drum_config[drum].shortname, "-"); + strcpy(drum_config[drum].shortname, " - "); drum_config[drum].pan = 0.0; drum_config[drum].vol_max = 0.0; drum_config[drum].vol_min = 0.0; diff --git a/drums.h b/drums.h index 5aa637d..728102a 100644 --- a/drums.h +++ b/drums.h @@ -31,7 +31,7 @@ #ifndef _DRUMS_H #define _DRUMS_H -uint8_t read_drum_config(void); +uint8_t read_drum_config(const char* drumset); typedef struct drum_config_s { uint8_t drum_class; // Type of drum