@effetune/dsp 0.6.0 → 0.8.0

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.
@@ -29,8 +29,8 @@ function channelSpec(channel) {
29
29
  if (channel === 'stereo') return -1;
30
30
  if (channel === 'left' || channel === '1') return 0;
31
31
  if (channel === 'right' || channel === '2') return 1;
32
- if (/^[3-8]$/.test(channel)) return Number(channel) - 1;
33
- return { '34': 17, '56': 18, '78': 19 }[channel];
32
+ if (/^([3-9]|1[0-6])$/.test(channel)) return Number(channel) - 1;
33
+ return { '34': 17, '56': 18, '78': 19, '910': 20, '1112': 21, '1314': 22, '1516': 23 }[channel];
34
34
  }
35
35
 
36
36
  export function effectiveNodeIds(document) {
@@ -143,7 +143,7 @@ function optionalSlot(value) {
143
143
  }
144
144
 
145
145
  export function decodeGraphSnapshot(bytes, document) {
146
- if (!(bytes instanceof Uint8Array) || bytes.byteLength < 128) {
146
+ if (!(bytes instanceof Uint8Array) || bytes.byteLength < 192) {
147
147
  throw new EffeTuneRuntimeError('DSP returned an invalid Graph compile snapshot.');
148
148
  }
149
149
  const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
@@ -161,7 +161,7 @@ export function decodeGraphSnapshot(bytes, document) {
161
161
  const edgesOffset = view.getUint32(56, true);
162
162
  const totalBytes = view.getUint32(60, true);
163
163
  if (nodeCount !== document.nodes.length || edgeCount !== document.edges.length ||
164
- channels < 1 || channels > 8 || nodeBytes !== 128 || edgeBytes !== 48 ||
164
+ channels < 1 || channels > 16 || nodeBytes !== 224 || edgeBytes !== 80 ||
165
165
  totalBytes !== bytes.byteLength) {
166
166
  throw new EffeTuneRuntimeError('DSP returned an inconsistent Graph compile snapshot.');
167
167
  }
@@ -185,8 +185,8 @@ export function decodeGraphSnapshot(bytes, document) {
185
185
  },
186
186
  kernelLatency: view.getUint32(offset + 24, true),
187
187
  inputLatency: vector(view, offset + 32, channels),
188
- outputLatency: vector(view, offset + 64, channels),
189
- preNodeCompensation: vector(view, offset + 96, channels)
188
+ outputLatency: vector(view, offset + 96, channels),
189
+ preNodeCompensation: vector(view, offset + 160, channels)
190
190
  };
191
191
  });
192
192
  const edges = document.edges.map((edge, index) => {
@@ -209,7 +209,7 @@ export function decodeGraphSnapshot(bytes, document) {
209
209
  nodes,
210
210
  edges,
211
211
  outputLatency: vector(view, 64, channels),
212
- outputCompensation: vector(view, 96, channels),
212
+ outputCompensation: vector(view, 128, channels),
213
213
  latencySamples: view.getUint32(28, true),
214
214
  capacity: {
215
215
  bufferSlots: view.getUint32(24, true),
package/dist/graph.js CHANGED
@@ -26,8 +26,8 @@ const STREAM_SAFE_PARAMETERS = new Map([
26
26
  ]);
27
27
 
28
28
  function validateAudio(audio) {
29
- if (!Array.isArray(audio) || audio.length < 1 || audio.length > 8) {
30
- throw new ValidationError('Audio must be an array containing between 1 and 8 Float32Array channels.');
29
+ if (!Array.isArray(audio) || audio.length < 1 || audio.length > 16) {
30
+ throw new ValidationError('Audio must be an array containing between 1 and 16 Float32Array channels.');
31
31
  }
32
32
  const frames = audio[0] instanceof Float32Array ? audio[0].length : -1;
33
33
  for (const channel of audio) {
@@ -49,8 +49,8 @@ function validateBlockSize(value = 128) {
49
49
  }
50
50
 
51
51
  function validateChannels(channels) {
52
- if (!Number.isInteger(channels) || channels < 1 || channels > 8) {
53
- throw new ValidationError('channels must be an integer from 1 to 8.');
52
+ if (!Number.isInteger(channels) || channels < 1 || channels > 16) {
53
+ throw new ValidationError('channels must be an integer from 1 to 16.');
54
54
  }
55
55
  return channels;
56
56
  }