Merge pull request 'Arp/Chord Menu+added related settings' (#71) from positionhigh/MicroDexed:dev into dev

Reviewed-on: https://codeberg.org/dcoredump/MicroDexed/pulls/71
pull/76/head
Holger Wirtz 3 years ago
commit c631d60eea
  1. 397
      MicroDexed.ino
  2. 291
      UI.hpp
  3. 33
      UI_FX.h
  4. 33
      UI_NO_FX.h
  5. 111
      sequencer.cpp
  6. 35
      sequencer.h
  7. BIN
      third-party/TeensyTimerTool-master.zip

@ -21,6 +21,9 @@
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "TeensyTimerTool.h"
using namespace TeensyTimerTool;
#include <limits.h>
#include "config.h"
#include <Audio.h>
@ -325,6 +328,7 @@ char g_voice_name[NUM_DEXED][VOICE_NAME_LEN];
char g_bank_name[NUM_DEXED][BANK_NAME_LEN];
char receive_bank_filename[FILENAME_LEN];
uint8_t selected_instance_id = 0;
uint8_t seq_UI_last_step = 0;
#ifdef TEENSY4
#if NUM_DEXED>1
int8_t midi_decay[NUM_DEXED] = { -1, -1};
@ -362,6 +366,8 @@ BiquadCoef graphic_eq(7);
#endif
extern void getNoteName(char* noteName, uint8_t noteNumber);
PeriodicTimer timer1;
extern char seq_chord_names[6][4];
/***********************************************************************
SETUP
@ -635,10 +641,13 @@ void setup()
#endif
LCDML.OTHER_jumpToFunc(UI_func_voice_select);
}
void loop()
{
timer1.begin(sequencer, 74'000,false);
}
void loop()
{
// MIDI input handling
check_midi_devices();
@ -646,13 +655,41 @@ void loop()
ENCODER[ENC_L].update();
ENCODER[ENC_R].update();
if (seq_running) {
sequencer();
}
#ifdef ENABLE_LCD_UI
LCDML.loop();
#endif
if (seq_running)
{
if (seq_step != seq_UI_last_step)
{
seq_UI_last_step=seq_step;
if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_sequencer)) //is in UI of Sequencer
{
lcd.setCursor(seq_step, 1);
lcd.print("X");
if (seq_step == 0)
{
lcd.setCursor(15, 1);
lcd.print(seq_find_shortname(15)[0]);
}
else
{
lcd.setCursor(seq_step - 1, 1);
lcd.print(seq_find_shortname(seq_step - 1)[0]);
}
}
else if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_arpeggio)) //is in UI of Arpeggiator
{
lcd.setCursor(7, 0);
lcd.print( seq_chord_names[arp_chord - 200][0]);
lcd.print( seq_chord_names[arp_chord - 200][1]);
lcd.print( seq_chord_names[arp_chord - 200][2]);
lcd.print( seq_chord_names[arp_chord - 200][3]);
}
}
}
// CONTROL-RATE-EVENT-HANDLING
if (control_rate > CONTROL_RATE_MS)
{
@ -730,13 +767,13 @@ void loop()
show_cpu_and_mem_usage();
}
#endif
}
}
/******************************************************************************
/******************************************************************************
MIDI MESSAGE HANDLER
******************************************************************************/
void handleNoteOn(byte inChannel, byte inNumber, byte inVelocity)
{
void handleNoteOn(byte inChannel, byte inNumber, byte inVelocity)
{
// Check for MicroDexed
for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++)
{
@ -823,11 +860,11 @@ void handleNoteOn(byte inChannel, byte inNumber, byte inVelocity)
}
}
#endif
}
}
#if NUM_DRUMS > 0
uint8_t drum_get_slot(uint8_t dt)
{
uint8_t drum_get_slot(uint8_t dt)
{
for (uint8_t i = 0; i < NUM_DRUMS; i++)
{
if (!Drum[i]->isPlaying())
@ -854,11 +891,11 @@ uint8_t drum_get_slot(uint8_t dt)
drum_type[drum_counter % 4] = dt;
drum_counter++;
return (drum_counter - 1 % 4);
}
}
#endif
void handleNoteOff(byte inChannel, byte inNumber, byte inVelocity)
{
void handleNoteOff(byte inChannel, byte inNumber, byte inVelocity)
{
for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++)
{
if (checkMidiChannel(inChannel, instance_id))
@ -883,10 +920,10 @@ void handleNoteOff(byte inChannel, byte inNumber, byte inVelocity)
}
}
}
}
}
void handleControlChange(byte inChannel, byte inCtrl, byte inValue)
{
void handleControlChange(byte inChannel, byte inCtrl, byte inValue)
{
inCtrl = constrain(inCtrl, 0, 127);
inValue = constrain(inValue, 0, 127);
@ -1099,10 +1136,10 @@ void handleControlChange(byte inChannel, byte inCtrl, byte inValue)
}
}
}
}
}
void handleAfterTouch(byte inChannel, byte inPressure)
{
void handleAfterTouch(byte inChannel, byte inPressure)
{
for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++)
{
if (checkMidiChannel(inChannel, instance_id))
@ -1111,10 +1148,10 @@ void handleAfterTouch(byte inChannel, byte inPressure)
MicroDexed[instance_id]->ControllersRefresh();
}
}
}
}
void handlePitchBend(byte inChannel, int inPitch)
{
void handlePitchBend(byte inChannel, int inPitch)
{
for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++)
{
if (checkMidiChannel(inChannel, instance_id))
@ -1122,10 +1159,10 @@ void handlePitchBend(byte inChannel, int inPitch)
MicroDexed[instance_id]->setPitchbend(inPitch);
}
}
}
}
void handleProgramChange(byte inChannel, byte inProgram)
{
void handleProgramChange(byte inChannel, byte inProgram)
{
for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++)
{
if (checkMidiChannel(inChannel, instance_id))
@ -1145,10 +1182,10 @@ void handleProgramChange(byte inChannel, byte inProgram)
}
}
}
}
}
void handleSystemExclusive(byte * sysex, uint len)
{
void handleSystemExclusive(byte * sysex, uint len)
{
for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++)
{
if (!checkMidiChannel((sysex[2] & 0x0f) + 1 , instance_id))
@ -1547,30 +1584,30 @@ void handleSystemExclusive(byte * sysex, uint len)
Serial.println(F("E: SysEx parameter length wrong."));
#endif
}
}
}
void handleTimeCodeQuarterFrame(byte data)
{
void handleTimeCodeQuarterFrame(byte data)
{
;
}
}
void handleAfterTouchPoly(byte inChannel, byte inNumber, byte inVelocity)
{
void handleAfterTouchPoly(byte inChannel, byte inNumber, byte inVelocity)
{
;
}
}
void handleSongSelect(byte inSong)
{
void handleSongSelect(byte inSong)
{
;
}
}
void handleTuneRequest(void)
{
void handleTuneRequest(void)
{
;
}
}
void handleClock(void)
{
void handleClock(void)
{
if (midi_bpm_counter % 24 == 0)
{
midi_bpm = (60000.0f / float(midi_bpm_timer) + 0.5);
@ -1621,32 +1658,32 @@ void handleClock(void)
}
midi_bpm_counter++;
}
}
void handleStart(void)
{
void handleStart(void)
{
midi_bpm_timer = 0;
midi_bpm_counter = 0;
_midi_bpm = -1;
}
}
void handleContinue(void)
{
void handleContinue(void)
{
;
}
}
void handleStop(void)
{
void handleStop(void)
{
;
}
}
void handleActiveSensing(void)
{
void handleActiveSensing(void)
{
;
}
}
void handleSystemReset(void)
{
void handleSystemReset(void)
{
for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++)
{
#ifdef DEBUG
@ -1656,13 +1693,13 @@ void handleSystemReset(void)
MicroDexed[instance_id]->panic();
MicroDexed[instance_id]->resetControllers();
}
}
}
/******************************************************************************
/******************************************************************************
MIDI HELPER
******************************************************************************/
bool checkMidiChannel(byte inChannel, uint8_t instance_id)
{
bool checkMidiChannel(byte inChannel, uint8_t instance_id)
{
// check for MIDI channel
if (configuration.dexed[instance_id].midi_channel == MIDI_CHANNEL_OMNI)
{
@ -1682,10 +1719,10 @@ bool checkMidiChannel(byte inChannel, uint8_t instance_id)
return (false);
}
return (true);
}
}
void init_MIDI_send_CC(void)
{
void init_MIDI_send_CC(void)
{
#ifdef DEBUG
Serial.println("init_MIDI_send_CC():");
#endif
@ -1699,14 +1736,14 @@ void init_MIDI_send_CC(void)
MD_sendControlChange(configuration.dexed[selected_instance_id].midi_channel, 105, configuration.fx.delay_time[selected_instance_id]);
MD_sendControlChange(configuration.dexed[selected_instance_id].midi_channel, 106, configuration.fx.delay_feedback[selected_instance_id]);
MD_sendControlChange(configuration.dexed[selected_instance_id].midi_channel, 107, configuration.fx.delay_level[selected_instance_id]);
}
}
/******************************************************************************
/******************************************************************************
VOLUME HELPER
******************************************************************************/
void set_volume(uint8_t v, uint8_t m)
{
void set_volume(uint8_t v, uint8_t m)
{
configuration.sys.vol = v;
if (configuration.sys.vol > 100)
@ -1747,14 +1784,14 @@ void set_volume(uint8_t v, uint8_t m)
mono2stereo[instance_id]->panorama(mapfloat(PANORAMA_MIN, PANORAMA_MIN, PANORAMA_MAX, -1.0, 1.0));
break;
}
}
}
/******************************************************************************
/******************************************************************************
EEPROM HELPER
******************************************************************************/
void initial_values_from_eeprom(bool init)
{
void initial_values_from_eeprom(bool init)
{
uint16_t _m_;
if (init == true)
@ -1801,28 +1838,28 @@ void initial_values_from_eeprom(bool init)
#ifdef DEBUG
show_configuration();
#endif
}
}
void check_configuration(void)
{
void check_configuration(void)
{
check_configuration_sys();
check_configuration_fx();
check_configuration_performance();
for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++)
check_configuration_dexed(instance_id);
}
}
void check_configuration_sys(void)
{
void check_configuration_sys(void)
{
configuration.sys.instances = constrain(configuration.sys.instances, INSTANCES_MIN, INSTANCES_MAX);
configuration.sys.vol = constrain(configuration.sys.vol, VOLUME_MIN, VOLUME_MAX);
configuration.sys.mono = constrain(configuration.sys.mono, MONO_MIN, MONO_MAX);
configuration.sys.soft_midi_thru = constrain(configuration.sys.soft_midi_thru, SOFT_MIDI_THRU_MIN, SOFT_MIDI_THRU_MAX);
configuration.sys.performance_number = constrain(configuration.sys.performance_number, PERFORMANCE_NUM_MIN, PERFORMANCE_NUM_MAX);
}
}
void check_configuration_fx(void)
{
void check_configuration_fx(void)
{
#ifdef USE_PLATEREVERB
configuration.fx.reverb_lowpass = constrain(configuration.fx.reverb_lowpass, REVERB_LOWPASS_MIN, REVERB_LOWPASS_MAX);
configuration.fx.reverb_lodamp = constrain(configuration.fx.reverb_lodamp, REVERB_LODAMP_MIN, REVERB_LODAMP_MAX);
@ -1848,10 +1885,10 @@ void check_configuration_fx(void)
configuration.fx.delay_sync[instance_id] = constrain(configuration.fx.delay_sync[instance_id], DELAY_SYNC_MIN, DELAY_SYNC_MAX);
configuration.fx.reverb_send[instance_id] = constrain(configuration.fx.reverb_send[instance_id], REVERB_SEND_MIN, REVERB_SEND_MAX);
}
}
}
void check_configuration_performance(void)
{
void check_configuration_performance(void)
{
configuration.performance.fx_number = constrain(configuration.performance.fx_number, FX_NUM_MIN, FX_NUM_MAX);
for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++)
@ -1860,10 +1897,10 @@ void check_configuration_performance(void)
configuration.performance.voice[instance_id] = constrain(configuration.performance.voice[instance_id], 0, MAX_VOICES - 1);
configuration.performance.voiceconfig_number[instance_id] = constrain(configuration.performance.voiceconfig_number[instance_id], VOICECONFIG_NUM_MIN, VOICECONFIG_NUM_MAX);
}
}
}
void check_configuration_dexed(uint8_t instance_id)
{
void check_configuration_dexed(uint8_t instance_id)
{
configuration.dexed[instance_id].midi_channel = constrain(configuration.dexed[instance_id].midi_channel, MIDI_CHANNEL_MIN, MIDI_CHANNEL_MAX);
configuration.dexed[instance_id].lowest_note = constrain(configuration.dexed[instance_id].lowest_note, INSTANCE_LOWEST_NOTE_MIN, INSTANCE_LOWEST_NOTE_MAX);
configuration.dexed[instance_id].highest_note = constrain(configuration.dexed[instance_id].highest_note, INSTANCE_HIGHEST_NOTE_MIN, INSTANCE_HIGHEST_NOTE_MAX);
@ -1893,10 +1930,10 @@ void check_configuration_dexed(uint8_t instance_id)
configuration.dexed[instance_id].portamento_glissando = constrain(configuration.dexed[instance_id].portamento_glissando, PORTAMENTO_GLISSANDO_MIN, PORTAMENTO_GLISSANDO_MAX);
configuration.dexed[instance_id].portamento_time = constrain(configuration.dexed[instance_id].portamento_time, PORTAMENTO_TIME_MIN, PORTAMENTO_TIME_MAX);
configuration.dexed[instance_id].op_enabled = constrain(configuration.dexed[instance_id].op_enabled, OP_ENABLED_MIN, OP_ENABLED_MAX);
}
}
void init_configuration(void)
{
void init_configuration(void)
{
#ifdef DEBUG
Serial.println(F("INITIALIZING CONFIGURATION"));
#endif
@ -1980,17 +2017,17 @@ void init_configuration(void)
set_volume(configuration.sys.vol, configuration.sys.mono);
eeprom_update();
}
}
void eeprom_update(void)
{
void eeprom_update(void)
{
uint8_t* c = (uint8_t*)&configuration;
for (uint16_t i = 0; i < sizeof(configuration); i++)
EEPROM.update(EEPROM_START_ADDRESS + i, c[i]);
}
}
void eeprom_update_sys(void)
{
void eeprom_update_sys(void)
{
uint8_t* c = (uint8_t*)&configuration.sys;
for (uint16_t i = 0; i < sizeof(configuration.sys); i++)
@ -1999,16 +2036,16 @@ void eeprom_update_sys(void)
#ifdef DEBUG
Serial.println(F("Updating EEPROM sys."));
#endif
}
}
bool eeprom_get_sys(void)
{
bool eeprom_get_sys(void)
{
EEPROM.get(EEPROM_START_ADDRESS + offsetof(configuration_s, sys), configuration.sys);
return (true);
}
}
void eeprom_update_fx(void)
{
void eeprom_update_fx(void)
{
uint8_t* c = (uint8_t*)&configuration.fx;
for (uint16_t i = 0; i < sizeof(configuration.fx); i++)
@ -2017,16 +2054,16 @@ void eeprom_update_fx(void)
#ifdef DEBUG
Serial.println(F("Updating EEPROM fx."));
#endif
}
}
bool eeprom_get_fx(void)
{
bool eeprom_get_fx(void)
{
EEPROM.get(EEPROM_START_ADDRESS + offsetof(configuration_s, fx), configuration.fx);
return (true);
}
}
void eeprom_update_dexed(uint8_t instance_id)
{
void eeprom_update_dexed(uint8_t instance_id)
{
#if NUM_DEXED == 1
uint8_t* c = (uint8_t*)&configuration.dexed[0];
@ -2054,10 +2091,10 @@ void eeprom_update_dexed(uint8_t instance_id)
Serial.print(instance_id);
Serial.println(F(")."));
#endif
}
}
bool eeprom_get_dexed(uint8_t instance_id)
{
bool eeprom_get_dexed(uint8_t instance_id)
{
for (uint8_t instance_id = 0; instance_id < MAX_DEXED; instance_id++)
{
if (instance_id == 0)
@ -2066,31 +2103,31 @@ bool eeprom_get_dexed(uint8_t instance_id)
EEPROM.get(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[1]), configuration.dexed[1]);
}
return (true);
}
}
void eeprom_update_performance()
{
void eeprom_update_performance()
{
EEPROM.put(EEPROM_START_ADDRESS + offsetof(configuration_s, performance), configuration.performance);
#ifdef DEBUG
Serial.println(F("Updating EEPROM performance."));
#endif
}
}
bool eeprom_get_performance()
{
bool eeprom_get_performance()
{
EEPROM.get(EEPROM_START_ADDRESS + offsetof(configuration_s, performance), configuration.performance);
#ifdef DEBUG
Serial.println(F("Getting EEPROM performance."));
#endif
return (true);
}
}
/******************************************************************************
/******************************************************************************
PARAMETER-HELPERS
******************************************************************************/
******************************************************************************/
void set_fx_params(void)
{
void set_fx_params(void)
{
#if defined(USE_FX)
for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++)
{
@ -2177,10 +2214,10 @@ void set_fx_params(void)
#endif
init_MIDI_send_CC();
}
}
void set_voiceconfig_params(uint8_t instance_id)
{
void set_voiceconfig_params(uint8_t instance_id)
{
// INIT PEAK MIXER
microdexed_peak_mixer.gain(instance_id, 1.0);
@ -2201,36 +2238,36 @@ void set_voiceconfig_params(uint8_t instance_id)
// PANORAMA
mono2stereo[instance_id]->panorama(mapfloat(configuration.dexed[instance_id].pan, PANORAMA_MIN, PANORAMA_MAX, -1.0, 1.0));
}
}
void set_sys_params(void)
{
void set_sys_params(void)
{
// set initial volume
set_volume(configuration.sys.vol, configuration.sys.mono);
}
}
/******************************************************************************
/******************************************************************************
HELPERS
******************************************************************************/
// https://www.reddit.com/r/Teensy/comments/7r19uk/reset_and_reboot_teensy_lc_via_code/
// https://www.reddit.com/r/Teensy/comments/7r19uk/reset_and_reboot_teensy_lc_via_code/
#define SCB_AIRCR (*(volatile uint32_t *)0xE000ED0C) // Application Interrupt and Reset Control location
void _softRestart(void)
{
void _softRestart(void)
{
Serial.end(); //clears the serial monitor if used
SCB_AIRCR = 0x05FA0004; //write value for restart
}
}
float pseudo_log_curve(float value)
{
float pseudo_log_curve(float value)
{
//return (mapfloat(_pseudo_log * arm_sin_f32(value), 0.0, _pseudo_log * arm_sin_f32(1.0), 0.0, 1.0));
//return (1 - sqrt(1 - value * value));
//return (pow(2, value) - 1);
return (pow(value, 2.2));
}
}
uint32_t crc32(byte * calc_start, uint16_t calc_bytes) // base code from https://www.arduino.cc/en/Tutorial/EEPROMCrc
{
uint32_t crc32(byte * calc_start, uint16_t calc_bytes) // base code from https://www.arduino.cc/en/Tutorial/EEPROMCrc
{
const uint32_t crc_table[16] =
{
0x00000000, 0x1db71064, 0x3b6e20c8, 0x26d930ac,
@ -2248,10 +2285,10 @@ uint32_t crc32(byte * calc_start, uint16_t calc_bytes) // base code from https:/
}
return (crc);
}
}
void generate_version_string(char* buffer, uint8_t len)
{
void generate_version_string(char* buffer, uint8_t len)
{
char tmp[3];
memset(buffer, 0, len);
@ -2271,21 +2308,21 @@ void generate_version_string(char* buffer, uint8_t len)
itoa (MAX_NOTES, tmp, 10);
strncat(buffer, tmp, 2);
#endif
}
}
#ifdef DISPLAY_LCD_SPI
void change_disp_sd(bool disp)
{
void change_disp_sd(bool disp)
{
if (sd_card > 0)
{
digitalWrite(sd_card, disp);
digitalWrite(U8X8_CS_PIN, !disp);
}
}
}
#endif
uint8_t check_sd_cards(void)
{
uint8_t check_sd_cards(void)
{
uint8_t ret = 0;
memset(sd_string, 0, sizeof(sd_string));
@ -2383,10 +2420,10 @@ uint8_t check_sd_cards(void)
#endif
return (ret);
}
}
void check_and_create_directories(void)
{
void check_and_create_directories(void)
{
if (sd_card > 0)
{
uint8_t i;
@ -2494,14 +2531,14 @@ void check_and_create_directories(void)
Serial.println(F("No SD card for directory check available."));
#endif
}
}
}
/******************************************************************************
/******************************************************************************
DEBUG HELPER
******************************************************************************/
#if defined (DEBUG) && defined (SHOW_CPU_LOAD_MSEC)
void show_cpu_and_mem_usage(void)
{
void show_cpu_and_mem_usage(void)
{
uint32_t sum_xrun = 0;
uint16_t sum_render_time_max = 0;
@ -2571,12 +2608,12 @@ void show_cpu_and_mem_usage(void)
#endif
AudioProcessorUsageMaxReset();
AudioMemoryUsageMaxReset();
}
}
#endif
#ifdef DEBUG
void show_configuration(void)
{
void show_configuration(void)
{
Serial.println();
Serial.println(F("CONFIGURATION:"));
Serial.println(F("System"));
@ -2652,10 +2689,10 @@ void show_configuration(void)
Serial.println();
Serial.flush();
}
}
void show_patch(uint8_t instance_id)
{
void show_patch(uint8_t instance_id)
{
char vn[VOICE_NAME_LEN];
Serial.print(F("INSTANCE "));
@ -2760,30 +2797,30 @@ void show_patch(uint8_t instance_id)
Serial.println(F(" |"));
Serial.println(F("+=========+=========+=========+=========+==========+==========+=========+==================================+"));
Serial.println(F("+==========================================================================================================+"));
}
}
void SerialPrintFormatInt3(uint8_t num)
{
void SerialPrintFormatInt3(uint8_t num)
{
char buf[4];
sprintf(buf, "%3d", num);
Serial.print(buf);
}
}
#ifdef TEENSY3_6
/* From: https://forum.pjrc.com/threads/33443-How-to-display-free-ram */
extern "C" char* sbrk(int incr);
uint32_t FreeMem(void)
{
/* From: https://forum.pjrc.com/threads/33443-How-to-display-free-ram */
extern "C" char* sbrk(int incr);
uint32_t FreeMem(void)
{
char top;
return &top - reinterpret_cast<char*>(sbrk(0));
}
}
#else
/* From: https://forum.pjrc.com/threads/33443-How-to-display-free-ram */
extern unsigned long _heap_end;
extern char *__brkval;
int FreeMem(void)
{
/* From: https://forum.pjrc.com/threads/33443-How-to-display-free-ram */
extern unsigned long _heap_end;
extern char *__brkval;
int FreeMem(void)
{
return (char *)&_heap_end - __brkval;
}
}
#endif
#endif

