@opendaw/lib-fusion 0.0.34 → 0.0.36

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.
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import './types';
1
+ import "./types";
2
2
  export * from "./live-stream/LiveStreamReceiver";
3
3
  export * from "./live-stream/LiveStreamBroadcaster";
4
4
  export * from "./peaks/Peaks";
package/dist/index.js CHANGED
@@ -6,7 +6,7 @@ else {
6
6
  globalThis[key] = true;
7
7
  console.debug(`%c${key.description}%c is now available in ${globalThis.constructor.name}.`, "color: hsl(200, 83%, 60%)", "color: inherit");
8
8
  }
9
- import './types';
9
+ import "./types";
10
10
  export * from "./live-stream/LiveStreamReceiver";
11
11
  export * from "./live-stream/LiveStreamBroadcaster";
12
12
  export * from "./peaks/Peaks";
@@ -8,7 +8,7 @@ export declare class LiveStreamBroadcaster {
8
8
  flush(): void;
9
9
  broadcastFloat(address: Address, provider: Provider<float>): Terminable;
10
10
  broadcastInteger(address: Address, provider: Provider<int>): Terminable;
11
- broadcastFloats(address: Address, values: Float32Array, update: Exec): Terminable;
11
+ broadcastFloats(address: Address, values: Float32Array, before?: Exec, after?: Exec): Terminable;
12
12
  broadcastIntegers(address: Address, values: Int32Array, update: Exec): Terminable;
13
13
  broadcastByteArray(address: Address, values: Int8Array, update: Exec): Terminable;
14
14
  terminate(): void;
@@ -1 +1 @@
1
- {"version":3,"file":"LiveStreamBroadcaster.d.ts","sourceRoot":"","sources":["../../src/live-stream/LiveStreamBroadcaster.ts"],"names":[],"mappings":"AAAA,OAAO,EAIH,IAAI,EACJ,KAAK,EACL,GAAG,EAGH,QAAQ,EACR,UAAU,EACb,MAAM,kBAAkB,CAAA;AACzB,OAAO,EAAC,OAAO,EAAC,MAAM,kBAAkB,CAAA;AACxC,OAAO,EAAe,SAAS,EAAC,MAAM,sBAAsB,CAAA;AAa5D,qBAAa,qBAAqB;;IAC9B,MAAM,CAAC,MAAM,C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AAG,CAAC,GAAG,UAAU;IASvE,eAAe,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,CAAC,EAAE,IAAI,EAAE,KAAK,CAAC,EAAE,IAAI,GAAG,UAAU;IAchG,iBAAiB,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,IAAI,GAAG,UAAU;IAajF,kBAAkB,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,IAAI,GAAG,UAAU;IAmCjF,SAAS,IAAI,IAAI;CAgDpB"}
@@ -1,4 +1,4 @@
1
- import { Arrays, assert, ByteArrayOutput, nextPowOf2, Option } from "@opendaw/lib-std";
1
+ import { Arrays, assert, ByteArrayOutput, nextPowOf2, Option, safeExecute } from "@opendaw/lib-std";
2
2
  import { Communicator } from "@opendaw/lib-runtime";
3
3
  import { Lock } from "./Lock";
4
4
  import { PackageType } from "./PackageType";
@@ -69,17 +69,18 @@ export class LiveStreamBroadcaster {
69
69
  put(output) { output.writeInt(provider()); }
70
70
  });
71
71
  }
72
- broadcastFloats(address, values, update) {
72
+ broadcastFloats(address, values, before, after) {
73
73
  return this.#storeChunk(new class {
74
74
  type = PackageType.FloatArray;
75
75
  address = address;
76
76
  capacity = 4 + (values.byteLength << 2);
77
77
  put(output) {
78
- update();
78
+ safeExecute(before);
79
79
  output.writeInt(values.length);
80
80
  for (const value of values) {
81
81
  output.writeFloat(value);
82
82
  }
83
+ safeExecute(after);
83
84
  }
84
85
  });
85
86
  }
