diff options
| -rw-r--r-- | plink0A6.bin | bin | 0 -> 1048576 bytes | |||
| -rw-r--r-- | plink0A6.uf2 | bin | 0 -> 874496 bytes | |||
| -rwxr-xr-x | sw/Core/Src/config.h | 3 | ||||
| -rwxr-xr-x | sw/Core/Src/params.h | 12 | ||||
| -rwxr-xr-x | sw/Core/Src/params_new.h | 4 | ||||
| -rwxr-xr-x | sw/Core/Src/plinky.c | 27 | ||||
| -rwxr-xr-x | sw/Core/Src/ui.h | 8 |
7 files changed, 46 insertions, 8 deletions
diff --git a/plink0A6.bin b/plink0A6.bin Binary files differnew file mode 100644 index 0000000..4fcbada --- /dev/null +++ b/plink0A6.bin diff --git a/plink0A6.uf2 b/plink0A6.uf2 Binary files differnew file mode 100644 index 0000000..927f4a9 --- /dev/null +++ b/plink0A6.uf2 diff --git a/sw/Core/Src/config.h b/sw/Core/Src/config.h index 2451839..f86471f 100755 --- a/sw/Core/Src/config.h +++ b/sw/Core/Src/config.h @@ -55,4 +55,5 @@ // 0.A3 - Fixes a USB bug in which some hosts wouldn't recognize Plinky. New startup sequence is plinky_init(), then midiinit(). // 0.A4 - Disabled MERGE_PLAYBACK in touch.h. DISABLE_AUTOSAVE flag enables Demo Mode - changes are not written to flash. Disables ProgramPage() in params.h // 0.A5 - Encoder fix -#define VERSION2 "v0.A5" +// 0.A6 - Set Channels for MIDI in and out (unused pad) +#define VERSION2 "v0.A6" diff --git a/sw/Core/Src/params.h b/sw/Core/Src/params.h index 905cf3d..910ab6b 100755 --- a/sw/Core/Src/params.h +++ b/sw/Core/Src/params.h @@ -200,6 +200,10 @@ const char * const paramnames[P_LAST]={ [P_YSHAPE]=I_SHAPE "LFO Shape", [P_YWARP]=I_WARP "LFO Warp", + [P_MIDI_CH_IN]=I_PIANO "MIDI In Ch", + [P_MIDI_CH_OUT]=I_PIANO "MIDI Out Ch", + + }; #define FLAG_SIGNED 128 @@ -239,8 +243,6 @@ const static u8 param_flags[P_LAST] = { [P_SEQPAT]=24, [P_SEQSTEP] = FLAG_SIGNED + 64, - - [P_DLSEND]=0, [P_DLTIME]=FLAG_SIGNED, [P_DLFB]=0, @@ -306,6 +308,9 @@ const static u8 param_flags[P_LAST] = { [P_SMP_TIME] = FLAG_SIGNED, [P_CV_QUANT] = CVQ_LAST, [P_JIT_PULSE] = FLAG_SIGNED, + + [P_MIDI_CH_IN] = 16, + [P_MIDI_CH_OUT] = 16 }; #define C ( 0*512) @@ -1079,6 +1084,9 @@ static Preset const init_params = { [P_YWARP] = {0}, [P_ACCEL_SENS] = {HALF}, + + [P_MIDI_CH_IN] = {0}, + [P_MIDI_CH_OUT] = {0}, } }; // init params diff --git a/sw/Core/Src/params_new.h b/sw/Core/Src/params_new.h index c3a40a8..3da280e 100755 --- a/sw/Core/Src/params_new.h +++ b/sw/Core/Src/params_new.h @@ -102,14 +102,14 @@ enum EParams { P_MIXSYNTH = PG_MIX1 * 6, P_MIXWETDRY, P_MIXHPF, - P_MIX_UNUSED, + P_MIDI_CH_IN, //P_MIX_UNUSED, P_CV_QUANT, P_HEADPHONE, // system? P_MIXINPUT = PG_MIX2 * 6, P_MIXINWETDRY, P_SYS_UNUSED1, - P_SYS_UNUSED2, + P_MIDI_CH_OUT, //P_SYS_UNUSED2, P_ACCEL_SENS, P_MIX_WIDTH, diff --git a/sw/Core/Src/plinky.c b/sw/Core/Src/plinky.c index 90df966..fdf9a9b 100755 --- a/sw/Core/Src/plinky.c +++ b/sw/Core/Src/plinky.c @@ -1500,6 +1500,11 @@ const s8 midicctable[128] = { /* 112 */ P_DLRATIO, P_DLWOB, P_RVWOB, -1, P_JIT_POS, P_JIT_GRAINSIZE, P_JIT_RATE, P_JIT_PULSE,
/* 120 */ -1, -1, -1, -1, -1, -1, -1, -1,
};
+
+
+
+
+
bool midi_receive(unsigned char packet[4]); // usb midi poll
void processmidimsg(u8 msg, u8 d1, u8 d2);
bool processusbmidi(void) {
@@ -1532,12 +1537,19 @@ bool send_midimsg(u8 status, u8 data1, u8 data2); void processmidimsg(u8 msg, u8 d1, u8 d2) {
u8 chan = msg & 15;
u8 type = msg >> 4;
- if ((chan != 0)&&(type != 0xF)) //LPZW KAY Fix for MIDI Sync type == F continue
+
+ //int midi_ch_in = ((GetParam(P_MIDI_CH_IN, 0) * 16)/FULL) & 15;
+ //int midi_ch_in = clampi(((GetParam(P_MIDI_CH_IN, 0) * 15)/FULL),0,15);
+
+ int midi_ch_in = clampi((mini(GetParam(P_MIDI_CH_IN, 0), FULL - 1) * 16) / FULL,0,15);
+
+ //if ((chan != 0)&&(type != 0xF)) // chan != 0 = allow all channels; LPZW KAY Fix for MIDI Sync type == F continue
+ if ((chan != midi_ch_in)&&(type != 0xF)) // allow only selected channel and MIDI sync
return;
if (type < 8)
return;
-// send_midimsg(msg, d1, d2); // midi echo!
+ // send_midimsg(msg, d1, d2); // midi echo!
if (type == 9 && d2 == 0)
type = 8;
@@ -2972,13 +2984,22 @@ bool send_midi_serial(const u8 *data, int len) { }
bool send_midimsg(u8 status, u8 data1, u8 data2) { // returns false if too full
+
u8 len=3;
- if (status>=0xc0 && status<0xe0)
+
+ if (status>=0xc0 && status<0xe0) // Cn Program Change, Dn Mono / Channel Aftertouch
len=2;
if (!(status&0x80))
return true;
if (status == 0x80 && data1 == 0)
return true; // er, no
+
+ //int midi_ch_out = ((GetParam(P_MIDI_CH_OUT, 0) * 16)/FULL) & 15;
+ //int midi_ch_out = clampi(((GetParam(P_MIDI_CH_OUT, 0) * 16)/FULL),0,15);
+ int midi_ch_out = clampi((mini(GetParam(P_MIDI_CH_OUT, 0), FULL - 1) * 16) / FULL,0,15);
+
+ if (status<0xf0) status += midi_ch_out; // sets output channel
+
u8 buf[4]={status>>4, status,data1,data2};
usb_midi_write(buf);
#ifdef DEBUG
diff --git a/sw/Core/Src/ui.h b/sw/Core/Src/ui.h index 1a93c8d..9687d0d 100755 --- a/sw/Core/Src/ui.h +++ b/sw/Core/Src/ui.h @@ -590,6 +590,14 @@ const char *getparamstr(int p, int mod, int v, char *valbuf, char *decbuf) { case P_ARPOCT: v += (FULL * 10) / displaymax; // 1 based break; + case P_MIDI_CH_IN: + case P_MIDI_CH_OUT: { + int midich = clampi(vscale,0,15)+1; + int n=sprintf(valbuf, "%d", midich); + if (!decbuf) + decbuf = valbuf + n; + return valbuf; + } case P_ARPMODE: return arpmodenames[clampi(vscale, 0, ARP_LAST - 1)]; case P_SEQMODE: |
