Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
jmamma committed Mar 16, 2020
2 parents 9f6f9de + 8dc6514 commit abdd3ae
Show file tree
Hide file tree
Showing 27 changed files with 832 additions and 125 deletions.
17 changes: 17 additions & 0 deletions Changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
MCL 2.61 16/03/2020

Changes:

- Arpeggitaor added to Chromatic Page. Accessible from Track Select Menu.
- MIDI CC can be used to control MD Parms across poly tracks.
CC 16 to 40 controls MD Params 1 to 24.
- Added many more scales to Chromatic Page
- Chromatic Page now indicates when in POLY mode.
- Added support for TRX-S2

Bug Fixes:

- Peering was broken in certain pages. Fixed
- Fixed PolyPage selection bugs.


MCL 2.60 15/02/2019

Note: MCL update 2.60, requires that you upgrade your Machinedrum to OS version 1.70.
Expand Down
Binary file added art/sprites/ram_1_icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added art/sprites/ram_2_icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
156 changes: 156 additions & 0 deletions avr/cores/megacommand/MCL/ArpPage.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
#include "ArpPage.h"
#include "MCL.h"

MCLEncoder arp_oct(0, 3, ENCODER_RES_SEQ);
MCLEncoder arp_mode(0, 17, ENCODER_RES_SEQ);
MCLEncoder arp_speed(0, 3, ENCODER_RES_SEQ);
MCLEncoder arp_und(0, 2, ENCODER_RES_SEQ);

void ArpPage::setup() {}

void ArpPage::init() {

DEBUG_PRINT_FN();
#ifdef OLED_DISPLAY
classic_display = false;
oled_display.setFont();
seq_ptc_page.redisplay = true;
seq_ptc_page.display();
#endif
}

void ArpPage::cleanup() {
// md_exploit.off();
#ifdef OLED_DISPLAY
oled_display.clearDisplay();
#endif
}

void ArpPage::loop() {
if (encoders[0]->hasChanged()) {
switch (encoders[0]->cur) {
case ARP_ON:
seq_ptc_page.setup_arp();
break;
case ARP_OFF:
seq_ptc_page.remove_arp();
break;
}
if (encoders[0]->old > 1) {
seq_ptc_page.note_mask = 0;
seq_ptc_page.render_arp();
}
}
if (encoders[1]->hasChanged() || encoders[2]->hasChanged() ||
encoders[3]->hasChanged()) {
seq_ptc_page.render_arp();
}
}

typedef char arp_name_t[4];

const arp_name_t arp_names[] PROGMEM = {
"UP", "DWN", "UD", "DU", "UND", "DNU", "CNV", "DIV", "CND",
"PU", "PD", "TU", "TD", "UPP", "DP", "U2", "D2", "RND",
};

