Skip to content

Commit

Permalink
add polytouchin/out to daisy
Browse files Browse the repository at this point in the history
  • Loading branch information
dromer committed Nov 20, 2023
1 parent 6b7e92b commit 4da68c3
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 1 deletion.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Next Release
* Objects: `[bang~]`
* Documentation fixes/additions
* Daisy: ability to set samplerate and blocksize
* Daisy: midirealtimein support
* Daisy: adding midirealtimein, polytouchin/out
* DPF: enum for UI parameter IDs
* DPF bugfixes: correct input PortGroup names; correct UI slider updates
* Cleanup: remove deprecated build.json
Expand Down
1 change: 1 addition & 0 deletions hvcc/generators/c2daisy/c2daisy.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
hv_midi_messages = {
"__hv_noteout",
"__hv_ctlout",
"__hv_polytouchout",
"__hv_pgmout",
"__hv_touchout",
"__hv_bendout",
Expand Down
26 changes: 26 additions & 0 deletions hvcc/generators/c2daisy/templates/HeavyDaisy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
{% if has_midi or usb_midi %}
#define HV_HASH_NOTEIN 0x67E37CA3
#define HV_HASH_CTLIN 0x41BE0f9C
#define HV_HASH_POLYTOUCHIN 0xBC530F59
#define HV_HASH_PGMIN 0x2E1EA03D
#define HV_HASH_TOUCHIN 0x553925BD
#define HV_HASH_BENDIN 0x3083F0F7
Expand All @@ -17,6 +18,7 @@

#define HV_HASH_NOTEOUT 0xD1D4AC2
#define HV_HASH_CTLOUT 0xE5e2A040
#define HV_HASH_POLYTOUCHOUT 0xD5ACA9D1
#define HV_HASH_PGMOUT 0x8753E39E
#define HV_HASH_TOUCHOUT 0x476D4387
#define HV_HASH_BENDOUT 0xE8458013
Expand Down Expand Up @@ -142,6 +144,14 @@ void HandleMidiMessage(MidiEvent m)
(float) p.channel);
break;
}
case PolyphonicKeyPressure: { // polyphonic aftertouch
PolyphonicKeyPressureEvent p = m.AsPolyphonicKeyPressure();
hv.sendMessageToReceiverV(HV_HASH_POLYTOUCHIN, 0, "fff",
(float) p.pressure, // pressure
(float) p.note, // note
(float) p.channel);
break;
}
case ControlChange: {
ControlChangeEvent p = m.AsControlChange();
hv.sendMessageToReceiverV(HV_HASH_CTLIN, 0, "fff",
Expand Down Expand Up @@ -312,6 +322,22 @@ void HandleMidiSend(uint32_t sendHash, const HvMessage *m)
HandleMidiOut(midiData, numElements);
break;
}
case HV_HASH_POLYTOUCHOUT:
{
uint8_t value = hv_msg_getFloat(m, 0);
uint8_t note = hv_msg_getFloat(m, 1);
uint8_t ch = hv_msg_getFloat(m, 2);
ch %= 16; // drop any pd "ports"

const uint8_t numElements = 3;
uint8_t midiData[numElements];
midiData[0] = 0xA0 | ch; // send Poly Aftertouch
midiData[1] = note;
midiData[2] = value;

HandleMidiOut(midiData, numElements);
break;
}
case HV_HASH_CTLOUT:
{
uint8_t value = hv_msg_getFloat(m, 0);
Expand Down

0 comments on commit 4da68c3

Please sign in to comment.