@grame/faustwasm 0.12.2 → 0.13.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.
Files changed (81) hide show
  1. package/.prettierrc +5 -0
  2. package/README.md +21 -3
  3. package/assets/standalone/faustwasm/index.d.ts +38 -16
  4. package/assets/standalone/faustwasm/index.js +1574 -404
  5. package/assets/standalone/faustwasm/index.js.map +2 -2
  6. package/dist/cjs/index.d.ts +38 -16
  7. package/dist/cjs/index.js +1573 -404
  8. package/dist/cjs/index.js.map +2 -2
  9. package/dist/cjs-bundle/index.d.ts +38 -16
  10. package/dist/cjs-bundle/index.js +1576 -406
  11. package/dist/cjs-bundle/index.js.map +2 -2
  12. package/dist/esm/index.d.ts +38 -16
  13. package/dist/esm/index.js +1574 -404
  14. package/dist/esm/index.js.map +2 -2
  15. package/dist/esm-bundle/index.d.ts +38 -16
  16. package/dist/esm-bundle/index.js +1576 -406
  17. package/dist/esm-bundle/index.js.map +2 -2
  18. package/eslint.config.js +11 -0
  19. package/package.json +57 -51
  20. package/sound.cpp +163 -0
  21. package/sound.dsp +4 -0
  22. package/sound.json +1 -0
  23. package/sound.wasm +0 -0
  24. package/src/FaustAudioWorkletCommunicator.ts +150 -143
  25. package/src/FaustAudioWorkletNode.ts +173 -75
  26. package/src/FaustAudioWorkletProcessor.ts +218 -90
  27. package/src/FaustCmajor.ts +9 -3
  28. package/src/FaustCompiler.ts +112 -35
  29. package/src/FaustDspGenerator.ts +561 -117
  30. package/src/FaustDspInstance.ts +58 -24
  31. package/src/FaustFFTAudioWorkletProcessor.ts +822 -612
  32. package/src/FaustOfflineProcessor.ts +187 -56
  33. package/src/FaustScriptProcessorNode.ts +156 -49
  34. package/src/FaustSensors.ts +426 -96
  35. package/src/FaustSvgDiagrams.ts +18 -5
  36. package/src/FaustWasmInstantiator.ts +224 -70
  37. package/src/FaustWebAudioDsp.ts +1060 -349
  38. package/src/LibFaust.ts +13 -4
  39. package/src/SoundfileReader.ts +175 -131
  40. package/src/WavDecoder.ts +42 -20
  41. package/src/WavEncoder.ts +35 -21
  42. package/src/copyWebStandaloneAssets.d.ts +20 -5
  43. package/src/copyWebStandaloneAssets.js +203 -75
  44. package/src/exports-bundle.ts +5 -5
  45. package/src/exports.ts +24 -24
  46. package/src/faust2CmajorFiles.d.ts +7 -3
  47. package/src/faust2cmajorFiles.js +10 -8
  48. package/src/faust2svgFiles.d.ts +7 -3
  49. package/src/faust2svgFiles.js +9 -7
  50. package/src/faust2wasmFiles.d.ts +10 -5
  51. package/src/faust2wasmFiles.js +34 -17
  52. package/src/faust2wavFiles.d.ts +12 -3
  53. package/src/faust2wavFiles.js +25 -12
  54. package/src/index-bundle-iife.ts +2 -2
  55. package/src/index-bundle.ts +1 -1
  56. package/src/index.ts +1 -1
  57. package/src/instantiateFaustModule.ts +43 -36
  58. package/src/instantiateFaustModuleFromFile.ts +30 -14
  59. package/src/types.ts +101 -25
  60. package/test/faustlive-wasm/faustwasm/index.d.ts +38 -16
  61. package/test/faustlive-wasm/faustwasm/index.js +1574 -404
  62. package/test/faustlive-wasm/faustwasm/index.js.map +2 -2
  63. package/test/web/create-faust-node.html +53 -0
  64. package/test/web/create-faust-node.js +186 -0
  65. package/test/organ/create-node.js +0 -252
  66. package/test/organ/dsp-meta.json +0 -131
  67. package/test/organ/dsp-module.wasm +0 -0
  68. package/test/organ/faust-pwa.js +0 -344
  69. package/test/organ/faust-ui/index.css +0 -442
  70. package/test/organ/faust-ui/index.css.map +0 -1
  71. package/test/organ/faust-ui/index.d.ts +0 -1
  72. package/test/organ/faust-ui/index.js +0 -3756
  73. package/test/organ/faust-ui/index.js.map +0 -1
  74. package/test/organ/faustwasm/index.d.ts +0 -1705
  75. package/test/organ/faustwasm/index.js +0 -4773
  76. package/test/organ/faustwasm/index.js.map +0 -7
  77. package/test/organ/icon.png +0 -0
  78. package/test/organ/index.html +0 -76
  79. package/test/organ/index.js +0 -69
  80. package/test/organ/manifest.json +0 -17
  81. package/test/organ/service-worker.js +0 -165
