pd4web 2.2.4__tar.gz → 2.2.6__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 (64) hide show
  1. {pd4web-2.2.4 → pd4web-2.2.6}/PKG-INFO +1 -1
  2. {pd4web-2.2.4 → pd4web-2.2.6}/Sources/pd4web/Pd4Web.py +18 -34
  3. {pd4web-2.2.4 → pd4web-2.2.6}/Sources/pd4web.cpp +21 -2
  4. {pd4web-2.2.4 → pd4web-2.2.6}/Sources/pd4web.hpp +1 -1
  5. {pd4web-2.2.4 → pd4web-2.2.6}/pyproject.toml +1 -1
  6. {pd4web-2.2.4 → pd4web-2.2.6}/LICENSE +0 -0
  7. {pd4web-2.2.4 → pd4web-2.2.6}/README.md +0 -0
  8. {pd4web-2.2.4 → pd4web-2.2.6}/Sources/.clang-format +0 -0
  9. {pd4web-2.2.4 → pd4web-2.2.6}/Sources/.prettierrc +0 -0
  10. {pd4web-2.2.4 → pd4web-2.2.6}/Sources/.yamlftm +0 -0
  11. {pd4web-2.2.4 → pd4web-2.2.6}/Sources/Libraries/Libraries.yaml +0 -0
  12. {pd4web-2.2.4 → pd4web-2.2.6}/Sources/Libraries/ambi~.cmake +0 -0
  13. {pd4web-2.2.4 → pd4web-2.2.6}/Sources/Libraries/cyclone.cmake +0 -0
  14. {pd4web-2.2.4 → pd4web-2.2.6}/Sources/Libraries/earplug.cmake +0 -0
  15. {pd4web-2.2.4 → pd4web-2.2.6}/Sources/Libraries/else.cmake +0 -0
  16. {pd4web-2.2.4 → pd4web-2.2.6}/Sources/Libraries/libpd.cmake +0 -0
  17. {pd4web-2.2.4 → pd4web-2.2.6}/Sources/Libraries/o.scofo~.cmake +0 -0
  18. {pd4web-2.2.4 → pd4web-2.2.6}/Sources/Libraries/pd.cmake/.git +0 -0
  19. {pd4web-2.2.4 → pd4web-2.2.6}/Sources/Libraries/pd.cmake/.github/workflows/c-cpp.yml +0 -0
  20. {pd4web-2.2.4 → pd4web-2.2.6}/Sources/Libraries/pd.cmake/.gitignore +0 -0
  21. {pd4web-2.2.4 → pd4web-2.2.6}/Sources/Libraries/pd.cmake/CMakeLists.txt +0 -0
  22. {pd4web-2.2.4 → pd4web-2.2.6}/Sources/Libraries/pd.cmake/Examples/.clang-format +0 -0
  23. {pd4web-2.2.4 → pd4web-2.2.6}/Sources/Libraries/pd.cmake/Examples/CMakeLists.txt +0 -0
  24. {pd4web-2.2.4 → pd4web-2.2.6}/Sources/Libraries/pd.cmake/Examples/fft~/fft~-help.pd +0 -0
  25. {pd4web-2.2.4 → pd4web-2.2.6}/Sources/Libraries/pd.cmake/Examples/fft~/fft~.cpp +0 -0
  26. {pd4web-2.2.4 → pd4web-2.2.6}/Sources/Libraries/pd.cmake/Examples/simple/simple-help.pd +0 -0
  27. {pd4web-2.2.4 → pd4web-2.2.6}/Sources/Libraries/pd.cmake/Examples/simple/simple-patch.pd +0 -0
  28. {pd4web-2.2.4 → pd4web-2.2.6}/Sources/Libraries/pd.cmake/Examples/simple/simple.cpp +0 -0
  29. {pd4web-2.2.4 → pd4web-2.2.6}/Sources/Libraries/pd.cmake/Examples/simple~/simple~-help.pd +0 -0
  30. {pd4web-2.2.4 → pd4web-2.2.6}/Sources/Libraries/pd.cmake/Examples/simple~/simple~.cpp +0 -0
  31. {pd4web-2.2.4 → pd4web-2.2.6}/Sources/Libraries/pd.cmake/LICENSE +0 -0
  32. {pd4web-2.2.4 → pd4web-2.2.6}/Sources/Libraries/pd.cmake/README.md +0 -0
  33. {pd4web-2.2.4 → pd4web-2.2.6}/Sources/Libraries/pd.cmake/Tests/01.Deprecated-Functions/CMakeLists.txt +0 -0
  34. {pd4web-2.2.4 → pd4web-2.2.6}/Sources/Libraries/pd.cmake/Tests/CMakeLists.txt +0 -0
  35. {pd4web-2.2.4 → pd4web-2.2.6}/Sources/Libraries/pd.cmake/pd.cmake +0 -0
  36. {pd4web-2.2.4 → pd4web-2.2.6}/Sources/Libraries/pmpd.cmake +0 -0
  37. {pd4web-2.2.4 → pd4web-2.2.6}/Sources/Libraries/timbreIDLib.cmake +0 -0
  38. {pd4web-2.2.4 → pd4web-2.2.6}/Sources/Templates/1/bula.md +0 -0
  39. {pd4web-2.2.4 → pd4web-2.2.6}/Sources/Templates/1/index.html +0 -0
  40. {pd4web-2.2.4 → pd4web-2.2.6}/Sources/Templates/2/index.html +0 -0
  41. {pd4web-2.2.4 → pd4web-2.2.6}/Sources/Templates/2/sketch.js +0 -0
  42. {pd4web-2.2.4 → pd4web-2.2.6}/Sources/Templates/3/index.html +0 -0
  43. {pd4web-2.2.4 → pd4web-2.2.6}/Sources/Templates/4/index.html +0 -0
  44. {pd4web-2.2.4 → pd4web-2.2.6}/Sources/Templates/4/sketch.js +0 -0
  45. {pd4web-2.2.4 → pd4web-2.2.6}/Sources/Templates/5/index.html +0 -0
  46. {pd4web-2.2.4 → pd4web-2.2.6}/Sources/Templates/5/tutorial.md +0 -0
  47. {pd4web-2.2.4 → pd4web-2.2.6}/Sources/__init__.py +0 -0
  48. {pd4web-2.2.4 → pd4web-2.2.6}/Sources/cmake-format.yaml +0 -0
  49. {pd4web-2.2.4 → pd4web-2.2.6}/Sources/config.h +0 -0
  50. {pd4web-2.2.4 → pd4web-2.2.6}/Sources/externals.cpp +0 -0
  51. {pd4web-2.2.4 → pd4web-2.2.6}/Sources/favicon.ico +0 -0
  52. {pd4web-2.2.4 → pd4web-2.2.6}/Sources/index.html +0 -0
  53. {pd4web-2.2.4 → pd4web-2.2.6}/Sources/nogui.html +0 -0
  54. {pd4web-2.2.4 → pd4web-2.2.6}/Sources/pd4web/Builder.py +0 -0
  55. {pd4web-2.2.4 → pd4web-2.2.6}/Sources/pd4web/Compilers.py +0 -0
  56. {pd4web-2.2.4 → pd4web-2.2.6}/Sources/pd4web/Libraries.py +0 -0
  57. {pd4web-2.2.4 → pd4web-2.2.6}/Sources/pd4web/Objects.py +0 -0
  58. {pd4web-2.2.4 → pd4web-2.2.6}/Sources/pd4web/Patch.py +0 -0
  59. {pd4web-2.2.4 → pd4web-2.2.6}/Sources/pd4web/__init__.py +0 -0
  60. {pd4web-2.2.4 → pd4web-2.2.6}/Sources/pd4web.gitignore +0 -0
  61. {pd4web-2.2.4 → pd4web-2.2.6}/Sources/pd4web.gui.js +0 -0
  62. {pd4web-2.2.4 → pd4web-2.2.6}/Sources/pd4web.midi.js +0 -0
  63. {pd4web-2.2.4 → pd4web-2.2.6}/Sources/pd4web.style.css +0 -0
  64. {pd4web-2.2.4 → pd4web-2.2.6}/Sources/pd4web.threads.js +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pd4web
