Dateien hochladen nach „“

pull/88/head
positionhigh 3 years ago
parent fcdf6598cf
commit a10e504da0
  1. 2
      UI.hpp
  2. 2
      config.h
  3. 52
      dexed_sd.cpp
  4. 1
      drums.h

@ -75,7 +75,7 @@ extern uint8_t seq_data[10][16];
extern uint8_t seq_vel[10][16]; extern uint8_t seq_vel[10][16];
extern uint8_t seq_patternchain[4][4]; extern uint8_t seq_patternchain[4][4];
extern uint8_t seq_content_type[10]; extern uint8_t seq_content_type[10];
extern uint8_t seq_track_type[4]; extern uint8_t seq_track_type[];
extern uint8_t seq_step; extern uint8_t seq_step;
extern uint8_t seq_chord_key_ammount; extern uint8_t seq_chord_key_ammount;
extern int seq_tempo_ms; extern int seq_tempo_ms;

@ -111,6 +111,8 @@
// NUMBER OF PARALLEL SAMPLEDRUMS // NUMBER OF PARALLEL SAMPLEDRUMS
#define NUM_DRUMS 8 #define NUM_DRUMS 8
// NUMBER OF SAMPLES IN DRUMSET
#define NUM_DRUMSET_CONFIG 20
// CHORUS parameters // CHORUS parameters
#define MOD_DELAY_SAMPLE_BUFFER int32_t(TIME_MS2SAMPLES(20.0)) // 20.0 ms delay buffer. #define MOD_DELAY_SAMPLE_BUFFER int32_t(TIME_MS2SAMPLES(20.0)) // 20.0 ms delay buffer.

