Fixed display errors for drum pitch.

dev
Holger Wirtz 2 years ago
parent 7b27aa9d9c
commit 8b5fa7c665
  1. 20
      UI.hpp
  2. 2
      addon/tools/drumset.cfg2
  3. 4
      addon/tools/wav2c.sh
  4. 2
      drumset.h

@ -4075,10 +4075,14 @@ void UI_func_drum_pitch(uint8_t param) {
{ {
midi_learn_mode = true; midi_learn_mode = true;
memset(tmp_name, ' ', 8);
tmp_name[8] = '\0';
strncpy(tmp_name, drum_config[active_sample].name, strlen(drum_config[active_sample].name));
display.setCursor(0, 0); display.setCursor(0, 0);
display.print(F("Drums Pitch")); display.print(F("Drums Pitch"));
display.setCursor(1, 1); display.setCursor(1, 1);
display.print(drum_config[active_sample].name); display.print(tmp_name);
display.setCursor(LCD_cols - 5, 1); display.setCursor(LCD_cols - 5, 1);
snprintf_P(tmp_val, sizeof(tmp_val), PSTR("%4.1f"), configuration.drums.pitch[active_sample] / 10.0); snprintf_P(tmp_val, sizeof(tmp_val), PSTR("%4.1f"), configuration.drums.pitch[active_sample] / 10.0);
display.print(tmp_val); display.print(tmp_val);
@ -4090,19 +4094,23 @@ void UI_func_drum_pitch(uint8_t param) {
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() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up()) || (LCDML.BT_checkEnter() && encoderDir[ENC_R].ButtonShort())) {
if (LCDML.BT_checkDown()) { if (LCDML.BT_checkDown()) {
if (display_name == true) { if (display_name == true) {
active_sample = constrain(++active_sample, 0, NUM_DRUMSET_CONFIG - 1); if (active_sample < NUM_DRUMSET_CONFIG - 2) {
active_sample++;
display.setCursor(LCD_cols - 5, 1); display.setCursor(LCD_cols - 5, 1);
snprintf_P(tmp_val, sizeof(tmp_val), PSTR("%4.1f"), configuration.drums.pitch[active_sample] / 10.0); snprintf_P(tmp_val, sizeof(tmp_val), PSTR("%4.1f"), configuration.drums.pitch[active_sample] / 10.0);
display.print(tmp_val); display.print(tmp_val);
}
} else { } else {
configuration.drums.pitch[active_sample] = constrain(configuration.drums.pitch[active_sample] + ENCODER[ENC_L].speed(), DRUMS_PITCH_MIN, DRUMS_PITCH_MAX); configuration.drums.pitch[active_sample] = constrain(configuration.drums.pitch[active_sample] + ENCODER[ENC_L].speed(), DRUMS_PITCH_MIN, DRUMS_PITCH_MAX);
} }
} else if (LCDML.BT_checkUp()) { } else if (LCDML.BT_checkUp()) {
if (display_name == true) { if (display_name == true) {
active_sample = constrain(--active_sample, 0, NUM_DRUMSET_CONFIG - 1); if (active_sample > 0) {
active_sample--;
display.setCursor(LCD_cols - 5, 1); display.setCursor(LCD_cols - 5, 1);
snprintf_P(tmp_val, sizeof(tmp_val), PSTR("%4.1f"), configuration.drums.pitch[active_sample] / 10.0); snprintf_P(tmp_val, sizeof(tmp_val), PSTR("%4.1f"), configuration.drums.pitch[active_sample] / 10.0);
display.print(tmp_val); display.print(tmp_val);
}
} else { } else {
configuration.drums.pitch[active_sample] = constrain(configuration.drums.pitch[active_sample] - ENCODER[ENC_L].speed(), DRUMS_PITCH_MIN, DRUMS_PITCH_MAX); configuration.drums.pitch[active_sample] = constrain(configuration.drums.pitch[active_sample] - ENCODER[ENC_L].speed(), DRUMS_PITCH_MIN, DRUMS_PITCH_MAX);
} }
@ -4113,8 +4121,12 @@ void UI_func_drum_pitch(uint8_t param) {
#ifdef DEBUG #ifdef DEBUG
Serial.printf("Pitch for active_sample=%d [%s]\n", active_sample, drum_config[active_sample].name); Serial.printf("Pitch for active_sample=%d [%s]\n", active_sample, drum_config[active_sample].name);
#endif #endif
memset(tmp_name, ' ', 8);
tmp_name[8] = '\0';
strncpy(tmp_name, drum_config[active_sample].name, strlen(drum_config[active_sample].name));
display.setCursor(1, 1); display.setCursor(1, 1);
display.print(drum_config[active_sample].name); display.print(tmp_name);
display.setCursor(LCD_cols - 5, 1); display.setCursor(LCD_cols - 5, 1);
snprintf_P(tmp_val, sizeof(tmp_val), PSTR("%4.1f"), configuration.drums.pitch[active_sample] / 10.0); snprintf_P(tmp_val, sizeof(tmp_val), PSTR("%4.1f"), configuration.drums.pitch[active_sample] / 10.0);
display.print(tmp_val); display.print(tmp_val);

@ -0,0 +1,2 @@
# class, midinote, name, shortname, pitch, p_offset, pan, vol_max, vol_min, reverb_send, filename
DRUM_BASS, MIDI_F2, S_loTom_1, B, 1.0, 0.0, 0.8, 0.0, 0.0, S_loTom_1.wav

@ -16,6 +16,7 @@ DRUMS_H="${TMP}/drums.h"
MAX_NUM_DRUMSET_CONFIG=71 # ARDUINO_TEENSY41 MAX_NUM_DRUMSET_CONFIG=71 # ARDUINO_TEENSY41
#MAX_NUM_DRUMSET_CONFIG=40 # ARDUINO_TEENSY40 #MAX_NUM_DRUMSET_CONFIG=40 # ARDUINO_TEENSY40
#MAX_NUM_DRUMSET_CONFIG=19 # ... #MAX_NUM_DRUMSET_CONFIG=19 # ...
NUM_DRUMSET=0
function cleanexit() function cleanexit()
{ {
@ -87,6 +88,7 @@ then
fi fi
mkdir -p "${TMP}" mkdir -p "${TMP}"
rm -f "${DRUMSET_H}"
cat >> "${DRUMSET_H}" << EOF cat >> "${DRUMSET_H}" << EOF
#pragma once #pragma once
@ -188,6 +190,8 @@ do
fi fi
echo "};" >> "${DRUMSET_H}" echo "};" >> "${DRUMSET_H}"
NUM_DRUMSET=`expr "${NUM_DRUMSET_CONFIG}" + 1`
converted_files["${sample['filename']}"]="${sample['c_name']},${sample['len']}" converted_files["${sample['filename']}"]="${sample['c_name']},${sample['len']}"
else else
sample['c_name']=`echo ${converted_files[${sample['filename']}]} | cut -d"," -f1` sample['c_name']=`echo ${converted_files[${sample['filename']}]} | cut -d"," -f1`

@ -239217,7 +239217,7 @@ PROGMEM const uint8_t DRUM_Vl1hbeep[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
}; };
PROGMEM const drum_config_t drum_config[NUM_DRUMSET_CONFIG] = const drum_config_t drum_config[NUM_DRUMSET_CONFIG] =
{ {
{ {
DRUM_BASS, DRUM_BASS,

Loading…
Cancel
Save