3
- Version: 2.2.4
3
+ Version: 2.2.6
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
@@ -5,10 +5,8 @@ import subprocess
5
5
  import pygit2
6
6
 
7
7
  import shutil
8
- import requests
9
8
  import importlib.metadata as importlib_metadata
10
9
 
11
-
12
10
  import certifi
13
11
 
14
12
  os.environ["SSL_CERT_FILE"] = certifi.where()
@@ -62,12 +60,12 @@ class Pd4Web:
62
60
 
63
61
  parser = parser.parse_args()
64
62
 
65
- self.get_mainPaths()
63
+ self.getMainPaths()
66
64
  self.do_actions(parser)
67
65
 
68
66
  self.Parser = parser
69
67
  self.Patch = os.path.abspath(self.Parser.patch_file)
70
-
68
+
71
69
  if not os.path.isfile(self.Patch):
72
70
  self.exception("\n\nError: Patch file not found")
73
71
 
@@ -101,7 +99,7 @@ class Pd4Web:
101
99
  self.declaredLibsObjs = []
102
100
  self.declaredPaths = []
103
101
  self.processedAbs = []
104
-
102
+
105
103
  # Versions
106
104
  self.Version = {}
107
105
  self.Version["python"] = f"{sys.version_info.major}.{sys.version_info.minor}.{sys.version_info.micro}"
