pixi-live2d-display-advanced 0.5.1 → 0.5.3
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/cubism2.es.js +38 -47
- package/dist/cubism2.js +38 -47
- package/dist/cubism2.min.js +1 -1
- package/dist/cubism4.es.js +38 -47
- package/dist/cubism4.js +38 -47
- package/dist/cubism4.min.js +1 -1
- package/dist/index.es.js +38 -47
- package/dist/index.js +38 -47
- package/dist/index.min.js +1 -1
- package/package.json +1 -1
- package/types/index.d.ts +3 -3
package/dist/cubism2.es.js
CHANGED
|
@@ -78,7 +78,7 @@ const config = {
|
|
|
78
78
|
preserveExpressionOnMotion: true,
|
|
79
79
|
cubism4: CubismConfig
|
|
80
80
|
};
|
|
81
|
-
const VERSION = "v0.5.
|
|
81
|
+
const VERSION = "v0.5.3";
|
|
82
82
|
const logger = {
|
|
83
83
|
log(tag, ...messages) {
|
|
84
84
|
if (config.logLevel <= config.LOG_LEVEL_VERBOSE) {
|
|
@@ -3710,11 +3710,10 @@ class SoundManager {
|
|
|
3710
3710
|
/**
|
|
3711
3711
|
* Creates an audio element and adds it to the {@link audios}.
|
|
3712
3712
|
* @param file - URL of the sound file.
|
|
3713
|
-
* @param onFinish - Callback invoked when the playback has finished.
|
|
3714
3713
|
* @param onError - Callback invoked when error occurs.
|
|
3715
3714
|
* @return Created audio element.
|
|
3716
3715
|
*/
|
|
3717
|
-
static add(file,
|
|
3716
|
+
static add(file, onError) {
|
|
3718
3717
|
return __async(this, null, function* () {
|
|
3719
3718
|
try {
|
|
3720
3719
|
const task = new Promise((resolve, reject) => {
|
|
@@ -3722,15 +3721,10 @@ class SoundManager {
|
|
|
3722
3721
|
url: file,
|
|
3723
3722
|
volume: this._volume,
|
|
3724
3723
|
preload: true,
|
|
3725
|
-
complete: () => {
|
|
3726
|
-
this.dispose(audio);
|
|
3727
|
-
onFinish == null ? void 0 : onFinish();
|
|
3728
|
-
},
|
|
3729
3724
|
loaded: () => {
|
|
3730
3725
|
if (!(audio.media instanceof webaudio.WebAudioMedia)) {
|
|
3731
3726
|
reject(new Error(`Error: ${file} is not WebAudioMedia`));
|
|
3732
3727
|
}
|
|
3733
|
-
debugger;
|
|
3734
3728
|
resolve(audio);
|
|
3735
3729
|
}
|
|
3736
3730
|
});
|
|
@@ -3746,9 +3740,15 @@ class SoundManager {
|
|
|
3746
3740
|
/**
|
|
3747
3741
|
* Plays the sound.
|
|
3748
3742
|
* @param audio - An audio element.
|
|
3743
|
+
* @param onFinish - Callback invoked when the playback has finished.
|
|
3749
3744
|
*/
|
|
3750
|
-
static play(audio) {
|
|
3751
|
-
audio.play(
|
|
3745
|
+
static play(audio, onFinish) {
|
|
3746
|
+
audio.play({
|
|
3747
|
+
complete: () => {
|
|
3748
|
+
onFinish == null ? void 0 : onFinish();
|
|
3749
|
+
audio.destroy();
|
|
3750
|
+
}
|
|
3751
|
+
});
|
|
3752
3752
|
}
|
|
3753
3753
|
static addAnalyzer(audio, context) {
|
|
3754
3754
|
const media = audio.media;
|
|
@@ -4017,25 +4017,14 @@ class MotionManager extends utils$1.EventEmitter {
|
|
|
4017
4017
|
const file = sound;
|
|
4018
4018
|
if (file) {
|
|
4019
4019
|
try {
|
|
4020
|
-
audio = yield SoundManager.add(
|
|
4021
|
-
|
|
4022
|
-
|
|
4023
|
-
|
|
4024
|
-
|
|
4025
|
-
if (resetExpression && expression && that.expressionManager) {
|
|
4026
|
-
that.expressionManager.resetExpression();
|
|
4027
|
-
}
|
|
4028
|
-
that.currentAudio = void 0;
|
|
4029
|
-
},
|
|
4030
|
-
(e, that = this) => {
|
|
4031
|
-
logger.error(this.tag, "Error during audio playback:", e);
|
|
4032
|
-
onError == null ? void 0 : onError(e);
|
|
4033
|
-
if (resetExpression && expression && that.expressionManager) {
|
|
4034
|
-
that.expressionManager.resetExpression();
|
|
4035
|
-
}
|
|
4036
|
-
that.currentAudio = void 0;
|
|
4020
|
+
audio = yield SoundManager.add(file, (e, that = this) => {
|
|
4021
|
+
logger.error(this.tag, "Error during audio playback:", e);
|
|
4022
|
+
onError == null ? void 0 : onError(e);
|
|
4023
|
+
if (resetExpression && expression && that.expressionManager) {
|
|
4024
|
+
that.expressionManager.resetExpression();
|
|
4037
4025
|
}
|
|
4038
|
-
|
|
4026
|
+
that.currentAudio = void 0;
|
|
4027
|
+
});
|
|
4039
4028
|
this.initializeAudio(audio, volume);
|
|
4040
4029
|
} catch (e) {
|
|
4041
4030
|
logger.warn(this.tag, "Failed to create audio", soundURL, e);
|
|
@@ -4046,7 +4035,13 @@ class MotionManager extends utils$1.EventEmitter {
|
|
|
4046
4035
|
let playSuccess = true;
|
|
4047
4036
|
try {
|
|
4048
4037
|
if (config.motionSync) {
|
|
4049
|
-
SoundManager.play(audio)
|
|
4038
|
+
SoundManager.play(audio, () => {
|
|
4039
|
+
onFinish == null ? void 0 : onFinish();
|
|
4040
|
+
if (resetExpression && expression && this.expressionManager) {
|
|
4041
|
+
this.expressionManager.resetExpression();
|
|
4042
|
+
}
|
|
4043
|
+
this.currentAudio = void 0;
|
|
4044
|
+
});
|
|
4050
4045
|
}
|
|
4051
4046
|
} catch (e) {
|
|
4052
4047
|
logger.warn(this.tag, "Failed to play audio", audio.url, e);
|
|
@@ -4124,24 +4119,14 @@ class MotionManager extends utils$1.EventEmitter {
|
|
|
4124
4119
|
const file = soundURL;
|
|
4125
4120
|
if (file) {
|
|
4126
4121
|
try {
|
|
4127
|
-
audio = yield SoundManager.add(
|
|
4128
|
-
|
|
4129
|
-
|
|
4130
|
-
|
|
4131
|
-
|
|
4132
|
-
that.expressionManager.resetExpression();
|
|
4133
|
-
}
|
|
4134
|
-
that.currentAudio = void 0;
|
|
4135
|
-
},
|
|
4136
|
-
(e, that = this) => {
|
|
4137
|
-
logger.error(this.tag, "Error during audio playback:", e);
|
|
4138
|
-
onError == null ? void 0 : onError(e);
|
|
4139
|
-
if (resetExpression && expression && that.expressionManager) {
|
|
4140
|
-
that.expressionManager.resetExpression();
|
|
4141
|
-
}
|
|
4142
|
-
that.currentAudio = void 0;
|
|
4122
|
+
audio = yield SoundManager.add(file, (e, that = this) => {
|
|
4123
|
+
logger.error(this.tag, "Error during audio playback:", e);
|
|
4124
|
+
onError == null ? void 0 : onError(e);
|
|
4125
|
+
if (resetExpression && expression && that.expressionManager) {
|
|
4126
|
+
that.expressionManager.resetExpression();
|
|
4143
4127
|
}
|
|
4144
|
-
|
|
4128
|
+
that.currentAudio = void 0;
|
|
4129
|
+
});
|
|
4145
4130
|
this.initializeAudio(audio, volume);
|
|
4146
4131
|
} catch (e) {
|
|
4147
4132
|
logger.warn(this.tag, "Failed to create audio", soundURL, e);
|
|
@@ -4151,7 +4136,13 @@ class MotionManager extends utils$1.EventEmitter {
|
|
|
4151
4136
|
if (audio) {
|
|
4152
4137
|
if (config.motionSync) {
|
|
4153
4138
|
try {
|
|
4154
|
-
SoundManager.play(audio)
|
|
4139
|
+
SoundManager.play(audio, (that = this) => {
|
|
4140
|
+
onFinish == null ? void 0 : onFinish();
|
|
4141
|
+
if (resetExpression && expression && that.expressionManager) {
|
|
4142
|
+
that.expressionManager.resetExpression();
|
|
4143
|
+
}
|
|
4144
|
+
that.currentAudio = void 0;
|
|
4145
|
+
});
|
|
4155
4146
|
} catch (e) {
|
|
4156
4147
|
logger.warn(this.tag, "Failed to play audio", audio.url, e);
|
|
4157
4148
|
}
|
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.
|
|
82
|
+
const VERSION = "v0.5.3";
|
|
83
83
|
const logger = {
|
|
84
84
|
log(tag, ...messages) {
|
|
85
85
|
if (config.logLevel <= config.LOG_LEVEL_VERBOSE) {
|
|
@@ -3711,11 +3711,10 @@ var __async = (__this, __arguments, generator) => {
|
|
|
3711
3711
|
/**
|
|
3712
3712
|
* Creates an audio element and adds it to the {@link audios}.
|
|
3713
3713
|
* @param file - URL of the sound file.
|
|
3714
|
-
* @param onFinish - Callback invoked when the playback has finished.
|
|
3715
3714
|
* @param onError - Callback invoked when error occurs.
|
|
3716
3715
|
* @return Created audio element.
|
|
3717
3716
|
*/
|
|
3718
|
-
static add(file,
|
|
3717
|
+
static add(file, onError) {
|
|
3719
3718
|
return __async(this, null, function* () {
|
|
3720
3719
|
try {
|
|
3721
3720
|
const task = new Promise((resolve, reject) => {
|
|
@@ -3723,15 +3722,10 @@ var __async = (__this, __arguments, generator) => {
|
|
|
3723
3722
|
url: file,
|
|
3724
3723
|
volume: this._volume,
|
|
3725
3724
|
preload: true,
|
|
3726
|
-
complete: () => {
|
|
3727
|
-
this.dispose(audio);
|
|
3728
|
-
onFinish == null ? void 0 : onFinish();
|
|
3729
|
-
},
|
|
3730
3725
|
loaded: () => {
|
|
3731
3726
|
if (!(audio.media instanceof sound.webaudio.WebAudioMedia)) {
|
|
3732
3727
|
reject(new Error(`Error: ${file} is not WebAudioMedia`));
|
|
3733
3728
|
}
|
|
3734
|
-
debugger;
|
|
3735
3729
|
resolve(audio);
|
|
3736
3730
|
}
|
|
3737
3731
|
});
|
|
@@ -3747,9 +3741,15 @@ var __async = (__this, __arguments, generator) => {
|
|
|
3747
3741
|
/**
|
|
3748
3742
|
* Plays the sound.
|
|
3749
3743
|
* @param audio - An audio element.
|
|
3744
|
+
* @param onFinish - Callback invoked when the playback has finished.
|
|
3750
3745
|
*/
|
|
3751
|
-
static play(audio) {
|
|
3752
|
-
audio.play(
|
|
3746
|
+
static play(audio, onFinish) {
|
|
3747
|
+
audio.play({
|
|
3748
|
+
complete: () => {
|
|
3749
|
+
onFinish == null ? void 0 : onFinish();
|
|
3750
|
+
audio.destroy();
|
|
3751
|
+
}
|
|
3752
|
+
});
|
|
3753
3753
|
}
|
|
3754
3754
|
static addAnalyzer(audio, context) {
|
|
3755
3755
|
const media = audio.media;
|
|
@@ -4018,25 +4018,14 @@ var __async = (__this, __arguments, generator) => {
|
|
|
4018
4018
|
const file = sound2;
|
|
4019
4019
|
if (file) {
|
|
4020
4020
|
try {
|
|
4021
|
-
audio = yield SoundManager.add(
|
|
4022
|
-
|
|
4023
|
-
|
|
4024
|
-
|
|
4025
|
-
|
|
4026
|
-
if (resetExpression && expression && that.expressionManager) {
|
|
4027
|
-
that.expressionManager.resetExpression();
|
|
4028
|
-
}
|
|
4029
|
-
that.currentAudio = void 0;
|
|
4030
|
-
},
|
|
4031
|
-
(e, that = this) => {
|
|
4032
|
-
logger.error(this.tag, "Error during audio playback:", e);
|
|
4033
|
-
onError == null ? void 0 : onError(e);
|
|
4034
|
-
if (resetExpression && expression && that.expressionManager) {
|
|
4035
|
-
that.expressionManager.resetExpression();
|
|
4036
|
-
}
|
|
4037
|
-
that.currentAudio = void 0;
|
|
4021
|
+
audio = yield SoundManager.add(file, (e, that = this) => {
|
|
4022
|
+
logger.error(this.tag, "Error during audio playback:", e);
|
|
4023
|
+
onError == null ? void 0 : onError(e);
|
|
4024
|
+
if (resetExpression && expression && that.expressionManager) {
|
|
4025
|
+
that.expressionManager.resetExpression();
|
|
4038
4026
|
}
|
|
4039
|
-
|
|
4027
|
+
that.currentAudio = void 0;
|
|
4028
|
+
});
|
|
4040
4029
|
this.initializeAudio(audio, volume);
|
|
4041
4030
|
} catch (e) {
|
|
4042
4031
|
logger.warn(this.tag, "Failed to create audio", soundURL, e);
|
|
@@ -4047,7 +4036,13 @@ var __async = (__this, __arguments, generator) => {
|
|
|
4047
4036
|
let playSuccess = true;
|
|
4048
4037
|
try {
|
|
4049
4038
|
if (config.motionSync) {
|
|
4050
|
-
SoundManager.play(audio)
|
|
4039
|
+
SoundManager.play(audio, () => {
|
|
4040
|
+
onFinish == null ? void 0 : onFinish();
|
|
4041
|
+
if (resetExpression && expression && this.expressionManager) {
|
|
4042
|
+
this.expressionManager.resetExpression();
|
|
4043
|
+
}
|
|
4044
|
+
this.currentAudio = void 0;
|
|
4045
|
+
});
|
|
4051
4046
|
}
|
|
4052
4047
|
} catch (e) {
|
|
4053
4048
|
logger.warn(this.tag, "Failed to play audio", audio.url, e);
|
|
@@ -4125,24 +4120,14 @@ var __async = (__this, __arguments, generator) => {
|
|
|
4125
4120
|
const file = soundURL;
|
|
4126
4121
|
if (file) {
|
|
4127
4122
|
try {
|
|
4128
|
-
audio = yield SoundManager.add(
|
|
4129
|
-
|
|
4130
|
-
|
|
4131
|
-
|
|
4132
|
-
|
|
4133
|
-
that.expressionManager.resetExpression();
|
|
4134
|
-
}
|
|
4135
|
-
that.currentAudio = void 0;
|
|
4136
|
-
},
|
|
4137
|
-
(e, that = this) => {
|
|
4138
|
-
logger.error(this.tag, "Error during audio playback:", e);
|
|
4139
|
-
onError == null ? void 0 : onError(e);
|
|
4140
|
-
if (resetExpression && expression && that.expressionManager) {
|
|
4141
|
-
that.expressionManager.resetExpression();
|
|
4142
|
-
}
|
|
4143
|
-
that.currentAudio = void 0;
|
|
4123
|
+
audio = yield SoundManager.add(file, (e, that = this) => {
|
|
4124
|
+
logger.error(this.tag, "Error during audio playback:", e);
|
|
4125
|
+
onError == null ? void 0 : onError(e);
|
|
4126
|
+
if (resetExpression && expression && that.expressionManager) {
|
|
4127
|
+
that.expressionManager.resetExpression();
|
|
4144
4128
|
}
|
|
4145
|
-
|
|
4129
|
+
that.currentAudio = void 0;
|
|
4130
|
+
});
|
|
4146
4131
|
this.initializeAudio(audio, volume);
|
|
4147
4132
|
} catch (e) {
|
|
4148
4133
|
logger.warn(this.tag, "Failed to create audio", soundURL, e);
|
|
@@ -4152,7 +4137,13 @@ var __async = (__this, __arguments, generator) => {
|
|
|
4152
4137
|
if (audio) {
|
|
4153
4138
|
if (config.motionSync) {
|
|
4154
4139
|
try {
|
|
4155
|
-
SoundManager.play(audio)
|
|
4140
|
+
SoundManager.play(audio, (that = this) => {
|
|
4141
|
+
onFinish == null ? void 0 : onFinish();
|
|
4142
|
+
if (resetExpression && expression && that.expressionManager) {
|
|
4143
|
+
that.expressionManager.resetExpression();
|
|
4144
|
+
}
|
|
4145
|
+
that.currentAudio = void 0;
|
|
4146
|
+
});
|
|
4156
4147
|
} catch (e) {
|
|
4157
4148
|
logger.warn(this.tag, "Failed to play audio", audio.url, e);
|
|
4158
4149
|
}
|