@ -140,6 +140,7 @@ extern uint8_t midi_bpm;
elapsedMillis back_from_volume ;
uint8_t instance_num [ 8 ] [ 8 ] ;
const char accepted_chars [ ] = " ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-abcdefghijklmnopqrstuvwxyz " ;
const char noteNames [ 12 ] [ 3 ] = { " C " , " C# " , " D " , " D# " , " E " , " F " , " F# " , " G " , " G# " , " A " , " A# " , " B " } ;
uint8_t active_perform_page = 1 ;
uint8_t orig_attack_values [ 2 ] [ 7 ] ;
uint8_t orig_release_values [ 2 ] [ 7 ] ;
@ -3838,9 +3839,26 @@ void UI_func_drum_pan(uint8_t param)
}
}
const char * seq_find_drum_name_from_note ( uint8_t note )
{
bool found = false ;
const char * shortname ;
for ( uint8_t d = 0 ; d < num_drums - 1 ; d + + )
{
if ( note = = drum_config [ d ] . midinote )
{ shortname = basename ( drum_config [ d ] . filename ) ;
found = true ;
break ;
}
}
if ( found = = false ) shortname = " " ;
return shortname ;
}
const char * seq_find_shortname ( uint8_t sstep )
{
const char * shortname = " " ;
const char * shortname ;
bool found = false ;
if ( seq_content_type [ seq_active_track ] = = 0 ) //is Drumtrack
{
@ -3858,7 +3876,9 @@ const char* seq_find_shortname(uint8_t sstep)
} else
{
// if (seq_data[ seq_patternchain[seq_chain_active_step][seq_active_track] ][sstep] > 0) shortname = "*"; else shortname = "-";
if ( seq_data [ seq_active_track ] [ sstep ] > 0 ) shortname = " * " ; else shortname = " - " ;
if ( seq_data [ seq_active_track ] [ sstep ] > 0 )
shortname = noteNames [ seq_data [ seq_active_track ] [ sstep ] % 12 ] ;
else shortname = " - " ;
}
return shortname ;
}
@ -4093,12 +4113,11 @@ void UI_func_seq_vel_editor(uint8_t param)
// setup function
lcd . setCursor ( 0 , 0 ) ;
lcd . print ( " Vel: " ) ;
//lcd.show(0, 6, 6, basename(drum_config[activesample].filename));
sprintf ( tmp , " %03d " , seq_vel [ seq_active_track ] [ seq_menu - 1 ] ) ;
lcd . setCursor ( 4 , 0 ) ;
lcd . print ( tmp ) ;
lcd . setCursor ( 10 , 0 ) ;
lcd . print ( " Seq [ " ) ;
lcd . setCursor ( 12 , 0 ) ;
lcd . print ( " S[ " ) ;
lcd . setCursor ( 15 , 0 ) ;
lcd . print ( " ] " ) ;
@ -4159,7 +4178,7 @@ void UI_func_seq_vel_editor(uint8_t param)
if ( seq_menu = = 0 ) {
lcd . setCursor ( 4 , 0 ) ;
lcd . print ( " --- " ) ;
lcd . print ( " --- --- " ) ;
lcd . setCursor ( 13 , 0 ) ;
lcd . print ( " [ " ) ;
lcd . print ( seq_active_track ) ;
@ -4167,7 +4186,7 @@ void UI_func_seq_vel_editor(uint8_t param)
lcd . setCursor ( 0 , 1 ) ;
for ( int i = 0 ; i < 16 ; i + + ) {
lcd . setCursor ( i , 1 ) ;
lcd . print ( seq_find_shortname ( i ) ) ;
lcd . print ( seq_find_shortname ( i ) [ 0 ] ) ;
}
} else if ( seq_menu = = 1 ) {
lcd . setCursor ( 13 , 0 ) ;
@ -4177,7 +4196,7 @@ void UI_func_seq_vel_editor(uint8_t param)
lcd . setCursor ( 0 , 1 ) ;
lcd . print ( " x " ) ;
lcd . setCursor ( 1 , 1 ) ;
lcd . print ( seq_find_shortname ( 1 ) ) ;
lcd . print ( seq_find_shortname ( 1 ) [ 0 ] ) ;
sprintf ( tmp , " %03d " , seq_vel [ seq_active_track ] [ seq_menu - 1 ] ) ;
lcd . setCursor ( 4 , 0 ) ;
lcd . print ( tmp ) ;
@ -4185,13 +4204,35 @@ void UI_func_seq_vel_editor(uint8_t param)
lcd . setCursor ( seq_menu - 1 , 1 ) ;
lcd . print ( " x " ) ;
lcd . setCursor ( seq_menu - 2 , 1 ) ;
lcd . print ( seq_find_shortname ( seq_menu - 2 ) ) ;
lcd . print ( seq_find_shortname ( seq_menu - 2 ) [ 0 ] ) ;
lcd . setCursor ( seq_menu , 1 ) ;
lcd . print ( seq_find_shortname ( seq_menu ) ) ;
lcd . print ( seq_find_shortname ( seq_menu ) [ 0 ] ) ;
sprintf ( tmp , " %03d " , seq_vel [ seq_active_track ] [ seq_menu - 1 ] ) ;
lcd . setCursor ( 4 , 0 ) ;
lcd . print ( tmp ) ;
}
if ( seq_menu > 0 ) {
lcd . setCursor ( 8 , 0 ) ;
if ( seq_data [ seq_active_track ] [ seq_menu - 1 ] > 0 ) {
if ( seq_content_type [ seq_active_track ] = = 0 ) //is Drumtrack
{
//activesample=seq_data[seq_active_track][seq_menu - 1];
lcd . show ( 0 , 8 , 5 , seq_find_drum_name_from_note ( seq_data [ seq_active_track ] [ seq_menu - 1 ] ) ) ;
// lcd.show(0, 8, 3, basename(drum_config[activesample].filename));
} else
{
lcd . print ( noteNames [ seq_data [ seq_active_track ] [ seq_menu - 1 ] % 12 ] [ 0 ] ) ;
if ( noteNames [ seq_data [ seq_active_track ] [ seq_menu - 1 ] % 12 ] [ 1 ] ! = ' \0 ' ) {
lcd . print ( noteNames [ seq_data [ seq_active_track ] [ seq_menu - 1 ] % 12 ] [ 1 ] ) ;
}
lcd . print ( ( seq_data [ seq_active_track ] [ seq_menu - 1 ] / 12 ) - 1 ) ;
lcd . print ( " " ) ;
}
}
else
lcd . print ( " " ) ;
}
}
if ( LCDML . FUNC_close ( ) ) // ****** STABLE END *********
{
@ -4203,6 +4244,7 @@ void UI_func_sequencer(uint8_t param)
{
if ( LCDML . FUNC_setup ( ) ) // ****** SETUP *********
{
temp_int = seq_data [ seq_active_track ] [ 0 ] ;
encoderDir [ ENC_R ] . reset ( ) ;
seq_note_in = 0 ;
// setup function
@ -4226,12 +4268,13 @@ void UI_func_sequencer(uint8_t param)
lcd . print ( seq_active_track ) ;
for ( int i = 0 ; i < 16 ; i + + ) {
lcd . setCursor ( i , 1 ) ;
lcd . print ( seq_find_shortname ( i ) ) ;
lcd . print ( seq_find_shortname ( i ) [ 0 ] ) ;
}
}
if ( LCDML . FUNC_loop ( ) ) // ****** LOOP *********
{
if ( seq_active_function = = 99 ) {
if ( seq_active_function = = 99 )
{
if ( ( LCDML . BT_checkDown ( ) & & encoderDir [ ENC_R ] . Down ( ) ) | | ( LCDML . BT_checkUp ( ) & & encoderDir [ ENC_R ] . Up ( ) ) )
{
@ -4241,20 +4284,36 @@ void UI_func_sequencer(uint8_t param)
seq_menu = constrain ( seq_menu - 1 , 0 , 18 ) ;
}
} else if ( seq_active_function = = 0 ) {
if ( seq_content_type [ seq_active_track ] = = 0 ) // is in Drumedit mode
{
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_drums + 1 ) ;
else if ( LCDML . BT_checkUp ( ) )
activesample = constrain ( activesample - 1 , 0 , num_drums + 1 ) ;
}
} else //is in Instrument Mode
{
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_drums + 2 ) ;
temp_int = constrain ( temp_int + 1 , 0 , 111 ) ;
else if ( LCDML . BT_checkUp ( ) )
activesample = constrain ( activesample - 1 , 0 , num_drums + 2 ) ;
temp_int = constrain ( temp_int - 1 , 0 , 111 ) ;
}
}
} else if ( seq_active_function = = 2 ) {
} 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 ( ) )
seq_active_track = constrain ( seq_active_track + 1 , 0 , 9 ) ;
else if ( LCDML . BT_checkUp ( ) )
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 ( LCDML . BT_checkEnter ( ) ) //handle button presses during menu >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
@ -4262,24 +4321,24 @@ void UI_func_sequencer(uint8_t param)
if ( seq_menu = = 0 & & seq_active_function = = 99 )
{
seq_active_function = 0 ;
} else if ( seq_menu = = 0 & & seq_active_function = = 0 )
{
if ( activesample = = num_drums + 2 ) {
if ( ( seq_content_type [ seq_active_track ] = = 0 & & activesample = = num_drums + 1 ) | | ( seq_content_type [ seq_active_track ] = = 0 & & temp_int = = 111 ) ) {
for ( int i = 0 ; i < 10 ; i + + ) {
memset ( seq_data [ i ] , 0 , sizeof ( seq_data [ i ] ) ) ;
memset ( seq_vel [ i ] , 0 , sizeof ( seq_vel [ i ] ) ) ;
}
for ( int i = 0 ; i < 16 ; i + + ) {
lcd . setCursor ( i , 1 ) ;
lcd . print ( seq_find_shortname ( i ) ) ;
lcd . print ( seq_find_shortname ( i ) [ 0 ] ) ;
}
} else if ( activesample = = num_drums + 1 ) {
} else if ( ( seq_content_type [ seq_active_track ] = = 0 & & activesample = = num_drums ) | | ( seq_content_type [ seq_active_track ] = = 0 & & temp_int = = 110 ) ) {
memset ( seq_data [ seq_active_track ] , 0 , sizeof ( seq_data [ seq_active_track ] ) ) ;
memset ( seq_vel [ seq_active_track ] , 0 , sizeof ( seq_vel [ seq_active_track ] ) ) ;
for ( int i = 0 ; i < 16 ; i + + ) {
lcd . setCursor ( i , 1 ) ;
lcd . print ( seq_find_shortname ( i ) ) ;
lcd . print ( seq_find_shortname ( i ) [ 0 ] ) ;
}
}
seq_active_function = 99 ;
@ -4287,14 +4346,11 @@ void UI_func_sequencer(uint8_t param)
if ( seq_menu = = 1 )
{
lcd . setCursor ( 9 , 0 ) ;
if ( seq_running = = false & & seq_recording = = false )
{
seq_running = true ;
lcd . print ( " REC " ) ;
} else
if ( seq_running = = true & & seq_recording = = false )
} else if ( seq_running = = true & & seq_recording = = false )
{
seq_running = true ;
seq_recording = true ;
@ -4310,21 +4366,47 @@ void UI_func_sequencer(uint8_t param)
lcd . print ( " PLY " ) ;
MicroDexed [ 0 ] - > panic ( ) ;
}
} else if ( seq_menu = = 2 )
{
if ( seq_active_function ! = 2 ) seq_active_function = 2 ; else seq_active_function = 99 ;
if ( seq_content_type [ seq_active_track ] = = 0 ) {
if ( activesample < num_drums - 1 )
lcd . show ( 0 , 1 , 6 , basename ( drum_config [ activesample ] . filename ) ) ;
} else {
if ( temp_int < 109 ) {
lcd . setCursor ( 3 , 0 ) ;
lcd . print ( " " ) ;
lcd . setCursor ( 1 , 0 ) ;
lcd . print ( noteNames [ temp_int % 12 ] ) ;
lcd . print ( ( temp_int / 12 ) - 1 ) ;
}
}
} else if ( seq_menu > 2 )
{
if ( seq_active_function = = 99 ) {
if ( seq_content_type [ seq_active_track ] = = 0 ) { //Drumtrack
seq_data [ seq_active_track ] [ seq_menu - 3 ] = drum_config [ activesample ] . midinote ;
seq_vel [ seq_active_track ] [ seq_menu - 3 ] = 120 ;
}
else
{ //Inst. Track
if ( temp_int = = 109 ) { //clear note
seq_data [ seq_active_track ] [ seq_menu - 3 ] = 0 ;
seq_vel [ seq_active_track ] [ seq_menu - 3 ] = 0 ;
} else
{
seq_data [ seq_active_track ] [ seq_menu - 3 ] = temp_int ;
seq_vel [ seq_active_track ] [ seq_menu - 3 ] = 120 ;
}
}
}
else
seq_active_function = 99 ;
}
}
//button check end <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
if ( seq_menu = = 0 ) {
lcd . setCursor ( 8 , 0 ) ;
lcd . print ( " " ) ;
@ -4332,23 +4414,45 @@ void UI_func_sequencer(uint8_t param)
lcd . print ( " " ) ;
lcd . setCursor ( 0 , 0 ) ;
lcd . print ( " [ " ) ;
if ( activesample < num_drums ) {
if ( seq_content_type [ seq_active_track ] = = 0 ) //Drum Mode
{
if ( activesample < num_drums - 1 ) {
lcd . show ( 0 , 1 , 6 , basename ( drum_config [ activesample ] . filename ) ) ;
} else if ( activesample = = num_drums ) {
} else if ( activesample = = num_drums - 1 ) {
lcd . setCursor ( 1 , 0 ) ;
lcd . print ( " EMPTY " ) ;
} else if ( activesample = = num_drums ) {
lcd . setCursor ( 1 , 0 ) ;
lcd . print ( " ClrTrk " ) ;
} else if ( activesample = = num_drums + 1 ) {
lcd . setCursor ( 1 , 0 ) ;
lcd . print ( " ClrAll " ) ;
}
lcd . setCursor ( 7 , 0 ) ;
lcd . print ( " ] " ) ;
} else //Inst. Mode
{
if ( temp_int < 109 ) {
lcd . setCursor ( 3 , 0 ) ;
lcd . print ( " " ) ;
lcd . setCursor ( 1 , 0 ) ;
lcd . print ( noteNames [ temp_int % 12 ] ) ;
lcd . print ( ( temp_int / 12 ) - 1 ) ;
} else if ( temp_int = = 109 ) {
lcd . setCursor ( 1 , 0 ) ;
lcd . print ( " EMPTY " ) ;
} else if ( temp_int = = 110 ) {
lcd . setCursor ( 1 , 0 ) ;
lcd . print ( " ClrTrk " ) ;
} else if ( activesample = = num_drums + 2 ) {
} else if ( temp_int = = 111 ) {
lcd . setCursor ( 1 , 0 ) ;
lcd . print ( " ClrAll " ) ;
}
lcd . setCursor ( 7 , 0 ) ;
lcd . print ( " ] " ) ;
}
if ( seq_menu = = 1 ) {
}
else if ( seq_menu = = 1 ) {
lcd . setCursor ( 0 , 0 ) ;
lcd . print ( " " ) ;
lcd . setCursor ( 7 , 0 ) ;
@ -4390,7 +4494,7 @@ void UI_func_sequencer(uint8_t param)
lcd . setCursor ( 0 , 1 ) ;
for ( int i = 0 ; i < 16 ; i + + ) {
lcd . setCursor ( i , 1 ) ;
lcd . print ( seq_find_shortname ( i ) ) ;
lcd . print ( seq_find_shortname ( i ) [ 0 ] ) ;
}
}
if ( seq_menu = = 3 ) {
@ -4401,16 +4505,15 @@ void UI_func_sequencer(uint8_t param)
lcd . setCursor ( 0 , 1 ) ;
lcd . print ( " x " ) ;
lcd . setCursor ( 1 , 1 ) ;
lcd . print ( seq_find_shortname ( 1 ) ) ;
lcd . print ( seq_find_shortname ( 1 ) [ 0 ] ) ;
}
if ( seq_menu > 3 ) {
lcd . setCursor ( seq_menu - 3 , 1 ) ;
lcd . print ( " x " ) ;
lcd . setCursor ( seq_menu - 4 , 1 ) ;
lcd . print ( seq_find_shortname ( seq_menu - 4 ) ) ;
lcd . print ( seq_find_shortname ( seq_menu - 4 ) [ 0 ] ) ;
lcd . setCursor ( seq_menu - 2 , 1 ) ;
lcd . print ( seq_find_shortname ( seq_menu - 2 ) ) ;
lcd . print ( seq_find_shortname ( seq_menu - 2 ) [ 0 ] ) ;
}
}
if ( LCDML . FUNC_close ( ) ) // ****** STABLE END *********