Added the rest of the drum UI functions.

dev
Holger Wirtz 2 years ago
parent 04cf625696
commit 5b4c861e9a
  1. 2
      MicroDexed.ino
  2. 219
      UI.hpp
  3. 6
      config.h

@ -564,7 +564,7 @@ void setup() {
configuration.drums.drum_vol[i] = mapfloat((drum_config[i].vol_max - drum_config[i].vol_min) / 2.0, 0.0, 1.0, DRUMS_VOL_MIN, DRUMS_VOL_MAX);
configuration.drums.drum_pan[i] = mapfloat(drum_config[i].pan, -1.0, 1.0, DRUMS_PANORAMA_MIN, DRUMS_PANORAMA_MAX);
configuration.drums.drum_reverb_send[i] = mapfloat(drum_config[i].reverb_send, 0.0, 1.0, DRUMS_REVERB_SEND_MIN, DRUMS_REVERB_SEND_MAX);
configuration.drums.drum_pitch[i] = mapfloat(drum_config[i].pitch, 0.0, 1.0, DRUMS_PITCH_MIN, DRUMS_PITCH_MAX);
configuration.drums.drum_pitch[i] = mapfloat(drum_config[i].pitch, -1.0, 1.0, DRUMS_PITCH_MIN, DRUMS_PITCH_MAX);
}
#endif

219
UI.hpp

