Merge pull request 'reliable Drumsettings load/save between different Teensy Devices-Types' (#108) from positionhigh/MicroDexed:dev into dev

Reviewed-on: https://codeberg.org/dcoredump/MicroDexed/pulls/108
pull/109/head
Holger Wirtz 3 years ago
commit 0e9f481041
  1. 26
      MicroDexed.ino
  2. 78
      addon/SD/SEQ/0-d.json
  3. 78
      addon/SD/SEQ/1-d.json
  4. 80
      addon/SD/SEQ/2-d.json
  5. 80
      addon/SD/SEQ/3-d.json
  6. 78
      addon/SD/SEQ/4-d.json
  7. 78
      addon/SD/SEQ/5-d.json
  8. 84
      addon/SD/SEQ/6-d.json
  9. 80
      addon/SD/SEQ/7-d.json
  10. 78
      addon/SD/SEQ/8-d.json
  11. 2
      config.h
  12. 39
      dexed_sd.cpp

@ -378,7 +378,6 @@ extern char seq_chord_names[7][4];
***********************************************************************/
void setup()
{
delay(50);
#ifdef DEBUG
Serial.begin(SERIAL_SPEED);
#endif
@ -2159,6 +2158,12 @@ bool eeprom_get_performance()
/******************************************************************************
PARAMETER-HELPERS
******************************************************************************/
void set_sample_note(uint8_t sample, uint8_t note)
{
drum_config[sample].midinote = note;
}
void set_sample_pitch(uint8_t sample, float playbackspeed)
{
drum_config[sample].pitch = playbackspeed;
@ -2189,7 +2194,10 @@ void set_sample_reverb_send(uint8_t sample, float s_reverb)
drum_config[sample].reverb_send = s_reverb;
}
uint8_t get_sample_note(uint8_t sample)
{
return (drum_config[sample].midinote);
}
float get_sample_pitch(uint8_t sample)
{
return (drum_config[sample].pitch);
@ -2215,6 +2223,20 @@ float get_sample_reverb_send(uint8_t sample)
return (drum_config[sample].reverb_send);
}
uint8_t find_drum_number_from_note(uint8_t note)
{
uint8_t number=0;
for (uint8_t d = 0; d < NUM_DRUMSET_CONFIG - 1; d++)
{
if (note == drum_config[d].midinote)
{
number = d;
break;
}
}
return number;
}
void set_fx_params(void)
{
#if defined(USE_FX)

@ -1,5 +1,77 @@
{
"drums_volume": 0.95,
"note": [
210,
211,
212,
213,
214,
215,
44,
45,
46,
47,
48,
49,
50,
51,
52,
53,
54,
55,
56,
57,
58,
59,
60,
61,
62,
63,
64,
65,
66,
67,
68,
69,
70,
71,
72,
73,
74,
75,
76,
77,
78,
79,
80,
81,
82,
83,
84,
85,
86,
87,
88,
89,
90,
92,
91,
93,
94,
95,
96,
97,
98,
99,
100,
101,
102,
103,
104,
105,
106,
107
],
"pitch": [
0,
0,
@ -70,7 +142,6 @@
0,
0,
0,
0,
0
],
"p_offset": [
@ -143,7 +214,6 @@
0,
0,
0,
0,
0
],
"pan": [
@ -216,7 +286,6 @@
0,
0,
0,
0,
0
],
"vol_max": [
@ -289,7 +358,6 @@
0,
0,
0,
0,
0
],
"vol_min": [
@ -362,7 +430,6 @@
0,
0,
0,
0,
0
],
"reverb_send": [
@ -435,7 +502,6 @@
0,
0,
0,
0,
0
]
}

@ -1,5 +1,77 @@
{
"drums_volume": 0.95,
"note": [
210,
211,
212,
213,
214,
215,
44,
45,
46,
47,
48,
49,
50,
51,
52,
53,
54,
55,
56,
57,
58,
59,
60,
61,
62,
63,
64,
65,
66,
67,
68,
69,
70,
71,
72,
73,
74,
75,
76,
77,
78,
79,
80,
81,
82,
83,
84,
85,
86,
87,
88,
89,
90,
92,
91,
93,
94,
95,
96,
97,
98,
99,
100,
101,
102,
103,
104,
105,
106,
107
],
"pitch": [
1.498307,
0,
@ -70,7 +142,6 @@
0,
0,
0,
0,
0
],
"p_offset": [
@ -143,7 +214,6 @@
0,
0,
0,
0,
0
],
"pan": [
@ -216,7 +286,6 @@
0,
0,
0,
0,
0
],
"vol_max": [
@ -289,7 +358,6 @@
0,
0,
0,
0,
0
],
"vol_min": [
@ -362,7 +430,6 @@
0,
0,
0,
0,
0
],
"reverb_send": [
@ -435,7 +502,6 @@
0,
0,
0,
0,
0
]
}

@ -1,12 +1,84 @@
{
"drums_volume": 0.95,
"note": [
210,
211,
212,
213,
214,
215,
44,
45,
46,
47,
48,
49,
50,
51,
52,
53,
54,
55,
56,
57,
58,
59,
60,
61,
62,
63,
64,
65,
66,
67,
68,
69,
70,
71,
72,
73,
74,
75,
76,
77,
78,
79,
80,
81,
82,
83,
84,
85,
86,
87,
88,
89,
90,
92,
91,
93,
94,
95,
96,
97,
98,
99,
100,
101,
102,
103,
104,
105,
106,
107
],
"pitch": [
0.420448,
0.178691,
0.140308,
0,
0,
0.629961,
0.561231,
0,
0,
0,
@ -70,7 +142,6 @@
0,
0,
0,
0,
0
],
"p_offset": [
@ -143,7 +214,6 @@
0,
0,
0,
0,
0
],
"pan": [
@ -216,7 +286,6 @@
0,
0,
0,
0,
0
],
"vol_max": [
@ -289,7 +358,6 @@
0,
0,
0,
0,
0
],
"vol_min": [
@ -362,7 +430,6 @@
0,
0,
0,
0,
0
],
"reverb_send": [
@ -435,7 +502,6 @@
0,
0,
0,
0,
0
]
}

@ -1,5 +1,77 @@
{
"drums_volume": 0.95,
"note": [
210,
211,
212,
213,
214,
215,
44,
45,
46,
47,
48,
49,
50,
51,
52,
53,
54,
55,
56,
57,
58,
59,
60,
61,
62,
63,
64,
65,
66,
67,
68,
69,
70,
71,
72,
73,
74,
75,
76,
77,
78,
79,
80,
81,
82,
83,
84,
85,
86,
87,
88,
89,
90,
92,
91,
93,
94,
95,
96,
97,
98,
99,
100,
101,
102,
103,
104,
105,
106,
107
],
"pitch": [
0,
0,
@ -70,7 +142,6 @@
0,
0,
0,
0,
0
],
"p_offset": [
@ -143,7 +214,6 @@
0,
0,
0,
0,
0
],
"pan": [
@ -216,7 +286,6 @@
0,
0,
0,
0,
0
],
"vol_max": [
@ -289,7 +358,6 @@
0,
0,
0,
0,
0
],
"vol_min": [
@ -362,7 +430,6 @@
0,
0,
0,
0,
0
],
"reverb_send": [
@ -374,14 +441,13 @@
0,
0,
0,
0.55,
0,
0,
0,
0,
0,
0.1,
0,
0.1,
0,
0,
0,

@ -1,5 +1,77 @@
{
"drums_volume": 0,
"note": [
210,
211,
212,
213,
214,
215,
44,
45,
46,
47,
48,
49,
50,
51,
52,
53,
54,
55,
56,
57,
58,
59,
60,
61,
62,
63,
64,
65,
66,
67,
68,
69,
70,
71,
72,
73,
74,
75,
76,
77,
78,
79,
80,
81,
82,
83,
84,
85,
86,
87,
88,
89,
90,
92,
91,
93,
94,
95,
96,
97,
98,
99,
100,
101,
102,
103,
104,
105,
106,
107
],
"pitch": [
0,
0,
@ -70,7 +142,6 @@
0,
0,
0,
0,
0
],
"p_offset": [
@ -143,7 +214,6 @@
0,
0,
0,
0,
0
],
"pan": [
@ -216,7 +286,6 @@
0,
0,
0,
0,
0
],
"vol_max": [
@ -289,7 +358,6 @@
0,
0,
0,
0,
0
],
"vol_min": [
@ -362,7 +430,6 @@
0,
0,
0,
0,
0
],
"reverb_send": [
@ -435,7 +502,6 @@
0,
0,
0,
0,
0
]
}

@ -1,5 +1,77 @@
{
"drums_volume": 0.95,
"note": [
210,
211,
212,
213,
214,
215,
44,
45,
46,
47,
48,
49,
50,
51,
52,
53,
54,
55,
56,
57,
58,
59,
60,
61,
62,
63,
64,
65,
66,
67,
68,
69,
70,
71,
72,
73,
74,
75,
76,
77,
78,
79,
80,
81,
82,
83,
84,
85,
86,
87,
88,
89,
90,
92,
91,
93,
94,
95,
96,
97,
98,
99,
100,
101,
102,
103,
104,
105,
106,
107
],
"pitch": [
0,
0,
@ -70,7 +142,6 @@
0,
0,
0,
0,
0
],
"p_offset": [
@ -143,7 +214,6 @@
0,
0,
0,
0,
0
],
"pan": [
@ -216,7 +286,6 @@
0,
0,
0,
0,
0
],
"vol_max": [
@ -289,7 +358,6 @@
0,
0,
0,
0,
0
],
"vol_min": [
@ -362,7 +430,6 @@
0,
0,
0,
0,
0
],
"reverb_send": [
@ -435,7 +502,6 @@
0,
0,
0,
0,
0
]
}

@ -1,10 +1,82 @@
{
"drums_volume": 0.95,
"note": [
210,
211,
212,
213,
214,
215,
44,
45,
46,
47,
48,
49,
50,
51,
52,
53,
54,
55,
56,
57,
58,
59,
60,
61,
62,
63,
64,
65,
66,
67,
68,
69,
70,
71,
72,
73,
74,
75,
76,
77,
78,
79,
80,
81,
82,
83,
84,
85,
86,
87,
88,
89,
90,
92,
91,
93,
94,
95,
96,
97,
98,
99,
100,
101,
102,
103,
104,
105,
106,
107
],
"pitch": [
1.052561,
1.122462,
1.181459,
0.840896,
1,
0.204737,
0.216911,
1,
0,
0,
@ -70,7 +142,6 @@
0,
0,
0,
0,
0
],
"p_offset": [
@ -143,7 +214,6 @@
1,
1,
0,
0,
0
],
"pan": [
@ -216,7 +286,6 @@
0,
0,
0,
0,
0
],
"vol_max": [
@ -289,7 +358,6 @@
1,
1,
0,
0,
0
],
"vol_min": [
@ -362,7 +430,6 @@
0,
0,
0,
0,
0
],
"reverb_send": [
@ -435,7 +502,6 @@
0,
0,
0,
0,
0
]
}

@ -1,7 +1,79 @@
{
"drums_volume": 0.95,
"note": [
210,
211,
212,
213,
214,
215,
44,
45,
46,
47,
48,
49,
50,
51,
52,
53,
54,
55,
56,
57,
58,
59,
60,
61,
62,
63,
64,
65,
66,
67,
68,
69,
70,
71,
72,
73,
74,
75,
76,
77,
78,
79,
80,
81,
82,
83,
84,
85,
86,
87,
88,
89,
90,
92,
91,
93,
94,
95,
96,
97,
98,
99,
100,
101,
102,
103,
104,
105,
106,
107
],
"pitch": [
1.001637,
1.191154,
0,
0,
0.48772,
@ -70,7 +142,6 @@
0,
0,
0,
0,
0
],
"p_offset": [
@ -143,7 +214,6 @@
0,
0,
0,
0,
0
],
"pan": [
@ -216,7 +286,6 @@
0,
0,
0,
0,
0
],
"vol_max": [
@ -289,7 +358,6 @@
1,
1,
0,
0,
0
],
"vol_min": [
@ -362,7 +430,6 @@
0,
0,
0,
0,
0
],
"reverb_send": [
@ -435,7 +502,6 @@
0,
0,
0,
0,
0
]
}

@ -1,5 +1,77 @@
{
"drums_volume": 0.95,
"note": [
210,
211,
212,
213,
214,
215,
44,
45,
46,
47,
48,
49,
50,
51,
52,
53,
54,
55,
56,
57,
58,
59,
60,
61,
62,
63,
64,
65,
66,
67,
68,
69,
70,
71,
72,
73,
74,
75,
76,
77,
78,
79,
80,
81,
82,
83,
84,
85,
86,
87,
88,
89,
90,
92,
91,
93,
94,
95,
96,
97,
98,
99,
100,
101,
102,
103,
104,
105,
106,
107
],
"pitch": [
0.979644,
1,
@ -70,7 +142,6 @@
0,
0,
0,
0,
0
],
"p_offset": [
@ -143,7 +214,6 @@
1,
1,
0,
0,
0
],
"pan": [
@ -216,7 +286,6 @@
0,
0,
0,
0,
0
],
"vol_max": [
@ -289,7 +358,6 @@
1,
1,
0,
0,
0
],
"vol_min": [
@ -362,7 +430,6 @@
0,
0,
0,
0,
0
],
"reverb_send": [
@ -435,7 +502,6 @@
0,
0,
0,
0,
0
]
}

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

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

Loading…
Cancel
Save