291
UI.hpp

@ -51,6 +51,9 @@
#endif
#define _LCDML_DISP_cfg_scrollbar 1 // enable a scrollbar
extern PeriodicTimer timer1;
extern void sequencer(void);
extern config_t configuration;
extern void set_volume(uint8_t v, uint8_t m);
extern bool load_sysex(uint8_t b, uint8_t v);
@ -65,6 +68,7 @@ extern float pseudo_log_curve(float value);
extern uint8_t selected_instance_id;
extern char receive_bank_filename[FILENAME_LEN];
#if NUM_DRUMS > 0
#include "drums.h"
extern drum_config_t drum_config[NUM_DRUMSET_CONFIG];
@ -82,13 +86,20 @@ extern bool seq_recording;
uint8_t seq_active_function = 99;
uint8_t activesample;
extern uint8_t seq_active_track;
extern elapsedMillis seq_millis_timer;
extern uint8_t seq_menu;
extern uint8_t seq_temp_select_menu;
extern uint8_t seq_temp_active_menu;
extern uint8_t seq_chain_active_chainstep; //for editor
extern uint8_t seq_chain_active_step;
extern int seq_transpose;
extern uint8_t arp_step;
extern uint8_t arp_note;
extern uint8_t arp_chord;
extern uint8_t arp_octave;
extern uint8_t arp_oct_usersetting;
extern uint8_t arp_style;
extern uint8_t arp_speed;
extern char arp_style_names[4][3];
#endif
#ifdef DISPLAY_LCD_SPI
@ -273,6 +284,7 @@ void UI_func_seq_live_transpose_oct(uint8_t param);
void UI_func_seq_lenght(uint8_t param);
void UI_func_seq_tempo(uint8_t param);
void UI_func_seq_pat_chain(uint8_t param);
void UI_func_arpeggio(uint8_t param);
void UI_func_seq_track_setup(uint8_t param);
void UI_func_seq_display_style(uint8_t param);
void UI_func_seq_pattern_load(uint8_t param);
@ -3915,14 +3927,9 @@ void UI_func_seq_display_style(uint8_t param)
lcd.setCursor(0, 0);
lcd.print("Seq. Disp. Style");
lcd.setCursor(0, 1);
lcd.print("Seq.");
lcd.print("Pat.");
lcd.setCursor(8, 1);
lcd.print("=");
lcd.setCursor(11, 1);
if (seq_content_type[seq_active_track] == 0)
lcd.print("Drum");
else
lcd.print("Inst");
}
if (LCDML.FUNC_loop()) // ****** LOOP *********
{
@ -3943,21 +3950,17 @@ void UI_func_seq_display_style(uint8_t param)
{
if (LCDML.BT_checkDown())
{
seq_content_type[seq_active_track] = constrain(seq_content_type[seq_active_track] + ENCODER[ENC_R].speed(), 0, 1);
seq_content_type[seq_active_track] = constrain(seq_content_type[seq_active_track] + ENCODER[ENC_R].speed(), 0, 2);
}
else if (LCDML.BT_checkUp())
{
seq_content_type[seq_active_track] = constrain(seq_content_type[seq_active_track] - ENCODER[ENC_R].speed(), 0, 1);
seq_content_type[seq_active_track] = constrain(seq_content_type[seq_active_track] - ENCODER[ENC_R].speed(), 0, 2);
}
}
}
if (LCDML.BT_checkEnter())
{
if (menu_select_toggle) {
menu_select_toggle = false;
} else
{ menu_select_toggle = true;
}
menu_select_toggle = !menu_select_toggle;
}
if (menu_select_toggle == false) {
lcd.setCursor(10, 1);
@ -3968,10 +3971,6 @@ void UI_func_seq_display_style(uint8_t param)
lcd.print("[");
lcd.print(seq_active_track);
lcd.print("]");
lcd.setCursor(11, 1);
if (seq_content_type[seq_active_track] == 0) lcd.print("Drum");
else
lcd.print("Inst");
} else {
lcd.setCursor(4, 1);
lcd.print(" ");
@ -3979,12 +3978,16 @@ void UI_func_seq_display_style(uint8_t param)
lcd.print(" ");
lcd.setCursor(10, 1);
lcd.print("[");
lcd.setCursor(15, 1);
lcd.print("]");
}
lcd.setCursor(11, 1);
if (seq_content_type[seq_active_track] == 0)
lcd.print("Drum");
else
else if (seq_content_type[seq_active_track] == 1)
lcd.print("Inst");
lcd.print("]");
}
else
lcd.print("Chrd");
}
if (LCDML.FUNC_close()) // ****** STABLE END *********
{
@ -4068,7 +4071,7 @@ void UI_func_seq_lenght(uint8_t param)
void UI_func_seq_tempo(uint8_t param)
{
char tmp[5];
char tmp[7];
if (LCDML.FUNC_setup()) // ****** SETUP *********
{
encoderDir[ENC_R].reset();
@ -4084,19 +4087,21 @@ void UI_func_seq_tempo(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())
seq_bpm = constrain(seq_bpm + ENCODER[ENC_R].speed(), 60, 180);
seq_bpm = constrain(seq_bpm + ENCODER[ENC_R].speed(), 50, 190);
else if (LCDML.BT_checkUp())
seq_bpm = constrain(seq_bpm - ENCODER[ENC_R].speed(), 60, 180);
seq_bpm = constrain(seq_bpm - ENCODER[ENC_R].speed(), 50, 190);
}
seq_tempo_ms = 60000 / seq_bpm / 4;
// seq_tempo_ms = 60000 / seq_bpm / 4;
seq_tempo_ms = 60000000 / seq_bpm / 4;
sprintf(tmp, "[%3d]", seq_bpm);
lcd.setCursor(0, 1);
sprintf(tmp, "[%3d]", seq_bpm);
lcd.print(tmp);
lcd.setCursor(9, 1);
sprintf(tmp, "[%3d]", seq_tempo_ms);
lcd.setCursor(11, 1);
sprintf(tmp, "%3d", seq_tempo_ms / 1000);
lcd.print(tmp);
//timer1.stop();
timer1.begin(sequencer, seq_tempo_ms / 2);
}
if (LCDML.FUNC_close()) // ****** STABLE END *********
{
@ -4152,7 +4157,7 @@ void UI_func_seq_vel_editor(uint8_t param)
else if (LCDML.BT_checkUp())
seq_vel[seq_active_track][seq_menu - 1] = constrain(seq_vel[seq_active_track][seq_menu - 1] - 1, 0, 127);
}
} else if (seq_active_function == 1 && seq_content_type[seq_active_track] > 1 ) {
} else if (seq_active_function == 1 && seq_content_type[seq_active_track] > 1 ) { //is in Chord or Arp Mode
if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up()))
{
if (LCDML.BT_checkDown())
@ -4179,7 +4184,7 @@ void UI_func_seq_vel_editor(uint8_t param)
}
//button check end <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
if ( seq_content_type[seq_active_track] > 1 && seq_vel[seq_active_track][seq_menu - 1]<200) seq_vel[seq_active_track][seq_menu - 1]=200;
if ( seq_content_type[seq_active_track] > 1 && seq_vel[seq_active_track][seq_menu - 1] < 200) seq_vel[seq_active_track][seq_menu - 1] = 200;
if (seq_menu == 0) {
lcd.setCursor(4, 0);
@ -4283,6 +4288,21 @@ void seq_refresh_display_play_status()
}
}
void arp_refresh_display_play_status()
{
lcd.setCursor(12, 0);
if (seq_running == false )
{
lcd.print("PLY");
} else if (seq_running == true )
{
seq_note_in = 0;
lcd.print("STP");
}
}
void UI_func_sequencer(uint8_t param)
{
if (LCDML.FUNC_setup()) // ****** SETUP *********
@ -4507,6 +4527,7 @@ void UI_func_sequencer(uint8_t param)
{
seq_running = true;
lcd.print("REC");
timer1.start();
} else if (seq_running == true && seq_recording == false)
{
seq_running = true;
@ -4521,6 +4542,7 @@ void UI_func_sequencer(uint8_t param)
seq_step = 0;
seq_chain_active_step = 0;
lcd.print("PLY");
timer1.stop();
MicroDexed[0]->panic();
}
} else if ( seq_menu == 2)
@ -4759,9 +4781,187 @@ void UI_func_sequencer(uint8_t param)
}
}
void UI_func_seq_pat_chain(uint8_t param)
void UI_func_arpeggio(uint8_t param)
{
if (LCDML.FUNC_setup()) // ****** SETUP *********
{
encoderDir[ENC_R].reset();
seq_temp_active_menu = 0;
lcd.setCursor( 0, 0);
lcd.print("Oct");
lcd.setCursor( 0, 1);
lcd.print("Style");
lcd.setCursor( 7, 0);
lcd.print("Maj");
lcd.setCursor( 11, 1);
lcd.print("1/16");
lcd.setCursor( 7, 0);
lcd.print(" ");
arp_refresh_display_play_status();
}
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 (seq_temp_active_menu == 0)
{
if (LCDML.BT_checkDown())
seq_temp_select_menu = constrain(seq_temp_select_menu + ENCODER[ENC_R].speed(), 0, 3);
else if (LCDML.BT_checkUp())
seq_temp_select_menu = constrain(seq_temp_select_menu - ENCODER[ENC_R].speed(), 0, 3);
} else if (seq_temp_active_menu == 1) // Octave setting
{
if (LCDML.BT_checkDown())
arp_oct_usersetting = constrain(arp_oct_usersetting + ENCODER[ENC_R].speed(), 0, 3);
else if (LCDML.BT_checkUp())
arp_oct_usersetting = constrain(arp_oct_usersetting - ENCODER[ENC_R].speed(), 0, 3);
}
else if (seq_temp_active_menu == 2) // Style setting
{
if (LCDML.BT_checkDown())
arp_style = constrain(arp_style + ENCODER[ENC_R].speed(), 0, 3);
else if (LCDML.BT_checkUp())
arp_style = constrain(arp_style - ENCODER[ENC_R].speed(), 0, 3);
}
else if (seq_temp_active_menu == 3) // Arp Speed setting
{
if (LCDML.BT_checkDown())
arp_speed = constrain(arp_speed + ENCODER[ENC_R].speed(), 0, 1);
else if (LCDML.BT_checkUp())
arp_speed = constrain(arp_speed - ENCODER[ENC_R].speed(), 0, 1);
}
if (LCDML.BT_checkEnter()) //handle button presses during menu >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
{
if ( seq_temp_select_menu == 0 && seq_temp_active_menu == 0 )
{
seq_temp_active_menu = 1;
}
else if ( seq_temp_select_menu == 0 && seq_temp_active_menu == 1 )
{
seq_temp_active_menu = 0;
}
if ( seq_temp_select_menu == 1 && seq_temp_active_menu == 0 )
{
seq_temp_active_menu = 2;
}
else if ( seq_temp_select_menu == 1 && seq_temp_active_menu == 2 )
{
seq_temp_active_menu = 0;
}
//else if ( seq_temp_select_menu == 2 && seq_temp_active_menu == 0 )
else if ( seq_temp_select_menu == 2 )
{
if (seq_running) {
seq_running = !seq_running;
timer1.stop();
MicroDexed[0]->panic();
arp_refresh_display_play_status();
seq_step = 0;
arp_octave = 0;
arp_step = 0;
seq_chain_active_step = 0;
} else
{
seq_running = !seq_running;
arp_refresh_display_play_status();
timer1.start();
}
}
else if ( seq_temp_select_menu == 3 && seq_temp_active_menu == 0 )
{
seq_temp_active_menu = 3;
}
else if ( seq_temp_select_menu == 3 && seq_temp_active_menu == 3 )
{
seq_temp_active_menu = 0;
}
}
}
lcd.setCursor( 4, 0);
lcd.print(arp_oct_usersetting);
lcd.setCursor( 6, 1);
lcd.print( arp_style_names[arp_style][0] );
lcd.print( arp_style_names[arp_style][1] );
lcd.print( arp_style_names[arp_style][2] );
lcd.setCursor( 11, 1);
if (arp_speed == 0)lcd.print("1/16"); else if (arp_speed == 1)lcd.print("1/8 ");
if (seq_temp_select_menu == 0) {
lcd.setCursor( 3, 0);
lcd.print("[");
lcd.setCursor( 5, 0);
lcd.print("]");
lcd.setCursor( 11, 0);
lcd.print(" ");
lcd.setCursor( 15, 0);
lcd.print(" ");
lcd.setCursor( 5, 1);
lcd.print(" ");
lcd.setCursor( 9, 1);
lcd.print(" ");
lcd.setCursor( 10, 1);
lcd.print(" ");
lcd.setCursor( 15, 1);
lcd.print(" ");
}
else if (seq_temp_select_menu == 1)
{
lcd.setCursor( 3, 0);
lcd.print(" ");
lcd.setCursor( 5, 0);
lcd.print(" ");
lcd.setCursor( 11, 0);
lcd.print(" ");
lcd.setCursor( 15, 0);
lcd.print(" ");
lcd.setCursor( 5, 1);
lcd.print("[");
lcd.setCursor( 9, 1);
lcd.print("]");
}
else if (seq_temp_select_menu == 2)
{
lcd.setCursor( 5, 1);
lcd.print(" ");
lcd.setCursor( 9, 1);
lcd.print(" ");
lcd.setCursor( 10, 1);
lcd.print(" ");
lcd.setCursor( 15, 1);
lcd.print(" ");
lcd.setCursor( 11, 0);
lcd.print("[");
lcd.setCursor( 15, 0);
lcd.print("]");
}
else if (seq_temp_select_menu == 3)
{
lcd.setCursor( 11, 0);
lcd.print(" ");
lcd.setCursor( 15, 0);
lcd.print(" ");
lcd.setCursor( 3, 0);
lcd.print(" ");
lcd.setCursor( 5, 0);
lcd.print(" ");
lcd.setCursor( 10, 1);
lcd.print("[");
lcd.setCursor( 15, 1);
lcd.print("]");
}
}
if (LCDML.FUNC_close()) // ****** STABLE END *********
{
encoderDir[ENC_R].reset();
}
}
void UI_func_seq_pat_chain(uint8_t param)
{
if (LCDML.FUNC_setup()) // ****** SETUP *********
{
// setup function
@ -4793,7 +4993,6 @@ void UI_func_seq_pat_chain(uint8_t param)
lcd.setCursor(8 , 1);
lcd.print( seq_patternchain[seq_chain_active_chainstep][3]);
}
if (LCDML.FUNC_loop()) // ****** LOOP *********
{
if (seq_temp_active_menu == 99) {
@ -4951,7 +5150,6 @@ void UI_func_seq_pat_chain(uint8_t param)
void UI_func_seq_track_setup(uint8_t param)
{
if (LCDML.FUNC_setup()) // ****** SETUP *********
{
// setup function
@ -4965,13 +5163,13 @@ void UI_func_seq_track_setup(uint8_t param)
lcd.setCursor(9 , 1);
lcd.print("T4");
lcd.setCursor(3 , 0);
if (seq_track_type[0] == 0 ) lcd.print("Drm"); else lcd.print("Ins");
if (seq_track_type[0] == 0 ) lcd.print("Drm"); else if (seq_track_type[0] == 1 ) lcd.print("Ins"); else if (seq_track_type[0] == 2 )lcd.print("Chd"); else lcd.print("Arp");
lcd.setCursor(3 , 1);
if (seq_track_type[1] == 0 ) lcd.print("Drm"); else lcd.print("Ins");
if (seq_track_type[1] == 0 ) lcd.print("Drm"); else if (seq_track_type[1] == 1 ) lcd.print("Ins"); else if (seq_track_type[1] == 2 )lcd.print("Chd"); else lcd.print("Arp");
lcd.setCursor(12 , 0);
if (seq_track_type[2] == 0 ) lcd.print("Drm"); else lcd.print("Ins");
if (seq_track_type[2] == 0 ) lcd.print("Drm"); else if (seq_track_type[2] == 1 ) lcd.print("Ins"); else if (seq_track_type[2] == 2 )lcd.print("Chd"); else lcd.print("Arp");
lcd.setCursor(12 , 1);
if (seq_track_type[3] == 0 ) lcd.print("Drm"); else lcd.print("Ins");
if (seq_track_type[3] == 0 ) lcd.print("Drm"); else if (seq_track_type[3] == 1 ) lcd.print("Ins"); else if (seq_track_type[3] == 2 )lcd.print("Chd"); else lcd.print("Arp");
}
if (LCDML.FUNC_loop()) // ****** LOOP *********
{
@ -4987,9 +5185,9 @@ void UI_func_seq_track_setup(uint8_t param)
if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up()))
{
if (LCDML.BT_checkDown())
seq_track_type[seq_temp_active_menu] = constrain(seq_track_type[seq_temp_active_menu] + 1, 0, 1);
seq_track_type[seq_temp_active_menu] = constrain(seq_track_type[seq_temp_active_menu] + 1, 0, 3);
else if (LCDML.BT_checkUp())
seq_track_type[seq_temp_active_menu] = constrain(seq_track_type[seq_temp_active_menu] - 1, 0, 1);
seq_track_type[seq_temp_active_menu] = constrain(seq_track_type[seq_temp_active_menu] - 1, 0, 3);
}
}
if (LCDML.BT_checkEnter()) //handle button presses during menu >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
@ -5012,7 +5210,7 @@ void UI_func_seq_track_setup(uint8_t param)
lcd.setCursor(6 , 1);
lcd.print(" ");
lcd.setCursor(3 , 0);
if (seq_track_type[0] == 0 ) lcd.print("Drm"); else lcd.print("Ins");
if (seq_track_type[0] == 0 ) lcd.print("Drm"); else if (seq_track_type[0] == 1 ) lcd.print("Ins"); else if (seq_track_type[0] == 2 )lcd.print("Chd"); else lcd.print("Arp");
} else if (seq_temp_select_menu == 1)
{
lcd.setCursor(2 , 0);
@ -5028,7 +5226,7 @@ void UI_func_seq_track_setup(uint8_t param)
lcd.setCursor(15 , 0);
lcd.print(" ");
lcd.setCursor(3 , 1);
if (seq_track_type[1] == 0 ) lcd.print("Drm"); else lcd.print("Ins");
if (seq_track_type[1] == 0 ) lcd.print("Drm"); else if (seq_track_type[1] == 1 ) lcd.print("Ins"); else if (seq_track_type[1] == 2 )lcd.print("Chd"); else lcd.print("Arp");
} else if (seq_temp_select_menu == 2)
{
lcd.setCursor(2 , 1);
@ -5044,7 +5242,7 @@ void UI_func_seq_track_setup(uint8_t param)
lcd.setCursor(15 , 1);
lcd.print(" ");
lcd.setCursor(12 , 0);
if (seq_track_type[2] == 0 ) lcd.print("Drm"); else lcd.print("Ins");
if (seq_track_type[2] == 0 ) lcd.print("Drm"); else if (seq_track_type[2] == 1 ) lcd.print("Ins"); else if (seq_track_type[2] == 2 )lcd.print("Chd"); else lcd.print("Arp");
} else if (seq_temp_select_menu == 3)
{
lcd.setCursor(11 , 0);
@ -5056,7 +5254,7 @@ void UI_func_seq_track_setup(uint8_t param)
lcd.setCursor(15 , 1);
lcd.print("]");
lcd.setCursor(12 , 1);
if (seq_track_type[3] == 0 ) lcd.print("Drm"); else lcd.print("Ins");
if (seq_track_type[3] == 0 ) lcd.print("Drm"); else if (seq_track_type[3] == 1 ) lcd.print("Ins"); else if (seq_track_type[3] == 2 )lcd.print("Chd"); else lcd.print("Arp");
}
}
if (LCDML.FUNC_close()) // ****** STABLE END *********
@ -5065,7 +5263,6 @@ void UI_func_seq_track_setup(uint8_t param)
}
}
void UI_func_seq_pattern_load(uint8_t param)
{
static uint8_t mode;
@ -5134,7 +5331,7 @@ void UI_func_seq_pattern_save(uint8_t param)
{
char tmp[FILENAME_LEN];
yesno = false;
temp_int=0;
temp_int = 0;
mode = 0;
encoderDir[ENC_R].reset();
lcd.setCursor(0, 0);
@ -7357,7 +7554,7 @@ void UI_func_eq_treble(uint8_t param)
}
}
lcd_display_meter_float("EQ Treble", configuration.fx.eq_treble, 0.1, 0.0, EQ_TREBLE_MIN, EQ_TREBLE_MAX, 1, 1, false, true, true);
sgtl5000_1.eqBand(4,mapfloat(configuration.fx.eq_treble, EQ_TREBLE_MIN, EQ_TREBLE_MAX, -1.0, 1.0));
sgtl5000_1.eqBand(4, mapfloat(configuration.fx.eq_treble, EQ_TREBLE_MIN, EQ_TREBLE_MAX, -1.0, 1.0));
}
if (LCDML.FUNC_close()) // ****** STABLE END *********

