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. 50
      drums.cpp
  50. 2
      drums.h

@ -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();

@ -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<JsonObject>();
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;

@ -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

Loading…
Cancel
Save