Dateien hochladen nach „“

pull/98/head
positionhigh 3 years ago
parent 687ac28cbc
commit b5e7f28672
  1. 55
      MicroDexed.ino
  2. 327
      UI.hpp

@ -2151,6 +2151,61 @@ bool eeprom_get_performance()
/******************************************************************************
PARAMETER-HELPERS
******************************************************************************/
void set_sample_pitch(uint8_t sample, float playbackspeed)
{
drum_config[sample].pitch = playbackspeed;
}
void set_sample_p_offset(uint8_t sample, float s_offset)
{
drum_config[sample].p_offset = s_offset;
}
void set_sample_pan(uint8_t sample, float s_pan)
{
drum_config[sample].pan = s_pan;
}
void set_sample_vol_max(uint8_t sample, float s_max)
{
drum_config[sample].vol_max = s_max;
}
void set_sample_vol_min(uint8_t sample, float s_min)
{
drum_config[sample].vol_min = s_min;
}
void set_sample_reverb_send(uint8_t sample, float s_reverb)
{
drum_config[sample].reverb_send = s_reverb;
}
float get_sample_pitch(uint8_t sample)
{
return (drum_config[sample].pitch);
}
float get_sample_p_offset(uint8_t sample)
{
return (drum_config[sample].p_offset);
}
float get_sample_pan(uint8_t sample)
{
return (drum_config[sample].pan);
}
float get_sample_vol_max(uint8_t sample)
{
return (drum_config[sample].vol_max);
}
float get_sample_vol_min(uint8_t sample)
{
return (drum_config[sample].vol_min);
}
float get_sample_reverb_send(uint8_t sample)
{
return (drum_config[sample].reverb_send);
}
void set_fx_params(void)
{

327
UI.hpp

@ -71,8 +71,10 @@ extern char receive_bank_filename[FILENAME_LEN];
#if NUM_DRUMS > 0
#include "drums.h"
extern void get_sd_seq_name_json(uint8_t number);
extern drum_config_t drum_config[NUM_DRUMSET_CONFIG];
extern uint8_t seq_data[10][16];
extern char seq_name[FILENAME_LEN];
extern char seq_name_temp[FILENAME_LEN];
extern uint8_t seq_vel[10][16];
extern uint8_t seq_patternchain[4][4];
extern uint8_t seq_content_type[10];
@ -84,8 +86,8 @@ extern uint8_t seq_bpm;
extern uint8_t seq_chain_lenght;
extern bool seq_running;
extern bool seq_recording;
uint8_t seq_active_function = 99;
uint8_t activesample;
extern bool smartfilter;
extern uint8_t seq_state_last_loadsave;
extern uint8_t seq_active_track;
extern uint8_t seq_menu;
extern uint8_t seq_temp_select_menu;
@ -106,6 +108,8 @@ extern int seq_oct_shift;
extern char arp_style_names[4][3];
extern char seq_chord_names[7][4];
extern float drums_volume;
uint8_t seq_active_function = 99;
uint8_t activesample; extern uint8_t seq_data[10][16];
#endif
#ifdef DISPLAY_LCD_SPI
@ -306,7 +310,9 @@ void UI_func_dexed_assign(uint8_t param);
void UI_func_seq_display_style(uint8_t param);
void UI_func_seq_state_load(uint8_t param);
void UI_func_seq_state_save(uint8_t param);
void UI_func_set_sequence_name(uint8_t param);
void UI_func_volume(uint8_t param);
void UI_func_smart_filter(uint8_t param);
void UI_func_drum_midi_channel(uint8_t param);
void UI_func_load_performance(uint8_t param);
void UI_func_save_performance(uint8_t param);
@ -359,6 +365,7 @@ void locate_random_non_favorite();
void UI_func_drums_main_volume(uint8_t param);
void UI_func_drum_volume(uint8_t param);
void UI_func_drum_pan(uint8_t param);
void UI_func_drum_pitch(uint8_t param);
char* basename(const char* filename);
char* strip_extension(char* filename);
@ -543,6 +550,59 @@ uint8_t * rotTile(const uint8_t * tile)
}
#endif
void smart_filter(uint8_t dir)
{
bool found = false;
//search backwards
if (dir == 0) {
if (smartfilter) {
do {
if (found == false) activesample = constrain(activesample - 1, 0, NUM_DRUMSET_CONFIG - 2);
for (uint8_t d = 0; d < 10; d++)
{
if (seq_content_type[d] == 0) {
for (uint8_t y = 0; y < 16; y++)
{
if (drum_config[activesample].midinote == seq_data[d][y] || drum_config[activesample].midinote == seq_vel[d][y])
{
found = true;
break;
}
}
}
}
} while (found == false && activesample > 0 );
}
else
activesample = constrain(activesample - 1, 0, NUM_DRUMSET_CONFIG - 2);
}
else //search forwards
{
if (smartfilter) {
do {
if (found == false) activesample = constrain(activesample + 1, 0, NUM_DRUMSET_CONFIG - 2);
for (uint8_t d = 0; d < 10; d++)
{
if (seq_content_type[d] == 0) {
for (uint8_t y = 0; y < 16; y++)
{
if (drum_config[activesample].midinote == seq_data[d][y] || drum_config[activesample].midinote == seq_vel[d][y])
{
found = true;
break;
}
}
}
}
} while (found == false && activesample < NUM_DRUMSET_CONFIG - 2 );
}
else
activesample = constrain(activesample + 1, 0, NUM_DRUMSET_CONFIG - 2);
}
}
void setup_ui(void)
{
// LCD Begin
@ -3630,11 +3690,13 @@ void UI_func_drum_reverb_send(uint8_t param)
{
if (LCDML.BT_checkDown())
{
activesample = constrain(activesample + ENCODER[ENC_R].speed(), 0, NUM_DRUMSET_CONFIG - 2);
// activesample = constrain(activesample + ENCODER[ENC_R].speed(), 0, NUM_DRUMSET_CONFIG - 2);
smart_filter(1);
}
else if (LCDML.BT_checkUp())
{
activesample = constrain(activesample - ENCODER[ENC_R].speed(), 0, NUM_DRUMSET_CONFIG - 2);
// activesample = constrain(activesample - ENCODER[ENC_R].speed(), 0, NUM_DRUMSET_CONFIG - 2);
smart_filter(0);
}
}
} else {
@ -3765,6 +3827,95 @@ void UI_func_drums_main_volume(uint8_t param)
encoderDir[ENC_R].reset();
}
}
void UI_func_drum_pitch(uint8_t param)
{
char displayname[8] = {0, 0, 0, 0, 0, 0, 0};
if (LCDML.FUNC_setup()) // ****** SETUP *********
{
encoderDir[ENC_R].reset();
temp_int = (int)(drum_config[activesample].p_offset * 100);
lcd.setCursor(0, 0);
lcd.print("DrumSmp. Pitch");
lcd.setCursor(1, 1);
lcd.setCursor(1, 1);
sprintf(displayname, "%02d", activesample);
lcd.print(displayname);
lcd.show(1, 4, 7, basename(drum_config[activesample].name));
}
if (LCDML.FUNC_loop()) // ****** LOOP *********
{
if (menu_select_toggle == false) {
if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up()) || (LCDML.BT_checkEnter() && encoderDir[ENC_R].ButtonShort()))
{
if (LCDML.BT_checkDown())
{
activesample = constrain(activesample + ENCODER[ENC_R].speed(), 0, NUM_DRUMSET_CONFIG - 2);
}
else if (LCDML.BT_checkUp())
{
activesample = constrain(activesample - ENCODER[ENC_R].speed(), 0, NUM_DRUMSET_CONFIG - 2);
}
}
} else {
if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up()) || (LCDML.BT_checkEnter() && encoderDir[ENC_R].ButtonShort()))
{
if (LCDML.BT_checkDown())
{
temp_int = constrain(temp_int + ENCODER[ENC_R].speed(), 0, 200);
}
else if (LCDML.BT_checkUp())
{
temp_int = constrain(temp_int - ENCODER[ENC_R].speed(), 0, 200);
}
}
}
if (LCDML.BT_checkEnter())
{
if (menu_select_toggle) {
menu_select_toggle = false;
} else
{ menu_select_toggle = true;
temp_int = (int)(drum_config[activesample].p_offset * 100);
}
}
if (menu_select_toggle == false) {
lcd.setCursor(11, 1);
lcd.print(" ");
lcd.setCursor(15, 1);
lcd.print(" ");
lcd.setCursor(0, 1);
lcd.print("[");
lcd.setCursor(3, 1);
lcd.print("]");
lcd.setCursor(1, 1);
sprintf(displayname, "%02d", activesample);
lcd.print(displayname);
lcd.show(1, 4, 7, basename(drum_config[activesample].name));
sprintf(displayname, "%03d", (int)(drum_config[activesample].p_offset * 100) );
lcd.setCursor(12, 1);
lcd.print(displayname);
} else {
temp_float = mapfloat(temp_int, 0, 200, 0.0, 2.0);
lcd.setCursor(0, 1);
lcd.print(" ");
lcd.setCursor(3, 1);
lcd.print(" ");
lcd.setCursor(11, 1);
lcd.print("[");
lcd.setCursor(15, 1);
lcd.print("]");
sprintf(displayname, "%03d", temp_int);
lcd.setCursor(12, 1);
lcd.print(displayname);
drum_config[activesample].p_offset = temp_float;
}
}
if (LCDML.FUNC_close()) // ****** STABLE END *********
{
encoderDir[ENC_R].reset();
}
}
void UI_func_drum_volume(uint8_t param)
{
@ -3789,11 +3940,13 @@ void UI_func_drum_volume(uint8_t param)
{
if (LCDML.BT_checkDown())
{
activesample = constrain(activesample + ENCODER[ENC_R].speed(), 0, NUM_DRUMSET_CONFIG - 2);
// activesample = constrain(activesample + ENCODER[ENC_R].speed(), 0, NUM_DRUMSET_CONFIG - 2);
smart_filter(1);
}
else if (LCDML.BT_checkUp())
{
activesample = constrain(activesample - ENCODER[ENC_R].speed(), 0, NUM_DRUMSET_CONFIG - 2);
// activesample = constrain(activesample - ENCODER[ENC_R].speed(), 0, NUM_DRUMSET_CONFIG - 2);
smart_filter(0);
}
}
} else {
@ -3959,11 +4112,13 @@ void UI_func_drum_pan(uint8_t param)
{
if (LCDML.BT_checkDown())
{
activesample = constrain(activesample + ENCODER[ENC_R].speed(), 0, NUM_DRUMSET_CONFIG - 2);
//activesample = constrain(activesample + ENCODER[ENC_R].speed(), 0, NUM_DRUMSET_CONFIG - 2);
smart_filter(1);
}
else if (LCDML.BT_checkUp())
{
activesample = constrain(activesample - ENCODER[ENC_R].speed(), 0, NUM_DRUMSET_CONFIG - 2);
//activesample = constrain(activesample - ENCODER[ENC_R].speed(), 0, NUM_DRUMSET_CONFIG - 2);
smart_filter(0);
}
}
} else {
@ -4113,21 +4268,6 @@ void seq_printVelGraphBar()
}
}
#endif
// deactivated for now since audio library seems not like to change reverb settings at runtime (and is skipping notes)
//void seq_set_rev_for_single_instr_per_step(uint8_t track, uint8_t note)
//{
//
// if (track < 3) {
// for (uint8_t d = 0; d < NUM_DRUMSET_CONFIG - 1; d++)
// {
// if (seq_data[track][seq_step] == drum_config[d].midinote)
// {
// drum_config[d].reverb_send = float(seq_reverb[track][seq_step]) / float(100);
// break;
// }
// }
// }
//}
void UI_func_seq_display_style(uint8_t param)
{
@ -4469,9 +4609,10 @@ void UI_func_seq_vel_editor(uint8_t param)
lcd.write(219); // cursor symbol
lcd.setCursor(seq_menu - 2, 1);
lcd.print(seq_find_shortname(seq_menu - 2)[0] );
lcd.setCursor(seq_menu , 1);
lcd.print(seq_find_shortname(seq_menu)[0] );
//sprintf(tmp, "%03d", seq_vel[seq_active_track][seq_menu - 1]);
if (seq_menu < 16) {
lcd.setCursor(seq_menu , 1);
lcd.print(seq_find_shortname(seq_menu)[0] );
}
}
if (seq_menu > 0) {
lcd.setCursor(4, 0);
@ -4984,7 +5125,7 @@ void UI_func_seq_pattern_editor(uint8_t param)
lcd.print("EMPTY ");
} else if (temp_int == 110) {
lcd.setCursor(1, 0);
lcd.print("LATCH");
lcd.print("LATCH ");
} else if (temp_int == 111) {
lcd.setCursor(1, 0);
lcd.print("ClrPat");
@ -5704,7 +5845,7 @@ void UI_func_seq_state_load(uint8_t param)
if (LCDML.FUNC_setup()) // ****** SETUP *********
{
char tmp[10];
temp_int = param;
if (seq_state_last_loadsave != 200)temp_int = seq_state_last_loadsave; else temp_int = param;
mode = 0;
encoderDir[ENC_R].reset();
lcd.setCursor(0, 0);
@ -5734,6 +5875,7 @@ void UI_func_seq_state_load(uint8_t param)
else
{
load_sd_seq_json(temp_int);
seq_state_last_loadsave = temp_int;
lcd.print("Done. ");
}
delay(MESSAGE_WAIT_TIME);
@ -5744,13 +5886,16 @@ void UI_func_seq_state_load(uint8_t param)
char tmp[10];
sprintf(tmp, "[%2d]", temp_int);
lcd.print(tmp);
lcd.setCursor(5, 1);
//cd.setCursor(5, 1);
if (check_sd_seq_exists(temp_int))
{
lcd.print("-- DATA --");
get_sd_seq_name_json(temp_int);
if ( seq_name_temp[0] != 0 )
lcd.show(1, 5, 11, seq_name_temp);
else
lcd.print(" -- DATA --");
}
else lcd.print(" ");
else lcd.print(" ");
}
if (LCDML.FUNC_close()) // ****** STABLE END *********
{
@ -5773,7 +5918,7 @@ void UI_func_seq_state_save(uint8_t param)
{
char tmp[FILENAME_LEN];
yesno = false;
temp_int = 0;
if (seq_state_last_loadsave != 200)temp_int = seq_state_last_loadsave; else temp_int = 0;
mode = 0;
encoderDir[ENC_R].reset();
lcd.setCursor(0, 0);
@ -5786,6 +5931,14 @@ void UI_func_seq_state_save(uint8_t param)
overwrite = true;
else
overwrite = false;
if (check_sd_seq_exists(temp_int))
{
get_sd_seq_name_json(temp_int);
if ( seq_name_temp[0] != 0 )
lcd.show(1, 5, 11, seq_name_temp);
else
lcd.print(" -- DATA --");
}
}
if (LCDML.FUNC_loop()) // ****** LOOP *********
{
@ -5826,6 +5979,7 @@ void UI_func_seq_state_save(uint8_t param)
}
save_sd_seq_json(temp_int);
lcd.show(1, 0, 16, "Done.");
seq_state_last_loadsave = temp_int;
delay(MESSAGE_WAIT_TIME);
LCDML.FUNC_goBackToMenu();
}
@ -5853,7 +6007,16 @@ void UI_func_seq_state_save(uint8_t param)
sprintf(tmp, "[%2d]", temp_int);
lcd.print(tmp);
lcd.setCursor(5, 1);
if (overwrite == false)lcd.print("-- empty --"); else lcd.print(" ");
if (overwrite == false) {
lcd.print("-- empty --");
} else if (check_sd_seq_exists(temp_int))
{
get_sd_seq_name_json(temp_int);
if ( seq_name_temp[0] != 0 )
lcd.show(1, 5, 11, seq_name_temp); else
lcd.print("-- DATA --");
}
else lcd.print(" ");
}
else
{
@ -5944,6 +6107,33 @@ void UI_func_midi_soft_thru(uint8_t param)
}
}
void UI_func_smart_filter(uint8_t param)
{
if (LCDML.FUNC_setup()) // ****** SETUP *********
{
encoderDir[ENC_R].reset();
lcd.setCursor(0, 0);
lcd.print(F("Drm Smart Filter"));
}
if (LCDML.FUNC_loop()) // ****** LOOP *********
{
if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up()))
{
if (LCDML.BT_checkDown())
smartfilter = !smartfilter;
else if (LCDML.BT_checkUp())
smartfilter = !smartfilter;
}
lcd.setCursor(0, 1);
if (smartfilter) lcd.print(F("[ON ]")); else lcd.print(F("[OFF]"));
}
if (LCDML.FUNC_close()) // ****** STABLE END *********
{
encoderDir[ENC_R].reset();
}
}
void UI_func_velocity_level(uint8_t param)
{
if (LCDML.FUNC_setup()) // ****** SETUP *********
@ -7576,6 +7766,73 @@ void UI_func_sysex_receive_bank(uint8_t param)
}
}
void UI_func_set_sequence_name(uint8_t param)
{
static uint8_t mode;
static uint8_t ui_select_name_state;
if (LCDML.FUNC_setup()) // ****** SETUP *********
{
encoderDir[ENC_R].reset();
mode = 0;
lcd.setCursor(0, 0);
lcd.print(F("Sequence Name"));
}
if (LCDML.FUNC_loop()) // ****** LOOP *********
{
if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up()))
{
if (LCDML.BT_checkDown()) {
if (mode == 1) ui_select_name_state = UI_select_name(1, 1, seq_name_temp, BANK_NAME_LEN - 1, false);
}
else if (LCDML.BT_checkUp()) {
if (mode == 1) ui_select_name_state = UI_select_name(1, 1, seq_name_temp, BANK_NAME_LEN - 1, false);
// if (ui_select_name_state == false) {
// lcd.setCursor(12, 1);
// lcd.print(" ");
// lcd.setCursor(0, 1);
// lcd.print("[");
// lcd.setCursor(11, 1);
// lcd.print("]");
// lcd.blink();
// ui_select_name_state = UI_select_name(1, 1, seq_name_temp, BANK_NAME_LEN - 1, true);
// }
}
}
else if (LCDML.BT_checkEnter() && encoderDir[ENC_R].ButtonShort())
{
if (mode == 1)
{
ui_select_name_state = UI_select_name(1, 1, seq_name_temp, BANK_NAME_LEN - 1, false);
if (ui_select_name_state == true)
{
strcpy( seq_name, seq_name_temp);
mode = 0xff;
lcd.noBlink();
lcd.setCursor(0, 1);
lcd.print(F("OK. "));
delay(MESSAGE_WAIT_TIME);
LCDML.FUNC_goBackToMenu();
}
}
}
if (mode == 0 )
{
mode = 1;
strcpy(seq_name_temp, seq_name);
lcd.setCursor(0, 1);
lcd.print(F("[ ] "));
ui_select_name_state = UI_select_name(1, 1, seq_name_temp, BANK_NAME_LEN - 1, true);
lcd.blink();
}
}
if (LCDML.FUNC_close()) // ****** STABLE END *********
{
encoderDir[ENC_R].reset();
lcd.noBlink();
}
}
void UI_func_sysex_send_bank(uint8_t param)
{
char bank_name[BANK_NAME_LEN];

Loading…
Cancel
Save