pixi-live2d-display-advanced 0.5.3 → 0.5.4

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.
@@ -23,7 +23,7 @@ var __async = (__this, __arguments, generator) => {
23
23
  });
24
24
  };
25
25
  import { utils as utils$1, Matrix, Texture, Transform, Point, ObservablePoint } from "@pixi/core";
26
- import { Sound, webaudio } from "@pixi/sound";
26
+ import { sound, Sound, webaudio } from "@pixi/sound";
27
27
  import { Container } from "@pixi/display";
28
28
  const LOGICAL_WIDTH = 2;
29
29
  const LOGICAL_HEIGHT = 2;
@@ -78,7 +78,7 @@ const config = {
78
78
  preserveExpressionOnMotion: true,
79
79
  cubism4: CubismConfig
80
80
  };
81
- const VERSION = "v0.5.3";
81
+ const VERSION = "v0.5.4";
82
82
  const logger = {
83
83
  log(tag, ...messages) {
84
84
  if (config.logLevel <= config.LOG_LEVEL_VERBOSE) {
@@ -3695,6 +3695,7 @@ class MotionState {
3695
3695
  }
3696
3696
  const TAG$2 = "SoundManager";
3697
3697
  const VOLUME = 0.5;
3698
+ sound.disableAutoPause = true;
3698
3699
  class SoundManager {
3699
3700
  /**
3700
3701
  * Global volume that applies to all the sounds.
@@ -3744,6 +3745,7 @@ class SoundManager {
3744
3745
  */
3745
3746
  static play(audio, onFinish) {
3746
3747
  audio.play({
3748
+ singleInstance: true,
3747
3749
  complete: () => {
3748
3750
  onFinish == null ? void 0 : onFinish();
3749
3751
  audio.destroy();
@@ -3761,7 +3763,6 @@ class SoundManager {
3761
3763
  analyser.smoothingTimeConstant = 0.85;
3762
3764
  source.connect(analyser);
3763
3765
  source.start(0);
3764
- analyser.connect(context.destination);
3765
3766
  this.analysers.push(analyser);
3766
3767
  return analyser;
3767
3768
  }
@@ -3988,7 +3989,7 @@ class MotionManager extends utils$1.EventEmitter {
3988
3989
  * @returns Promise that resolves with true if the sound is playing, false otherwise.
3989
3990
  */
3990
3991
  speak(_0) {
3991
- return __async(this, arguments, function* (sound, {
3992
+ return __async(this, arguments, function* (sound2, {
3992
3993
  volume = VOLUME,
3993
3994
  expression,
3994
3995
  resetExpression = true,
@@ -4005,16 +4006,16 @@ class MotionManager extends utils$1.EventEmitter {
4005
4006
  }
4006
4007
  }
4007
4008
  let soundURL;
4008
- const isBase64Content = sound && sound.startsWith("data:");
4009
- if (sound && !isBase64Content) {
4009
+ const isBase64Content = sound2 && sound2.startsWith("data:");
4010
+ if (sound2 && !isBase64Content) {
4010
4011
  const A = document.createElement("a");
4011
- A.href = sound;
4012
- sound = A.href;
4013
- soundURL = sound;
4012
+ A.href = sound2;
4013
+ sound2 = A.href;
4014
+ soundURL = sound2;
4014
4015
  } else {
4015
4016
  soundURL = "data:audio/";
4016
4017
  }
4017
- const file = sound;
4018
+ const file = sound2;
4018
4019
  if (file) {
4019
4020
  try {
4020
4021
  audio = yield SoundManager.add(file, (e, that = this) => {
@@ -4078,7 +4079,7 @@ class MotionManager extends utils$1.EventEmitter {
4078
4079
  */
4079
4080
  startMotion(_0, _1) {
4080
4081
  return __async(this, arguments, function* (group, index, priority = MotionPriority.NORMAL, {
4081
- sound = void 0,
4082
+ sound: sound2 = void 0,
4082
4083
  volume = VOLUME,
4083
4084
  expression = void 0,
4084
4085
  resetExpression = true,
@@ -4104,12 +4105,12 @@ class MotionManager extends utils$1.EventEmitter {
4104
4105
  }
4105
4106
  let audio;
4106
4107
  let soundURL;
4107
- const isBase64Content = sound && sound.startsWith("data:");
4108
- if (sound && !isBase64Content) {
4108
+ const isBase64Content = sound2 && sound2.startsWith("data:");
4109
+ if (sound2 && !isBase64Content) {
4109
4110
  const A = document.createElement("a");
4110
- A.href = sound;
4111
- sound = A.href;
4112
- soundURL = sound;
4111
+ A.href = sound2;
4112
+ sound2 = A.href;
4113
+ soundURL = sound2;
4113
4114
  } else {
4114
4115
  soundURL = this.getSoundFile(definition);
4115
4116
  if (soundURL) {
@@ -4183,7 +4184,7 @@ class MotionManager extends utils$1.EventEmitter {
4183
4184
  */
4184
4185
  startRandomMotion(_0, _1) {
4185
4186
  return __async(this, arguments, function* (group, priority, {
4186
- sound,
4187
+ sound: sound2,
4187
4188
  volume = VOLUME,
4188
4189
  expression,
4189
4190
  resetExpression = true,
@@ -4201,7 +4202,7 @@ class MotionManager extends utils$1.EventEmitter {
4201
4202
  if (availableIndices.length) {
4202
4203
  const index = availableIndices[Math.floor(Math.random() * availableIndices.length)];
4203
4204
  return this.startMotion(group, index, priority, {
4204
- sound,
4205
+ sound: sound2,
4205
4206
  volume,
4206
4207
  expression,
4207
4208
  resetExpression,
@@ -5522,7 +5523,7 @@ class Live2DModel extends Container {
5522
5523
  */
5523
5524
  motion(_0, _1, _2) {
5524
5525
  return __async(this, arguments, function* (group, index, priority, {
5525
- sound = void 0,
5526
+ sound: sound2 = void 0,
5526
5527
  volume = VOLUME,
5527
5528
  expression = void 0,
5528
5529
  resetExpression = true,
@@ -5531,7 +5532,7 @@ class Live2DModel extends Container {
5531
5532
  } = {}) {
5532
5533
  if (index === void 0) {
5533
5534
  return this.internalModel.motionManager.startRandomMotion(group, priority, {
5534
- sound,
5535
+ sound: sound2,
5535
5536
  volume,
5536
5537
  expression,
5537
5538
  resetExpression,
@@ -5540,7 +5541,7 @@ class Live2DModel extends Container {
5540
5541
  });
5541
5542
  } else {
5542
5543
  return this.internalModel.motionManager.startMotion(group, index, priority, {
5543
- sound,
5544
+ sound: sound2,
5544
5545
  volume,
5545
5546
  expression,
5546
5547
  resetExpression,
@@ -5623,14 +5624,14 @@ class Live2DModel extends Container {
5623
5624
  * @param [options.onError] - Callback function when an error occurs.
5624
5625
  * @returns Promise that resolves with true if the sound is playing, false if it's not.
5625
5626
  */
5626
- speak(sound, {
5627
+ speak(sound2, {
5627
5628
  volume = VOLUME,
5628
5629
  expression,
5629
5630
  resetExpression = true,
5630
5631
  onFinish,
5631
5632
  onError
5632
5633
  } = {}) {
5633
- return this.internalModel.motionManager.speak(sound, {
5634
+ return this.internalModel.motionManager.speak(sound2, {
5634
5635
  volume,
5635
5636
  expression,
5636
5637
  resetExpression,
package/dist/cubism2.js CHANGED
@@ -79,7 +79,7 @@ var __async = (__this, __arguments, generator) => {
79
79
  preserveExpressionOnMotion: true,
80
80
  cubism4: CubismConfig
81
81
  };
82
- const VERSION = "v0.5.3";
82
+ const VERSION = "v0.5.4";
83
83
  const logger = {
84
84
  log(tag, ...messages) {
85
85
  if (config.logLevel <= config.LOG_LEVEL_VERBOSE) {
@@ -3696,6 +3696,7 @@ var __async = (__this, __arguments, generator) => {
3696
3696
  }
3697
3697
  const TAG$2 = "SoundManager";
3698
3698
  const VOLUME = 0.5;
3699
+ sound.sound.disableAutoPause = true;
3699
3700
  class SoundManager {
3700
3701
  /**
3701
3702
  * Global volume that applies to all the sounds.
@@ -3745,6 +3746,7 @@ var __async = (__this, __arguments, generator) => {
3745
3746
  */
3746
3747
  static play(audio, onFinish) {
3747
3748
  audio.play({
3749
+ singleInstance: true,
3748
3750
  complete: () => {
3749
3751
  onFinish == null ? void 0 : onFinish();
3750
3752
  audio.destroy();
@@ -3762,7 +3764,6 @@ var __async = (__this, __arguments, generator) => {
3762
3764
  analyser.smoothingTimeConstant = 0.85;
3763
3765
  source.connect(analyser);
3764
3766
  source.start(0);
3765
- analyser.connect(context.destination);
3766
3767
  this.analysers.push(analyser);
3767
3768
  return analyser;
3768
3769
  }