chris@552
|
1 #N canvas 959 597 692 1046 10;
|
chris@552
|
2 #X obj 45 615 dac~ 1 2;
|
chris@552
|
3 #X obj 45 574 *~ 0.1;
|
chris@552
|
4 #X obj 45 553 osc~ 440;
|
chris@552
|
5 #X text 464 21 ............................;
|
chris@552
|
6 #X text 464 31 . ____ ._____ _ .......___ .;
|
chris@552
|
7 #X text 464 41 .| __ )| ____| |....../ _ |.;
|
chris@552
|
8 #X text 464 61 .| |_) | |___| |___ / ___ |.;
|
chris@552
|
9 #X text 464 71 .|____/|_____|_____/_/..._|.io;
|
chris@552
|
10 #X text 464 81 ............................;
|
chris@552
|
11 #X text 464 51 .| __ || __|.| |...../ _| |.;
|
chris@552
|
12 #X text 35 32 Using custom render.cpp files;
|
chris@552
|
13 #X text 35 42 =============================;
|
chris@552
|
14 #X text 35 58 It is possible to modify the default libpd and heavy
|
chris@552
|
15 ;
|
chris@552
|
16 #X text 35 72 wrapper templates in order to combine c++ code with;
|
chris@552
|
17 #X text 35 86 your puredata patches.;
|
chris@552
|
18 #X text 35 100 In this example you should hear a tremolo effect being
|
chris@552
|
19 ;
|
chris@552
|
20 #X text 35 114 applied to the output. This is done by taking the output
|
chris@552
|
21 ;
|
chris@552
|
22 #X text 35 128 buffer returned from libpd or heavy and applying further
|
chris@552
|
23 ;
|
chris@552
|
24 #X text 35 142 processing before writing the buffer to the Bela context.
|
chris@552
|
25 ;
|
chris@552
|
26 #X text 35 156 It is also possible to define more input or output channels
|
chris@552
|
27 ;
|
chris@552
|
28 #X text 35 170 within the render.cpp file in order to pass auxiliary
|
chris@552
|
29 ;
|
chris@552
|
30 #X text 35 198 code.;
|
chris@552
|
31 #X text 35 184 signals (e.g. envelopes) across the pd patch and the
|
chris@552
|
32 c++;
|
chris@552
|
33 #X obj 46 716 adc~ 3;
|
chris@552
|
34 #X obj 46 738 snapshot~;
|
chris@552
|
35 #X obj 97 694 loadbang;
|
chris@552
|
36 #X obj 97 716 metro 5;
|
chris@552
|
37 #X obj 46 804 * 20;
|
chris@552
|
38 #X obj 46 826 + 0.5;
|
chris@552
|
39 #X text 94 826 map to exponential range 0.5Hz<->20Hz;
|
chris@552
|
40 #X obj 46 848 s tremoloRate;
|
chris@552
|
41 #X text 154 848 <<< this receiver doesn't exist in the patch but is
|
chris@552
|
42 parsed;
|
chris@552
|
43 #X text 36 520 Simple 440Hz sine wave;
|
chris@552
|
44 #X text 36 530 ----------------------;
|
chris@552
|
45 #X text 36 660 Sending messages to modified render.cpp;
|
chris@552
|
46 #X text 36 670 ---------------------------------------;
|
chris@552
|
47 #X text 35 211 In this example we are sending float values to a receiver
|
chris@552
|
48 ;
|
chris@552
|
49 #X text 35 225 named 'tremoloRate' which is parsed by the modified
|
chris@552
|
50 ;
|
chris@552
|
51 #X text 35 239 render.cpp file and used to control the rate of the
|
chris@552
|
52 tremolo;
|
chris@552
|
53 #X text 35 253 effect applied to the output.;
|
chris@552
|
54 #X obj 46 760 t f f;
|
chris@552
|
55 #X obj 46 782 *;
|
chris@552
|
56 #X text 35 267 See the render.cpp file in the project folder for the
|
chris@552
|
57 libpd;
|
chris@552
|
58 #X text 35 282 implementation. The heavy implementation can be found
|
chris@552
|
59 inside;
|
chris@552
|
60 #X text 35 295 the enclosed /heavy folder. (This is where custom render.cpp
|
chris@552
|
61 ;
|
chris@552
|
62 #X text 35 309 files for heavy need to be placed when compiling with
|
chris@552
|
63 heavy);
|
chris@552
|
64 #X text 179 860 by a hook function in the modified render.cpp file.
|
chris@552
|
65 ;
|
chris@552
|
66 #X text 200 897 Bela_floatHook(const char *source \, float value);
|
chris@552
|
67 #X text 180 962 For heavy this is:;
|
chris@552
|
68 #X text 179 884 For libpd this function is:;
|
chris@552
|
69 #X text 200 973 sendHook( double timestamp \, const char *receiverName
|
chris@552
|
70 ;
|
chris@552
|
71 #X text 260 986 \, const HvMessage *const m \, void *userData);
|
chris@552
|
72 #X text 180 911 Note that in libpd the receiver name needs to be registered
|
chris@552
|
73 ;
|
chris@552
|
74 #X text 180 925 using the libpd_bind(const char *sym) function (see
|
chris@552
|
75 the;
|
chris@552
|
76 #X text 180 939 contents of setup());
|
chris@552
|
77 #X text 180 1002 The receiver name does not need to be registered anywhere.
|
chris@552
|
78 ;
|
chris@552
|
79 #X text 35 324 Search for 'MODIFICATION' (no quotation marks) inside
|
chris@552
|
80 either;
|
chris@552
|
81 #X text 35 338 of the render files to inspect all the modifications
|
chris@552
|
82 that;
|
chris@552
|
83 #X text 36 352 were made for this example.;
|
chris@552
|
84 #X text 36 386 Running the patch with the modified render.cpp file
|
chris@552
|
85 ;
|
chris@552
|
86 #X text 36 396 ---------------------------------------------------
|
chris@552
|
87 ;
|
chris@552
|
88 #X text 36 409 If using libpd \, you can simply run this patch from
|
chris@552
|
89 the;
|
chris@552
|
90 #X text 36 423 Bela IDE. The system will automatically detect the;
|
chris@552
|
91 #X text 36 437 modified file use it instead of the template.;
|
chris@552
|
92 #X text 36 457 Similarly \, the build script for the Heavy compiler
|
chris@552
|
93 ;
|
chris@552
|
94 #X text 36 471 will detect the presence of a render.cpp file inside
|
chris@552
|
95 ;
|
chris@552
|
96 #X text 36 485 the enclosed /heavy/ folder and bypass the default wrapper.
|
chris@552
|
97 ;
|
chris@552
|
98 #X connect 1 0 0 1;
|
chris@552
|
99 #X connect 1 0 0 0;
|
chris@552
|
100 #X connect 2 0 1 0;
|
chris@552
|
101 #X connect 23 0 24 0;
|
chris@552
|
102 #X connect 24 0 40 0;
|
chris@552
|
103 #X connect 25 0 26 0;
|
chris@552
|
104 #X connect 26 0 24 0;
|
chris@552
|
105 #X connect 27 0 28 0;
|
chris@552
|
106 #X connect 28 0 30 0;
|
chris@552
|
107 #X connect 40 0 41 0;
|
chris@552
|
108 #X connect 40 1 41 1;
|
chris@552
|
109 #X connect 41 0 27 0;
|