@@ -124,8 +122,7 @@ class Pd4Web:
124
122
  # add /bin and /usr/bin to PATH on macOS
125
123
  if sys.platform == "darwin":
126
124
  self.env["PATH"] += ":/bin:/usr/bin"
127
-
128
-
125
+
129
126
  def Execute(self):
130
127
  from .Builder import GetAndBuildExternals
131
128
  from .Compilers import ExternalsCompiler
@@ -134,7 +131,7 @@ class Pd4Web:
134
131
  if self.Patch == "":
135
132
  self.exception("You must set a patch file")
136
133
 
137
- self.get_mainPaths()
134
+ self.getMainPaths()
138
135
  self.InitVariables()
139
136
 
140
137
  # ╭──────────────────────────────────────╮
@@ -161,24 +158,17 @@ class Pd4Web:
161
158
 
162
159
  def RunBrowser(self):
163
160
  self.CWD = os.getcwd()
164
- if sys.platform == "win32":
165
- self.APPDATA = os.path.join(os.getenv("APPDATA"), "pd4web")
166
- elif sys.platform == "darwin":
167
- self.APPDATA = os.path.join(os.path.expanduser("~/Library/"), "pd4web")
168
- elif sys.platform == "linux":
169
- self.APPDATA = os.path.join(os.path.expanduser("~/.local/share"), "pd4web")
170
- else:
171
- self.exception("Unsupported platform")
161
+ self.PD4WEB_ROOT = os.path.dirname(os.path.realpath(__file__))
162
+ self.APPDATA = os.path.join(self.PD4WEB_ROOT, "data")
163
+
172
164
  emccRun = self.APPDATA + "/emsdk/upstream/emscripten/emrun"
173
- # check if emrun exists
174
165
  if not os.path.exists(emccRun):
175
166
  self.exception("emrun not found. Please install Emscripten")
176
-
177
167
  projectRoot = os.path.realpath(self.Patch)
178
168
  os.chdir(projectRoot)
179
169
  subprocess.run(f"{emccRun} {projectRoot}/index.html", shell=True, env=self.env)
180
170
 
181
- def get_mainPaths(self):
171
+ def getMainPaths(self):
182
172
  self.PROJECT_ROOT = os.path.dirname(os.path.realpath(self.Patch))
183
173
  self.PROJECT_PATCH = os.path.basename(self.Patch)
184
174
  self.PD4WEB_ROOT = os.path.dirname(os.path.realpath(__file__))
@@ -187,15 +177,9 @@ class Pd4Web:
187
177
  self.PD4WEB_LIBRARIES = os.path.abspath(self.PD4WEB_LIBRARIES)
188
178
 
189
179
  self.CWD = os.getcwd()
190
- if sys.platform == "win32":
191
- self.APPDATA = os.path.join(os.getenv("APPDATA"), "pd4web")
192
- elif sys.platform == "darwin":
193
- self.APPDATA = os.path.join(os.path.expanduser("~/Library/"), "pd4web")
194
- elif sys.platform == "linux":
195
- self.APPDATA = os.path.join(os.path.expanduser("~/.local/share"), "pd4web")
196
- else:
197
- self.exception("Unsupported platform")
198
-
180
+ if not os.path.exists(os.path.join(self.PD4WEB_ROOT, "data")):
181
+ os.makedirs(os.path.join(self.PD4WEB_ROOT, "data"))
182
+ self.APPDATA = os.path.join(self.PD4WEB_ROOT, "data")
199
183
  if not os.path.exists(self.APPDATA):
