spessasynth_core 4.0.3 → 4.0.5
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.js +26 -15
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -3340,8 +3340,8 @@ var BasicMIDI2 = class _BasicMIDI {
|
|
|
3340
3340
|
switch (e.statusByte) {
|
|
3341
3341
|
case midiMessageTypes.endOfTrack:
|
|
3342
3342
|
if (i !== track.events.length - 1) {
|
|
3343
|
-
i--;
|
|
3344
3343
|
track.deleteEvent(i);
|
|
3344
|
+
i--;
|
|
3345
3345
|
SpessaSynthWarn("Unexpected EndOfTrack. Removing!");
|
|
3346
3346
|
}
|
|
3347
3347
|
break;
|
|
@@ -7064,7 +7064,6 @@ var BasicZone = class {
|
|
|
7064
7064
|
const genValue = this.getGenerator(type, generatorLimits[type].def);
|
|
7065
7065
|
this.setGenerator(type, value + genValue, validate);
|
|
7066
7066
|
}
|
|
7067
|
-
// noinspection JSUnusedGlobalSymbols
|
|
7068
7067
|
/**
|
|
7069
7068
|
* Sets a generator to a given value if preset, otherwise adds a new one.
|
|
7070
7069
|
*/
|
|
@@ -7242,12 +7241,14 @@ var BasicPresetZone = class extends BasicZone {
|
|
|
7242
7241
|
"Instrument ID cannot be determined without the sound bank itself."
|
|
7243
7242
|
);
|
|
7244
7243
|
}
|
|
7244
|
+
const instrumentID = bank.instruments.indexOf(this.instrument);
|
|
7245
|
+
if (instrumentID < 0) {
|
|
7246
|
+
throw new Error(
|
|
7247
|
+
`${this.instrument.name} does not exist in ${bank.soundBankInfo.name}! Cannot write instrument generator.`
|
|
7248
|
+
);
|
|
7249
|
+
}
|
|
7245
7250
|
gens.push(
|
|
7246
|
-
new Generator(
|
|
7247
|
-
generatorTypes.instrument,
|
|
7248
|
-
bank.instruments.indexOf(this.instrument),
|
|
7249
|
-
false
|
|
7250
|
-
)
|
|
7251
|
+
new Generator(generatorTypes.instrument, instrumentID, false)
|
|
7251
7252
|
);
|
|
7252
7253
|
return gens;
|
|
7253
7254
|
}
|
|
@@ -7302,13 +7303,13 @@ var BasicInstrumentZone = class extends BasicZone {
|
|
|
7302
7303
|
}
|
|
7303
7304
|
getWriteGenerators(bank) {
|
|
7304
7305
|
const gens = super.getWriteGenerators(bank);
|
|
7305
|
-
|
|
7306
|
-
|
|
7307
|
-
|
|
7308
|
-
bank.
|
|
7309
|
-
|
|
7310
|
-
|
|
7311
|
-
);
|
|
7306
|
+
const sampleID = bank.samples.indexOf(this.sample);
|
|
7307
|
+
if (sampleID < 0) {
|
|
7308
|
+
throw new Error(
|
|
7309
|
+
`${this.sample.name} does not exist in ${bank.soundBankInfo.name}! Cannot write sampleID generator.`
|
|
7310
|
+
);
|
|
7311
|
+
}
|
|
7312
|
+
gens.push(new Generator(generatorTypes.sampleID, sampleID, false));
|
|
7312
7313
|
return gens;
|
|
7313
7314
|
}
|
|
7314
7315
|
};
|
|
@@ -12684,7 +12685,7 @@ var SoundFontSample = class extends BasicSample {
|
|
|
12684
12685
|
} else {
|
|
12685
12686
|
if (linked.linkedSample) {
|
|
12686
12687
|
SpessaSynthInfo(
|
|
12687
|
-
`%cInvalid linked sample for ${this.name}:
|
|
12688
|
+
`%cInvalid linked sample for ${this.name}: ${linked.name} is already linked to ${linked.linkedSample.name}`,
|
|
12688
12689
|
consoleColors.warn
|
|
12689
12690
|
);
|
|
12690
12691
|
this.unlinkSample();
|
|
@@ -16053,6 +16054,11 @@ var SoundFontPresetZone = class extends BasicPresetZone {
|
|
|
16053
16054
|
} else {
|
|
16054
16055
|
throw new Error("No instrument ID found in preset zone.");
|
|
16055
16056
|
}
|
|
16057
|
+
if (!instrument) {
|
|
16058
|
+
throw new Error(
|
|
16059
|
+
`Invalid instrument ID: ${instrumentID.generatorValue}, available instruments: ${instruments.length}`
|
|
16060
|
+
);
|
|
16061
|
+
}
|
|
16056
16062
|
super(preset, instrument);
|
|
16057
16063
|
this.addGenerators(...generators);
|
|
16058
16064
|
this.addModulators(...modulators);
|
|
@@ -16146,6 +16152,11 @@ var SoundFontInstrumentZone = class extends BasicInstrumentZone {
|
|
|
16146
16152
|
} else {
|
|
16147
16153
|
throw new Error("No sample ID found in instrument zone.");
|
|
16148
16154
|
}
|
|
16155
|
+
if (!sample) {
|
|
16156
|
+
throw new Error(
|
|
16157
|
+
`Invalid sample ID: ${sampleID.generatorValue}, available samples: ${samples.length}`
|
|
16158
|
+
);
|
|
16159
|
+
}
|
|
16149
16160
|
super(inst, sample);
|
|
16150
16161
|
this.addGenerators(...generators);
|
|
16151
16162
|
this.addModulators(...modulators);
|