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