200
184
  os.makedirs(self.APPDATA)
201
185
 
@@ -305,7 +289,7 @@ class Pd4Web:
305
289
  type=int,
306
290
  help="Initial memory size in MB",
307
291
  )
308
-
292
+
309
293
  parser.add_argument(
310
294
  "--patch-file",
311
295
  required=False,
@@ -349,7 +333,7 @@ class Pd4Web:
349
333
  type=str,
350
334
  help="Pure Data version to use",
351
335
  )
352
-
336
+
353
337
  # Pd Object
354
338
  parser.add_argument(
355
339
  "--pd-external",
@@ -358,7 +342,7 @@ class Pd4Web:
358
342
  action="store_true",
359
343
  help="If is it pd4web external",
360
344
  )
361
-
345
+
362
346
  parser.add_argument(
363
347
  "--pd-external-version",
364
348
  required=False,
@@ -391,13 +375,13 @@ class Pd4Web:
391
375
  if pd4web:
392
376
  if color == "red":
393
377
  print("ERROR: " + text)
394
- sys.stdout.flush() # Ensure immediate output
378
+ sys.stdout.flush()
395
379
  elif color == "yellow":
396
380
  print("WARNING: " + text)
397
- sys.stdout.flush() # Ensure immediate output
381
+ sys.stdout.flush()
398
382
  else:
399
383
  print(text)
400
- sys.stdout.flush() # Ensure immediate output
384
+ sys.stdout.flush()
401
385
  return
402
386
  if silence:
403
387
  return
@@ -24,11 +24,29 @@ EM_JS(void, _JS_addSoundToggle, (void), {
24
24
  });
25
25
  });
26
26
 
27
+ // ─────────────────────────────────────
28
+ EM_JS(void, _JS_pd4webCppClass, (void *Pd4Web), {
29
+ console.log("Received Pd4Web pointer:", Pd4Web);
30
+ });
31
+
27
32
  // ─────────────────────────────────────
28
33
  EM_JS(void, _JS_setIcon, (const char *icon, const char *animation), {
29
34
  let jsIcon = UTF8ToString(icon);
30
35
  let jsAnimation = UTF8ToString(animation);
31
- setSoundIcon(jsIcon, jsAnimation);
36
+
37
+ function tryCallSetSoundIcon() {
38
+ if (typeof setSoundIcon === 'function') {
39
+ setSoundIcon(jsIcon, jsAnimation);
40
+ } else {
41
+ setTimeout(() => {
42
+ if (typeof setSoundIcon === 'function') {
43
+ setSoundIcon(jsIcon, jsAnimation);
44
+ }
45
+ }, 200); // Retry after 200ms
46
+ }
47
+ }
48
+
49
+ setTimeout(() => tryCallSetSoundIcon(), 200);
32
50
  });
33
51
 
34
52
  // ─────────────────────────────────────
@@ -935,7 +953,6 @@ void Pd4Web::resumeAudio() { emscripten_resume_audio_context_sync(m_Context); }
935
953
  */
936
954
  void Pd4Web::suspendAudio() { _JS_suspendAudioWorkLet(m_Context); }
937
955
 
938
-
939
956
  /* Sound Switch */
940
957
  void Pd4Web::soundToggle() {
941
958
  if (m_audioSuspended) {
@@ -1012,6 +1029,8 @@ void Pd4Web::init() {
1012
1029
  }
1013
1030
  m_audioSuspended = false;
1014
1031
 
1032
+ _JS_pd4webCppClass(this);
1033
+
1015
1034
  return;
1016
1035
  }
1017
1036
  // ╭─────────────────────────────────────╮
@@ -140,7 +140,7 @@ EMSCRIPTEN_BINDINGS(WebPd) {
140
140
  .function("suspendAudio", &Pd4Web::suspendAudio)
141
141
  .function("resumeAudio", &Pd4Web::resumeAudio)
142
142
  .function("soundToggle", &Pd4Web::soundToggle)
143
-
143
+
144
144
  // senders
145
145
  .function("sendFloat", &Pd4Web::sendFloat)
146
146
  .function("sendSymbol", &Pd4Web::sendSymbol)
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "pd4web"
3
- version = "2.2.4"
3
+ version = "2.2.6"
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
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes