Dateien hochladen nach „“

pull/64/head
positionhigh 3 years ago
parent eb6130820c
commit f74c6ebb0f
  1. 75
      MicroDexed.ino
  2. 233
      UI.hpp
  3. 12
      sequencer.cpp
  4. 4
      sequencer.h

@ -138,36 +138,36 @@ AudioMixer8 drum_reverb_send_mixer_l;
{stereo2mono, 0, i2s1, 0},
{stereo2mono, 1, i2s1, 1},
#endif
#elif defined (I2S_AUDIO_ONLY)
AudioOutputI2S i2s1;
AudioConnection patchCord10(stereo2mono, 0, i2s1, 0);
AudioConnection patchCord11(stereo2mono, 1, i2s1, 1);
#elif defined(TGA_AUDIO_BOARD)
AudioOutputI2S i2s1;
AudioConnection patchCord10(stereo2mono, 0, i2s1, 0);
AudioConnection patchCord11(stereo2mono, 1, i2s1, 1);
AudioControlWM8731master wm8731_1;
#elif defined(PT8211_AUDIO)
AudioOutputPT8211 pt8211_1;
AudioConnection patchCord10(stereo2mono, 0, pt8211_1, 0);
AudioConnection patchCord11(stereo2mono, 1, pt8211_1, 1);
#elif defined(TEENSY_DAC_SYMMETRIC)
AudioOutputAnalogStereo dacOut;
AudioMixer4 invMixer;
AudioConnection patchCord10(stereo2mono, 0, dacOut , 0);
AudioConnection patchCord11(stereo2mono, 1, invMixer, 0);
AudioConnection patchCord12(invMixer, 0, dacOut , 1);
#elif defined(TEENSY_DAC)
AudioOutputAnalogStereo dacOut;
AudioConnection patchCord10(stereo2mono, 0, dacOut, 0);
AudioConnection patchCord11(stereo2mono, 1, dacOut, 1);
#endif
#ifdef AUDIO_DEVICE_USB
AudioOutputUSB usb1;
AudioConnection patchCord13(stereo2mono, 0, usb1, 0);
AudioConnection patchCord14(stereo2mono, 1, usb1, 1);
#endif
#elif defined (I2S_AUDIO_ONLY)
AudioOutputI2S i2s1;
AudioConnection patchCord10(stereo2mono, 0, i2s1, 0);
AudioConnection patchCord11(stereo2mono, 1, i2s1, 1);
#elif defined(TGA_AUDIO_BOARD)
AudioOutputI2S i2s1;
AudioConnection patchCord10(stereo2mono, 0, i2s1, 0);
AudioConnection patchCord11(stereo2mono, 1, i2s1, 1);
AudioControlWM8731master wm8731_1;
#elif defined(PT8211_AUDIO)
AudioOutputPT8211 pt8211_1;
AudioConnection patchCord10(stereo2mono, 0, pt8211_1, 0);
AudioConnection patchCord11(stereo2mono, 1, pt8211_1, 1);
#elif defined(TEENSY_DAC_SYMMETRIC)
AudioOutputAnalogStereo dacOut;
AudioMixer4 invMixer;
AudioConnection patchCord10(stereo2mono, 0, dacOut , 0);
AudioConnection patchCord11(stereo2mono, 1, invMixer, 0);
AudioConnection patchCord12(invMixer, 0, dacOut , 1);
#elif defined(TEENSY_DAC)
AudioOutputAnalogStereo dacOut;
AudioConnection patchCord10(stereo2mono, 0, dacOut, 0);
AudioConnection patchCord11(stereo2mono, 1, dacOut, 1);
#endif
#ifdef AUDIO_DEVICE_USB
AudioOutputUSB usb1;
AudioConnection patchCord13(stereo2mono, 0, usb1, 0);
AudioConnection patchCord14(stereo2mono, 1, usb1, 1);
#endif
*/
// Audio chain tail
@ -2476,6 +2476,15 @@ void check_and_create_directories(void)
#endif
SD.mkdir(tmp);
}
sprintf(tmp, "/%s", SEQ_CONFIG_PATH);
if (!SD.exists(tmp))
{
#ifdef DEBUG
Serial.print(F("Creating directory "));
Serial.println(tmp);
#endif
SD.mkdir(tmp);
}
//check if updated Fav-System is ready or if setup has to run once.
@ -2494,7 +2503,6 @@ void check_and_create_directories(void)
if (SD.exists(tmp))
SD.remove(tmp);
}
// Remove empty Folders. rmdir will only remove strictly emtpy folders, which is the desired result.
// Only needs to run once.
for (uint8_t i = 0; i < MAX_BANKS; i++)
@ -2507,14 +2515,13 @@ void check_and_create_directories(void)
if (SD.exists(tmp))
SD.rmdir(tmp);
}
sprintf(tmp, "/%s/fav-v2", FAV_CONFIG_PATH);
if (!SD.exists(tmp))
SD.mkdir(tmp); // Set Marker so that the Cleanup loops only run once.
} else
#ifdef DEBUG
Serial.println(F("Favs-V2 ready. "));
#endif
}
#ifdef DEBUG
else

233
UI.hpp