#ifndef OLED_DISPLAY
void ArpPage::display() {
uint8_t dev_num;
if (!redisplay) {
return true;
}
GUI.setLine(GUI.LINE1);

GUI.put_string_at(0, "ARP");
GUI.put_string_at(4, "MOD");
GUI.put_string_at(8, "SPD");
GUI.put_string_at(12,"OCT");

GUI.setLine(GUI.LINE2);
char str[5];

switch (encoders[0]->cur) {
case ARP_ON:
strcpy(str, "ON");
break;
case ARP_OFF:
strcpy(str, "--");
break;
case ARP_LATCH:
strcpy(str, "LAT");
break;
}
GUI.put_string_at(0, str);
m_strncpy_p(str, arp_names[encoders[1]->cur], 4);
GUI.put_string_at(4,str);
GUI.put_value_at2(8, encoders[2]->cur);
GUI.put_value_at2(12, encoders[3]->cur);
}
#else
void ArpPage::display() {

if (!classic_display) {
}
auto oldfont = oled_display.getFont();
oled_display.setFont(&TomThumb);

oled_display.fillRect(8, 2, 128 - 16, 32 - 2, BLACK);
oled_display.drawRect(8 + 1, 2 + 1, 128 - 16 - 2, 32 - 2 - 2, WHITE);

oled_display.setCursor(42, 10);

oled_display.setTextColor(WHITE);
oled_display.print("ARPEGGIATOR");
char str[5];
uint8_t y = 12;
uint8_t x = 16;

switch (encoders[0]->cur) {
case ARP_ON:
strcpy(str, "ON");
break;
case ARP_OFF:
strcpy(str, "--");
break;
case ARP_LATCH:
strcpy(str, "LAT");
break;
}
mcl_gui.draw_text_encoder(x + 0 * mcl_gui.knob_w, y, "ARP", str);

m_strncpy_p(str, arp_names[encoders[1]->cur], 4);

mcl_gui.draw_text_encoder(x + 1 * mcl_gui.knob_w, y, "MODE", str);

itoa(encoders[2]->cur, str, 10);
mcl_gui.draw_text_encoder(x + 2 * mcl_gui.knob_w, y, "SPD", str);

itoa(encoders[3]->cur, str, 10);
mcl_gui.draw_text_encoder(x + 3 * mcl_gui.knob_w, y, "OCT", str);

oled_display.display();
oled_display.setFont(oldfont);
}

#endif
bool ArpPage::handleEvent(gui_event_t *event) {
if (EVENT_PRESSED(event, Buttons.BUTTON1) ||
EVENT_PRESSED(event, Buttons.BUTTON3) ||
EVENT_PRESSED(event, Buttons.BUTTON2) ||
EVENT_PRESSED(event, Buttons.BUTTON4)) {
GUI.ignoreNextEvent(event->source);
GUI.popPage();
return true;
}

seq_ptc_page.handleEvent(event);

if (note_interface.is_event(event)) {
uint8_t track = event->source - 128;
if (midi_active_peering.get_device(event->port) != DEVICE_MD) {
return true;
}
}
return false;
}
32 changes: 32 additions & 0 deletions avr/cores/megacommand/MCL/ArpPage.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/* Justin Mammarella [email protected] 2018 */

#ifndef ARPPAGE_H__
#define ARPPAGE_H__

//#include "Pages.hh"
#include "GUI.h"
#include "MCLEncoder.h"

extern MCLEncoder arp_speed;
extern MCLEncoder arp_oct;
extern MCLEncoder arp_mode;
extern MCLEncoder arp_und;

class ArpPage : public LightPage {
public:

ArpPage(Encoder *e1 = NULL, Encoder *e2 = NULL, Encoder *e3 = NULL,
Encoder *e4 = NULL)
: LightPage(e1, e2, e3, e4) {
}

bool handleEvent(gui_event_t *event);

void loop();
void display();
void setup();
void init();
void cleanup();
};

#endif /* ARPPAGE_H__ */
4 changes: 2 additions & 2 deletions avr/cores/megacommand/MCL/MCL.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@
#include "Fonts/Elektrothic.h"
#endif

#define VERSION 2060
#define VERSION_STR "2.60"
#define VERSION 2061
#define VERSION_STR "2.61"

#define CALLBACK_TIMEOUT 500
#define GUI_NAME_TIMEOUT 800
Expand Down
4 changes: 2 additions & 2 deletions avr/cores/megacommand/MCL/MCLActions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -362,12 +362,12 @@ void MCLActions::send_tracks_to_devices() {
memcpy(&MD.kit.dynamics[0], kit_extra.dynamics, sizeof(kit_extra.dynamics));
}

MD.kit.origPosition = 0xF7;
MD.kit.origPosition = 0x7F;

/*Send the encoded kit to the MD via sysex*/
uint16_t myclock = slowclock;

md_setsysex_recpos(4, MD.kit.origPosition);
//md_setsysex_recpos(4, MD.kit.origPosition);
MD.kit.toSysex();

