Drums folder organization changed for using different drumsets later.

pull/60/head
Holger Wirtz 3 years ago
parent c0ad47b6af
commit 8125a895e4
  1. 8
      MicroDexed.ino
  2. 0
      addon/SD/drm/StdDrums.json
  3. 0
      addon/SD/drm/StdDrums/808Clap1.wav
  4. 0
      addon/SD/drm/StdDrums/808HHCL1.wav
  5. 0
      addon/SD/drm/StdDrums/808RimS1.wav
  6. 0
      addon/SD/drm/StdDrums/PHKick1.wav
  7. 0
      addon/SD/drm/StdDrums/bd01.wav
  8. 0
      addon/SD/drm/StdDrums/bd02.wav
  9. 0
      addon/SD/drm/StdDrums/bd03.wav
  10. 0
      addon/SD/drm/StdDrums/bd04.wav
  11. 0
      addon/SD/drm/StdDrums/bd05.wav
  12. 0
      addon/SD/drm/StdDrums/bd06.wav
  13. 0
      addon/SD/drm/StdDrums/bd07.wav
  14. 0
      addon/SD/drm/StdDrums/bd08.wav
  15. 0
      addon/SD/drm/StdDrums/bd09.wav
  16. 0
      addon/SD/drm/StdDrums/bd10.wav
  17. 0
      addon/SD/drm/StdDrums/cp01.wav
  18. 0
      addon/SD/drm/StdDrums/cp02.wav
  19. 0
      addon/SD/drm/StdDrums/cr01.wav
  20. 0
      addon/SD/drm/StdDrums/cr02.wav
  21. 0
      addon/SD/drm/StdDrums/hh01.wav
  22. 0
      addon/SD/drm/StdDrums/hh02.wav
  23. 0
      addon/SD/drm/StdDrums/ht01.wav
  24. 0
      addon/SD/drm/StdDrums/ht02.wav
  25. 0
      addon/SD/drm/StdDrums/lt01.wav
  26. 0
      addon/SD/drm/StdDrums/lt02.wav
  27. 0
      addon/SD/drm/StdDrums/mt01.wav
  28. 0
      addon/SD/drm/StdDrums/mt02.wav
  29. 0
      addon/SD/drm/StdDrums/oh01.wav
  30. 0
      addon/SD/drm/StdDrums/oh02.wav
  31. 0
      addon/SD/drm/StdDrums/rd01.wav
  32. 0
      addon/SD/drm/StdDrums/rd02.wav
  33. 0
      addon/SD/drm/StdDrums/rs01.wav
  34. 0
      addon/SD/drm/StdDrums/sd01.wav
  35. 0
      addon/SD/drm/StdDrums/sd02.wav
  36. 0
      addon/SD/drm/StdDrums/sd03.wav
  37. 0
      addon/SD/drm/StdDrums/sd04.wav
  38. 0
      addon/SD/drm/StdDrums/sd05.wav
  39. 0
      addon/SD/drm/StdDrums/sd06.wav
  40. 0
      addon/SD/drm/StdDrums/sd07.wav
  41. 0
      addon/SD/drm/StdDrums/sd08.wav
  42. 0
      addon/SD/drm/StdDrums/sd09.wav
  43. 0
      addon/SD/drm/StdDrums/sd10.wav
  44. 0
      addon/SD/drm/StdDrums/sd11.wav
  45. 0
      addon/SD/drm/StdDrums/sd12.wav
  46. 0
      addon/SD/drm/StdDrums/sd13.wav
  47. 0
      addon/SD/drm/StdDrums/sd14.wav
  48. 0
      addon/SD/drm/StdDrums/sd15.wav
  49. 28
      drums.cpp
  50. 2
      drums.h

@ -109,6 +109,10 @@ AudioMixer8 drum_reverb_send_mixer_l;
#endif #endif
#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 // Audio chain tail
#if defined(USE_FX) #if defined(USE_FX)
#ifdef USE_PLATEREVERB #ifdef USE_PLATEREVERB
@ -329,6 +333,7 @@ uint8_t num_drums = 0;
drum_config_t drum_config[DRUM_MAX_INSTRUMENTS + 1]; drum_config_t drum_config[DRUM_MAX_INSTRUMENTS + 1];
uint8_t drum_counter; uint8_t drum_counter;
uint8_t drum_type[DRUM_MAX_INSTRUMENTS + 1]; uint8_t drum_type[DRUM_MAX_INSTRUMENTS + 1];
char drumset_name[26];
extern void sequencer(void); extern void sequencer(void);
#endif #endif
@ -516,7 +521,8 @@ void setup()
} }
else else
{ {
num_drums = read_drum_config(); strcpy(drumset_name,"StdDrums");
num_drums = read_drum_config(drumset_name);
check_and_create_directories(); check_and_create_directories();

@ -33,19 +33,29 @@
extern drum_config_t drum_config[DRUM_MAX_INSTRUMENTS]; 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; uint8_t config_drums = 0;
char ds[26];
File json; File json;
DynamicJsonDocument drums_json(4096); 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(); AudioNoInterrupts();
if (SD.exists("/DRM/CFGDrums.json")) if (SD.exists(ds))
{ {
#ifdef DEBUG #ifdef DEBUG
Serial.println(F("Found drum configuration file.")); Serial.print(F("Found drum configuration file ["));
Serial.print(ds);
Serial.println(F("]"));
#endif #endif
json = SD.open("/DRM/CFGDrums.json"); json = SD.open(ds);
if (json) if (json)
{ {
deserializeJson(drums_json, json); deserializeJson(drums_json, json);
@ -64,13 +74,21 @@ uint8_t read_drum_config(void)
config_drums = constrain(config_drums, 0, DRUM_MAX_INSTRUMENTS); 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(); AudioInterrupts();
uint8_t drum = 0; uint8_t drum = 0;
JsonObject root = drums_json["drums"].as<JsonObject>(); JsonObject root = drums_json["drums"].as<JsonObject>();
for (JsonPair kv : root) 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)) if (!SD.exists(drum_config[drum].filename))
{ {
#ifdef DEBUG #ifdef DEBUG

@ -31,7 +31,7 @@
#ifndef _DRUMS_H #ifndef _DRUMS_H
#define _DRUMS_H #define _DRUMS_H
uint8_t read_drum_config(void); uint8_t read_drum_config(const char* drumset);
typedef struct drum_config_s { typedef struct drum_config_s {
uint8_t drum_class; // Type of drum uint8_t drum_class; // Type of drum

Loading…
Cancel
Save