pd4web 2.1.0.dev6__tar.gz → 2.1.0rc2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. {pd4web-2.1.0.dev6 → pd4web-2.1.0rc2}/PKG-INFO +1 -1
  2. pd4web-2.1.0rc2/Sources/Templates/3/index.html +505 -0
  3. {pd4web-2.1.0.dev6 → pd4web-2.1.0rc2}/Sources/pd4web/Helpers.py +5 -1
  4. {pd4web-2.1.0.dev6 → pd4web-2.1.0rc2}/Sources/pd4web.gui.js +7 -2
  5. {pd4web-2.1.0.dev6 → pd4web-2.1.0rc2}/pyproject.toml +1 -1
  6. {pd4web-2.1.0.dev6 → pd4web-2.1.0rc2}/LICENSE +0 -0
  7. {pd4web-2.1.0.dev6 → pd4web-2.1.0rc2}/README.md +0 -0
  8. {pd4web-2.1.0.dev6 → pd4web-2.1.0rc2}/Sources/.clang-format +0 -0
  9. {pd4web-2.1.0.dev6 → pd4web-2.1.0rc2}/Sources/.prettierrc +0 -0
  10. {pd4web-2.1.0.dev6 → pd4web-2.1.0rc2}/Sources/.yamlftm +0 -0
  11. {pd4web-2.1.0.dev6 → pd4web-2.1.0rc2}/Sources/Libraries/Libraries.yaml +0 -0
  12. {pd4web-2.1.0.dev6 → pd4web-2.1.0rc2}/Sources/Libraries/ambi~.cmake +0 -0
  13. {pd4web-2.1.0.dev6 → pd4web-2.1.0rc2}/Sources/Libraries/cyclone.cmake +0 -0
  14. {pd4web-2.1.0.dev6 → pd4web-2.1.0rc2}/Sources/Libraries/earplug.cmake +0 -0
  15. {pd4web-2.1.0.dev6 → pd4web-2.1.0rc2}/Sources/Libraries/else.cmake +0 -0
  16. {pd4web-2.1.0.dev6 → pd4web-2.1.0rc2}/Sources/Libraries/libpd.cmake +0 -0
  17. {pd4web-2.1.0.dev6 → pd4web-2.1.0rc2}/Sources/Libraries/o.scofo~.cmake +0 -0
  18. {pd4web-2.1.0.dev6 → pd4web-2.1.0rc2}/Sources/Libraries/pd.cmake/.git +0 -0
  19. {pd4web-2.1.0.dev6 → pd4web-2.1.0rc2}/Sources/Libraries/pd.cmake/.github/workflows/c-cpp.yml +0 -0
  20. {pd4web-2.1.0.dev6 → pd4web-2.1.0rc2}/Sources/Libraries/pd.cmake/.gitignore +0 -0
  21. {pd4web-2.1.0.dev6 → pd4web-2.1.0rc2}/Sources/Libraries/pd.cmake/CMakeLists.txt +0 -0
  22. {pd4web-2.1.0.dev6 → pd4web-2.1.0rc2}/Sources/Libraries/pd.cmake/Examples/.clang-format +0 -0
  23. {pd4web-2.1.0.dev6 → pd4web-2.1.0rc2}/Sources/Libraries/pd.cmake/Examples/CMakeLists.txt +0 -0
  24. {pd4web-2.1.0.dev6 → pd4web-2.1.0rc2}/Sources/Libraries/pd.cmake/Examples/fft~/fft~-help.pd +0 -0
  25. {pd4web-2.1.0.dev6 → pd4web-2.1.0rc2}/Sources/Libraries/pd.cmake/Examples/fft~/fft~.cpp +0 -0
  26. {pd4web-2.1.0.dev6 → pd4web-2.1.0rc2}/Sources/Libraries/pd.cmake/Examples/simple/simple-help.pd +0 -0
  27. {pd4web-2.1.0.dev6 → pd4web-2.1.0rc2}/Sources/Libraries/pd.cmake/Examples/simple/simple-patch.pd +0 -0
  28. {pd4web-2.1.0.dev6 → pd4web-2.1.0rc2}/Sources/Libraries/pd.cmake/Examples/simple/simple.cpp +0 -0
  29. {pd4web-2.1.0.dev6 → pd4web-2.1.0rc2}/Sources/Libraries/pd.cmake/Examples/simple~/simple~-help.pd +0 -0
  30. {pd4web-2.1.0.dev6 → pd4web-2.1.0rc2}/Sources/Libraries/pd.cmake/Examples/simple~/simple~.cpp +0 -0
  31. {pd4web-2.1.0.dev6 → pd4web-2.1.0rc2}/Sources/Libraries/pd.cmake/LICENSE +0 -0
  32. {pd4web-2.1.0.dev6 → pd4web-2.1.0rc2}/Sources/Libraries/pd.cmake/README.md +0 -0
  33. {pd4web-2.1.0.dev6 → pd4web-2.1.0rc2}/Sources/Libraries/pd.cmake/Tests/01.Deprecated-Functions/CMakeLists.txt +0 -0
  34. {pd4web-2.1.0.dev6 → pd4web-2.1.0rc2}/Sources/Libraries/pd.cmake/Tests/CMakeLists.txt +0 -0
  35. {pd4web-2.1.0.dev6 → pd4web-2.1.0rc2}/Sources/Libraries/pd.cmake/pd.cmake +0 -0
  36. {pd4web-2.1.0.dev6 → pd4web-2.1.0rc2}/Sources/Libraries/pmpd.cmake +0 -0
  37. {pd4web-2.1.0.dev6 → pd4web-2.1.0rc2}/Sources/Libraries/timbreIDLib.cmake +0 -0
  38. {pd4web-2.1.0.dev6 → pd4web-2.1.0rc2}/Sources/Templates/1/bula.md +0 -0
  39. {pd4web-2.1.0.dev6 → pd4web-2.1.0rc2}/Sources/Templates/1/index.html +0 -0
  40. {pd4web-2.1.0.dev6 → pd4web-2.1.0rc2}/Sources/Templates/2/index.html +0 -0
  41. {pd4web-2.1.0.dev6 → pd4web-2.1.0rc2}/Sources/Templates/2/sketch.js +0 -0
  42. {pd4web-2.1.0.dev6 → pd4web-2.1.0rc2}/Sources/__init__.py +0 -0
  43. {pd4web-2.1.0.dev6 → pd4web-2.1.0rc2}/Sources/cmake-format.yaml +0 -0
  44. {pd4web-2.1.0.dev6 → pd4web-2.1.0rc2}/Sources/config.h +0 -0
  45. {pd4web-2.1.0.dev6 → pd4web-2.1.0rc2}/Sources/externals.cpp +0 -0
  46. {pd4web-2.1.0.dev6 → pd4web-2.1.0rc2}/Sources/favicon.ico +0 -0
  47. {pd4web-2.1.0.dev6 → pd4web-2.1.0rc2}/Sources/index.html +0 -0
  48. {pd4web-2.1.0.dev6 → pd4web-2.1.0rc2}/Sources/nogui.html +0 -0
  49. {pd4web-2.1.0.dev6 → pd4web-2.1.0rc2}/Sources/pd4web/Builder.py +0 -0
  50. {pd4web-2.1.0.dev6 → pd4web-2.1.0rc2}/Sources/pd4web/Compilers.py +0 -0
  51. {pd4web-2.1.0.dev6 → pd4web-2.1.0rc2}/Sources/pd4web/Libraries.py +0 -0
  52. {pd4web-2.1.0.dev6 → pd4web-2.1.0rc2}/Sources/pd4web/Objects.py +0 -0
  53. {pd4web-2.1.0.dev6 → pd4web-2.1.0rc2}/Sources/pd4web/Patch.py +0 -0
  54. {pd4web-2.1.0.dev6 → pd4web-2.1.0rc2}/Sources/pd4web/Pd4Web.py +0 -0
  55. {pd4web-2.1.0.dev6 → pd4web-2.1.0rc2}/Sources/pd4web/__init__.py +0 -0
  56. {pd4web-2.1.0.dev6 → pd4web-2.1.0rc2}/Sources/pd4web.cpp +0 -0
  57. {pd4web-2.1.0.dev6 → pd4web-2.1.0rc2}/Sources/pd4web.gitignore +0 -0
  58. {pd4web-2.1.0.dev6 → pd4web-2.1.0rc2}/Sources/pd4web.hpp +0 -0
  59. {pd4web-2.1.0.dev6 → pd4web-2.1.0rc2}/Sources/pd4web.midi.js +0 -0
  60. {pd4web-2.1.0.dev6 → pd4web-2.1.0rc2}/Sources/pd4web.style.css +0 -0
  61. {pd4web-2.1.0.dev6 → pd4web-2.1.0rc2}/Sources/pd4web.threads.js +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pd4web