@ -121,20 +121,21 @@ LCDML_add(87, LCDML_0, 5, "Sequencer", NULL);
LCDML_add(88, LCDML_0_5, 1, "Sequencer", UI_func_sequencer);
LCDML_add(89, LCDML_0_5, 2, "Vel./Chrd Edit", UI_func_seq_vel_editor);
LCDML_add(90, LCDML_0_5, 3, "Pattern Chain", UI_func_seq_pat_chain);
LCDML_add(91, LCDML_0_5, 4, "Seq. Length", UI_func_seq_lenght);
LCDML_add(92, LCDML_0_5, 5, "Tempo", UI_func_seq_tempo);
LCDML_add(93, LCDML_0_5, 6, "L.Transp.Key", UI_func_seq_live_transpose_oct);
LCDML_add(94, LCDML_0_5, 7, "L.Trp.Offset", NULL);
LCDML_add(95, LCDML_0_5, 8, "Track Setup", UI_func_seq_track_setup);
LCDML_add(96, LCDML_0_5, 9, "Seq.Disp.Style", UI_func_seq_display_style);
LCDML_add(97, LCDML_0_5, 10, "LOAD Patterns", UI_func_seq_pattern_load);
LCDML_add(98, LCDML_0_5, 11, "SAVE Patterns", UI_func_seq_pattern_save);
LCDML_add(99, LCDML_0, 6, "System", NULL);
LCDML_add(100, LCDML_0_6, 1, "Stereo/Mono", UI_func_stereo_mono);
LCDML_add(101, LCDML_0_6, 2, "MIDI Soft THRU", UI_func_midi_soft_thru);
LCDML_add(102, LCDML_0_6, 3, "Favorites", UI_func_favorites);
LCDML_add(103, LCDML_0_6, 4, "EEPROM Reset", UI_func_eeprom_reset);
LCDML_add(104, LCDML_0, 7, "Info", UI_func_information);
LCDML_addAdvanced(105, LCDML_0, 8, COND_hide, "Volume", UI_func_volume, 0, _LCDML_TYPE_default);
#define _LCDML_DISP_cnt 105
LCDML_add(91, LCDML_0_5, 4, "Arpeggio", UI_func_arpeggio);
LCDML_add(92, LCDML_0_5, 5, "Seq. Length", UI_func_seq_lenght);
LCDML_add(93, LCDML_0_5, 6, "Tempo", UI_func_seq_tempo);
LCDML_add(94, LCDML_0_5, 7, "L.Transp.Key", UI_func_seq_live_transpose_oct);
LCDML_add(95, LCDML_0_5, 8, "L.Trp.Offset", NULL);
LCDML_add(96, LCDML_0_5, 9, "Track Setup", UI_func_seq_track_setup);
LCDML_add(97, LCDML_0_5, 10, "Seq.Disp.Style", UI_func_seq_display_style);
LCDML_add(98, LCDML_0_5, 11, "LOAD Patterns", UI_func_seq_pattern_load);
LCDML_add(99, LCDML_0_5, 12, "SAVE Patterns", UI_func_seq_pattern_save);
LCDML_add(100, LCDML_0, 6, "System", NULL);
LCDML_add(101, LCDML_0_6, 1, "Stereo/Mono", UI_func_stereo_mono);
LCDML_add(102, LCDML_0_6, 2, "MIDI Soft THRU", UI_func_midi_soft_thru);
LCDML_add(103, LCDML_0_6, 3, "Favorites", UI_func_favorites);
LCDML_add(104, LCDML_0_6, 4, "EEPROM Reset", UI_func_eeprom_reset);
LCDML_add(105, LCDML_0, 7, "Info", UI_func_information);
LCDML_addAdvanced(106, LCDML_0, 8, COND_hide, "Volume", UI_func_volume, 0, _LCDML_TYPE_default);
#define _LCDML_DISP_cnt 106
#endif