@@ -9,18 +9,18 @@
9
9
  }
10
10
 
11
11
  /** Enum describing the axis of the accelerometer or gyroscope */
12
- export enum Axis { x, y, z }
12
+ export enum Axis {
13
+ x,
14
+ y,
15
+ z
16
+ }
13
17
 
14
18
  /** Enum describing the curve of the accelerometer */
15
- export enum Curve { Up, Down, UpDown, DownUp }
16
-
17
- /** Object describing value off accelerometer metadata values */
18
- class AccMeta {
19
- axis: Axis;
20
- curve: Curve;
21
- amin: number;
22
- amid: number;
23
- amax: number;
19
+ export enum Curve {
20
+ Up,
21
+ Down,
22
+ UpDown,
23
+ DownUp
24
24
  }
25
25
 
26
26
  interface Range {
@@ -51,7 +51,11 @@ interface Interpolator3pt {
51
51
  fSegment2: Interpolator;
52
52
  fMid: number;
53
53
  returnMappedValue(v: number): number;
54
- getMappingValues(amin: number, amid: number, amax: number): InterpolateObject3pt;
54
+ getMappingValues(
55
+ amin: number,
56
+ amid: number,
57
+ amax: number
58
+ ): InterpolateObject3pt;
55
59
  }
56
60
 
57
61
  /**
@@ -68,8 +72,19 @@ interface ValueConverter {
68
72
  export interface UpdatableValueConverter extends ValueConverter {
69
73
  fActive: boolean;
70
74
 
71
- setMappingValues(amin: number, amid: number, amax: number, min: number, init: number, max: number): void;
72
- getMappingValues(amin: number, amid: number, amax: number): InterpolateObject3pt;
75
+ setMappingValues(
76
+ amin: number,
77
+ amid: number,
78
+ amax: number,
79
+ min: number,
80
+ init: number,
81
+ max: number
82
+ ): void;
83
+ getMappingValues(
84
+ amin: number,
85
+ amid: number,
86
+ amax: number
87
+ ): InterpolateObject3pt;
73
88
 
74
89
  setActive(onOff: boolean): void;
75
90
  getActive(): boolean;
@@ -78,7 +93,7 @@ export interface UpdatableValueConverter extends ValueConverter {
78
93
  export default class FaustSensors {
79
94
  /**
80
95
  * Function to convert a number to an axis type
81
- *
96
+ *
82
97
  * @param value number
83
98
  * @returns axis type
84
99
  */
@@ -91,13 +106,13 @@ export default class FaustSensors {
91
106
  case 2:
92
107
  return Axis.z;
93
108
  default:
94
- console.error("Error: Axis not found value: " + value);
109
+ console.error('Error: Axis not found value: ' + value);
95
110
  return Axis.x;
96
111
  }
97
112
  }
98
113
  /**
99
114
  * Function to convert a number to a curve type
100
- *
115
+ *
101
116
  * @param value number
102
117
  * @returns curve type
103
118
  */
@@ -112,7 +127,7 @@ export default class FaustSensors {
112
127
  case 3:
113
128
  return Curve.DownUp;
114
129
  default:
115
- console.error("Error: Curve not found value: " + value);
130
+ console.error('Error: Curve not found value: ' + value);
116
131
  return Curve.Up;
117
132
  }
118
133
  }
@@ -140,7 +155,12 @@ export default class FaustSensors {
140
155
  return this._Range;
141
156
  }
142
157
 