@ -38,6 +38,7 @@ extern void check_configuration_dexed(uint8_t instance_id);
extern void check_configuration_performance(void); extern void check_configuration_performance(void);
extern void check_configuration_fx(void); extern void check_configuration_fx(void);
extern void sequencer(); extern void sequencer();
extern float drums_volume;
//extern StaticJsonDocument<JSON_BUFFER> data_json; //extern StaticJsonDocument<JSON_BUFFER> data_json;
extern uint8_t seq_chain_lenght; extern uint8_t seq_chain_lenght;
extern uint8_t seq_data[10][16]; extern uint8_t seq_data[10][16];
@ -61,6 +62,19 @@ extern uint8_t seq_chord_dexed_inst;
extern uint8_t seq_inst_dexed[4]; extern uint8_t seq_inst_dexed[4];
extern PeriodicTimer timer1; extern PeriodicTimer timer1;
typedef struct drum_config_s {
uint8_t drum_class; // Type of drum
uint8_t midinote; // Triggered by note
char name[DRUM_NAME_LEN];
const unsigned int* drum_data;
char shortname[2]; // 1 char name for sequencer
float32_t pan; // Panorama (-1.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)
float32_t reverb_send; // how much signal to send to the reverb (0.0 - 1.0)
} drum_config_t;
extern drum_config_t drum_config[NUM_DRUMSET_CONFIG];
/****************************************************************************** /******************************************************************************
SD BANK/VOICE LOADING SD BANK/VOICE LOADING
@ -774,7 +788,7 @@ bool save_sd_fx_json(uint8_t fx)
} }
bool load_sd_seq_drumsettings_json(uint8_t number) bool load_sd_seq_drumsettings_json(uint8_t number)
{ { // test function , to save drumsettings for use in sequencer, so storing in the SEQ_Path for now
if (number < 0) if (number < 0)
return (false); return (false);
@ -809,17 +823,15 @@ bool load_sd_seq_drumsettings_json(uint8_t number)
serializeJsonPretty(data_json, Serial); serializeJsonPretty(data_json, Serial);
Serial.println(); Serial.println();
#endif #endif
drums_volume = data_json["drums_volume"];
// drums_volume = data_json["drums_volume"]; for (uint8_t i = 0; i < NUM_DRUMSET_CONFIG; i++)
for (uint8_t i = 0; i < 20; i++) // needs to replaced by NUM_DRUMSET_CONFIG but does not work
{ {
// drum_config[i].pan = data_json["pan"][i] ; drum_config[i].pan = data_json["pan"][i] ;
// drum_config[i].vol_max = data_json["vol_max"][i] ; drum_config[i].vol_max = data_json["vol_max"][i] ;
// drum_config[i].vol_min = data_json["vol_min"][i] ; drum_config[i].vol_min = data_json["vol_min"][i] ;
// drum_config[i].reverb_send = data_json["reverb_send"][i]; drum_config[i].reverb_send = data_json["reverb_send"][i];
} }
//set_fx_params();
return (true); return (true);
} }
@ -845,7 +857,7 @@ bool load_sd_seq_drumsettings_json(uint8_t number)
} }
bool save_sd_seq_drumsettings_json(uint8_t number) bool save_sd_seq_drumsettings_json(uint8_t number)
{ { // test function , to save drumsettings for use in sequencer, since storing in the SEQ_Path for now
char filename[FILENAME_LEN]; char filename[FILENAME_LEN];
number = constrain(number, 0, 99); number = constrain(number, 0, 99);
@ -863,17 +875,22 @@ bool save_sd_seq_drumsettings_json(uint8_t number)
#endif #endif
AudioNoInterrupts(); AudioNoInterrupts();
if (SD.exists(filename)){
Serial.println("remove old drumsettings file");
SD.remove(filename);
}
json = SD.open(filename, FILE_WRITE); json = SD.open(filename, FILE_WRITE);
if (json) if (json)
{ {
// data_json["drums_volume"] = drums_volume; data_json["drums_volume"] = drums_volume;
for (uint8_t i = 0; i < 20; i++) // needs to be replaced by NUM_DRUMSET_CONFIG for (uint8_t i = 0; i < NUM_DRUMSET_CONFIG; i++)
{ {
// data_json["pan"][i] = drum_config[i].pan; data_json["pan"][i] = drum_config[i].pan;
// data_json["vol_max"][i] = drum_config[i].vol_max; data_json["vol_max"][i] = drum_config[i].vol_max;
// data_json["vol_min"][i] = drum_config[i].vol_min; data_json["vol_min"][i] = drum_config[i].vol_min;
// data_json["reverb_send"][i] = drum_config[i].reverb_send; data_json["reverb_send"][i] = drum_config[i].reverb_send;
} }
#ifdef DEBUG #ifdef DEBUG
Serial.println(F("Write JSON data:")); Serial.println(F("Write JSON data:"));
@ -905,6 +922,8 @@ bool save_sd_seq_json(uint8_t seq_number)
int count = 0; int count = 0;
seq_number = constrain(seq_number, 0, 99); seq_number = constrain(seq_number, 0, 99);
save_sd_seq_drumsettings_json(seq_number);
if (sd_card > 0) if (sd_card > 0)
{ {
File json; File json;
@ -1024,6 +1043,7 @@ bool load_sd_seq_json(uint8_t seq_number)
seq_number = constrain(seq_number, 0, 99); seq_number = constrain(seq_number, 0, 99);
load_sd_seq_drumsettings_json(seq_number);
if (sd_card > 0) if (sd_card > 0)
{ {
File json; File json;

@ -49,7 +49,6 @@ enum {DRUM_NONE, DRUM_BASS, DRUM_SNARE, DRUM_HIHAT, DRUM_HANDCLAP, DRUM_RIDE, DR
// DEFAULT MIDI CHANNEL FOR SAMPLEDRUMS // DEFAULT MIDI CHANNEL FOR SAMPLEDRUMS
uint8_t drum_midi_channel=10; uint8_t drum_midi_channel=10;
#define NUM_DRUMSET_CONFIG 20
drum_config_t drum_config[NUM_DRUMSET_CONFIG] = drum_config_t drum_config[NUM_DRUMSET_CONFIG] =
{ {
{ {

Loading…
Cancel
Save