@ -91,22 +91,23 @@ LCDML_add(57, LCDML_0_3, 2, "Drum Volumes", UI_func_drum_volume);
LCDML_add(58, LCDML_0_3, 3, "Drum Pan", UI_func_drum_pan);
LCDML_add(59, LCDML_0, 4, "Sequencer", NULL);
LCDML_add(60, LCDML_0_4, 1, "Sequencer", UI_func_sequencer);
LCDML_add(61, LCDML_0_5, 2, "Velocity Edit", UI_func_seq_vel_editor);
LCDML_add(61, LCDML_0_5, 2, "Vel./Chrd Edit", UI_func_seq_vel_editor);
LCDML_add(62, LCDML_0_4, 3, "Pattern Chain", UI_func_seq_pat_chain);
LCDML_add(63, LCDML_0_4, 4, "Seq. Length", UI_func_seq_lenght);
LCDML_add(64, LCDML_0_4, 5, "Tempo", UI_func_seq_tempo);
LCDML_add(65, LCDML_0_4, 6, "L.Transp.Key", UI_func_seq_live_transpose_oct);
LCDML_add(66, LCDML_0_5, 7, "Track Setup", UI_func_seq_track_setup);
LCDML_add(67, LCDML_0_5, 8, "Seq.Disp.Style", UI_func_seq_display_style);
LCDML_add(68, LCDML_0_4, 9, "LOAD Patterns", UI_func_seq_pattern_load);
LCDML_add(69, LCDML_0_4, 10, "SAVE Patterns", UI_func_seq_pattern_save);
LCDML_add(70, LCDML_0, 5, "System", NULL);
LCDML_add(71, LCDML_0_5, 1, "Stereo/Mono", UI_func_stereo_mono);
LCDML_add(72, LCDML_0_5, 2, "MIDI Soft THRU", UI_func_midi_soft_thru);
LCDML_add(73, LCDML_0_5, 3, "Favorites", UI_func_favorites);
LCDML_add(74, LCDML_0_5, 4, "EEPROM Reset", UI_func_eeprom_reset);
LCDML_add(75, LCDML_0, 6, "Info", UI_func_information);
LCDML_addAdvanced(76, LCDML_0, 5, COND_hide, "Volume", UI_func_volume, 0, _LCDML_TYPE_default);
#define _LCDML_DISP_cnt 76
LCDML_add(63, LCDML_0_5, 4, "Arpeggio", UI_func_arpeggio);
LCDML_add(64, LCDML_0_4, 5, "Seq. Length", UI_func_seq_lenght);
LCDML_add(65, LCDML_0_4, 6, "Tempo", UI_func_seq_tempo);
LCDML_add(66, LCDML_0_4, 7, "L.Transp.Key", UI_func_seq_live_transpose_oct);
LCDML_add(67, LCDML_0_5, 8, "Track Setup", UI_func_seq_track_setup);
LCDML_add(68, LCDML_0_5, 9, "Seq.Disp.Style", UI_func_seq_display_style);
LCDML_add(69, LCDML_0_4, 10, "LOAD Patterns", UI_func_seq_pattern_load);
LCDML_add(70, LCDML_0_4, 11, "SAVE Patterns", UI_func_seq_pattern_save);
LCDML_add(71, LCDML_0, 5, "System", NULL);
LCDML_add(72, LCDML_0_5, 1, "Stereo/Mono", UI_func_stereo_mono);
LCDML_add(73, LCDML_0_5, 2, "MIDI Soft THRU", UI_func_midi_soft_thru);
LCDML_add(74, LCDML_0_5, 3, "Favorites", UI_func_favorites);
LCDML_add(75, LCDML_0_5, 4, "EEPROM Reset", UI_func_eeprom_reset);
LCDML_add(76, LCDML_0, 6, "Info", UI_func_information);
LCDML_addAdvanced(77, LCDML_0, 5, COND_hide, "Volume", UI_func_volume, 0, _LCDML_TYPE_default);
#define _LCDML_DISP_cnt 77
#endif