143
- static _Interpolator: new (lo: number, hi: number, v1: number, v2: number) => Interpolator;
158
+ static _Interpolator: new (
159
+ lo: number,
160
+ hi: number,
161
+ v1: number,
162
+ v2: number
163
+ ) => Interpolator;
144
164
  /**
145
165
  * Interpolator class
146
166
  */
@@ -164,7 +184,7 @@ export default class FaustSensors {
164
184
  }
165
185
  }
166
186
  returnMappedValue(v: number): number {
167
- var x = this.fRange.clip(v);
187
+ const x = this.fRange.clip(v);
168
188
  return this.fOffset + x * this.fCoef;
169
189
  }
170
190
  getLowHigh(amin: number, amax: number): InterpolateObject {
@@ -175,174 +195,441 @@ export default class FaustSensors {
175
195
  return this._Interpolator;
176
196
  }
177
197
 
178
- static _Interpolator3pt: new (lo: number, mid: number, hi: number, v1: number, vMid: number, v2: number) => Interpolator3pt;
198
+ static _Interpolator3pt: new (
199
+ lo: number,
200
+ mid: number,
201
+ hi: number,
202
+ v1: number,
203
+ vMid: number,
204
+ v2: number
205
+ ) => Interpolator3pt;
179
206
  /**
180
207
  * Interpolator3pt class, combine two interpolators
181
208
  */
182
209
  static get Interpolator3pt() {
183
210
  if (!this._Interpolator3pt) {
184
211
  this._Interpolator3pt = class {
185
-
186
212
  fSegment1: Interpolator;
187
213
  fSegment2: Interpolator;
188
214
  fMid: number;
189
215
 
190
- constructor(lo: number, mid: number, hi: number, v1: number, vMid: number, v2: number) {
191
- this.fSegment1 = new FaustSensors.Interpolator(lo, mid, v1, vMid);
192
- this.fSegment2 = new FaustSensors.Interpolator(mid, hi, vMid, v2);
216
+ constructor(
217
+ lo: number,
218
+ mid: number,
219
+ hi: number,
220
+ v1: number,
221
+ vMid: number,
222
+ v2: number
223
+ ) {
224
+ this.fSegment1 = new FaustSensors.Interpolator(
225
+ lo,
226
+ mid,
227
+ v1,
228
+ vMid
229
+ );
230
+ this.fSegment2 = new FaustSensors.Interpolator(
231
+ mid,
232
+ hi,
233
+ vMid,
234
+ v2
235
+ );
193
236
  this.fMid = mid;
194
237
  }
195
238
  returnMappedValue(x: number): number {
196
- return (x < this.fMid) ? this.fSegment1.returnMappedValue(x) : this.fSegment2.returnMappedValue(x);
239
+ return x < this.fMid
240
+ ? this.fSegment1.returnMappedValue(x)
241
+ : this.fSegment2.returnMappedValue(x);
197
242
  }
198
243
 
199
- getMappingValues(amin: number, amid: number, amax: number): InterpolateObject3pt {
200
- var lowHighSegment1 = this.fSegment1.getLowHigh(amin, amid);
201
- var lowHighSegment2 = this.fSegment2.getLowHigh(amid, amax);
202
- return { amin: lowHighSegment1.amin, amid: lowHighSegment2.amin, amax: lowHighSegment2.amax };
244
+ getMappingValues(
245
+ amin: number,
246
+ amid: number,
247
+ amax: number
248
+ ): InterpolateObject3pt {
249
+ const lowHighSegment1 = this.fSegment1.getLowHigh(
250
+ amin,
251
+ amid
252
+ );
253
+ const lowHighSegment2 = this.fSegment2.getLowHigh(
254
+ amid,
255
+ amax
256
+ );
257
+ return {
258
+ amin: lowHighSegment1.amin,
259
+ amid: lowHighSegment2.amin,
260
+ amax: lowHighSegment2.amax
261
+ };
203
262
  }
204
- }
205
-
263
+ };
206
264
  }
207
265
  return this._Interpolator3pt;
208
266
  }
209
- static _UpConverter: new (amin: number, amid: number, amax: number, fmin: number, fmid: number, fmax: number) => UpdatableValueConverter;
267
+ static _UpConverter: new (
268
+ amin: number,
269
+ amid: number,
270
+ amax: number,
271
+ fmin: number,
272
+ fmid: number,
273
+ fmax: number
274
+ ) => UpdatableValueConverter;
210
275
  /**
211
276
  * UpConverter class, convert accelerometer value to Faust value
212
277
  */
213
278
  static get UpConverter() {
214
279
  if (!this._UpConverter) {
215
280
  this._UpConverter = class implements UpdatableValueConverter {
216
-
217
281
  fA2F: Interpolator3pt;
218
282
  fF2A: Interpolator3pt;
219
283
  fActive: boolean = true;
220
284
 
221
- constructor(amin: number, amid: number, amax: number, fmin: number, fmid: number, fmax: number) {
222
- this.fA2F = new FaustSensors.Interpolator3pt(amin, amid, amax, fmin, fmid, fmax);
223
- this.fF2A = new FaustSensors.Interpolator3pt(fmin, fmid, fmax, amin, amid, amax);
285
+ constructor(
286
+ amin: number,
287
+ amid: number,
288
+ amax: number,
289
+ fmin: number,
290
+ fmid: number,
291
+ fmax: number
292
+ ) {
293
+ this.fA2F = new FaustSensors.Interpolator3pt(
294
+ amin,
295
+ amid,
296
+ amax,
297
+ fmin,
298
+ fmid,
299
+ fmax
300
+ );
301
+ this.fF2A = new FaustSensors.Interpolator3pt(
302
+ fmin,
303
+ fmid,
304
+ fmax,
305
+ amin,
306
+ amid,
307
+ amax
308
+ );
224
309
  }
225
310
 
226
- uiToFaust(x: number) { return this.fA2F.returnMappedValue(x) }
227
- faustToUi(x: number) { return this.fF2A.returnMappedValue(x) }
311
+ uiToFaust(x: number) {
312
+ return this.fA2F.returnMappedValue(x);
313
+ }
314
+ faustToUi(x: number) {
315
+ return this.fF2A.returnMappedValue(x);
316
+ }
228
317
 
229
- setMappingValues(amin: number, amid: number, amax: number, min: number, init: number, max: number): void {
230
- this.fA2F = new FaustSensors.Interpolator3pt(amin, amid, amax, min, init, max);
231
- this.fF2A = new FaustSensors.Interpolator3pt(min, init, max, amin, amid, amax);
318
+ setMappingValues(
319
+ amin: number,
320
+ amid: number,
321
+ amax: number,
322
+ min: number,
323
+ init: number,
324
+ max: number
325
+ ): void {
326
+ this.fA2F = new FaustSensors.Interpolator3pt(
327
+ amin,
328
+ amid,
329
+ amax,
330
+ min,
331
+ init,
332
+ max
333
+ );
334
+ this.fF2A = new FaustSensors.Interpolator3pt(
335
+ min,
336
+ init,
337
+ max,
338
+ amin,
339
+ amid,
340
+ amax
341
+ );
232
342
  }
233
343
 
234
- getMappingValues(amin: number, amid: number, amax: number): InterpolateObject3pt {
344
+ getMappingValues(
345
+ amin: number,
346
+ amid: number,
347
+ amax: number
348
+ ): InterpolateObject3pt {
235
349
  return this.fA2F.getMappingValues(amin, amid, amax);
236
350
  }
237
351
 
238
- setActive(onOff: boolean): void { this.fActive = onOff }
239
- getActive(): boolean { return this.fActive }
240
- }
241
-
352
+ setActive(onOff: boolean): void {
353
+ this.fActive = onOff;
354
+ }
355
+ getActive(): boolean {
356
+ return this.fActive;
357
+ }
358
+ };
242
359
  }
243
360
  return this._UpConverter;
244
361
  }
245
- static _DownConverter: new (amin: number, amid: number, amax: number, fmin: number, fmid: number, fmax: number) => UpdatableValueConverter;
362
+ static _DownConverter: new (
363
+ amin: number,
364
+ amid: number,
365
+ amax: number,
366
+ fmin: number,
367
+ fmid: number,
368
+ fmax: number
369
+ ) => UpdatableValueConverter;
246
370
  /**
247
371
  * DownConverter class, convert accelerometer value to Faust value
248
372
  */
249
373
  static get DownConverter() {
250
374
  if (!this._DownConverter) {
251
375
  this._DownConverter = class implements UpdatableValueConverter {
252
-
253
376
  fA2F: Interpolator3pt;
254
377
  fF2A: Interpolator3pt;
255
378
  fActive: boolean = true;
256
379
 
257
- constructor(amin: number, amid: number, amax: number, fmin: number, fmid: number, fmax: number) {
258
- this.fA2F = new FaustSensors.Interpolator3pt(amin, amid, amax, fmax, fmid, fmin);
259
- this.fF2A = new FaustSensors.Interpolator3pt(fmin, fmid, fmax, amax, amid, amin);
380
+ constructor(
381
+ amin: number,
382
+ amid: number,
383
+ amax: number,
384
+ fmin: number,
385
+ fmid: number,
386
+ fmax: number
387
+ ) {
388
+ this.fA2F = new FaustSensors.Interpolator3pt(
389
+ amin,
390
+ amid,
391
+ amax,
392
+ fmax,
393
+ fmid,
394
+ fmin
395
+ );
396
+ this.fF2A = new FaustSensors.Interpolator3pt(
397
+ fmin,
398
+ fmid,
399
+ fmax,
400
+ amax,
401
+ amid,
402
+ amin
403
+ );
260
404
  }
261
405
 
262
- uiToFaust(x: number) { return this.fA2F.returnMappedValue(x) }
263
- faustToUi(x: number) { return this.fF2A.returnMappedValue(x) }
406
+ uiToFaust(x: number) {
407
+ return this.fA2F.returnMappedValue(x);
408
+ }
409
+ faustToUi(x: number) {
410
+ return this.fF2A.returnMappedValue(x);
411
+ }
264
412
 
265
- setMappingValues(amin: number, amid: number, amax: number, min: number, init: number, max: number): void {
266
- this.fA2F = new FaustSensors.Interpolator3pt(amin, amid, amax, max, init, min);
267
- this.fF2A = new FaustSensors.Interpolator3pt(min, init, max, amax, amid, amin);
413
+ setMappingValues(
414
+ amin: number,
415
+ amid: number,
416
+ amax: number,
417
+ min: number,
418
+ init: number,
419
+ max: number
420
+ ): void {
421
+ this.fA2F = new FaustSensors.Interpolator3pt(
422
+ amin,
423
+ amid,
424
+ amax,
425
+ max,
426
+ init,
427
+ min
428
+ );
429
+ this.fF2A = new FaustSensors.Interpolator3pt(
430
+ min,
431
+ init,
432
+ max,
433
+ amax,
434
+ amid,
435
+ amin
436
+ );
268
437
  }
269
- getMappingValues(amin: number, amid: number, amax: number): InterpolateObject3pt {
438
+ getMappingValues(
439
+ amin: number,
440
+ amid: number,
441
+ amax: number
442
+ ): InterpolateObject3pt {
270
443
  return this.fA2F.getMappingValues(amin, amid, amax);
271
444
  }
272
445
 
273
- setActive(onOff: boolean): void { this.fActive = onOff }
274
- getActive(): boolean { return this.fActive }
275
- }
276
-
446
+ setActive(onOff: boolean): void {
447
+ this.fActive = onOff;
448
+ }
449
+ getActive(): boolean {
450
+ return this.fActive;
451
+ }
452
+ };
277
453
  }
278
454
  return this._DownConverter;
279
455
  }
280
- static _UpDownConverter: new (amin: number, amid: number, amax: number, fmin: number, fmid: number, fmax: number) => UpdatableValueConverter;
456
+ static _UpDownConverter: new (
457
+ amin: number,
458
+ amid: number,
459
+ amax: number,
460
+ fmin: number,
461
+ fmid: number,
462
+ fmax: number
463
+ ) => UpdatableValueConverter;
281
464
  /**
282
465
  * UpDownConverter class, convert accelerometer value to Faust value
283
466
  */
284
467
  static get UpDownConverter() {
285
468
  if (!this._UpDownConverter) {
286
469
  this._UpDownConverter = class implements UpdatableValueConverter {
287
-
288
470
  fA2F: Interpolator3pt;
289
471
  fF2A: Interpolator;
290
472
  fActive: boolean = true;
291
473
 
292
- constructor(amin: number, amid: number, amax: number, fmin: number, fmid: number, fmax: number) {
293
- this.fA2F = new FaustSensors.Interpolator3pt(amin, amid, amax, fmin, fmax, fmin);
294
- this.fF2A = new FaustSensors.Interpolator(fmin, fmax, amin, amax);
474
+ constructor(
475
+ amin: number,
476
+ amid: number,
477
+ amax: number,
478
+ fmin: number,
479
+ fmid: number,
480
+ fmax: number
481
+ ) {
482
+ this.fA2F = new FaustSensors.Interpolator3pt(
483
+ amin,
484
+ amid,
485
+ amax,
486
+ fmin,
487
+ fmax,
488
+ fmin
489
+ );
490
+ this.fF2A = new FaustSensors.Interpolator(
491
+ fmin,
492
+ fmax,
493
+ amin,
494
+ amax
495
+ );
295
496
  }
296
497
 
297
- uiToFaust(x: number) { return this.fA2F.returnMappedValue(x) }
298
- faustToUi(x: number) { return this.fF2A.returnMappedValue(x) }
498
+ uiToFaust(x: number) {
499
+ return this.fA2F.returnMappedValue(x);
500
+ }
501
+ faustToUi(x: number) {
502
+ return this.fF2A.returnMappedValue(x);
503
+ }
299
504
 
300
- setMappingValues(amin: number, amid: number, amax: number, min: number, init: number, max: number): void {
301
- this.fA2F = new FaustSensors.Interpolator3pt(amin, amid, amax, min, max, min);
302
- this.fF2A = new FaustSensors.Interpolator(min, max, amin, amax);
505
+ setMappingValues(
506
+ amin: number,
507
+ amid: number,
508
+ amax: number,
509
+ min: number,
510
+ init: number,
511
+ max: number
512
+ ): void {
513
+ this.fA2F = new FaustSensors.Interpolator3pt(
514
+ amin,
515
+ amid,
516
+ amax,
517
+ min,
518
+ max,
519
+ min
520
+ );
521
+ this.fF2A = new FaustSensors.Interpolator(
522
+ min,
523
+ max,
524
+ amin,
525
+ amax
526
+ );
303
527
  }
304
- getMappingValues(amin: number, amid: number, amax: number): InterpolateObject3pt {
528
+ getMappingValues(
529
+ amin: number,
530
+ amid: number,
531
+ amax: number
532
+ ): InterpolateObject3pt {
305
533
  return this.fA2F.getMappingValues(amin, amid, amax);
306
534
  }
307
535
 
308
- setActive(onOff: boolean): void { this.fActive = onOff }
309
- getActive(): boolean { return this.fActive }
310
- }
311
-
536
+ setActive(onOff: boolean): void {
537
+ this.fActive = onOff;
538
+ }
539
+ getActive(): boolean {
540
+ return this.fActive;
541
+ }
542
+ };
312
543
  }
313
544
  return this._UpDownConverter;
314
545
  }
315
546
  /**
316
547
  * DownUpConverter class, convert accelerometer value to Faust value
317
548
  */
318
- static _DownUpConverter: new (amin: number, amid: number, amax: number, fmin: number, fmid: number, fmax: number) => UpdatableValueConverter;
549
+ static _DownUpConverter: new (
550
+ amin: number,
551
+ amid: number,
552
+ amax: number,
553
+ fmin: number,
554
+ fmid: number,
555
+ fmax: number
556
+ ) => UpdatableValueConverter;
319
557
  static get DownUpConverter() {
320
558
  if (!this._DownUpConverter) {
321
559
  this._DownUpConverter = class implements UpdatableValueConverter {
322
-
323
560
  fA2F: Interpolator3pt;
324
561
  fF2A: Interpolator;
325
562
  fActive: boolean = true;
326
563
 
327
- constructor(amin: number, amid: number, amax: number, fmin: number, fmid: number, fmax: number) {
328
- this.fA2F = new FaustSensors.Interpolator3pt(amin, amid, amax, fmax, fmin, fmax);
329
- this.fF2A = new FaustSensors.Interpolator(fmin, fmax, amin, amax);
564
+ constructor(
565
+ amin: number,
566
+ amid: number,
567
+ amax: number,
568
+ fmin: number,
569
+ fmid: number,
570
+ fmax: number
571
+ ) {
572
+ this.fA2F = new FaustSensors.Interpolator3pt(
573
+ amin,
574
+ amid,
575
+ amax,
576
+ fmax,
577
+ fmin,
578
+ fmax
579
+ );
580
+ this.fF2A = new FaustSensors.Interpolator(
581
+ fmin,
582
+ fmax,
583
+ amin,
584
+ amax
585
+ );
330
586
  }
331
587
 
332
- uiToFaust(x: number) { return this.fA2F.returnMappedValue(x) }
333
- faustToUi(x: number) { return this.fF2A.returnMappedValue(x) }
588
+ uiToFaust(x: number) {
589
+ return this.fA2F.returnMappedValue(x);
590
+ }
591
+ faustToUi(x: number) {
592
+ return this.fF2A.returnMappedValue(x);
593
+ }
334
594
 
335
- setMappingValues(amin: number, amid: number, amax: number, min: number, init: number, max: number): void {
336
- this.fA2F = new FaustSensors.Interpolator3pt(amin, amid, amax, max, min, max);
337
- this.fF2A = new FaustSensors.Interpolator(min, max, amin, amax);
595
+ setMappingValues(
596
+ amin: number,
597
+ amid: number,
598
+ amax: number,
599
+ min: number,
600
+ init: number,
601
+ max: number
602
+ ): void {
603
+ this.fA2F = new FaustSensors.Interpolator3pt(
604
+ amin,
605
+ amid,
606
+ amax,
607
+ max,
608
+ min,
609
+ max
610
+ );
611
+ this.fF2A = new FaustSensors.Interpolator(
612
+ min,
613
+ max,
614
+ amin,
615
+ amax
616
+ );
338
617
  }
339
- getMappingValues(amin: number, amid: number, amax: number): InterpolateObject3pt {
618
+ getMappingValues(
619
+ amin: number,
620
+ amid: number,
621
+ amax: number
622
+ ): InterpolateObject3pt {
340
623
  return this.fA2F.getMappingValues(amin, amid, amax);
341
624
  }
342
625
 
343
- setActive(onOff: boolean): void { this.fActive = onOff }
344
- getActive(): boolean { return this.fActive }
345
- }
626
+ setActive(onOff: boolean): void {
627
+ this.fActive = onOff;
628
+ }
629
+ getActive(): boolean {
630
+ return this.fActive;
631
+ }
632
+ };
346
633
  }
347
634
  return this._DownUpConverter;
348
635
  }
@@ -351,18 +638,61 @@ export default class FaustSensors {
351
638
  *
352
639
  * @returns `UpdatableValueConverter` built for the given curve
353
640
  */
354
- static buildHandler(curve: Curve, amin: number, amid: number, amax: number, min: number, init: number, max: number): UpdatableValueConverter {
641
+ static buildHandler(
642
+ curve: Curve,
643
+ amin: number,
644
+ amid: number,
645
+ amax: number,
646
+ min: number,
647
+ init: number,
648
+ max: number
649
+ ): UpdatableValueConverter {
355
650
  switch (curve) {
356
651
  case Curve.Up:
357
- return new FaustSensors.UpConverter(amin, amid, amax, min, init, max);
652
+ return new FaustSensors.UpConverter(
653
+ amin,
654
+ amid,
655
+ amax,
656
+ min,
657
+ init,
658
+ max
659
+ );
358
660
  case Curve.Down:
359
- return new FaustSensors.DownConverter(amin, amid, amax, min, init, max);
661
+ return new FaustSensors.DownConverter(
662
+ amin,
663
+ amid,
664
+ amax,
665
+ min,
666
+ init,
667
+ max
668
+ );
360
669
  case Curve.UpDown:
361
- return new FaustSensors.UpDownConverter(amin, amid, amax, min, init, max);
670
+ return new FaustSensors.UpDownConverter(
671
+ amin,
672
+ amid,
673
+ amax,
674
+ min,
675
+ init,
676
+ max
677
+ );
362
678
  case Curve.DownUp:
363
- return new FaustSensors.DownUpConverter(amin, amid, amax, min, init, max);
679
+ return new FaustSensors.DownUpConverter(
680
+ amin,
681
+ amid,
682
+ amax,
683
+ min,
684
+ init,
685
+ max
686
+ );
364
687
  default:
365
- return new FaustSensors.UpConverter(amin, amid, amax, min, init, max);
688
+ return new FaustSensors.UpConverter(
689
+ amin,
690
+ amid,
691
+ amax,
692
+ min,
693
+ init,
694
+ max
695
+ );
366
696
  }
367
697
  }
368
698
  }