@ -4003,6 +4003,41 @@ void _check_display_name(bool display_name, uint8_t digits) {
}
}
void _check_display_name_min_max ( uint8_t display_name , uint8_t digits ) {
switch ( display_name ) {
case 0 :
display . setCursor ( 0 , 1 ) ;
display . print ( F ( " [ " ) ) ;
display . setCursor ( 9 , 1 ) ;
display . print ( F ( " ] " ) ) ;
display . setCursor ( LCD_cols - digits - 2 , 1 ) ;
display . print ( F ( " " ) ) ;
display . setCursor ( LCD_cols - 1 , 1 ) ;
display . print ( F ( " " ) ) ;
break ;
case 1 :
display . setCursor ( 0 , 1 ) ;
display . print ( F ( " " ) ) ;
display . setCursor ( 9 , 1 ) ;
display . print ( F ( " " ) ) ;
display . setCursor ( LCD_cols - digits - 2 , 1 ) ;
display . print ( F ( " [ " ) ) ;
display . setCursor ( LCD_cols - 1 , 1 ) ;
display . print ( F ( " ] " ) ) ;
break ;
case 2 :
display . setCursor ( 0 , 1 ) ;
display . print ( F ( " " ) ) ;
display . setCursor ( 9 , 1 ) ;
display . print ( F ( " " ) ) ;
display . setCursor ( LCD_cols - digits - 2 , 1 ) ;
display . print ( F ( " [ " ) ) ;
display . setCursor ( LCD_cols - 1 , 1 ) ;
display . print ( F ( " ] " ) ) ;
break ;
}
}
void UI_func_drum_midi_channel ( uint8_t param ) {
if ( LCDML . FUNC_setup ( ) ) // ****** SETUP *********
{
@ -4142,7 +4177,92 @@ void UI_func_drum_pitch(uint8_t param) {
}
void UI_func_drum_vol_min_max ( uint8_t param ) {
;
static uint8_t input_mode ;
static uint8_t input_type ;
char tmp_val [ 5 ] ;
char tmp_name [ 9 ] ;
if ( LCDML . FUNC_setup ( ) ) // ****** SETUP *********
{
midi_learn_mode = MIDI_LEARN_MODE_ON ;
memset ( tmp_name , ' ' , 8 ) ;
strncpy ( tmp_name , drum_config [ active_sample ] . name , strlen ( drum_config [ active_sample ] . name ) ) ;
tmp_name [ 8 ] = ' \0 ' ;
display . setCursor ( 0 , 0 ) ;
display . print ( F ( " Vol [Min]/ Max " ) ) ;
display . setCursor ( 1 , 1 ) ;
display . print ( tmp_name ) ;
display . setCursor ( LCD_cols - 5 , 1 ) ;
snprintf_P ( tmp_val , sizeof ( tmp_val ) , PSTR ( " %4.1f " ) , configuration . drums . pitch [ active_sample ] / 10.0 ) ;
display . print ( tmp_val ) ;
_check_display_name_min_max ( input_mode , 4 ) ;
}
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 ( ) ) {
switch ( input_mode ) {
case 0 :
if ( active_sample < NUM_DRUMSET_CONFIG - 2 ) {
active_sample + + ;
display . setCursor ( LCD_cols - 5 , 1 ) ;
snprintf_P ( tmp_val , sizeof ( tmp_val ) , PSTR ( " %4.1f " ) , configuration . drums . pitch [ active_sample ] / 10.0 ) ;
display . print ( tmp_val ) ;
}
break ;
case 1 :
configuration . drums . pitch [ active_sample ] = constrain ( configuration . drums . pitch [ active_sample ] + ENCODER [ ENC_L ] . speed ( ) , DRUMS_PITCH_MIN , DRUMS_PITCH_MAX ) ;
break ;
case 2 :
break ;
}
} else if ( LCDML . BT_checkUp ( ) ) {
switch ( input_mode ) {
case 0 :
if ( active_sample > 0 ) {
active_sample - - ;
display . setCursor ( LCD_cols - 5 , 1 ) ;
snprintf_P ( tmp_val , sizeof ( tmp_val ) , PSTR ( " %4.1f " ) , configuration . drums . pitch [ active_sample ] / 10.0 ) ;
display . print ( tmp_val ) ;
}
break ;
case 1 :
configuration . drums . pitch [ active_sample ] = constrain ( configuration . drums . pitch [ active_sample ] - ENCODER [ ENC_L ] . speed ( ) , DRUMS_PITCH_MIN , DRUMS_PITCH_MAX ) ;
break ;
case 2 :
break ;
}
} else if ( LCDML . BT_checkEnter ( ) ) {
input_mode = input_mode + + % 3 ;
}
}
# ifdef DEBUG
if ( input_type = = 0 )
Serial . printf_P ( PSTR ( " Drum volume MIN for active_sample=%d [%s]=%d \n " ) , active_sample , drum_config [ active_sample ] . name , configuration . drums . vol_min [ active_sample ] ) ;
else
Serial . printf_P ( PSTR ( " Drum volume MAX for active_sample=%d [%s]=%d \n " ) , active_sample , drum_config [ active_sample ] . name , configuration . drums . vol_max [ active_sample ] ) ;
# endif
memset ( tmp_name , ' ' , 8 ) ;
strncpy ( tmp_name , drum_config [ active_sample ] . name , strlen ( drum_config [ active_sample ] . name ) ) ;
tmp_name [ 8 ] = ' \0 ' ;
display . setCursor ( 1 , 1 ) ;
display . print ( tmp_name ) ;
display . setCursor ( LCD_cols - 5 , 1 ) ;
snprintf_P ( tmp_val , sizeof ( tmp_val ) , PSTR ( " %4.1f " ) , configuration . drums . pitch [ active_sample ] / 10.0 ) ;
display . print ( tmp_val ) ;
_check_display_name_min_max ( input_mode , 4 ) ;
}
if ( LCDML . FUNC_close ( ) ) // ****** STABLE END *********
{
encoderDir [ ENC_L ] . reset ( ) ;
midi_learn_mode = MIDI_LEARN_MODE_OFF ;
}
}
void UI_func_drum_pan ( uint8_t param ) {
@ -4324,7 +4444,7 @@ void UI_func_drum_midi_note(uint8_t param) {
if ( LCDML . FUNC_loop ( ) ) // ****** LOOP *********
{
if ( midi_learn_mode > MIDI_LEARN_MODE_NULL )
if ( midi_learn_mode > = DRUMS_MIDI_NOTE_MIN )
configuration . drums . midinote [ active_sample ] = midi_learn_mode ;
if ( ( LCDML . BT_checkDown ( ) & & encoderDir [ ENC_R ] . Down ( ) ) | | ( LCDML . BT_checkUp ( ) & & encoderDir [ ENC_R ] . Up ( ) ) | | ( LCDML . BT_checkEnter ( ) & & encoderDir [ ENC_R ] . ButtonShort ( ) ) ) {