Dateien hochladen nach „“

pull/98/head
positionhigh 3 years ago
parent ec25987758
commit 687ac28cbc
  1. 2
      config.h
  2. 109
      dexed_sd.cpp
  3. 786
      drums.h
  4. 9
      midinotes.h

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

@ -33,21 +33,6 @@ using namespace TeensyTimerTool;
#include "synth_dexed.h"
#include "dexed_sd.h"
// Bad hack!!!
typedef struct drum_config_s {
uint8_t drum_class; // Type of drum
uint8_t midinote; // Triggered by note
char name[DRUM_NAME_LEN];
const uint8_t* drum_data;
char shortname[2]; // 1 char name for sequencer
uint32_t len; // number of elements in drum_data
float32_t pitch; //
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 void init_MIDI_send_CC(void);
extern void check_configuration_dexed(uint8_t instance_id);
extern void check_configuration_performance(void);
@ -75,9 +60,22 @@ extern uint8_t arp_style;
extern uint8_t seq_chord_velocity;
extern uint8_t seq_chord_dexed_inst;
extern uint8_t seq_inst_dexed[4];
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 drum_config_t drum_config[NUM_DRUMSET_CONFIG];
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 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);
/******************************************************************************
SD BANK/VOICE LOADING
@ -484,11 +482,12 @@ bool load_sd_drumsettings_json(uint8_t number, uint8_t target)
for (uint8_t i = 0; i < NUM_DRUMSET_CONFIG; i++)
{
drum_config[i].pitch = data_json["pitch"][i] ;
drum_config[i].pan = data_json["pan"][i] ;
drum_config[i].vol_max = data_json["vol_max"][i] ;
drum_config[i].vol_min = data_json["vol_min"][i] ;
drum_config[i].reverb_send = data_json["reverb_send"][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]);
}
return (true);
}
@ -535,6 +534,7 @@ bool save_sd_drumsettings_json(uint8_t number, uint8_t target)
if (SD.exists(filename)) {
Serial.println("remove old drumsettings file");
SD.begin();
SD.remove(filename);
}
json = SD.open(filename, FILE_WRITE);
@ -544,11 +544,12 @@ bool save_sd_drumsettings_json(uint8_t number, uint8_t target)
for (uint8_t i = 0; i < NUM_DRUMSET_CONFIG; i++)
{
data_json["pitch"][i] = drum_config[i].pitch;
data_json["pan"][i] = drum_config[i].pan;
data_json["vol_max"][i] = drum_config[i].vol_max;
data_json["vol_min"][i] = drum_config[i].vol_min;
data_json["reverb_send"][i] = drum_config[i].reverb_send;
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);
data_json["vol_max"][i] = get_sample_vol_max(i);
data_json["vol_min"][i] = get_sample_vol_min(i);
data_json["reverb_send"][i] = get_sample_reverb_send(i);
}
#ifdef DEBUG
Serial.println(F("Write JSON data:"));
@ -696,6 +697,8 @@ bool save_sd_voiceconfig_json(uint8_t vc, uint8_t instance_id, uint8_t target)
#endif
AudioNoInterrupts();
SD.begin();
SD.remove(filename);
json = SD.open(filename, FILE_WRITE);
if (json)
{
@ -814,7 +817,9 @@ bool load_sd_fx_json(uint8_t fx, uint8_t target)
configuration.fx.delay_sync[i] = data_json["delay_sync"][i];
configuration.fx.reverb_send[i] = data_json["reverb_send"][i];
if (configuration.fx.delay_sync[i] > 0)
{
configuration.fx.delay_time[i] = 0;
}
}
configuration.fx.reverb_roomsize = data_json["reverb_roomsize"];
configuration.fx.reverb_damping = data_json["reverb_damping"];
@ -878,6 +883,8 @@ bool save_sd_fx_json(uint8_t fx, uint8_t target)
#endif
AudioNoInterrupts();
SD.begin();
SD.remove(filename);
json = SD.open(filename, FILE_WRITE);
if (json)
{
@ -980,7 +987,8 @@ bool save_sd_seq_json(uint8_t seq_number)
Serial.print(F(" "));
AudioNoInterrupts();
SD.begin();
SD.remove(filename);
json = SD.open(filename, FILE_WRITE);
if (json)
{
@ -1046,6 +1054,10 @@ bool save_sd_seq_json(uint8_t seq_number)
for (uint8_t i = 0; i < sizeof(seq_inst_dexed); i++) {
data_json["seq_inst_dexed"][i] = seq_inst_dexed[i];
}
for (uint8_t i = 0; i < FILENAME_LEN; i++) {
data_json["seq_name"][i] = seq_name[i];
}
#ifdef DEBUG
Serial.println(F("Write JSON data:"));
@ -1071,6 +1083,41 @@ bool save_sd_seq_json(uint8_t seq_number)
return (false);
}
void get_sd_seq_name_json(uint8_t seq_number)
{
seq_number = constrain(seq_number, 0, 99);
memset(seq_name_temp, 0, FILENAME_LEN);
if (sd_card > 0)
{
File json;
StaticJsonDocument<JSON_BUFFER_SIZE> data_json;
char filename[FILENAME_LEN];
sprintf(filename, "/%s/%d-S.json", SEQ_CONFIG_PATH, seq_number);
// first check if file exists...
AudioNoInterrupts();
if (SD.exists(filename))
{
// ... and if: load
json = SD.open(filename);
if (json)
{
deserializeJson(data_json, json);
json.close();
AudioInterrupts();
}
if (data_json["seq_name"][0] != 0) {
for (uint8_t i = 0; i < FILENAME_LEN; i++) {
seq_name_temp[i] = data_json["seq_name"][i];
}
}
}
}
}
bool load_sd_seq_json(uint8_t seq_number)
{
if (seq_number < 0)
@ -1152,6 +1199,13 @@ bool load_sd_seq_json(uint8_t seq_number)
for (uint8_t i = 0; i < sizeof(seq_inst_dexed); i++) {
seq_inst_dexed[i] = data_json["seq_inst_dexed"][i];
}
if (data_json["seq_name"][0] != 0) {
for (uint8_t i = 0; i < FILENAME_LEN; i++) {
seq_name[i] = data_json["seq_name"][i];
}
}
count = 0;
seq_tempo_ms = data_json["seq_tempo_ms"] ;
seq_bpm = data_json["seq_bpm"];
@ -1167,6 +1221,7 @@ bool load_sd_seq_json(uint8_t seq_number)
seq_oct_shift = data_json["seq_oct_shift"];
seq_element_shift = data_json["seq_element_shift"];
for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++)
{
configuration.performance.bank[instance_id] = data_json["bank"][instance_id];

File diff suppressed because it is too large Load Diff

@ -5,6 +5,15 @@
#ifndef _MIDINOTES_H
#define _MIDINOTES_H
#define MIDI_C0 12
#define MIDI_CIS0 13
#define MIDI_D0 14
#define MIDI_DIS0 15
#define MIDI_E0 16
#define MIDI_F0 17
#define MIDI_FIS0 18
#define MIDI_G0 19
#define MIDI_GIS0 20
#define MIDI_A0 21
#define MIDI_AIS0 22
#define MIDI_B0 23

Loading…
Cancel
Save