@@ -6,8 +6,8 @@ export declare class LiveStreamReceiver implements Terminable {
6
6
  static ID: int;
7
7
  constructor();
8
8
  connect(messenger: Messenger): Terminable;
9
- subscribeFloat(address: Address, procedure: Procedure<int>): Subscription;
10
- subscribeInteger(address: Address, procedure: Procedure<float>): Subscription;
9
+ subscribeFloat(address: Address, procedure: Procedure<float>): Subscription;
10
+ subscribeInteger(address: Address, procedure: Procedure<int>): Subscription;
11
11
  subscribeFloats(address: Address, procedure: Procedure<Float32Array>): Subscription;
12
12
  subscribeIntegers(address: Address, procedure: Procedure<Int32Array>): Subscription;
13
13
  subscribeByteArray(address: Address, procedure: Procedure<Int8Array>): Subscription;
@@ -1 +1 @@
1
- {"version":3,"file":"LiveStreamReceiver.d.ts","sourceRoot":"","sources":["../../src/live-stream/LiveStreamReceiver.ts"],"names":[],"mappings":"AAAA,OAAO,EAIH,KAAK,EACL,GAAG,EAIH,SAAS,EAET,YAAY,EACZ,UAAU,EACb,MAAM,kBAAkB,CAAA;AACzB,OAAO,EAAC,OAAO,EAAC,MAAM,kBAAkB,CAAA;AAExC,OAAO,EAAe,SAAS,EAAC,MAAM,sBAAsB,CAAA;AAmG5D,qBAAa,kBAAmB,YAAW,UAAU;;IACjD,MAAM,CAAC,EAAE,EAAE,GAAG,CAAQ;;IA0BtB,OAAO,CAAC,SAAS,EAAE,SAAS,GAAG,UAAU;IA2BzC,cAAc,CAAC,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,CAAC,GAAG,CAAC,GAAG,YAAY;IAIzE,gBAAgB,CAAC,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,CAAC,KAAK,CAAC,GAAG,YAAY;IAI7E,eAAe,CAAC,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,CAAC,YAAY,CAAC,GAAG,YAAY;IAInF,iBAAiB,CAAC,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,CAAC,UAAU,CAAC,GAAG,YAAY;IAInF,kBAAkB,CAAC,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,CAAC,SAAS,CAAC,GAAG,YAAY;IAInF,SAAS,IAAI,IAAI;CA4CpB"}
1
+ {"version":3,"file":"LiveStreamReceiver.d.ts","sourceRoot":"","sources":["../../src/live-stream/LiveStreamReceiver.ts"],"names":[],"mappings":"AAAA,OAAO,EAIH,KAAK,EACL,GAAG,EAIH,SAAS,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,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;iBAWrD,OAAO,CAAC,IAAI,CAAC;kCAWT,CAAC,QAAQ,MAAM,aAAa,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC;wCAkBnD,MAAM,YAAY,6BAA6B,GAAG,OAAO,CAAC,0BAA0B,CAAC;8CAO/E,aAAa,CAAC,MAAM,CAAC,YACrB,6BAA6B,GAAG,OAAO,CAAC,yBAAyB,CAAC;MAKnG,CAAA;CAMT"}
1
+ {"version":3,"file":"OpfsWorker.d.ts","sourceRoot":"","sources":["../../src/opfs/OpfsWorker.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,YAAY,EAAE,SAAS,EAAW,MAAM,sBAAsB,CAAA;AACtE,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAA;AAC3C,OAAO,UAAU,CAAA;AAEjB,yBAAiB,UAAU,CAAC;IAGjB,MAAM,IAAI,GAAI,WAAW,SAAS;;oBAIf,MAAM,QAAQ,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC;mBAczC,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC;qBAe1B,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;mBASxB,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;iBAWrD,OAAO,CAAC,IAAI,CAAC;kCAWT,CAAC,QAAQ,MAAM,aAAa,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC;wCAqBnD,MAAM,YAAY,6BAA6B,GAAG,OAAO,CAAC,0BAA0B,CAAC;8CAO/E,aAAa,CAAC,MAAM,CAAC,YACrB,6BAA6B,GAAG,OAAO,CAAC,yBAAyB,CAAC;MAKnG,CAAA;CAMT"}
@@ -1,4 +1,4 @@
1
- import { Arrays, asDefined, panic } from "@opendaw/lib-std";
1
+ import { Arrays, asDefined, isNotUndefined, panic } from "@opendaw/lib-std";
2
2
  import { Communicator, Promises } from "@opendaw/lib-runtime";
3
3
  import "../types";
4
4
  export var OpfsWorker;
@@ -73,20 +73,23 @@ export var OpfsWorker;
73
73
  }
74
74
  }
