Skip to content

Commit 0b7686f

Browse files
committed
add DAW Controller support for various Arturia controllers
MiniLab 3 Keylab Essential KeyLab Essential mk3 KeyLab mkII based on https://github.com/PrzemekBarski/arturia-keylab-essential-mk3-programming-guide Tested on a Arturia MiniLab 3 and KeyLab mkII Keylab Essential and Keylab Essential mk3 is not tested
1 parent 8703dc4 commit 0b7686f

18 files changed

Lines changed: 2280 additions & 164 deletions

src/Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ CMSIS_DIR = ../CMSIS_5/CMSIS
99
OBJS = main.o kernel.o minidexed.o config.o userinterface.o uimenu.o \
1010
mididevice.o midikeyboard.o serialmididevice.o pckeyboard.o \
1111
sysexfileloader.o performanceconfig.o perftimer.o \
12-
effect_compressor.o effect_platervbstereo.o uibuttons.o midipin.o
12+
effect_compressor.o effect_platervbstereo.o uibuttons.o midipin.o \
13+
dawcontroller.o
1314

1415
OPTIMIZE = -O3
1516

src/common.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
#ifndef _common_h
33
#define _common_h
44

5+
#define ARRAY_LENGTH(x) (sizeof(x) / sizeof((x)[0]))
6+
57
inline long maplong(long x, long in_min, long in_max, long out_min, long out_max) {
68
return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
79
}
@@ -16,6 +18,12 @@ inline float32_t mapfloat(int val, int in_min, int in_max, float32_t out_min, fl
1618
return (val - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
1719
}
1820

21+
inline long mapfloatr(int val, int in_min, int in_max, float32_t out_min, float32_t out_max)
22+
{
23+
return lround((val - in_min) * (out_max - out_min) / (in_max - in_min) + out_min);
24+
}
25+
26+
1927
#define constrain(amt, low, high) ({ \
2028
__typeof__(amt) _amt = (amt); \
2129
__typeof__(low) _low = (low); \

src/config.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,9 @@ void CConfig::Load (void)
204204
m_MIDIButtonActionBankDown = m_Properties.GetString ("MIDIButtonActionBankDown", "");
205205
m_MIDIButtonActionTGUp = m_Properties.GetString ("MIDIButtonActionTGUp", "");
206206
m_MIDIButtonActionTGDown = m_Properties.GetString ("MIDIButtonActionTGDown", "");
207-
207+
208+
m_bDAWControllerEnabled = m_Properties.GetNumber ("DAWControllerEnabled", 0) != 0;
209+
208210
m_bEncoderEnabled = m_Properties.GetNumber ("EncoderEnabled", 0) != 0;
209211
m_nEncoderPinClock = m_Properties.GetNumber ("EncoderPinClock", 10);
210212
m_nEncoderPinData = m_Properties.GetNumber ("EncoderPinData", 9);
@@ -751,6 +753,11 @@ const char *CConfig::GetMIDIButtonActionTGDown (void) const
751753
return m_MIDIButtonActionTGDown.c_str();
752754
}
753755

756+
bool CConfig::GetDAWControllerEnabled (void) const
757+
{
758+
return m_bDAWControllerEnabled;
759+
}
760+
754761
bool CConfig::GetEncoderEnabled (void) const
755762
{
756763
return m_bEncoderEnabled;

src/config.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,8 @@ class CConfig // Configuration for MiniDexed
240240
const char *GetMIDIButtonActionTGUp (void) const;
241241
const char *GetMIDIButtonActionTGDown (void) const;
242242

243+
bool GetDAWControllerEnabled (void) const;
244+
243245
// KY-040 Rotary Encoder
244246
// GPIO pin numbers are chip numbers, not header positions
245247
bool GetEncoderEnabled (void) const;
@@ -371,6 +373,8 @@ class CConfig // Configuration for MiniDexed
371373
unsigned m_nMIDIButtonTGUp;
372374
unsigned m_nMIDIButtonTGDown;
373375

376+
bool m_bDAWControllerEnabled;
377+
374378
bool m_bEncoderEnabled;
375379
unsigned m_nEncoderPinClock;
376380
unsigned m_nEncoderPinData;

0 commit comments

Comments
 (0)