spessasynth_core 3.26.29 → 3.26.30

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "spessasynth_core",
3
- "version": "3.26.29",
3
+ "version": "3.26.30",
4
4
  "description": "MIDI and SoundFont2/DLS library with no compromises",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -4,7 +4,7 @@ import { readLittleEndian, signedInt8 } from "../../utils/byte_functions/little_
4
4
  import { stbvorbis } from "../../externals/stbvorbis_sync/stbvorbis_sync.min.js";
5
5
  import { SpessaSynthWarn } from "../../utils/loggin.js";
6
6
  import { readBytesAsString } from "../../utils/byte_functions/string.js";
7
- import { BasicSample } from "../basic_soundfont/basic_sample.js";
7
+ import { BasicSample, sampleTypes } from "../basic_soundfont/basic_sample.js";
8
8
 
9
9
  export const SF3_BIT_FLIT = 0x10;
10
10
 
@@ -136,7 +136,16 @@ export class SoundFontSample extends BasicSample
136
136
  {
137
137
  return;
138
138
  }
139
- this.setLinkedSample(samplesArray[this.linkedSampleIndex], this.sampleType);
139
+ const linkedSample = samplesArray[this.linkedSampleIndex];
140
+ if (!linkedSample)
141
+ {
142
+ SpessaSynthWarn(`Invalid linked sample for ${this.sampleName}. Setting to mono.`);
143
+ this.setSampleType(sampleTypes.monoSample);
144
+ }
145
+ else
146
+ {
147
+ this.setLinkedSample(samplesArray[this.linkedSampleIndex], this.sampleType);
148
+ }
140
149
  }
141
150
 
142
151
  /**