3
- Version: 2.1.0.dev6
3
+ Version: 2.1.0rc2
4
4
  Summary: pd4web compiles PureData patches with external objects for Wasm, allowing to run entire patches in web browsers.
5
5
  Home-page: https://charlesneimog.github.io/pd4web
6
6
  Author: Charles K. Neimog
@@ -0,0 +1,505 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <title>Pd4Web</title>
5
+ <meta charset="UTF-8" />
6
+ <script src="./pd4web.threads.js"></script>
7
+ <!-- Just necessary if you are using Github Pages -->
8
+ <script src="./pd4web.js"></script>
9
+ <script src="https://cdn.jsdelivr.net/npm/vexflow/build/cjs/vexflow.js"></script>
10
+ </head>
11
+ <style>
12
+ @media (min-width: 1080px) {
13
+ body {
14
+ max-width: 700px;
15
+ margin: 0 auto;
16
+ overflow-x: hidden;
17
+ }
18
+ }
19
+ /* The switch - the box around the slider */
20
+ .switch {
21
+ position: relative;
22
+ display: inline-block;
23
+ width: 60px;
24
+ height: 34px;
25
+ }
26
+
27
+ /* Hide default HTML checkbox */
28
+ .switch input {
29
+ opacity: 0;
30
+ width: 0;
31
+ height: 0;
32
+ }
33
+
34
+ /* The slider */
35
+ .slider {
36
+ position: absolute;
37
+ cursor: pointer;
38
+ top: 0;
39
+ left: 0;
40
+ right: 0;
41
+ bottom: 0;
42
+ background-color: #ccc;
43
+ -webkit-transition: 0.4s;
44
+ transition: 0.4s;
45
+ }
46
+
47
+ .slider:before {
48
+ position: absolute;
49
+ content: "";
50
+ height: 26px;
51
+ width: 26px;
52
+ left: 4px;
53
+ bottom: 4px;
54
+ background-color: white;
55
+ -webkit-transition: 0.4s;
56
+ transition: 0.4s;
57
+ }
58
+
59
+ input:checked + .slider {
60
+ background-color: #2196f3;
61
+ }
62
+
63
+ input:focus + .slider {
64
+ box-shadow: 0 0 1px #2196f3;
65
+ }
66
+
67
+ input:checked + .slider:before {
68
+ -webkit-transform: translateX(26px);
69
+ -ms-transform: translateX(26px);
70
+ transform: translateX(26px);
71
+ }
72
+
73
+ /* Rounded sliders */
74
+ .slider.round {
75
+ border-radius: 34px;
76
+ }
77
+
78
+ .slider.round:before {
79
+ border-radius: 50%;
80
+ }
81
+ canvas {
82
+ background: rgb(206, 203, 203);
83
+ padding: 0px;
84
+ }
85
+
86
+ div.egcode {
87
+ font-family: Courier;
88
+ font-size: 14px;
89
+ }
90
+
91
+ select#naipe-select {
92
+ margin-top: 20px;
93
+ display: inline-block;
94
+ outline: 0;
95
+ border: 0;
96
+ cursor: pointer;
97
+ transition:
98
+ box-shadow 0.15s ease,
99
+ transform 0.15s ease;
100
+ will-change: box-shadow, transform;
101
+ text-align: center;
102
+ background: rgb(70, 70, 70);
103
+ box-shadow:
104
+ 0px 2px 4px rgb(45 35 66 / 40%),
105
+ 0px 4px 2px -3px rgba(108, 108, 108, 0.3),
106
+ inset 0px -3px 0px #5b5b5b;
107
+ height: 46px;
108
+ padding: 0 30px;
109
+ font-size: 16px;
110
+ border-radius: 6px;
111
+ color: #ffffff;
112
+ transition:
113
+ box-shadow 0.15s ease,
114
+ transform 0.15s ease;
115
+ }
116
+ </style>
117
+
118
+ <body style="height: 100%; background-color: rgb(48, 48, 48)">
119
+ <div
120
+ id="control-gui"
121
+ style="
122
+ background-color: rgb(48, 48, 48);
123
+ text-align: center;
124
+ border-radius: 10px;
125
+ "
126
+ >
127
+ <h1 id="mytitle" style="color: white; font-size: 48px"></h1>
128
+ <p id="thecomposer" style="color: white; font-size: 24px"></p>
129
+
130
+ <label class="switch">
131
+ <input type="checkbox" id="myCheckbox" />
132
+ <span class="slider round"></span>
133
+ </label>
134
+ <br />
135
+ <select id="naipe-select" onchange="chooseNaipe()">
136
+ <option value="none">Escolha seu Naipe!</option>
137
+ <option value="Soprano">Soprano</option>
138
+ <option value="Contralto">Contralto</option>
139
+ <option value="Tenor">Tenor</option>
140
+ <option value="Baixo">Baixo</option>
141
+ </select>
142
+ <hr
143
+ style="
144
+ width: 90%;
145
+ margin-top: 20px;
146
+ background-color: rgb(226, 225, 225);
147
+ "
148
+ />
149
+ <div
150
+ id="duration-bar"
151
+ style="
152
+ margin-top: 20px;
153
+ width: 100%;
154
+ border-radius: 5px;
155
+
156
+ height: 20px;
157
+ background-color: white;
158
+ "
159
+ ></div>
160
+ <div id="VexFlowNote"></div>
161
+ <script>
162
+ var VF = Vex.Flow;
163
+ var CLEF = "treble";
164
+ Vex.Flow.setMusicFont("Bravura");
165
+
166
+ var div = document.getElementById("VexFlowNote");
167
+ var renderer = new VF.Renderer(div, VF.Renderer.Backends.SVG);
168
+
169
+ // check if I am on a mobile device
170
+ if (/Mobi/.test(navigator.userAgent)) {
171
+ var scaleFactor = 5;
172
+ } else {
173
+ var scaleFactor = 2;
174
+ }
175
+
176
+ const scoreWidth = 160;
177
+ const scoreHeight = 130;
178
+
179
+ renderer.resize(scoreWidth * scaleFactor, scoreHeight * scaleFactor);
180
+
181
+ // Get the rendering context
182
+ const context = renderer.getContext();
183
+ var DEFAULT_COLOR = "white";
184
+ context.setFillStyle(DEFAULT_COLOR);
185
+ context.setStrokeStyle(DEFAULT_COLOR);
186
+ context.scale(scaleFactor, scaleFactor);
187
+ var group = renderer.getContext().openGroup();
188
+
189
+ var note = null;
190
+ var stave = new VF.Stave(0, 0, scoreWidth, { fill_style: "white" });
191
+ stave.setEndBarType(VF.Barline.type.END);
192
+ stave.addClef(CLEF).setContext(context).draw();
193
+
194
+ function setNaipe() {
195
+ const naipe = document.getElementById("naipe-select").value;
196
+ if (naipe == "Baixo") {
197
+ window.naipe = 1;
198
+ CLEF = "bass";
199
+ } else if (naipe == "Tenor") {
200
+ Pd4Web.sendFloat("naipe", 2);
201
+ window.naipe = 2;
202
+ CLEF = "bass";
203
+ } else if (naipe == "Contralto") {
204
+ window.naipe = 3;
205
+ Pd4Web.sendFloat("naipe", 3);
206
+ CLEF = "treble";
207
+ } else if (naipe == "Soprano") {
208
+ window.naipe = 4;
209
+ Pd4Web.sendFloat("naipe", 4);
210
+ CLEF = "treble";
211
+ }
212
+ }
213
+ // remove CLEF from the stave
214
+
215
+ function setNoteAndSilaba(pitch, silaba) {
216
+ if (window.naipe == 1) {
217
+ CLEF = "bass";
218
+ Pd4Web.sendFloat("naipe", 1);
219
+ } else if (window.naipe == 2) {
220
+ CLEF = "bass";
221
+ Pd4Web.sendFloat("naipe", 2);
222
+ } else if (window.naipe == 3) {
223
+ CLEF = "treble";
224
+ Pd4Web.sendFloat("naipe", 3);
225
+ } else if (window.naipe == 4) {
226
+ Pd4Web.sendFloat("naipe", 4);
227
+ CLEF = "treble";
228
+ } else {
229
+ setNaipe();
230
+ }
231
+
232
+ const pitchname = pitch[0];
233
+ let remainingPitch = pitch.slice(1);
234
+ const pitchoctave = remainingPitch[remainingPitch.length - 1];
235
+ var acc = remainingPitch.slice(0, -1);
236
+ var vexPitch = pitchname;
237
+ if (acc.length != 0){
238
+ if (acc == "#+") {
239
+ acc = "++";
240
+ } else if (acc == "b-") {
241
+ acc = "db";
242
+ } else if (acc = "-") {
243
+ acc = "d";
244
+ }
245
+ }
246
+
247
+ //vexPitch += remainingPitch;
248
+ vexPitch += "/";
249
+ vexPitch += pitchoctave;
250
+
251
+ //return;
252
+ const notes = document.querySelectorAll(".vf-stavenote");
253
+ notes.forEach((note) => {
254
+ note.remove();
255
+ });
256
+ stave.setContext(context).draw();
257
+ note = new VF.StaveNote({
258
+ clef: CLEF,
259
+ keys: [vexPitch],
260
+ duration: "w",
261
+ align_center: true,
262
+ });
263
+ note.setAttribute("id", "mynote");
264
+ note.setLedgerLineStyle({ fillStyle: "white", strokeStyle: "white" });
265
+ note.setFlagStyle({ fillStyle: "white", strokeStyle: "white" });
266
+
267
+ var silaba = silaba;
268
+ const lyricsAnnotation = new VF.Annotation(silaba);
269
+ lyricsAnnotation.setFont("Serif", 12, "");
270
+
271
+ lyricsAnnotation.setVerticalJustification(
272
+ VF.Annotation.VerticalJustify.BOTTOM,
273
+ );
274
+ lyricsAnnotation.setJustification(
275
+ VF.Annotation.HorizontalJustify.CENTER,
276
+ );
277
+
278
+ note.addModifier(lyricsAnnotation, 0);
279
+
280
+ // Accidental
281
+ // https://github.com/0xfe/vexflow/wiki/Microtonal-Support
282
+ if (acc.length != 0) {
283
+ const vexAcc = new VF.Accidental(acc);
284
+ note.addModifier(vexAcc, 0);
285
+ }
286
+
287
+
288
+ voice = new VF.Voice({ num_beats: 4, beat_value: 4 });
289
+ voice.addTickables([note]);
290
+
291
+ var formatter = new VF.Formatter()
292
+ .joinVoices([voice])
293
+ .format([voice], scoreWidth - scoreWidth * 0.5);
294
+
295
+ voice.draw(context, stave);
296
+ }
297
+ </script>
298
+ </div>
299
+
300
+ <hr
301
+ style="width: 90%; margin-top: 20px; background-color: rgb(226, 225, 225)"
302
+ />
303
+ <div id="Phrase" style="height: 50%; margin-left: 0%; margin-top: 0%">
304
+ <h1
305
+ id="phrase"
306
+ style="font-size: 30px; color: white; text-align: center; height: 30px"
307
+ ></h1>
308
+ </div>
309
+ <hr
310
+ style="width: 90%; margin-top: 20px; background-color: rgb(226, 225, 225)"
311
+ />
312
+ <div
313
+ id="piece-duration-bar"
314
+ style="
315
+ margin-top: 20px;
316
+ width: 100%;
317
+ border-radius: 10px;
318
+ height: 5px;
319
+ background-color: white;
320
+ "
321
+ ></div>
322
+ <script>
323
+ document.getElementById("phrase").innerText = "Escolha seu Naipe!";
324
+
325
+ function chooseNaipe() {
326
+ const naipe = document.getElementById("naipe-select").value;
327
+ if (naipe === "none") {
328
+ return;
329
+ }
330
+ if (Pd4Web === null) {
331
+ alert(
332
+ "Pd4Web is not loaded yet. Please wait a few seconds and try again.",
333
+ );
334
+ return;
335
+ }
336
+ setNaipe();
337
+
338
+ const clefs = document.querySelectorAll(".vf-clef");
339
+ clefs.forEach((clef) => {
340
+ clef.remove();
341
+ });
342
+ stave = new VF.Stave(0, 0, scoreWidth, { fill_style: "white" });
343
+ stave.setEndBarType(VF.Barline.type.END);
344
+ stave.addClef(CLEF).setContext(context).draw();
345
+ return;
346
+ }
347
+ </script>
348
+ <script>
349
+ function generateNumbersWithSum(total, numElements, minValue, maxValue) {
350
+ // Thanks to llama
351
+ let numbers = Array.from(
352
+ { length: numElements },
353
+ () =>
354
+ Math.floor(Math.random() * (maxValue - minValue + 1)) + minValue,
355
+ );
356
+ let currentSum = numbers.reduce((acc, num) => acc + num, 0);
357
+ let difference = total - currentSum;
358
+ while (difference !== 0) {
359
+ for (let i = 0; i < numElements; i++) {
360
+ if (difference === 0) break;
361
+ if (difference > 0) {
362
+ let increment = Math.min(difference, maxValue - numbers[i]);
363
+ numbers[i] += increment;
364
+ difference -= increment;
365
+ } else if (difference < 0) {
366
+ let decrement = Math.min(-difference, numbers[i] - minValue);
367
+ numbers[i] -= decrement;
368
+ difference += decrement;
369
+ }
370
+ }
371
+ }
372
+ return numbers;
373
+ }
374
+
375
+ var poemDur = generateNumbersWithSum(270000, 21, 8000, 20000);
376
+ poemDur.unshift(30000);
377
+ const sum = poemDur.reduce((acc, num) => acc + num, 0);
378
+ if (sum !== 300000) {
379
+ alert("Error: sum is not 300000");
380
+ }
381
+
382
+ const msInitEnd = 30000;
383
+ var globalDur = [];
384
+ globalDur.push(msInitEnd);
385
+ const chords = generateNumbersWithSum(180000, 6, 20000, 35000);
386
+ const transitions = generateNumbersWithSum(60000, 6, 5000, 15000);
387
+ for (let i = 0; i < 6; i++) {
388
+ globalDur.push(chords[i]);
389
+ globalDur.push(transitions[i]);
390
+ }
391
+ globalDur.push(msInitEnd);
392
+
393
+ // Generate a random list of 4 numbers that sum 100
394
+
395
+ let Pd4Web = null;
396
+ Pd4WebModule().then((Pd4WebModulePromise) => {
397
+ Pd4Web = new Pd4WebModulePromise.Pd4Web();
398
+ });
399
+
400
+ var Pd4WebInitiate = false;
401
+
402
+ // ================== INIT ==================
403
+ async function Pd4WebOnClick(event) {
404
+ if (Pd4WebInitiate) {
405
+ console.log("Pd4Web already initiated");
406
+ return;
407
+ }
408
+ Pd4WebInitiate = true;
409
+ Pd4Web.init();
410
+
411
+ Pd4Web.onListReceived("pitch-syl", function (list) {
412
+ console.log(list);
413
+ //return;
414
+ const pitch = list[0];
415
+ const silaba = list[1];
416
+ setNoteAndSilaba(pitch, silaba);
417
+ });
418
+
419
+ Pd4Web.onListReceived("poem-phrase", function (list) {
420
+ const poemPhrase = list.join(" ");
421
+ document.getElementById("phrase").innerText = poemPhrase;
422
+ if (poemPhrase === "Respire!") {
423
+ const notes = document.querySelectorAll(".vf-stavenote");
424
+ notes.forEach((note) => {
425
+ note.remove();
426
+ });
427
+ }
428
+ if (poemPhrase === "Fim!") {
429
+ const notes = document.querySelectorAll(".vf-stavenote");
430
+ notes.forEach((note) => {
431
+ note.remove();
432
+ });
433
+ }
434
+ });
435
+
436
+ Pd4Web.onSymbolReceived("poem-phrase", function (symbol) {
437
+ const poemPhrase = symbol;c
438
+ document.getElementById("phrase").innerText = poemPhrase;
439
+ if (poemPhrase === "Respire!") {
440
+ const notes = document.querySelectorAll(".vf-stavenote");
441
+ notes.forEach((note) => {
442
+ note.remove();
443
+ });
444
+ }
445
+ if (poemPhrase === "Fim!") {
446
+ const notes = document.querySelectorAll(".vf-stavenote");
447
+ notes.forEach((note) => {
448
+ note.remove();
449
+ });
450
+ }
451
+ });
452
+
453
+ Pd4Web.onFloatReceived("duration-bar", function (number) {
454
+ const durationBar = document.getElementById("duration-bar");
455
+ durationBar.style.width = number + "%";
456
+ });
457
+
458
+ Pd4Web.onFloatReceived("piece-duration-bar", function (number) {
459
+ const durationBar = document.getElementById("piece-duration-bar");
460
+ durationBar.style.width = number + "%";
461
+ });
462
+
463
+ Pd4Web.onListReceived("composer", function (list) {
464
+ const composer = list.join(" ");
465
+ document.getElementById("thecomposer").innerText = composer;
466
+ });
467
+
468
+ Pd4Web.onListReceived("title", function (list) {
469
+ document.getElementById("mytitle").innerText = list.join(" ");
470
+ });
471
+
472
+ Pd4Web.onSymbolReceived("title", function (symbol) {
473
+ document.getElementById("mytitle").innerText = symbol;
474
+ });
475
+
476
+ }
477
+
478
+ const checkbox = document.getElementById("myCheckbox");
479
+ checkbox.addEventListener("click", function () {
480
+ const naipe = document.getElementById("naipe-select").value;
481
+ if (naipe === "none") {
482
+ checkbox.checked = false;
483
+ alert("Please choose a naipe!");
484
+ return;
485
+ }
486
+ Pd4WebOnClick().then(() => {
487
+ if (checkbox.checked) {
488
+ document.getElementById("phrase").innerText = "Inicializando...";
489
+ setTimeout(() => {
490
+ setNaipe();
491
+ Pd4Web.sendList("duration-list", poemDur);
492
+ Pd4Web.sendList("sectiondur-list", globalDur);
493
+ }, 100);
494
+ setTimeout(() => {
495
+ Pd4Web.sendFloat("on-off", 1);
496
+ }, 500);
497
+ } else {
498
+ Pd4Web.sendFloat("on-off", 0);
499
+ }
500
+ });
501
+ });
502
+ //document.addEventListener("click", initPd4WebOnClick);
503
+ </script>
504
+ </body>
505
+ </html>
@@ -20,10 +20,13 @@ def pd4web_print(text, color=None, bright=False, silence=False, pd4web=False):
20
20
  if pd4web:
21
21
  if color == "red":
22
22
  print("ERROR: " + text)
23
+ sys.stdout.flush() # Ensure immediate output
23
24
  elif color == "yellow":
24
25
  print("WARNING: " + text)
26
+ sys.stdout.flush() # Ensure immediate output
25
27
  else:
26
28
  print(text)
29
+ sys.stdout.flush() # Ensure immediate output
27
30
  return
28
31
  if silence:
29
32
  return
@@ -57,7 +60,6 @@ def pd4web_print(text, color=None, bright=False, silence=False, pd4web=False):
57
60
  print(tab + color_code + "🔴️ ERROR: " + text + reset_code)
58
61
  elif color == "yellow":
59
62
  print(tab + color_code + "🟡️ WARNING: " + text + reset_code)
60
-
61
63
  elif color == "green":
62
64
  print(tab + color_code + "🟢️ " + text + reset_code)
63
65
  elif color == "blue":
@@ -66,8 +68,10 @@ def pd4web_print(text, color=None, bright=False, silence=False, pd4web=False):
66
68
  print(tab + color_code + "🟣️ " + text + reset_code)
67
69
  else:
68
70
  print(tab + color_code + text + reset_code)
71
+ sys.stdout.flush() # Ensure immediate output
69
72
  except:
70
73
  print(text)