@ -3965,52 +3965,6 @@ void UI_handle_OP(uint8_t param) {
}
}
void UI_func_drum_reverb_send(uint8_t param) {
char displayname[8];
memset(displayname, 0, sizeof(displayname));
if (LCDML.FUNC_setup()) // ****** SETUP *********
{
encoderDir[ENC_R].reset();
temp_int = (int)(drum_config[activesample].reverb_send * 100);
display.setCursor(0, 0);
display.print("Drum Rev. Send");
display.setCursor(1, 1);
snprintf_P(displayname, sizeof(displayname), PSTR("%02d"), activesample);
display.print(displayname);
display.show(4, 5, 6, basename(drum_config[activesample].name));
}
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()) {
temp_int = constrain(temp_int + ENCODER[ENC_R].speed(), 0, REVERB_SEND_MAX);
} else if (LCDML.BT_checkUp()) {
temp_int = constrain(temp_int - ENCODER[ENC_R].speed(), 0, REVERB_SEND_MAX);
}
}
display.setCursor(0, 1);
display.print(" ");
display.setCursor(3, 1);
display.print(" ");
display.setCursor(11, 1);
display.print("[");
display.setCursor(15, 1);
display.print("]");
snprintf_P(displayname, sizeof(displayname), PSTR("%03d"), temp_int);
display.setCursor(12, 1);
display.print(displayname);
drum_config[activesample].reverb_send = mapfloat(temp_int, 0, 100, 0.0, 1.0);
}
if (LCDML.FUNC_close()) // ****** STABLE END *********
{
encoderDir[ENC_R].reset();
}
}
void UI_func_drum_midi_channel(uint8_t param) {
if (LCDML.FUNC_setup()) // ****** SETUP *********
{
@ -4068,24 +4022,58 @@ void UI_func_drums_main_volume(uint8_t param) {
}
}
void UI_func_drum_pitch(uint8_t param) {
char displayname[8];
void _UI_func_drum_pitch_display(bool mode) {
char temp1[10];
char temp2[10];
memset(temp1, 0, sizeof(temp1));
memset(temp2, 0, sizeof(temp2));
if (mode == false) {
snprintf_P(temp1, sizeof(temp1), PSTR("[%02d]"), activesample + 1);
snprintf_P(temp2, sizeof(temp2), PSTR(" %02d "), abs(configuration.drums.drum_pitch[activesample]));
} else {
snprintf_P(temp1, sizeof(temp1), PSTR(" %02d "), activesample + 1);
snprintf_P(temp2, sizeof(temp2), PSTR("[%02d]"), abs(configuration.drums.drum_pitch[activesample]));
}
display.show(1, 0, 4, temp1);
display.show(1, 4, 8, basename(drum_config[activesample].name));
display.show(1, 12, 4, temp2);
}
memset(displayname, 0, sizeof(displayname));
void UI_func_drum_pitch(uint8_t param) {
static bool mode;
if (LCDML.FUNC_setup()) // ****** SETUP *********
{
encoderDir[ENC_R].reset();
display.setCursor(0, 0);
display.print("Drum Pitch");
display.setCursor(1, 1);
snprintf_P(displayname, sizeof(displayname), PSTR("%02d"), activesample);
display.print(displayname);
display.show(1, 4, 7, basename(drum_config[activesample].name));
_UI_func_drum_pitch_display(mode);
}
if (LCDML.FUNC_loop()) // ****** LOOP *********
{
;
if (LCDML.BT_checkEnter() && encoderDir[ENC_R].ButtonShort()) {
mode = !mode;
} else if (LCDML.BT_checkDown()) {
if (mode == false)
activesample = (activesample + ENCODER[ENC_R].speed()) % (NUM_DRUMSET_CONFIG - 1);
else
configuration.drums.drum_pitch[activesample] = constrain(++configuration.drums.drum_pitch[activesample], DRUMS_PITCH_MIN, DRUMS_PITCH_MAX);
} else if (LCDML.BT_checkUp()) {
if (mode == false) {
uint8_t temp_encoder = ENCODER[ENC_R].speed();
if (activesample - temp_encoder < 0)
activesample = NUM_DRUMSET_CONFIG - (abs(activesample - temp_encoder)) - 1;
else
activesample -= temp_encoder;
} else
configuration.drums.drum_pitch[activesample] = constrain(--configuration.drums.drum_pitch[activesample], DRUMS_PITCH_MIN, DRUMS_PITCH_MAX);
}
// Display and set values
_UI_func_drum_pitch_display(mode);
}
if (LCDML.FUNC_close()) // ****** STABLE END *********
@ -4094,25 +4082,60 @@ void UI_func_drum_pitch(uint8_t param) {
}
}
void UI_func_drum_volume(uint8_t param) {
char displayname[8];
void _UI_func_drum_volume_display(bool mode) {
char temp1[10];
char temp2[10];
memset(displayname, 0, sizeof(displayname));
memset(temp1, 0, sizeof(temp1));
memset(temp2, 0, sizeof(temp2));
if (mode == false) {
snprintf_P(temp1, sizeof(temp1), PSTR("[%02d]"), activesample + 1);
snprintf_P(temp2, sizeof(temp2), PSTR(" %02d "), configuration.drums.drum_vol[activesample]);
} else {
snprintf_P(temp1, sizeof(temp1), PSTR(" %02d "), activesample + 1);
snprintf_P(temp2, sizeof(temp2), PSTR("[%02d]"), configuration.drums.drum_vol[activesample]);
}
display.show(1, 0, 4, temp1);
display.show(1, 4, 8, basename(drum_config[activesample].name));
display.show(1, 12, 4, temp2);
}
void UI_func_drum_volume(uint8_t param) {
static bool mode;
if (LCDML.FUNC_setup()) // ****** SETUP *********
{
encoderDir[ENC_R].reset();
temp_int = (int)(drum_config[activesample].vol_max * 100);
display.setCursor(0, 0);
display.print("Drum Volume");
display.setCursor(1, 1);
snprintf_P(displayname, sizeof(displayname), PSTR("%02d"), activesample);
display.print(displayname);
display.show(1, 4, 7, basename(drum_config[activesample].name));
_UI_func_drum_volume_display(mode);
}
if (LCDML.FUNC_loop()) // ****** LOOP *********
{
;
if (LCDML.BT_checkEnter() && encoderDir[ENC_R].ButtonShort()) {
mode = !mode;
} else if (LCDML.BT_checkDown()) {
if (mode == false)
activesample = (activesample + ENCODER[ENC_R].speed()) % (NUM_DRUMSET_CONFIG - 1);
else
configuration.drums.drum_vol[activesample] = constrain(++configuration.drums.drum_vol[activesample], DRUMS_VOL_MIN, DRUMS_VOL_MAX);
} else if (LCDML.BT_checkUp()) {
if (mode == false) {
uint8_t temp_encoder = ENCODER[ENC_R].speed();
if (activesample - temp_encoder < 0)
activesample = NUM_DRUMSET_CONFIG - (abs(activesample - temp_encoder)) - 1;
else
activesample -= temp_encoder;
} else {
if (configuration.drums.drum_vol[activesample] > DRUMS_VOL_MIN)
configuration.drums.drum_vol[activesample]--;
}
}
// Display and set values
_UI_func_drum_volume_display(mode);
}
if (LCDML.FUNC_close()) // ****** STABLE END *********
@ -4130,15 +4153,15 @@ void _UI_func_drum_pan_display(bool mode) {
if (configuration.drums.drum_pan[activesample] > 25)
display.show(0, 14, 4, ">>");
else if (configuration.drums.drum_pan[activesample] > 10)
display.show(0, 14, 4, "> ");
display.show(0, 14, 4, " >");
else if (configuration.drums.drum_pan[activesample] > 0)
display.show(0, 14, 4, ">=");
display.show(0, 14, 4, "=>");
else if (configuration.drums.drum_pan[activesample] < -25)
display.show(0, 14, 4, "<<");
else if (configuration.drums.drum_pan[activesample] < -10)
display.show(0, 14, 4, " <");
display.show(0, 14, 4, "< ");
else if (configuration.drums.drum_pan[activesample] < 0)
display.show(0, 14, 4, "=<");
display.show(0, 14, 4, "<=");
else
display.show(0, 14, 4, "==");
if (mode == false) {
@ -4188,8 +4211,68 @@ void UI_func_drum_pan(uint8_t param) {
// Display and set values
_UI_func_drum_pan_display(mode);
}
if (LCDML.FUNC_close()) // ****** STABLE END *********
{
encoderDir[ENC_R].reset();
}
}
void _UI_func_drum_reverb_send_display(bool mode) {
char temp1[10];
char temp2[10];
memset(temp1, 0, sizeof(temp1));
memset(temp2, 0, sizeof(temp2));
//configuration.drums.drum_pan[i] = mapfloat(drum_config[i].pan, 0.0, 1.0, DRUMS_PANORAMA_MIN, DRUMS_PANORAMA_MAX);
if (mode == false) {
snprintf_P(temp1, sizeof(temp1), PSTR("[%02d]"), activesample + 1);
snprintf_P(temp2, sizeof(temp2), PSTR(" %02d "), configuration.drums.drum_reverb_send[activesample]);
} else {
snprintf_P(temp1, sizeof(temp1), PSTR(" %02d "), activesample + 1);
snprintf_P(temp2, sizeof(temp2), PSTR("[%02d]"), configuration.drums.drum_reverb_send[activesample]);
}
display.show(1, 0, 4, temp1);
display.show(1, 4, 8, basename(drum_config[activesample].name));
display.show(1, 12, 4, temp2);
}
void UI_func_drum_reverb_send(uint8_t param) {
static bool mode;
if (LCDML.FUNC_setup()) // ****** SETUP *********
{
encoderDir[ENC_R].reset();
display.setCursor(0, 0);
display.print("Drum RevSend");
_UI_func_drum_reverb_send_display(mode);
}
if (LCDML.FUNC_loop()) // ****** LOOP *********
{
if (LCDML.BT_checkEnter() && encoderDir[ENC_R].ButtonShort()) {
mode = !mode;
} else if (LCDML.BT_checkDown()) {
if (mode == false)
activesample = (activesample + ENCODER[ENC_R].speed()) % (NUM_DRUMSET_CONFIG - 1);
else
configuration.drums.drum_reverb_send[activesample] = constrain(++configuration.drums.drum_reverb_send[activesample], DRUMS_REVERB_SEND_MIN, DRUMS_REVERB_SEND_MAX);
} else if (LCDML.BT_checkUp()) {
if (mode == false) {
uint8_t temp_encoder = ENCODER[ENC_R].speed();
if (activesample - temp_encoder < 0)
activesample = NUM_DRUMSET_CONFIG - (abs(activesample - temp_encoder)) - 1;
else
activesample -= temp_encoder;
} else {
if (configuration.drums.drum_reverb_send[activesample] > DRUMS_REVERB_SEND_MIN)
configuration.drums.drum_reverb_send[activesample]--;
}
}
// Display and set values
_UI_func_drum_reverb_send_display(mode);
}
if (LCDML.FUNC_close()) // ****** STABLE END *********

@ -673,8 +673,8 @@
#define DRUMS_REVERB_SEND_MIN 0
#define DRUMS_REVERB_SEND_MAX 99
#define DRUMS_PITCH_MIN 0
#define DRUMS_PITCH_MAX 99
#define DRUMS_PITCH_MIN -50
#define DRUMS_PITCH_MAX 50
#define EQ_1_MIN 15
#define EQ_1_MAX 250
@ -936,7 +936,7 @@ typedef struct drums_s {
uint8_t drum_vol[NUM_DRUMSET_CONFIG - 1];
int8_t drum_pan[NUM_DRUMSET_CONFIG - 1];
uint8_t drum_reverb_send[NUM_DRUMSET_CONFIG - 1];
uint8_t drum_pitch[NUM_DRUMSET_CONFIG - 1];
int8_t drum_pitch[NUM_DRUMSET_CONFIG - 1];
} drum_t;
typedef struct configuration_s {

Loading…
Cancel
Save