// mcl_seq.disable();
Expand Down
70 changes: 48 additions & 22 deletions avr/cores/megacommand/MCL/MCLGUI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -439,18 +439,21 @@ void MCLGUI::draw_microtiming(uint8_t resolution, uint8_t timing) {
oled_display.setFont(&TomThumb);

oled_display.setTextColor(WHITE);
if (resolution == 0) { resolution = 1; }
if (resolution > 2) { resolution = 1; }
if (resolution == 0) {
resolution = 1;
}
if (resolution > 2) {
resolution = 1;
}
uint8_t degrees = 24 / resolution;
uint8_t heights[12];

if (resolution == 1) {
uint8_t heights_highres[12] = { 12, 2, 4, 8, 6, 2, 10, 2, 6, 8, 4, 2 };
memcpy(&heights, &heights_highres, 12);
}
else {
uint8_t heights_lowres[6] = { 12, 4, 6, 10, 4, 8 };
memcpy(&heights, &heights_lowres, 6);
uint8_t heights_highres[12] = {12, 2, 4, 8, 6, 2, 10, 2, 6, 8, 4, 2};
memcpy(&heights, &heights_highres, 12);
} else {
uint8_t heights_lowres[6] = {12, 4, 6, 10, 4, 8};
memcpy(&heights, &heights_lowres, 6);
}
uint8_t y_pos = 11;
uint8_t a = 0;
Expand All @@ -459,23 +462,27 @@ void MCLGUI::draw_microtiming(uint8_t resolution, uint8_t timing) {
uint8_t x_w = (w / (degrees));
uint8_t x = x_pos;

oled_display.fillRect(8,2,128 - 16, 32 - 2,BLACK);
oled_display.fillRect(8, 2, 128 - 16, 32 - 2, BLACK);
oled_display.drawRect(8 + 1, 2 + 1, 128 - 16 - 2, 32 - 2 - 2, WHITE);

oled_display.setCursor(x_pos + 34, 10);
oled_display.print("uTIMING");

oled_display.drawLine(x, y_pos + heights[0], x + w, y_pos + heights[0], WHITE);

oled_display.drawLine(x, y_pos + heights[0], x + w, y_pos + heights[0],
WHITE);
for (uint8_t n = 0; n <= degrees; n++) {
oled_display.drawLine(x, y_pos + heights[0], x, y_pos + heights[0] - heights[a] , WHITE);
a++;
if (n == timing) {
oled_display.fillRect(x - 1, y_pos + heights[0] + 3, 3, 3, WHITE);
oled_display.drawPixel(x, y_pos + heights[0] + 2, WHITE);
}
oled_display.drawLine(x, y_pos + heights[0], x,
y_pos + heights[0] - heights[a], WHITE);
a++;
if (n == timing) {
oled_display.fillRect(x - 1, y_pos + heights[0] + 3, 3, 3, WHITE);
oled_display.drawPixel(x, y_pos + heights[0] + 2, WHITE);
}

if (a == degrees / 2) { a = 0; }
x += x_w;
if (a == degrees / 2) {
a = 0;
}
x += x_w;
}
oled_display.setFont(oldfont);
#endif
Expand Down Expand Up @@ -650,9 +657,9 @@ void MCLGUI::draw_leds(uint8_t x, uint8_t y, uint8_t offset, uint64_t lock_mask,
show_current_step && step_count == idx && MidiClock.state == 2;
bool locked = in_range && IS_BIT_SET64(lock_mask, i + offset);

// if (note_interface.notes[i] == 1) {
// TI feedback
// oled_display.drawRect(x, y, seq_w, led_h, WHITE);
// if (note_interface.notes[i] == 1) {
// TI feedback
// oled_display.drawRect(x, y, seq_w, led_h, WHITE);
if (!in_range) {
// don't draw
} else if (current ^ locked) {
Expand Down Expand Up @@ -913,6 +920,25 @@ const unsigned char icon_sound[] PROGMEM = {
0x01, 0xc7, 0xe0, 0x07, 0xc7, 0xc0, 0x0f, 0xc3, 0x80, 0x0f, 0xc0, 0x00,
0x0f, 0x80, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00};

// 'ram_2_icon2', 24x25px
const unsigned char icon_ram2[] PROGMEM = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0xff, 0xf8, 0x20, 0x00,
0x04, 0x20, 0x00, 0x04, 0x20, 0x00, 0x04, 0x23, 0xff, 0xc4, 0x26,
0x43, 0x24, 0x25, 0x42, 0xa4, 0x24, 0xc2, 0x64, 0x23, 0x81, 0xc4,
0x20, 0x00, 0x04, 0x20, 0x00, 0x04, 0x20, 0xff, 0x04, 0x1f, 0xff,
0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x6c, 0xe0, 0x0f,
0x6d, 0xf0, 0x06, 0x6d, 0xb0, 0x06, 0x7d, 0xb0, 0x06, 0x7d, 0xb0,
0x06, 0x7d, 0xf0, 0x06, 0x38, 0xe0, 0x00, 0x00, 0x00};
// 'ram_1_icon', 24x25px
const unsigned char icon_ram1[] PROGMEM = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0xff, 0xf8, 0x20, 0x00,
0x04, 0x20, 0x00, 0x04, 0x20, 0x00, 0x04, 0x23, 0xff, 0xc4, 0x24,
0xc2, 0x64, 0x25, 0x42, 0xa4, 0x26, 0x43, 0x24, 0x23, 0x81, 0xc4,
0x20, 0x00, 0x04, 0x20, 0x00, 0x04, 0x20, 0xff, 0x04, 0x1f, 0xff,
0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x38, 0x70, 0x0f,
0xbc, 0xf0, 0x0d, 0xb6, 0xc0, 0x0d, 0xb6, 0xf0, 0x0d, 0xb6, 0xc0,
0x0f, 0xb6, 0xf0, 0x07, 0x36, 0x70, 0x00, 0x00, 0x00};

// 'md_rev', 34x24px
const unsigned char icon_md[] PROGMEM = {
0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x01, 0xa0, 0x00, 0x00, 0x00,
Expand Down
4 changes: 4 additions & 0 deletions avr/cores/megacommand/MCL/MCLGUI.h
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,10 @@ extern const unsigned char icon_para[];
extern const unsigned char icon_step[];
// 'gatebox', 24x25px
extern const unsigned char icon_gatebox[];
// 'ram1', 24x25px
extern const unsigned char icon_ram1[];
// 'ram2', 24x25px
extern const unsigned char icon_ram2[];
// 'rythmecho', 24x25px
extern const unsigned char icon_rhytmecho [];
// 'route', 24x16px
Expand Down
6 changes: 3 additions & 3 deletions avr/cores/megacommand/MCL/MDSeqTrack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ void MDSeqTrack::record_track_pitch(uint8_t pitch) {
}
set_track_pitch(step_count, pitch);
}
void MDSeqTrack::record_track(uint8_t note_num, uint8_t velocity) {
void MDSeqTrack::record_track(uint8_t velocity) {
/*uint8_t step_count =
(MidiClock.div16th_counter - mcl_actions.start_clock32th / 2) -
(length * ((MidiClock.div16th_counter - mcl_actions.start_clock32th / 2)
Expand All @@ -347,10 +347,10 @@ void MDSeqTrack::record_track(uint8_t note_num, uint8_t velocity) {
return;
}
uint8_t utiming = MidiClock.mod12_counter + 12;
set_track_step(step_count, utiming, note_num, velocity);
set_track_step(step_count, utiming, velocity);
}

void MDSeqTrack::set_track_step(uint8_t step, uint8_t utiming, uint8_t note_num,
void MDSeqTrack::set_track_step(uint8_t step, uint8_t utiming,
uint8_t velocity) {
uint8_t condition = 0;

Expand Down
Loading

0 comments on commit abdd3ae

Please sign in to comment.