@m4l-jweb/wrapper 0.9.5 → 0.9.9

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 (2) hide show
  1. package/package.json +1 -1
  2. package/src/core.ts +0 -88
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@m4l-jweb/wrapper",
3
- "version": "0.9.5",
3
+ "version": "0.9.9",
4
4
  "description": "m4l-jweb: the Max for Live glue layer connecting a device to LiveAPI.",
5
5
  "type": "module",
6
6
  "license": "MIT",
package/src/core.ts CHANGED
@@ -857,94 +857,6 @@ function finishSavePlace(): void {
857
857
  activeSave = null;
858
858
  }
859
859
 
860
- /* ------------------------------------------------------------------ *
861
- * Samples - the `samples` chain
862
- * ------------------------------------------------------------------ */
863
-
864
- /**
865
- * The app: `buffer_load <slot> <path>` - read a file into that slot's [buffer~].
866
- *
867
- * WHY THIS GOES THROUGH [js] AT ALL, when the chain could route it straight to the
868
- * buffer: because the path the app wrote is not a path [buffer~] can open, and it
869
- * fails in the two ways this file exists to prevent.
870
- *
871
- * A RELATIVE path is resolved against the device's folder - the same resolution
872
- * `fetch_to_file` does, and it has to be the same one or the app downloads a file to
873
- * one place and loads it from another. [buffer~] does not resolve it that way: a bare
874
- * name is looked up in MAX's SEARCH PATH, which does not contain the device's folder,
875
- * so `preview.wav` - freshly downloaded, right there next to the .amxd - reports
876
- * "can't open" and the promise times out.
877
- *
878
- * ...and the resolved path CONTAINS SPACES on a normal Live install ("Ableton
879
- * Library", "Max For Live"). A message travelling through the patcher as text would
880
- * split there into three atoms and [buffer~] would open the first one. Handed out of
881
- * [js] as a string, it stays ONE symbol all the way to `replace`.
882
- *
883
- * The file is checked before the buffer is asked for it, because a missing file makes
884
- * [buffer~] print to the Max console and stay silent - there is no failure bang to
885
- * bind to, and the app would learn nothing until the timeout. `buffer_error` says so
886
- * at once.
887
- */
888
- function buffer_load(slot: string, path: string): void {
889
- var resolved = resolveFetchPath(path); // the same folder the download wrote to
890
- var f: File | null = null;
891
- try {
892
- f = new File(resolved, "read");
893
- } catch (e) {
894
- f = null;
895
- }
896
- if (!f || !f.isopen) {
897
- outlet(0, "buffer_error", slot, "no file at " + resolved);
898
- return;
899
- }
900
- var bytes = f.eof;
901
- f.close();
902
- if (!bytes) {
903
- outlet(0, "buffer_error", slot, "empty file at " + resolved);
904
- return;
905
- }
906
-
907
- // Outlet 1 is the aux outlet; the `samples` chain routes `buffer_replace` off it,
908
- // exactly as the `download` chain routes `maxurl`. Outlet 0 belongs to [jweb].
909
- post("m4l-jweb: buffer_load " + slot + " -> " + resolved + "\n");
910
- outlet(1, "buffer_replace", slot, resolved);
911
- }
912
-
913
- /**
914
- * The app: `render_load <slot> <path> <lengthBeats>` - read a rendered WAV into a
915
- * renderplay slot's [buffer~].
916
- *
917
- * Same path problem, same fix as buffer_load: a relative path is resolved against the
918
- * device folder (where saveToFile wrote it), and the resolved path - which contains
919
- * spaces on a normal Live install - is handed out of [js] as ONE symbol via the aux
920
- * outlet, so `replace` sees a single file rather than three atoms. The loop length rides
921
- * alongside as `render_len` for the chain's transport-lock detector.
922
- */
923
- function render_load(slot: string, path: string, lengthBeats: number): void {
924
- var resolved = resolveFetchPath(path);
925
- var f: File | null = null;
926
- try {
927
- f = new File(resolved, "read");
928
- } catch (e) {
929
- f = null;
930
- }
931
- if (!f || !f.isopen) {
932
- outlet(0, "render_error", slot, "no file at " + resolved);
933
- return;
934
- }
935
- var bytes = f.eof;
936
- f.close();
937
- if (!bytes) {
938
- outlet(0, "render_error", slot, "empty file at " + resolved);
939
- return;
940
- }
941
- post("m4l-jweb: render_load " + slot + " -> " + resolved + " (" + lengthBeats + " beats)\n");
942
- // Aux outlet (1): the renderplay chain routes render_replace and render_len off it,
943
- // the same way the download chain routes maxurl. Outlet 0 belongs to [jweb].
944
- outlet(1, "render_len", slot, lengthBeats);
945
- outlet(1, "render_replace", slot, resolved);
946
- }
947
-
948
860
  /** The app: `fetch_to_file <requestId> <url> <destPath>`. */
949
861
  function fetch_to_file(requestId: string, url: string, destPath: string): void {
950
862
  fetchQueue.push({ requestId: requestId, url: url, destPath: destPath, partBytes: 0 });