Dateien hochladen nach „“

pull/49/head
positionhigh 3 years ago
parent 3434b0d8c7
commit 6fc8cf5e19
  1. 220
      UI.hpp
  2. 12
      drums.h

220
UI.hpp

@ -66,6 +66,7 @@ extern char receive_bank_filename[FILENAME_LEN];
extern uint8_t seqdata[3][16]; extern uint8_t seqdata[3][16];
extern uint8_t seqsteptimer; extern uint8_t seqsteptimer;
extern bool seq_running; extern bool seq_running;
uint8_t seq_active_function = 99;
uint8_t activesample; uint8_t activesample;
#if NUM_DRUMS > 0 #if NUM_DRUMS > 0
#include "drums.h" #include "drums.h"
@ -124,6 +125,7 @@ uint8_t orig_attack_values[2][7];
uint8_t orig_release_values[2][7]; uint8_t orig_release_values[2][7];
uint8_t active_seq_track = 0; uint8_t active_seq_track = 0;
uint8_t seq_menu; uint8_t seq_menu;
bool seq_button_r = false;
#ifdef I2C_DISPLAY #ifdef I2C_DISPLAY
#include <LiquidCrystal_I2C.h> #include <LiquidCrystal_I2C.h>
@ -635,7 +637,8 @@ void lcdml_menu_control(void)
Serial.println(F("ENC-R short")); Serial.println(F("ENC-R short"));
#endif #endif
encoderDir[ENC_R].ButtonShort(true); encoderDir[ENC_R].ButtonShort(true);
seq_button_r = true;
//nexus
LCDML.BT_enter(); LCDML.BT_enter();
} }
} }
@ -3530,24 +3533,18 @@ void UI_handle_OP(uint8_t param)
} }
} }
void UI_func_sequencer(uint8_t param) void UI_func_sequencer(uint8_t param)
{ {
bool foundsound = false;
String displayname = String(8); String displayname = String(8);
if (LCDML.FUNC_setup()) // ****** SETUP ********* if (LCDML.FUNC_setup()) // ****** SETUP *********
{ {
encoderDir[ENC_R].reset(); encoderDir[ENC_R].reset();
seq_button_r = false;
// setup function // setup function
// lcd.print(drum_config[activesample].midinote);
lcd.setCursor(1, 0); lcd.setCursor(1, 0);
displayname = drum_config[activesample].filename; displayname = drum_config[activesample].filename;
lcd.print(displayname.substring(5, 11) ); lcd.print(displayname.substring(5, 11) );
lcd.setCursor(8, 0); lcd.setCursor(8, 0);
lcd.print("["); lcd.print("[");
lcd.setCursor(9, 0); lcd.setCursor(9, 0);
@ -3558,50 +3555,95 @@ void UI_func_sequencer(uint8_t param)
else { else {
lcd.print("RUN"); lcd.print("RUN");
} }
lcd.setCursor(12, 0); lcd.setCursor(12, 0);
lcd.print("]"); lcd.print("]");
lcd.setCursor(14, 0); lcd.setCursor(14, 0);
lcd.print(active_seq_track + 1); lcd.print(active_seq_track + 1);
lcd.setCursor(0, 1);
lcd.print("----------------" );
lcd.setCursor(10, 0); lcd.setCursor(10, 0);
for (int i = 0; i < 16; i++) { for (int i = 0; i < 16; i++) {
lcd.setCursor(i, 1); lcd.setCursor(i, 1);
for (uint8_t d = 0; d < NUM_DRUMCONFIG - 1; d++)
for (uint8_t d = 0; d < NUM_DRUMCONFIG; d++)
{ {
if (seqdata[active_seq_track][i] == drum_config[d].midinote) if (seqdata[active_seq_track][i] == drum_config[d].midinote)
{ {
lcd.print(drum_config[d].shortname ); //one letter name of Category lcd.print(drum_config[d].shortname ); //one letter name of Category
foundsound = true;
break; break;
} }
} }
if (foundsound == false)lcd.print("-");
foundsound = false;
} }
} }
if (LCDML.FUNC_loop()) // ****** LOOP ********* if (LCDML.FUNC_loop()) // ****** LOOP *********
{ {
if (seq_active_function == 99) {
if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up())) if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up()))
{
if (LCDML.BT_checkDown())
seq_menu = constrain(seq_menu + 1, 0, 18);
else if (LCDML.BT_checkUp())
seq_menu = constrain(seq_menu - 1, 0, 18);
}
} else if (seq_active_function == 0 ) {
if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up()))
{
if (LCDML.BT_checkDown())
activesample = constrain(activesample + 1, 0, NUM_DRUMCONFIG - 1 );
else if (LCDML.BT_checkUp())
activesample = constrain(activesample - 1, 0, NUM_DRUMCONFIG - 1 );
}
} else if (seq_active_function == 2) {
if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up()))
{
if (LCDML.BT_checkDown())
active_seq_track = constrain(active_seq_track + 1, 0, 2);
else if (LCDML.BT_checkUp())
active_seq_track = constrain(active_seq_track - 1, 0, 2);
}
}
if (seq_button_r) //handle button presses during menu >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
{ {
if (LCDML.BT_checkDown()) seq_button_r = false;
seq_menu = constrain(seq_menu + 1, 0, 18); if ( seq_menu == 0 && seq_active_function == 99)
else if (LCDML.BT_checkUp()) {
seq_menu = constrain(seq_menu - 1, 0, 18); seq_active_function = 0;
} else if ( seq_menu == 0 && seq_active_function == 0)
{
seq_active_function = 99;
}
if ( seq_menu == 1)
{
lcd.setCursor(9, 0);
if (seq_running == true)
{
seq_running = false;
lcd.print("RUN");
} else
{
seq_running = true;
lcd.print("STP");
}
} else if ( seq_menu == 2)
{
if (seq_active_function != 2) seq_active_function = 2; else seq_active_function = 99;
}
if (seq_menu > 2)
{
if (seq_active_function == 99) {
seqdata[active_seq_track][seq_menu - 3] = drum_config[activesample].midinote;
}
else
seq_active_function = 99;
}
} }
bool foundsound = false; //button check end <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
if (seq_menu == 0) { if (seq_menu == 0) {
lcd.setCursor(8, 0); lcd.setCursor(8, 0);
lcd.print(" "); lcd.print(" ");
lcd.setCursor(12, 0); lcd.setCursor(12, 0);
lcd.print(" "); lcd.print(" ");
lcd.setCursor(0, 0); lcd.setCursor(0, 0);
lcd.print("["); lcd.print("[");
lcd.setCursor(1, 0); lcd.setCursor(1, 0);
@ -3610,9 +3652,7 @@ void UI_func_sequencer(uint8_t param)
lcd.setCursor(7, 0); lcd.setCursor(7, 0);
lcd.print("]"); lcd.print("]");
} }
if (seq_menu == 1) { if (seq_menu == 1) {
lcd.setCursor(0, 0); lcd.setCursor(0, 0);
lcd.print(" "); lcd.print(" ");
lcd.setCursor(7, 0); lcd.setCursor(7, 0);
@ -3621,7 +3661,6 @@ void UI_func_sequencer(uint8_t param)
lcd.print(" "); lcd.print(" ");
lcd.setCursor(15, 0); lcd.setCursor(15, 0);
lcd.print(" "); lcd.print(" ");
lcd.setCursor(8, 0); lcd.setCursor(8, 0);
lcd.print("["); lcd.print("[");
lcd.setCursor(9, 0); lcd.setCursor(9, 0);
@ -3634,51 +3673,43 @@ void UI_func_sequencer(uint8_t param)
} }
lcd.setCursor(12, 0); lcd.setCursor(12, 0);
lcd.print("]"); lcd.print("]");
} }
if (seq_menu == 2) { if (seq_menu == 2) {
lcd.setCursor(8, 0); lcd.setCursor(8, 0);
lcd.print(" "); lcd.print(" ");
lcd.setCursor(12, 0); lcd.setCursor(12, 0);
lcd.print(" "); lcd.print(" ");
lcd.setCursor(13, 0); lcd.setCursor(13, 0);
lcd.print("["); lcd.print("[");
lcd.setCursor(14, 0); lcd.setCursor(14, 0);
lcd.print(active_seq_track + 1); lcd.print(active_seq_track + 1);
lcd.setCursor(15, 0); lcd.setCursor(15, 0);
lcd.print("]"); lcd.print("]");
lcd.setCursor(0, 1); lcd.setCursor(0, 1);
for (int i = 0; i < 16; i++) {
for (uint8_t d = 0; d < NUM_DRUMCONFIG; d++) lcd.setCursor(i, 1);
{ for (uint8_t d = 0; d < NUM_DRUMCONFIG - 1; d++)
if (seqdata[active_seq_track][0] == drum_config[d].midinote)
{ {
lcd.print(drum_config[d].shortname ); //one letter name of Category if (seqdata[active_seq_track][i] == drum_config[d].midinote)
foundsound = true; {
break; lcd.print(drum_config[d].shortname ); //one letter name of Category
foundsound = true;
break;
}
} }
if (foundsound == false)lcd.print("-");
foundsound = false;
} }
if (foundsound == false) lcd.print("-");
foundsound = false;
} }
if (seq_menu == 3) { if (seq_menu == 3) {
lcd.setCursor(15, 0); lcd.setCursor(15, 0);
lcd.print(" "); lcd.print(" ");
lcd.setCursor(13, 0); lcd.setCursor(13, 0);
lcd.print(" "); lcd.print(" ");
lcd.setCursor(0, 1); lcd.setCursor(0, 1);
lcd.print("X"); lcd.print("x");
lcd.setCursor(1, 1); lcd.setCursor(1, 1);
for (uint8_t d = 0; d < NUM_DRUMCONFIG - 1; d++)
for (uint8_t d = 0; d < NUM_DRUMCONFIG; d++)
{ {
if (seqdata[active_seq_track][1] == drum_config[d].midinote) if (seqdata[active_seq_track][1] == drum_config[d].midinote)
{ {
@ -3689,19 +3720,12 @@ void UI_func_sequencer(uint8_t param)
} }
if (foundsound == false) lcd.print("-"); if (foundsound == false) lcd.print("-");
foundsound = false; foundsound = false;
} }
if (seq_menu > 3) { if (seq_menu > 3) {
lcd.setCursor(seq_menu - 3, 1); lcd.setCursor(seq_menu - 3, 1);
lcd.print("X"); lcd.print("x");
lcd.setCursor(seq_menu - 4, 1); lcd.setCursor(seq_menu - 4, 1);
for (uint8_t d = 0; d < NUM_DRUMCONFIG - 1; d++)
for (uint8_t d = 0; d < NUM_DRUMCONFIG; d++)
{ {
if (seqdata[active_seq_track][seq_menu - 4] == drum_config[d].midinote) if (seqdata[active_seq_track][seq_menu - 4] == drum_config[d].midinote)
{ {
@ -3712,10 +3736,8 @@ void UI_func_sequencer(uint8_t param)
} }
if (foundsound == false) lcd.print("-"); if (foundsound == false) lcd.print("-");
foundsound = false; foundsound = false;
lcd.setCursor(seq_menu - 2, 1); lcd.setCursor(seq_menu - 2, 1);
for (uint8_t d = 0; d < NUM_DRUMCONFIG - 1; d++)
for (uint8_t d = 0; d < NUM_DRUMCONFIG; d++)
{ {
if (seqdata[active_seq_track][seq_menu - 2] == drum_config[d].midinote) if (seqdata[active_seq_track][seq_menu - 2] == drum_config[d].midinote)
{ {
@ -3726,84 +3748,12 @@ void UI_func_sequencer(uint8_t param)
} }
if (foundsound == false) lcd.print("-"); if (foundsound == false) lcd.print("-");
foundsound = false; foundsound = false;
}
// if (seq_menu == 55) {
//
// if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up()))
// {
// if (LCDML.BT_checkDown())
// activesample = constrain(activesample + 1, 0, NUM_DRUMCONFIG - 1);
// else if (LCDML.BT_checkUp())
// activesample = constrain(activesample - 1, 0, NUM_DRUMCONFIG - 1);
// }
// }
// else
//
// if (seq_menu == 41) {
//
// if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up()))
// {
// if (LCDML.BT_checkDown())
// activesample = constrain(activesample + 1, 0, NUM_DRUMCONFIG - 1);
// else if (LCDML.BT_checkUp())
// activesample = constrain(activesample - 1, 0, NUM_DRUMCONFIG - 1);
// }
//
//
// lcd.setCursor(1, 0);
// displayname = drum_config[activesample].filename;
//
// lcd.print(displayname.substring(5, 11) );
//
// } else
//
// if (seq_menu == 54) {
//
// ;
//
// } else
//
// if (seq_menu == 555) {
//
// if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up()))
// {
// if (LCDML.BT_checkDown())
// active_seq_track = constrain(active_seq_track + 1, 0, 2);
// else if (LCDML.BT_checkUp())
// active_seq_track = constrain(active_seq_track - 1, 0, 2);
// }
//
// }
lcd.setCursor(0, 1);
lcd.print("----------------" );
for (int i = 0; i < 16; i++) {
lcd.setCursor(i, 1);
for (uint8_t d = 0; d < NUM_DRUMCONFIG; d++)
{
if (seqdata[active_seq_track][i] == drum_config[d].midinote)
{
lcd.print(drum_config[d].shortname ); //one letter name of Category
break;
}
}
} }
} }
if (LCDML.FUNC_close()) // ****** STABLE END ********* if (LCDML.FUNC_close()) // ****** STABLE END *********
{ {
encoderDir[ENC_R].reset(); encoderDir[ENC_R].reset();
} }
} }
void UI_func_information(uint8_t param) void UI_func_information(uint8_t param)

@ -37,7 +37,7 @@ typedef struct drum_config_s {
float32_t vol; // Volume (0.0 - 1.0) float32_t vol; // Volume (0.0 - 1.0)
} drum_config_t; } drum_config_t;
#define NUM_DRUMCONFIG 14 #define NUM_DRUMCONFIG 15
drum_config_t drum_config[NUM_DRUMCONFIG] = { drum_config_t drum_config[NUM_DRUMCONFIG] = {
{ {
DRUM_BASS, DRUM_BASS,
@ -148,6 +148,14 @@ drum_config_t drum_config[NUM_DRUMCONFIG] = {
"H", "H",
0.4, 0.4,
0.6 0.6
} },
{
DRUM_SNARE,
0,
"/drm/EMPTY ",
"-",
0.0,
0.0
}
}; };
#endif #endif

Loading…
Cancel
Save