Dateien hochladen nach „“

pull/108/head
positionhigh 3 years ago
parent 49e8def8ee
commit c0b79bfc9a
  1. 2
      config.h
  2. 39
      dexed_sd.cpp

@ -90,7 +90,7 @@
//************************************************************************************************* //*************************************************************************************************
//* DEBUG OUTPUT SETTINGS //* DEBUG OUTPUT SETTINGS
//************************************************************************************************* //*************************************************************************************************
//#define DEBUG 1 #define DEBUG 1
#define SERIAL_SPEED 230400 #define SERIAL_SPEED 230400
#define SHOW_XRUN 1 #define SHOW_XRUN 1
#define SHOW_CPU_LOAD_MSEC 5000 #define SHOW_CPU_LOAD_MSEC 5000

@ -68,18 +68,21 @@ extern char seq_name[FILENAME_LEN];
extern char seq_name_temp[FILENAME_LEN]; extern char seq_name_temp[FILENAME_LEN];
extern PeriodicTimer timer1; extern PeriodicTimer timer1;
extern float midi_volume_transform(uint8_t midi_amp); extern float midi_volume_transform(uint8_t midi_amp);
extern void set_sample_note(uint8_t sample, uint8_t note);
extern void set_sample_pitch(uint8_t sample, float playbackspeed); extern void set_sample_pitch(uint8_t sample, float playbackspeed);
extern void set_sample_p_offset(uint8_t sample, float s_offset); extern void set_sample_p_offset(uint8_t sample, float s_offset);
extern void set_sample_pan(uint8_t sample, float s_pan); extern void set_sample_pan(uint8_t sample, float s_pan);
extern void set_sample_vol_max(uint8_t sample, float s_max); extern void set_sample_vol_max(uint8_t sample, float s_max);
extern void set_sample_vol_min(uint8_t sample, float s_min); extern void set_sample_vol_min(uint8_t sample, float s_min);
extern void set_sample_reverb_send(uint8_t sample, float s_reverb); extern void set_sample_reverb_send(uint8_t sample, float s_reverb);
extern uint8_t get_sample_note(uint8_t sample);
extern float get_sample_pitch(uint8_t sample); extern float get_sample_pitch(uint8_t sample);
extern float get_sample_p_offset(uint8_t sample); extern float get_sample_p_offset(uint8_t sample);
extern float get_sample_pan(uint8_t sample); extern float get_sample_pan(uint8_t sample);
extern float get_sample_vol_max(uint8_t sample); extern float get_sample_vol_max(uint8_t sample);
extern float get_sample_vol_min(uint8_t sample); extern float get_sample_vol_min(uint8_t sample);
extern float get_sample_reverb_send(uint8_t sample); extern float get_sample_reverb_send(uint8_t sample);
extern uint8_t find_drum_number_from_note(uint8_t note);
/****************************************************************************** /******************************************************************************
SD BANK/VOICE LOADING SD BANK/VOICE LOADING
@ -484,14 +487,27 @@ bool load_sd_drumsettings_json(uint8_t number, uint8_t target)
#endif #endif
drums_volume = data_json["drums_volume"]; drums_volume = data_json["drums_volume"];
set_drums_volume(drums_volume); set_drums_volume(drums_volume);
for (uint8_t i = 0; i < NUM_DRUMSET_CONFIG; i++) for (uint8_t i = 0; i < NUM_DRUMSET_CONFIG - 1; i++)
{ {
set_sample_pitch( i, data_json["pitch"][i] ); uint8_t drumnumber = 0;
set_sample_p_offset ( i, data_json["p_offset"][i] ); drumnumber = find_drum_number_from_note( data_json["note"][i] );
set_sample_pan( i, data_json["pan"][i]) ; if ( ( (int)data_json["note"][i] > 0 && find_drum_number_from_note( data_json["note"][i] ) > 0 ) ||
set_sample_vol_max( i, data_json["vol_max"][i]) ; ( i == 0 && (int)data_json["note"][i] == 210) )
set_sample_vol_min( i, data_json["vol_min"][i] ); {
set_sample_reverb_send( i, data_json["reverb_send"][i]); set_sample_pitch( drumnumber, data_json["pitch"][i] );
set_sample_p_offset ( drumnumber, data_json["p_offset"][i] );
set_sample_pan( drumnumber, data_json["pan"][i]) ;
set_sample_vol_max( drumnumber, data_json["vol_max"][i]) ;
set_sample_vol_min( drumnumber, data_json["vol_min"][i] );
set_sample_reverb_send( drumnumber, data_json["reverb_send"][i]);
//Serial.print(" drumnumber: ");
//Serial.print(drumnumber);
//Serial.print(" notenumber: ");
//Serial.print(find_drum_number_from_note( data_json["note"][i] ));
//Serial.print(" note: ");
//Serial.print( (int)data_json["note"][i] );
//Serial.println(F(" "));
}
} }
return (true); return (true);
} }
@ -518,7 +534,6 @@ bool save_sd_drumsettings_json(uint8_t number, uint8_t target)
{ {
char filename[FILENAME_LEN]; char filename[FILENAME_LEN];
number = constrain(number, 0, 99); number = constrain(number, 0, 99);
if (sd_card > 0) if (sd_card > 0)
{ {
File json; File json;
@ -533,9 +548,7 @@ bool save_sd_drumsettings_json(uint8_t number, uint8_t target)
Serial.print(F(" to ")); Serial.print(F(" to "));
Serial.println(filename); Serial.println(filename);
#endif #endif
AudioNoInterrupts(); AudioNoInterrupts();
if (SD.exists(filename)) { if (SD.exists(filename)) {
Serial.println("remove old drumsettings file"); Serial.println("remove old drumsettings file");
SD.begin(); SD.begin();
@ -545,9 +558,9 @@ bool save_sd_drumsettings_json(uint8_t number, uint8_t target)
if (json) if (json)
{ {
data_json["drums_volume"] = drums_volume; data_json["drums_volume"] = drums_volume;
for (uint8_t i = 0; i < NUM_DRUMSET_CONFIG - 1; i++)
for (uint8_t i = 0; i < NUM_DRUMSET_CONFIG; i++)
{ {
data_json["note"][i] = get_sample_note(i);
data_json["pitch"][i] = get_sample_pitch(i); data_json["pitch"][i] = get_sample_pitch(i);
data_json["p_offset"][i] = get_sample_p_offset(i); data_json["p_offset"][i] = get_sample_p_offset(i);
data_json["pan"][i] = get_sample_pan(i); data_json["pan"][i] = get_sample_pan(i);

Loading…
Cancel
Save