diff --git a/docs/04.midi.md b/docs/04.midi.md index 321b2bad..7f62d12d 100644 --- a/docs/04.midi.md +++ b/docs/04.midi.md @@ -38,7 +38,9 @@ The same principle applies for sending MIDI data out of the heavy context. If yo ## Note! -`It is generally the users responsibility to convert to and from the MIDI byte data to the float values used by heavy.` +`* For compatibility reasons [bendout] uses -8192 to 8191 range (and resets the offset with an internal [+ 8192]). This ensures expected behaviour with pd-vanilla patches.` + +`* It is generally the users responsibility to convert to and from the MIDI byte data to the float values used by heavy.` Some framework targets like [DPF](03.gen.dpf.md) already have implementations available. However, if you're integrating the C/C++ code on a custom platform then you'll need to provide your own conversion process. @@ -48,6 +50,10 @@ Here's the `DPF` implementation as an example. The MIDI input is called during the DPF `run()` loop where it receives `MidiEvent` messages: +## Handling MIDI Input + +The MIDI input is called during the DPF `run()` loop where it receives `MidiEvent` messages: + ```cpp #if DISTRHO_PLUGIN_WANT_MIDI_INPUT void {{class_name}}::handleMidiInput(uint32_t curEventIndex, const MidiEvent* midiEvents) diff --git a/examples/dpf/dpf_bend.pd b/examples/dpf/dpf_bend.pd index 7cb7a272..c8e3f324 100644 --- a/examples/dpf/dpf_bend.pd +++ b/examples/dpf/dpf_bend.pd @@ -1,10 +1,16 @@ -#N canvas 1069 603 354 149 12; +#N canvas 769 445 438 195 12; #X obj 30 25 bendin; -#X obj 155 54 hsl 128 15 0 16383 0 0 empty empty empty -2 -8 0 10 -262144 --1 -1 0 1; -#X obj 121 24 r bend @hv_param 0 16383 8192; +#X obj 192 42 hsl 128 15 -8192 8192 0 0 empty empty empty -2 -8 0 10 +-262144 -1 -1 8900 1; +#X obj 121 9 r bend @hv_param 0 16383 8192; #X obj 30 58 print; -#X obj 121 97 bendout; +#X obj 121 75 bendout; +#X obj 121 40 - 8192; +#X text 17 106 For compatibility reasons we reproduce the inconsistent +[bendin] and [bendout] behaviour. While [bendin] outputs values from +0 to 16383 \, [bendout] takes values from -8192 to 8191 - this likely +won't change., f 55; #X connect 0 0 3 0; #X connect 1 0 4 0; -#X connect 2 0 4 0; +#X connect 2 0 5 0; +#X connect 5 0 4 0; diff --git a/hvcc/interpreters/pd2hv/libs/pd/bendout.pd b/hvcc/interpreters/pd2hv/libs/pd/bendout.pd index fe84be46..e4b63090 100644 --- a/hvcc/interpreters/pd2hv/libs/pd/bendout.pd +++ b/hvcc/interpreters/pd2hv/libs/pd/bendout.pd @@ -1,14 +1,16 @@ -#N canvas 1122 327 232 295 10; -#X obj 52 201 pack f f; -#X obj 97 74 inlet channel; -#X obj 97 146 f \$1; -#X obj 97 168 clip 0 15; -#X obj 114 106 loadbang; -#X obj 52 233 s __hv_bendout @hv_param; -#X obj 52 40 inlet bend; +#N canvas 695 1073 401 415 10; +#X obj 53 297 pack f f; +#X obj 98 170 inlet channel; +#X obj 98 242 f \$1; +#X obj 98 264 clip 0 15; +#X obj 115 202 loadbang; +#X obj 53 329 s __hv_bendout @hv_param; +#X obj 53 95 inlet bend; +#X obj 53 138 + 8192; #X connect 0 0 5 0; #X connect 1 0 2 0; #X connect 2 0 3 0; #X connect 3 0 0 1; #X connect 4 0 2 0; -#X connect 6 0 0 0; +#X connect 6 0 7 0; +#X connect 7 0 0 0;