spessasynth_core 3.26.26 → 3.26.28
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/package.json +1 -1
- package/src/midi/xmf_loader.js +1 -1
- package/src/soundfont/basic_soundfont/basic_instrument.js +5 -1
- package/src/soundfont/basic_soundfont/basic_sample.js +9 -0
- package/src/soundfont/basic_soundfont/basic_soundbank.js +17 -15
- package/src/soundfont/dls/dls_sample.js +3 -4
- package/src/utils/indexed_array.js +1 -1
package/package.json
CHANGED
package/src/midi/xmf_loader.js
CHANGED
|
@@ -69,8 +69,12 @@ export class BasicInstrument
|
|
|
69
69
|
this.linkedPresets.splice(index, 1);
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
-
|
|
72
|
+
deleteInstrument()
|
|
73
73
|
{
|
|
74
|
+
if (this.useCount > 0)
|
|
75
|
+
{
|
|
76
|
+
throw new Error(`Cannot delete an instrument that has ${this.useCount} usages.`);
|
|
77
|
+
}
|
|
74
78
|
this.instrumentZones.forEach(z => z.deleteZone());
|
|
75
79
|
this.instrumentZones.length = 0;
|
|
76
80
|
}
|
|
@@ -246,6 +246,15 @@ export class BasicSample
|
|
|
246
246
|
|
|
247
247
|
}
|
|
248
248
|
|
|
249
|
+
deleteSample()
|
|
250
|
+
{
|
|
251
|
+
if (this.useCount > 0)
|
|
252
|
+
{
|
|
253
|
+
throw new Error(`Cannot delete sample that has ${this.useCount} usages.`);
|
|
254
|
+
}
|
|
255
|
+
this.unlinkSample();
|
|
256
|
+
}
|
|
257
|
+
|
|
249
258
|
// noinspection JSUnusedGlobalSymbols
|
|
250
259
|
/**
|
|
251
260
|
* Unlinks a sample link
|
|
@@ -149,7 +149,6 @@ class BasicSoundBank
|
|
|
149
149
|
20,
|
|
150
150
|
0,
|
|
151
151
|
0,
|
|
152
|
-
0,
|
|
153
152
|
127
|
|
154
153
|
);
|
|
155
154
|
sample.sampleData = new Float32Array(128);
|
|
@@ -443,15 +442,24 @@ class BasicSoundBank
|
|
|
443
442
|
|
|
444
443
|
removeUnusedElements()
|
|
445
444
|
{
|
|
446
|
-
this.instruments.
|
|
445
|
+
this.instruments = this.instruments.filter(i =>
|
|
446
|
+
{
|
|
447
|
+
const deletable = i.useCount < 1;
|
|
448
|
+
if (deletable)
|
|
449
|
+
{
|
|
450
|
+
i.deleteInstrument();
|
|
451
|
+
}
|
|
452
|
+
return deletable;
|
|
453
|
+
});
|
|
454
|
+
this.samples = this.samples.filter(s =>
|
|
447
455
|
{
|
|
448
|
-
|
|
456
|
+
const deletable = s.useCount < 1;
|
|
457
|
+
if (deletable)
|
|
449
458
|
{
|
|
450
|
-
|
|
459
|
+
s.deleteSample();
|
|
451
460
|
}
|
|
461
|
+
return deletable;
|
|
452
462
|
});
|
|
453
|
-
this.instruments = this.instruments.filter(i => i.useCount > 0);
|
|
454
|
-
this.samples = this.samples.filter(s => s.useCount > 0);
|
|
455
463
|
}
|
|
456
464
|
|
|
457
465
|
/**
|
|
@@ -459,12 +467,8 @@ class BasicSoundBank
|
|
|
459
467
|
*/
|
|
460
468
|
deleteInstrument(instrument)
|
|
461
469
|
{
|
|
462
|
-
|
|
463
|
-
{
|
|
464
|
-
throw new Error(`Cannot delete an instrument that has ${instrument.useCount} usages.`);
|
|
465
|
-
}
|
|
470
|
+
instrument.deleteInstrument();
|
|
466
471
|
this.instruments.splice(this.instruments.indexOf(instrument), 1);
|
|
467
|
-
instrument.deleteAllZones();
|
|
468
472
|
}
|
|
469
473
|
|
|
470
474
|
/**
|
|
@@ -481,10 +485,7 @@ class BasicSoundBank
|
|
|
481
485
|
*/
|
|
482
486
|
deleteSample(sample)
|
|
483
487
|
{
|
|
484
|
-
|
|
485
|
-
{
|
|
486
|
-
throw new Error(`Cannot delete sample that has ${sample.useCount} usages.`);
|
|
487
|
-
}
|
|
488
|
+
sample.deleteSample();
|
|
488
489
|
this.samples.splice(this.samples.indexOf(sample), 1);
|
|
489
490
|
}
|
|
490
491
|
|
|
@@ -616,6 +617,7 @@ class BasicSoundBank
|
|
|
616
617
|
delete this.presets;
|
|
617
618
|
delete this.instruments;
|
|
618
619
|
delete this.samples;
|
|
620
|
+
delete this.soundFontInfo;
|
|
619
621
|
}
|
|
620
622
|
}
|
|
621
623
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BasicSample } from "../basic_soundfont/basic_sample.js";
|
|
1
|
+
import { BasicSample, sampleTypes } from "../basic_soundfont/basic_sample.js";
|
|
2
2
|
|
|
3
3
|
export class DLSSample extends BasicSample
|
|
4
4
|
{
|
|
@@ -38,12 +38,11 @@ export class DLSSample extends BasicSample
|
|
|
38
38
|
rate,
|
|
39
39
|
pitch,
|
|
40
40
|
pitchCorrection,
|
|
41
|
-
|
|
42
|
-
1,
|
|
41
|
+
sampleTypes.monoSample,
|
|
43
42
|
loopStart,
|
|
44
43
|
loopEnd
|
|
45
44
|
);
|
|
46
|
-
this.
|
|
45
|
+
this.setAudioData(data);
|
|
47
46
|
this.sampleDbAttenuation = sampleDbAttenuation;
|
|
48
47
|
}
|
|
49
48
|
|