comparison examples/08-PureData/customRender/_main.pd @ 552:f8bb6186498d prerelease

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