From dc0b1ba9836c5e5fa60fc7191e51a6e5b089eb7d Mon Sep 17 00:00:00 2001 From: positionhigh Date: Sun, 15 Aug 2021 22:59:27 +0200 Subject: [PATCH] =?UTF-8?q?Dateien=20hochladen=20nach=20=E2=80=9E=E2=80=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- UI.hpp | 327 +++++++++++++++++++++++++++++++++++++++------------- sequencer.h | 8 +- 2 files changed, 251 insertions(+), 84 deletions(-) diff --git a/UI.hpp b/UI.hpp index f0588a0..2d7ebe1 100644 --- a/UI.hpp +++ b/UI.hpp @@ -92,6 +92,7 @@ extern uint8_t seq_temp_active_menu; extern uint8_t seq_chain_active_chainstep; //for editor extern uint8_t seq_chain_active_step; extern int seq_transpose; +extern uint8_t seq_inst_dexed[4]; extern uint8_t arp_step; extern uint8_t arp_note; extern uint8_t arp_chord; @@ -101,6 +102,7 @@ extern uint8_t arp_style; extern uint8_t arp_speed; extern char arp_style_names[4][3]; extern char seq_chord_names[7][4]; +extern float drums_volume; #endif #ifdef DISPLAY_LCD_SPI @@ -287,6 +289,7 @@ void UI_func_seq_tempo(uint8_t param); void UI_func_seq_pat_chain(uint8_t param); void UI_func_arpeggio(uint8_t param); void UI_func_seq_track_setup(uint8_t param); +void UI_func_dexed_assign(uint8_t param); void UI_func_seq_display_style(uint8_t param); void UI_func_seq_pattern_load(uint8_t param); void UI_func_seq_pattern_save(uint8_t param); @@ -337,7 +340,7 @@ void locate_previous_favorite(); void locate_next_favorite(); void locate_next_non_favorite(); void locate_random_non_favorite(); -void UI_func_drum_main_volume(uint8_t param); +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); @@ -3600,6 +3603,10 @@ void UI_func_drum_reverb_send(uint8_t param) encoderDir[ENC_R].reset(); lcd.setCursor(0, 0); lcd.print("Drum Rev. Send"); + lcd.setCursor(1, 1); + sprintf(displayname, "%02d", activesample); + lcd.print(displayname); + lcd.show(4, 5, 6, basename(drum_config[activesample].name)); } if (LCDML.FUNC_loop()) // ****** LOOP ********* { @@ -3674,9 +3681,42 @@ void UI_func_drum_reverb_send(uint8_t param) } } -void UI_func_drum_main_volume(uint8_t param) +void UI_func_drums_main_volume(uint8_t param) { - ; + char displayname[4] = {0, 0, 0, 0}; + if (LCDML.FUNC_setup()) // ****** SETUP ********* + { + encoderDir[ENC_R].reset(); + temp_int = mapfloat(drums_volume, 0.0, VOL_MAX_FLOAT, 0, 100); + lcd.setCursor(0, 0); + lcd.print(" Drums M.Volume "); + } + if (LCDML.FUNC_loop()) // ****** LOOP ********* + { + 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, 100); + } + else if (LCDML.BT_checkUp()) + { + temp_int = constrain(temp_int - ENCODER[ENC_R].speed(), 0, 100); + } + } + lcd.setCursor(5, 1); + sprintf(displayname, "%03d", temp_int); + lcd.print(displayname); + lcd.setCursor(8, 1); + lcd.print("/100"); + master_mixer_r.gain (2, mapfloat(temp_int, 0, 100, 0.0, VOL_MAX_FLOAT)); + master_mixer_l.gain (2, mapfloat(temp_int, 0, 100, 0.0, VOL_MAX_FLOAT)); + drums_volume = mapfloat(temp_int, 0, 100, 0.0, VOL_MAX_FLOAT); + } + if (LCDML.FUNC_close()) // ****** STABLE END ********* + { + encoderDir[ENC_R].reset(); + } } void UI_func_drum_volume(uint8_t param) @@ -3687,6 +3727,12 @@ void UI_func_drum_volume(uint8_t param) encoderDir[ENC_R].reset(); lcd.setCursor(0, 0); lcd.print("DrumSmp. Volume"); + 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 ********* { @@ -3770,6 +3816,10 @@ void UI_func_drum_pan(uint8_t param) encoderDir[ENC_R].reset(); lcd.setCursor(0, 0); lcd.print("DrmSmp. Panorama"); + lcd.setCursor(1, 1); + sprintf(displayname, "%02d", activesample); + lcd.print(displayname); + lcd.show(1, 4, 6, basename(drum_config[activesample].name)); } if (LCDML.FUNC_loop()) // ****** LOOP ********* { @@ -3843,7 +3893,7 @@ void UI_func_drum_pan(uint8_t param) else { lcd.print("C"); } - sprintf(displayname, "%02d", temp_int); + sprintf(displayname, "%02d", abs(temp_int)); lcd.setCursor(13, 1); lcd.print( displayname); } @@ -4411,7 +4461,7 @@ void UI_func_sequencer(uint8_t param) seq_active_track = constrain(seq_active_track - 1, 0, 9); lcd.setCursor(1, 0); - if (seq_content_type[seq_active_track] == 0) lcd.print("Drum "); else lcd.print("Inst "); //else lcd.print("[ ]"); + if (seq_content_type[seq_active_track] == 0) lcd.print("Drum "); else if (seq_content_type[seq_active_track] == 1) lcd.print("Instr "); else if (seq_content_type[seq_active_track] == 2) lcd.print("Chord "); else lcd.print("Arp "); } } if (LCDML.BT_checkEnter()) //handle button presses during menu >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> @@ -4483,7 +4533,7 @@ void UI_func_sequencer(uint8_t param) seq_active_function = 0; } else if ( seq_menu == 0 && seq_active_function == 0) { - if ( (seq_content_type[seq_active_track] == 0 && activesample == NUM_DRUMSET_CONFIG + 4) || (seq_content_type[seq_active_track] == 1 && temp_int == 114) ) + if ( (seq_content_type[seq_active_track] == 0 && activesample == NUM_DRUMSET_CONFIG + 4) || (seq_content_type[seq_active_track] > 0 && temp_int == 114) ) { //fill patterns lcd.setCursor(0, 0); lcd.print("Fill Pattern:"); @@ -4493,25 +4543,25 @@ void UI_func_sequencer(uint8_t param) seq_temp_select_menu = 0; seq_temp_active_menu = 0; } - else if ( (seq_content_type[seq_active_track] == 0 && activesample == NUM_DRUMSET_CONFIG + 3) || (seq_content_type[seq_active_track] == 1 && temp_int == 113) ) + else if ( (seq_content_type[seq_active_track] == 0 && activesample == NUM_DRUMSET_CONFIG + 3) || (seq_content_type[seq_active_track] > 0 && temp_int == 113) ) { //swap patterns: Active pattern <-> destination pattern lcd.setCursor(0, 0); lcd.print("Swap Pattern:"); temp_int = seq_active_track + 1; if (temp_int > 9)temp_int = 0; seq_menu = 30; - } else if ( (seq_content_type[seq_active_track] == 0 && activesample == NUM_DRUMSET_CONFIG + 2) || (seq_content_type[seq_active_track] == 1 && temp_int == 112) ) + } else if ( (seq_content_type[seq_active_track] == 0 && activesample == NUM_DRUMSET_CONFIG + 2) || (seq_content_type[seq_active_track] > 0 && temp_int == 112) ) { //copy pattern lcd.setCursor(0, 0); lcd.print("Copy Pattern:"); temp_int = seq_active_track + 1; if (temp_int > 9)temp_int = 0; seq_menu = 31; - } else if ( (seq_content_type[seq_active_track] == 0 && activesample == NUM_DRUMSET_CONFIG + 1) || (seq_content_type[seq_active_track] == 1 && temp_int == 111) ) + } else if ( (seq_content_type[seq_active_track] == 0 && activesample == NUM_DRUMSET_CONFIG + 1) || (seq_content_type[seq_active_track] > 0 && temp_int == 111) ) { //clear all patterns seq_clear_all_patterns(); seq_printAllSeqSteps(); - } else if ( (seq_content_type[seq_active_track] == 0 && activesample == NUM_DRUMSET_CONFIG) || (seq_content_type[seq_active_track] == 1 && temp_int == 110) ) + } else if ( (seq_content_type[seq_active_track] == 0 && activesample == NUM_DRUMSET_CONFIG) || (seq_content_type[seq_active_track] > 0 && temp_int == 110) ) { //clear pattern seq_clear_active_pattern(); seq_printAllSeqSteps(); @@ -4600,7 +4650,7 @@ void UI_func_sequencer(uint8_t param) } else if (seq_menu == 32 ) { //fill pattern - if (seq_content_type[seq_active_track] == 0) { //inst + if (seq_content_type[seq_active_track] == 0) { //drum lcd.setCursor(0, 1); lcd.print("with"); lcd.setCursor(4, 1); @@ -4784,8 +4834,8 @@ void UI_func_arpeggio(uint8_t param) if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); - seq_temp_select_menu=0; - seq_temp_active_menu=0; + seq_temp_select_menu = 0; + seq_temp_active_menu = 0; lcd.setCursor( 0, 0); lcd.print("Oct"); lcd.setCursor(7, 0); @@ -4881,79 +4931,79 @@ void UI_func_arpeggio(uint8_t param) } } - - lcd.setCursor( 4, 0); - lcd.print(arp_oct_usersetting); - lcd.setCursor( 6, 1); - lcd.print( arp_style_names[arp_style][0] ); - lcd.print( arp_style_names[arp_style][1] ); - lcd.print( arp_style_names[arp_style][2] ); - lcd.setCursor( 11, 1); - if (arp_speed == 0)lcd.print("1/16"); else if (arp_speed == 1)lcd.print("1/8 "); - if (seq_temp_select_menu == 0) { - lcd.setCursor( 3, 0); - lcd.print("["); - lcd.setCursor( 5, 0); - lcd.print("]"); - lcd.setCursor( 5, 1); - lcd.print(" "); - lcd.setCursor( 9, 1); - lcd.print(" "); - lcd.setCursor( 10, 1); - lcd.print(" "); - lcd.setCursor( 15, 1); - lcd.print(" "); + lcd.setCursor( 4, 0); + lcd.print(arp_oct_usersetting); + lcd.setCursor( 6, 1); + lcd.print( arp_style_names[arp_style][0] ); + lcd.print( arp_style_names[arp_style][1] ); + lcd.print( arp_style_names[arp_style][2] ); + lcd.setCursor( 11, 1); + if (arp_speed == 0)lcd.print("1/16"); else if (arp_speed == 1)lcd.print("1/8 "); - } - else if (seq_temp_select_menu == 1) - { + if (seq_temp_select_menu == 0) { + lcd.setCursor( 3, 0); + lcd.print("["); + lcd.setCursor( 5, 0); + lcd.print("]"); + lcd.setCursor( 5, 1); + lcd.print(" "); + lcd.setCursor( 9, 1); + lcd.print(" "); + lcd.setCursor( 10, 1); + lcd.print(" "); + lcd.setCursor( 15, 1); + lcd.print(" "); - lcd.setCursor( 5, 1); - lcd.print("["); - lcd.setCursor( 9, 1); - lcd.print("]"); - lcd.setCursor( 3, 0); - lcd.print(" "); - lcd.setCursor( 5, 0); - lcd.print(" "); - lcd.setCursor( 11, 0); - lcd.print(" "); - lcd.setCursor( 15, 0); - lcd.print(" "); - } - else if (seq_temp_select_menu == 2) - { - lcd.setCursor( 5, 1); - lcd.print(" "); - lcd.setCursor( 9, 1); - lcd.print(" "); - lcd.setCursor( 11, 0); - lcd.print("["); - lcd.setCursor( 15, 0); - lcd.print("]"); - lcd.setCursor( 10, 1); - lcd.print(" "); - lcd.setCursor( 15, 1); - lcd.print(" "); - } - else if (seq_temp_select_menu == 3) - { - lcd.setCursor( 11, 0); - lcd.print(" "); - lcd.setCursor( 15, 0); - lcd.print(" "); - lcd.setCursor( 10, 1); - lcd.print("["); - lcd.setCursor( 15, 1); - lcd.print("]"); + } + else if (seq_temp_select_menu == 1) + { + + lcd.setCursor( 5, 1); + lcd.print("["); + lcd.setCursor( 9, 1); + lcd.print("]"); lcd.setCursor( 3, 0); - lcd.print(" "); - lcd.setCursor( 5, 0); - lcd.print(" "); + lcd.print(" "); + lcd.setCursor( 5, 0); + lcd.print(" "); + lcd.setCursor( 11, 0); + lcd.print(" "); + lcd.setCursor( 15, 0); + lcd.print(" "); + } + else if (seq_temp_select_menu == 2) + { + lcd.setCursor( 5, 1); + lcd.print(" "); + lcd.setCursor( 9, 1); + lcd.print(" "); + lcd.setCursor( 11, 0); + lcd.print("["); + lcd.setCursor( 15, 0); + lcd.print("]"); + lcd.setCursor( 10, 1); + lcd.print(" "); + lcd.setCursor( 15, 1); + lcd.print(" "); + } + else if (seq_temp_select_menu == 3) + { + lcd.setCursor( 11, 0); + lcd.print(" "); + lcd.setCursor( 15, 0); + lcd.print(" "); + lcd.setCursor( 10, 1); + lcd.print("["); + lcd.setCursor( 15, 1); + lcd.print("]"); + lcd.setCursor( 3, 0); + lcd.print(" "); + lcd.setCursor( 5, 0); + lcd.print(" "); + } + } - - } if (LCDML.FUNC_close()) // ****** STABLE END ********* { encoderDir[ENC_R].reset(); @@ -5265,6 +5315,121 @@ void UI_func_seq_track_setup(uint8_t param) } } +void UI_func_dexed_assign(uint8_t param) +{ + if (LCDML.FUNC_setup()) // ****** SETUP ********* + { + // setup function + seq_temp_active_menu = 99; + lcd.setCursor(0 , 0); + lcd.print("T1"); + lcd.setCursor(0 , 1); + lcd.print("T2"); + lcd.setCursor(9 , 0); + lcd.print("T3"); + lcd.setCursor(9 , 1); + lcd.print("T4"); + lcd.setCursor(3 , 0); + if (seq_inst_dexed[0] == 0 ) lcd.print("D1"); else lcd.print("D2"); + lcd.setCursor(3 , 1); + if (seq_inst_dexed[1] == 0 ) lcd.print("D1"); else lcd.print("D2"); + lcd.setCursor(12 , 0); + if (seq_inst_dexed[2] == 0 ) lcd.print("D1"); else lcd.print("D2"); + lcd.setCursor(12 , 1); + if (seq_inst_dexed[3] == 0 ) lcd.print("D1"); else lcd.print("D2"); + } + if (LCDML.FUNC_loop()) // ****** LOOP ********* + { + if (seq_temp_active_menu == 99) { + if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up())) + { + if (LCDML.BT_checkDown()) + seq_temp_select_menu = constrain(seq_temp_select_menu + 1, 0, 3); + else if (LCDML.BT_checkUp()) + seq_temp_select_menu = constrain(seq_temp_select_menu - 1, 0, 3); + } + } else { + if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up())) + { + if (LCDML.BT_checkDown()) + seq_inst_dexed[seq_temp_active_menu] = constrain(seq_inst_dexed[seq_temp_active_menu] + 1, 0, 1); + else if (LCDML.BT_checkUp()) + seq_inst_dexed[seq_temp_active_menu] = constrain(seq_inst_dexed[seq_temp_active_menu] - 1, 0, 1); + } + } + if (LCDML.BT_checkEnter()) //handle button presses during menu >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> + { + if (seq_temp_active_menu == 99) { + seq_temp_active_menu = seq_temp_select_menu; + } else + { + seq_temp_active_menu = 99; + } + } + if (seq_temp_select_menu == 0) + { + lcd.setCursor(2 , 0); + lcd.print("["); + lcd.setCursor(6 , 0); + lcd.print("]"); + lcd.setCursor(2 , 1); + lcd.print(" "); + lcd.setCursor(6 , 1); + lcd.print(" "); + lcd.setCursor(3 , 0); + if (seq_inst_dexed[0] == 0 ) lcd.print("D1"); else lcd.print("D2"); + } else if (seq_temp_select_menu == 1) + { + lcd.setCursor(2 , 0); + lcd.print(" "); + lcd.setCursor(6 , 0); + lcd.print(" "); + lcd.setCursor(2 , 1); + lcd.print("["); + lcd.setCursor(6 , 1); + lcd.print("]"); + lcd.setCursor(11 , 0); + lcd.print(" "); + lcd.setCursor(15 , 0); + lcd.print(" "); + lcd.setCursor(3 , 1); + if (seq_inst_dexed[1] == 0 ) lcd.print("D1"); else lcd.print("D2"); + } else if (seq_temp_select_menu == 2) + { + lcd.setCursor(2 , 1); + lcd.print(" "); + lcd.setCursor(6 , 1); + lcd.print(" "); + lcd.setCursor(11 , 0); + lcd.print("["); + lcd.setCursor(15 , 0); + lcd.print("]"); + lcd.setCursor(11 , 1); + lcd.print(" "); + lcd.setCursor(15 , 1); + lcd.print(" "); + lcd.setCursor(12 , 0); + if (seq_inst_dexed[2] == 0 ) lcd.print("D1"); else lcd.print("D2"); + } else if (seq_temp_select_menu == 3) + { + lcd.setCursor(11 , 0); + lcd.print(" "); + lcd.setCursor(15 , 0); + lcd.print(" "); + lcd.setCursor(11 , 1); + lcd.print("["); + lcd.setCursor(15 , 1); + lcd.print("]"); + lcd.setCursor(12 , 1); + if (seq_inst_dexed[3] == 0 ) lcd.print("D1"); else lcd.print("D2"); + } + } + if (LCDML.FUNC_close()) // ****** STABLE END ********* + { + encoderDir[ENC_R].reset(); + } +} + void UI_func_seq_pattern_load(uint8_t param) { static uint8_t mode; diff --git a/sequencer.h b/sequencer.h index 4bef2a2..9f25531 100644 --- a/sequencer.h +++ b/sequencer.h @@ -1,4 +1,5 @@ +float drums_volume; uint8_t seq_active_track = 0; uint8_t seq_menu; bool seq_button_r = false; @@ -11,7 +12,7 @@ uint8_t seq_note_in_velocity; int seq_transpose; uint8_t seq_inst_dexed[4] = { 0, 0, 1, 1 }; uint8_t seq_chord_dexed_inst = 0; -uint8_t seq_chord_velocity = 50; +uint8_t seq_chord_velocity = 60; uint8_t arp_style = 0; // up, down, up&down, random uint8_t seq_chords[7][4] = { 4, 7, 0, 0, //major 3, 7, 0, 0, //minor @@ -21,6 +22,7 @@ uint8_t seq_chords[7][4] = { 4, 7, 0, 0, //major 4, 7, 11, 0, //maj7, 0, 0, 0 , 0 //no Chord }; + char seq_chord_names[7][4] = { 'M', 'a', 'j', ' ' , //major 'M', 'i', 'n', ' ' , 's', 'e', 'v', ' ' , @@ -48,7 +50,7 @@ uint8_t seq_prev_vel[4]; uint8_t arp_step; uint8_t arp_note; uint8_t arp_chord = 6; -bool arp_play_basenote=true; +bool arp_play_basenote = true; uint8_t arp_note_prev; uint8_t arp_octave; uint8_t arp_prev_oct; @@ -81,7 +83,7 @@ uint8_t seq_vel[10][16] = {120, 0, 0, 0, 120, 0, 0, 0, 120, 0, 0, 0, 120, 0, 0, uint8_t seq_patternchain[4][4] = { 0 , 1 , 6 , 9 , 0 , 1 , 5 , 8 , 0 , 1 , 6 , 9 , 2 , 1 , 5 , 7 }; uint8_t seq_content_type[10] = { 0, 0, 0, 0 , 1, 1, 1 , 1 , 1 , 1 }; // 0 = track is Drumtrack, 1= Instrumenttrack, 2= Chord or Arpeggio -uint8_t seq_track_type[4] = { 0, 0, 0, 1 }; // 0 = track is Drumtrack, 1 = Instrumenttrack, 2 = Chord, 3 = Arp +uint8_t seq_track_type[4] = { 0, 0, 2, 1 }; // 0 = track is Drumtrack, 1 = Instrumenttrack, 2 = Chord, 3 = Arp //uint8_t seq_reverb[4][16] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0, 0, 0, 0, 15, 0, 0, 0, 0, 0, 0, 0, 36, 0, 0, 0,