@ -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 ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up()))
if (seq_content_type[seq_active_track] == 0) // is in Drumedit mode
{
if (LCDML.BT_checkDown())
activesample = constrain(activesample + 1, 0, num_drums + 2 );
else if (LCDML.BT_checkUp())
activesample = constrain(activesample - 1, 0, num_drums + 2 );
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())
temp_int = constrain(temp_int + 1, 0, 111 );
else if (LCDML.BT_checkUp())
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,44 +4346,67 @@ 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)
{
seq_running = true;
seq_recording = true;
seq_note_in = 0;
lcd.print("STP");
} else if (seq_running == true && seq_recording == true)
{
seq_running = false;
seq_recording = false;
seq_note_in = 0;
seq_step = 0;
seq_chain_active_step = 0;
lcd.print("PLY");
MicroDexed[0]->panic();
}
} else if (seq_running == true && seq_recording == false)
{
seq_running = true;
seq_recording = true;
seq_note_in = 0;
lcd.print("STP");
} else if (seq_running == true && seq_recording == true)
{
seq_running = false;
seq_recording = false;
seq_note_in = 0;
seq_step = 0;
seq_chain_active_step = 0;
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) {
seq_data[seq_active_track][seq_menu - 3] = drum_config[activesample].midinote;
seq_vel[seq_active_track][seq_menu - 3] = 120;
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) {
lcd.show(0, 1, 6, basename(drum_config[activesample].filename));
} else if (activesample == num_drums) {
lcd.setCursor(1, 0);
lcd.print("EMPTY ");
} else if (activesample == num_drums + 1) {
lcd.setCursor(1, 0);
lcd.print("ClrTrk");
} else if (activesample == num_drums + 2) {
lcd.setCursor(1, 0);
lcd.print("ClrAll");
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 - 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 (temp_int == 111) {
lcd.setCursor(1, 0);
lcd.print("ClrAll");
}
lcd.setCursor(7, 0);
lcd.print("]");
}
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 *********

@ -48,27 +48,23 @@ void sequencer(void)
lcd.print("X");
if (seq_step == 0) {
lcd.setCursor(15, 1);
lcd.print(seq_find_shortname(15));
lcd.print(seq_find_shortname(15)[0]);
}
else
{
lcd.setCursor(seq_step - 1, 1);
lcd.print(seq_find_shortname(seq_step - 1));
}
lcd.print(seq_find_shortname(seq_step - 1)[0]);
}
}
for (uint8_t d = 0; d < 4; d++)
{
if ( seq_content_type[ seq_patternchain[seq_chain_active_step][d] ] == 0){// drum track
if ( seq_track_type[d] == 0){// drum track
if (seq_data[ seq_patternchain[seq_chain_active_step][d] ][seq_step] > 0 && seq_vel[ seq_patternchain[seq_chain_active_step][d] ][seq_step] > 0)
{
handleNoteOn(DRUM_MIDI_CHANNEL, seq_data[ seq_patternchain[seq_chain_active_step][d] ][seq_step] , seq_vel[ seq_patternchain[seq_chain_active_step][d] ][seq_step]);
}
}
else {
if (seq_data[ seq_patternchain[seq_chain_active_step][d] ][seq_step] > 0 && seq_vel[ seq_patternchain[seq_chain_active_step][d] ][seq_step] > 0) // instrument track
{

@ -22,7 +22,7 @@ uint8_t seq_prev_note[4]; // note_offs for every (instr.) track
uint8_t seq_data[10][16] = {72 ,0 ,0 ,0 ,72 ,0 ,0 ,0 ,72 ,0 ,0 ,0 ,72 ,0 ,0 ,0 ,
78 ,78 ,78 ,78 ,78 ,78 ,78 ,78 ,78 ,78 ,78 ,78 ,78 ,78 ,78 ,78 ,
72 ,0 ,0 ,0 ,72 ,0 ,0 ,0 ,72 ,0 ,0 ,75 ,72 ,0 ,0 ,0 ,
0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,
60 ,61 ,62 ,63 ,64 ,65 ,66 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,
0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,
55 ,0 ,0 ,0 ,0 ,0 ,52 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,
57 ,0 ,0 ,0 ,0 ,0 ,53 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,
@ -45,7 +45,7 @@ uint8_t seq_vel[10][16] = {120 ,0 ,0 ,0 ,120 ,0 ,0 ,0 ,120 ,0 ,0 ,0 ,
uint8_t seq_patternchain[4][4] = { 0 ,1 ,6 ,9 ,0 ,1 ,5 ,8 ,0 ,1 ,6 ,9 ,2 ,1 ,5 ,7
};
uint8_t seq_content_type[10] = { 0, 0, 0, 0 , 1, 1, 1 , 1 , 1 , 1 }; // 0 = track is Drumtrack, 1= Instrumenttrack
uint8_t seq_content_type[10] = { 0, 0, 0, 0 , 1, 1, 1 , 1 , 1 , 1 }; // 0 = track is Drumtrack, 1= Instrumenttrackz
uint8_t seq_track_type[4] = { 0, 0, 1, 1 }; // 0 = track is Drumtrack, 1= Instrumenttrack
//uint8_t seq_reverb[4][16] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,

Loading…
Cancel
Save