74
+ sys.stdout.flush() # Ensure immediate output
71
75
 
72
76
 
73
77
  def getPrintValue(color, bright=False):
@@ -43,8 +43,13 @@ function setSoundIcon(icon, animation) {
43
43
  const svgDoc = parser.parseFromString(svgDecoded, "image/svg+xml");
44
44
  const svgElement = svgDoc.querySelector("svg");
45
45
  if (svgElement) {
46
- svgElement.setAttribute("width", "24");
47
- svgElement.setAttribute("height", "24");
46
+ if (Pd4Web.isMobile) {
47
+ svgElement.setAttribute("width", "48");
48
+ svgElement.setAttribute("height", "48");
49
+ } else {
50
+ svgElement.setAttribute("width", "24");
51
+ svgElement.setAttribute("height", "24");
52
+ }
48
53
  svgElement.style.display = "inline-block";
49
54
  svgElement.style.animation = animation;
50
55
  soundSwitch.innerHTML = "";
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "pd4web"
3
- version = "2.1.0.dev6"
3
+ version = "2.1.0.rc2"
4
4
  description = "pd4web compiles PureData patches with external objects for Wasm, allowing to run entire patches in web browsers."
5
5
  authors = ["Charles K. Neimog <charlesneimog@outlook.com>"]
6
6
  readme = "README.md"
File without changes
File without changes
File without changes
File without changes