Skip to content

Commit

Permalink
Feature/dpf improvements (Wasted-Audio#34)
Browse files Browse the repository at this point in the history
* use pd-vanilla legacy offset for [bendout]
  • Loading branch information
dromer authored Oct 23, 2021
1 parent baef1e8 commit 627b14f
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 16 deletions.
8 changes: 7 additions & 1 deletion docs/04.midi.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand All @@ -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)
Expand Down
18 changes: 12 additions & 6 deletions examples/dpf/dpf_bend.pd
Original file line number Diff line number Diff line change
@@ -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;
20 changes: 11 additions & 9 deletions hvcc/interpreters/pd2hv/libs/pd/bendout.pd
Original file line number Diff line number Diff line change
@@ -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;

0 comments on commit 627b14f

Please sign in to comment.