littlejsengine 1.18.28 → 1.18.29

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.
@@ -35,7 +35,7 @@ const engineName = 'LittleJS';
35
35
  * @type {string}
36
36
  * @default
37
37
  * @memberof Engine */
38
- const engineVersion = '1.18.28';
38
+ const engineVersion = '1.18.29';
39
39
 
40
40
  /** Frames per second to update
41
41
  * @type {number}
@@ -6316,9 +6316,11 @@ class Sound
6316
6316
  }
6317
6317
  else if (typeof asset === 'string')
6318
6318
  {
6319
- // load the audio file
6319
+ // load the audio file, report failures rather than leaving an
6320
+ // unhandled rejection, the sound just stays unloaded and silent
6320
6321
  const filename = asset;
6321
- this.loadSound(filename);
6322
+ this.loadSound(filename).catch(e=>
6323
+ LOG('Sound load failed for', filename, '-', e.message));
6322
6324
  }
6323
6325
  }
6324
6326
 
@@ -6675,7 +6677,7 @@ function speak(text, volume=1, rate=1, pitch=1, language='')
6675
6677
  // build utterance and speak
6676
6678
  const utterance = new SpeechSynthesisUtterance(text);
6677
6679
  utterance.lang = language;
6678
- utterance.volume = 2*volume*soundVolume;
6680
+ utterance.volume = volume*soundVolume;
6679
6681
  utterance.rate = rate;
6680
6682
  utterance.pitch = pitch;
6681
6683
  speechSynthesis.speak(utterance);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "littlejsengine",
3
- "version": "1.18.28",
3
+ "version": "1.18.29",
4
4
  "description": "LittleJS - Tiny and Fast HTML5 Game Engine",
5
5
  "main": "dist/littlejs.esm.js",
6
6
  "types": "dist/littlejs.d.ts",
package/src/engine.js CHANGED
@@ -32,7 +32,7 @@ const engineName = 'LittleJS';
32
32
  * @type {string}
33
33
  * @default
34
34
  * @memberof Engine */
35
- const engineVersion = '1.18.28';
35
+ const engineVersion = '1.18.29';
36
36
 
37
37
  /** Frames per second to update
38
38
  * @type {number}
@@ -131,9 +131,11 @@ class Sound
131
131
  }
132
132
  else if (typeof asset === 'string')
133
133
  {
134
- // load the audio file
134
+ // load the audio file, report failures rather than leaving an
135
+ // unhandled rejection, the sound just stays unloaded and silent
135
136
  const filename = asset;
136
- this.loadSound(filename);
137
+ this.loadSound(filename).catch(e=>
138
+ LOG('Sound load failed for', filename, '-', e.message));
137
139
  }
138
140
  }
139
141
 
@@ -490,7 +492,7 @@ function speak(text, volume=1, rate=1, pitch=1, language='')
490
492
  // build utterance and speak
491
493
  const utterance = new SpeechSynthesisUtterance(text);
492
494
  utterance.lang = language;
493
- utterance.volume = 2*volume*soundVolume;
495
+ utterance.volume = volume*soundVolume;
494
496
  utterance.rate = rate;
495
497
  utterance.pitch = pitch;
496
498
  speechSynthesis.speak(utterance);