75
75
  async #acquireLock(path, operation) {
76
- const existingLock = this.#locks.get(path);
77
- if (existingLock) {
78
- await existingLock;
79
- }
80
- let releaseLock = () => panic("Lock not acquired");
81
- const lockPromise = new Promise(resolve => releaseLock = resolve);
82
- this.#locks.set(path, lockPromise);
83
- try {
84
- return await operation();
85
- }
86
- finally {
87
- releaseLock();
88
- if (this.#locks.get(path) === lockPromise) {
89
- this.#locks.delete(path);
76
+ while (true) {
77
+ const existingLock = this.#locks.get(path);
78
+ if (isNotUndefined(existingLock)) {
79
+ await existingLock;
80
+ continue;
81
+ }
82
+ let releaseLock = () => panic("Lock not acquired");
83
+ const lockPromise = new Promise(resolve => releaseLock = resolve);
84
+ this.#locks.set(path, lockPromise);
85
+ try {
86
+ return await operation();
87
+ }
88
+ finally {
89
+ if (this.#locks.get(path) === lockPromise) {
90
+ this.#locks.delete(path);
91
+ }
92
+ releaseLock();
90
93
  }
91
94
  }
92
95
  }
package/package.json CHANGED
@@ -1,34 +1,34 @@
1
1
  {
2
- "name": "@opendaw/lib-fusion",
3
- "version": "0.0.34",
4
- "main": "./dist/index.js",
5
- "types": "./dist/index.d.ts",
6
- "license": "LGPL-3.0-or-later",
7
- "publishConfig": {
8
- "access": "public"
9
- },
10
- "exports": {
11
- ".": {
12
- "types": "./dist/index.d.ts",
13
- "default": "./dist/index.js"
14
- }
15
- },
16
- "files": [
17
- "dist/**/*"
18
- ],
19
- "scripts": {
20
- "build": "tsc",
21
- "lint": "eslint \"**/*.ts\"",
22
- "test": "echo \"No tests to run\""
23
- },
24
- "dependencies": {
25
- "@opendaw/lib-box": "^0.0.34",
26
- "@opendaw/lib-runtime": "^0.0.34",
27
- "@opendaw/lib-std": "^0.0.34"
28
- },
29
- "devDependencies": {
30
- "@opendaw/eslint-config": "^0.0.19",
31
- "@opendaw/typescript-config": "^0.0.20"
32
- },
33
- "gitHead": "3197d0b9e1c6d9480aa6f29a41976a4685c0a0ff"
2
+ "name": "@opendaw/lib-fusion",
3
+ "version": "0.0.36",
4
+ "main": "./dist/index.js",
5
+ "types": "./dist/index.d.ts",
6
+ "license": "LGPL-3.0-or-later",
7
+ "publishConfig": {
8
+ "access": "public"
9
+ },
10
+ "exports": {
11
+ ".": {
12
+ "types": "./dist/index.d.ts",
13
+ "default": "./dist/index.js"
14
+ }
15
+ },
16
+ "files": [
17
+ "dist/**/*"
18
+ ],
19
+ "scripts": {
20
+ "build": "tsc",
21
+ "lint": "eslint \"**/*.ts\"",
22
+ "test": "echo \"No tests to run\""
23
+ },
24
+ "dependencies": {
25
+ "@opendaw/lib-box": "^0.0.36",
26
+ "@opendaw/lib-runtime": "^0.0.36",
27
+ "@opendaw/lib-std": "^0.0.36"
28
+ },
29
+ "devDependencies": {
30
+ "@opendaw/eslint-config": "^0.0.20",
31
+ "@opendaw/typescript-config": "^0.0.20"
32
+ },
33
+ "gitHead": "a3c95d33522ce3b35c1a67af0fd6064488d35c97"
34
34
  }