@ -10,9 +10,11 @@ extern config_t configuration;
extern void handleNoteOn(byte , byte , byte );
extern void handleNoteOff(byte , byte , byte );
extern void UI_func_sequencer(uint8_t);
extern void UI_func_arpeggio(uint8_t);
extern const char* seq_find_shortname(uint8_t);
boolean interrupt_swapper = false;
void sequencer(void)
void sequencer_part1(void)
{
//if (seq_note_in > 0 && seq_note_in < 62 && seq_recording == false ) {
//handleNoteOff(configuration.dexed[0].midi_channel, seq_data[3][seq_step] + seq_transpose , 0);
@ -23,34 +25,18 @@ void sequencer(void)
//seq_note_in = 0;
//}
if (seq_millis_timer > seq_timer_previous + seq_tempo_ms)
{
seq_timer_previous = seq_millis_timer;
if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_sequencer)) {
// if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_sequencer)) { //is in UI of Sequencer
//write to sequencer if in sequencer menu
if (seq_note_in > 0 && seq_recording == true) {
// if ( seq_content_type[ seq_patternchain[seq_chain_active_step][active_track] ] == 1) handleNoteOff(configuration.dexed[0].midi_channel, seq_data[active_track][seq_step] + seq_transpose , 0);
seq_data[seq_active_track][seq_step] = seq_note_in;
seq_vel[seq_active_track][seq_step] = seq_note_in_velocity;
seq_note_in = 0;
seq_note_in_velocity = 0;
}
lcd.setCursor(seq_step, 1);
lcd.print("X");
if (seq_step == 0) {
lcd.setCursor(15, 1);
lcd.print(seq_find_shortname(15)[0]);
}
else
{
lcd.setCursor(seq_step - 1, 1);
lcd.print(seq_find_shortname(seq_step - 1)[0]);
}
}
// if (seq_note_in > 0 && seq_recording == true) {
//
// // if ( seq_content_type[ seq_patternchain[seq_chain_active_step][active_track] ] == 1) handleNoteOff(configuration.dexed[0].midi_channel, seq_data[active_track][seq_step] + seq_transpose , 0);
//
// seq_data[seq_active_track][seq_step] = seq_note_in;
// seq_vel[seq_active_track][seq_step] = seq_note_in_velocity;
// seq_note_in = 0;
// seq_note_in_velocity = 0;
// }
for (uint8_t d = 0; d < 4; d++)
{
@ -78,46 +64,61 @@ void sequencer(void)
handleNoteOn(configuration.dexed[seq_chord_dexed_inst].midi_channel, seq_data[ seq_patternchain[seq_chain_active_step][d] ][seq_step] + seq_transpose + seq_chords[seq_vel[ seq_patternchain[seq_chain_active_step][d] ][seq_step] - 200][3], seq_chord_velocity);
}
}
else if (seq_track_type[d] == 3) { //Arp
arp_step = 0;
arp_counter = 0;
arp_note = seq_data[ seq_patternchain[seq_chain_active_step][d] ][seq_step] + seq_transpose;
arp_chord = seq_vel[ seq_patternchain[seq_chain_active_step][d] ][seq_step];
}
}
}
if (seq_track_type[d] == 3)
{ //Arp
if (arp_speed == 0 || (arp_speed == 1 && arp_counter == 2) ) {
if (arp_step == 0 ) {
handleNoteOn(configuration.dexed[seq_chord_dexed_inst].midi_channel, arp_note+ arp_octave * 12 , seq_chord_velocity);
arp_note_prev = arp_note+arp_octave * 12;
handleNoteOn(configuration.dexed[seq_chord_dexed_inst].midi_channel, arp_note + arp_octave * 12 , seq_chord_velocity);
arp_note_prev = arp_note + arp_octave * 12;
}
else
{
{ if (arp_style == 0) { //arp up
handleNoteOn(configuration.dexed[seq_chord_dexed_inst].midi_channel, arp_note + seq_chords[arp_chord - 200][arp_step - 1] + arp_octave * 12, seq_chord_velocity);
arp_note_prev = arp_note + seq_chords[arp_chord - 200][arp_step - 1] + arp_octave * 12;
}
else if (arp_style == 3) { //arp random
uint8_t rnd1 = random(4);
uint8_t rnd2 = random(arp_oct_usersetting + 1) * 12;
handleNoteOn(configuration.dexed[seq_chord_dexed_inst].midi_channel, arp_note + seq_chords[arp_chord - 200][rnd1] + rnd2, seq_chord_velocity);
arp_note_prev = arp_note + seq_chords[arp_chord - 200][rnd1] + rnd2;
}
}
}
}
seq_noteoffsent[d] = false;
}
seq_step++;
if (arp_speed == 0) // Arp Speed 1/16
{
arp_step++;
if (arp_step > 3) {
}
else
{
if (arp_speed == 1) // Arp Speed 1/8
{
if (arp_counter > 1) {
arp_counter = 0;
arp_step++;
}
arp_counter++;
}
}
if (arp_step > 3 || seq_chords[arp_chord - 200][arp_step] == 0 ) {
arp_step = 0;
arp_octave++;
if (arp_octave > 1) arp_octave = 0;
if (arp_octave > arp_oct_usersetting) arp_octave = 0;
}
if (seq_step > 15) {
seq_step = 0;
if (seq_chain_lenght > 0) {
seq_chain_active_step++;
@ -127,38 +128,40 @@ void sequencer(void)
}
}
}
}
if (seq_millis_timer > seq_timer_previous + 80 )
{
}
void sequencer_part2(void)
{
for (uint8_t d = 0; d < 4; d++)
{
if ( seq_noteoffsent[d] == false) {
if ( seq_prev_note[d] > 0 && seq_track_type[d] > 0) //test instrument sequencer Instance=0
if ( seq_prev_note[d] > 0 && seq_track_type[d] > 0)
{
handleNoteOff(configuration.dexed[seq_inst_dexed[d]].midi_channel, seq_prev_note[d] , 0);
if (seq_track_type[d] == 2) { //Chords
if ( seq_prev_vel[d] > 199) {
handleNoteOff(configuration.dexed[seq_chord_dexed_inst].midi_channel, seq_prev_note[d] + seq_chords[seq_prev_vel[d] - 200][0], 0);
handleNoteOff(configuration.dexed[seq_chord_dexed_inst].midi_channel, seq_prev_note[d] + seq_chords[seq_prev_vel[d] - 200][1] , 0);
handleNoteOff(configuration.dexed[seq_chord_dexed_inst].midi_channel, seq_prev_note[d] + seq_chords[seq_prev_vel[d] - 200][2] , 0);
handleNoteOff(configuration.dexed[seq_chord_dexed_inst].midi_channel, seq_prev_note[d] + seq_chords[seq_prev_vel[d] - 200][3] , 0);
}
}
else if (seq_track_type[d] == 3)
{ //Arp
handleNoteOff(configuration.dexed[seq_chord_dexed_inst].midi_channel, arp_note_prev, 0);
}
}
}
seq_noteoffsent[d] = true;
}
}
}
void sequencer(void)
{ // Runs in Interrupt Timer. Switches between the Noteon and Noteoff Task, each cycle
interrupt_swapper = !interrupt_swapper;
if (interrupt_swapper) sequencer_part1();
else sequencer_part2();
}

@ -3,17 +3,16 @@ uint8_t seq_active_track = 0;
uint8_t seq_menu;
bool seq_button_r = false;
bool seq_noteoffsent[4] = {false, false, false, false};
elapsedMillis seq_millis_timer;
uint8_t seq_step = 0;
uint32_t seq_timer_previous = 0;
bool seq_running = false;
bool seq_recording = false;
uint8_t seq_note_in;
uint8_t seq_note_in_velocity;
int seq_transpose;
uint8_t seq_inst_dexed[4] = { 1, 1, 1, 1 };
uint8_t seq_inst_dexed[4] = { 0, 0, 0, 1 };
uint8_t seq_chord_dexed_inst = 0;
uint8_t seq_chord_velocity = 50;
uint8_t arp_style = 0; // up, down, up&down, random
uint8_t seq_chords[6][4] = { 4, 7, 12, 0, //major
3, 7, 12, 0, //minor
4, 7, 10, 12, //seventh
@ -21,12 +20,26 @@ uint8_t seq_chords[6][4] = { 4, 7, 12, 0, //major
3, 6, 12, 0, //dim
4, 7, 11 , 0 //maj7,
};
char seq_chord_names[6][4] = { 'M', 'a', 'j', ' ' , //major
'M', 'i', 'n', ' ' ,
's', 'e', 'v', ' ' ,
'a', 'u', 'g', ' ' ,
'd', 'i', 'm', ' ' ,
'M', 'a', 'j', '7' ,
};
char arp_style_names[4][3] = { 'u', 'p', ' ',
'd', 'w', 'n',
'u', '&', 'd',
'R', 'N', 'D',
};
int seq_tempo_ms = 147;
int seq_bpm = 102;
uint8_t seq_temp_select_menu;
uint8_t seq_temp_active_menu = 99;
uint8_t seq_chain_active_chainstep;
uint8_t seq_chain_lenght = 3; // 0=16 steps, 1=32 Steps, 2=46 Steps, 3=64 Steps
uint8_t seq_chain_lenght = 3; // 0 = 16 steps, 1 = 32 Steps, 2 = 46 Steps, 3 = 64 Steps
uint8_t seq_chain_active_step = 0;
uint8_t seq_prev_note[4]; // note_offs for every (instr.) track
uint8_t seq_prev_vel[4];
@ -36,21 +49,23 @@ uint8_t arp_chord;
uint8_t arp_note_prev;
uint8_t arp_octave;
uint8_t arp_prev_oct;
uint8_t arp_speed = 0;
uint8_t arp_counter = 0;
uint8_t arp_oct_usersetting = 1;
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 ,
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 , //c1
57 , 0 , 0 , 0 , 0 , 0 , 53 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , //C2
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 ,
74 , 0 , 0 , 72 , 0 , 0 , 74 , 0 , 0 , 0 , 76 , 0 , 0 , 0 , 0 , 0 ,
74 , 0 , 0 , 72 , 0 , 0 , 71 , 0 , 0 , 0 , 67 , 0 , 0 , 0 , 0 , 0 ,
69 , 0 , 0 , 76 , 0 , 0 , 69 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0
};
uint8_t seq_vel[10][16] = {120, 0, 0, 0, 120, 0, 0, 0, 120, 0, 0, 0, 120, 0, 0, 0,
105, 80, 105, 70, 106, 98, 106, 70, 126, 97, 106, 70, 106, 99, 90, 65,
120, 0, 0, 0, 120, 0, 0, 0, 120, 0, 120, 50, 120, 120, 0, 0,
120, 0, 0, 0, 120, 0, 0, 0, 120, 0, 120, 60, 120, 120, 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, 0, 0, 0, 0, 0, 0, 0, 0, 200,
200, 200, 200, 200, 200, 200, 201, 0, 0, 0, 0, 0, 0, 0, 0, 200,
@ -62,8 +77,8 @@ uint8_t seq_vel[10][16] = {120, 0, 0, 0, 120, 0, 0, 0, 120, 0, 0, 0, 120, 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, 2, 2 , 1 , 1 , 1 }; // 0 = track is Drumtrack, 1= Instrumenttrack, 2= Chord, 3= Arpeggio
uint8_t seq_track_type[4] = { 0, 0, 3, 1 }; // 0 = track is Drumtrack, 1= Instrumenttrack, 2= Chord, 3=Arp, 4=Chord+Arp
uint8_t seq_content_type[10] = { 0, 0, 0, 0 , 1, 1, 1 , 1 , 1 , 1 }; // 0 = track is Drumtrack, 1= Instrumenttrack, 2= Chord or Arpeggio
uint8_t seq_track_type[4] = { 0, 0, 1, 1 }; // 0 = track is Drumtrack, 1 = Instrumenttrack, 2 = Chord, 3 = Arp
//uint8_t seq_reverb[4][16] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
// 0, 0, 0, 0, 15, 0, 0, 0, 0, 0, 0, 0, 36, 0, 0, 0,

Binary file not shown.
Loading…
Cancel
Save