pixi-live2d-display-advanced 0.5.2 → 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 -46
- package/dist/cubism2.js +38 -46
- package/dist/cubism2.min.js +1 -1
- package/dist/cubism4.es.js +38 -46
- package/dist/cubism4.js +38 -46
- package/dist/cubism4.min.js +1 -1
- package/dist/index.es.js +38 -46
- package/dist/index.js +38 -46
- 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,10 +3721,6 @@ 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`));
|
|
@@ -3745,9 +3740,15 @@ class SoundManager {
|
|
|
3745
3740
|
/**
|
|
3746
3741
|
* Plays the sound.
|
|
3747
3742
|
* @param audio - An audio element.
|
|
3743
|
+
* @param onFinish - Callback invoked when the playback has finished.
|
|
3748
3744
|
*/
|
|
3749
|
-
static play(audio) {
|
|
3750
|
-
audio.play(
|
|
3745
|
+
static play(audio, onFinish) {
|
|
3746
|
+
audio.play({
|
|
3747
|
+
complete: () => {
|
|
3748
|
+
onFinish == null ? void 0 : onFinish();
|
|
3749
|
+
audio.destroy();
|
|
3750
|
+
}
|
|
3751
|
+
});
|
|
3751
3752
|
}
|
|
3752
3753
|
static addAnalyzer(audio, context) {
|
|
3753
3754
|
const media = audio.media;
|
|
@@ -4016,25 +4017,14 @@ class MotionManager extends utils$1.EventEmitter {
|
|
|
4016
4017
|
const file = sound;
|
|
4017
4018
|
if (file) {
|
|
4018
4019
|
try {
|
|
4019
|
-
audio = yield SoundManager.add(
|
|
4020
|
-
|
|
4021
|
-
|
|
4022
|
-
|
|
4023
|
-
|
|
4024
|
-
if (resetExpression && expression && that.expressionManager) {
|
|
4025
|
-
that.expressionManager.resetExpression();
|
|
4026
|
-
}
|
|
4027
|
-
that.currentAudio = void 0;
|
|
4028
|
-
},
|
|
4029
|
-
(e, that = this) => {
|
|
4030
|
-
logger.error(this.tag, "Error during audio playback:", e);
|
|
4031
|
-
onError == null ? void 0 : onError(e);
|
|
4032
|
-
if (resetExpression && expression && that.expressionManager) {
|
|
4033
|
-
that.expressionManager.resetExpression();
|
|
4034
|
-
}
|
|
4035
|
-
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();
|
|
4036
4025
|
}
|
|
4037
|
-
|
|
4026
|
+
that.currentAudio = void 0;
|
|
4027
|
+
});
|
|
4038
4028
|
this.initializeAudio(audio, volume);
|
|
4039
4029
|
} catch (e) {
|
|
4040
4030
|
logger.warn(this.tag, "Failed to create audio", soundURL, e);
|
|
@@ -4045,7 +4035,13 @@ class MotionManager extends utils$1.EventEmitter {
|
|
|
4045
4035
|
let playSuccess = true;
|
|
4046
4036
|
try {
|
|
4047
4037
|
if (config.motionSync) {
|
|
4048
|
-
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
|
+
});
|
|
4049
4045
|
}
|
|
4050
4046
|
} catch (e) {
|
|
4051
4047
|
logger.warn(this.tag, "Failed to play audio", audio.url, e);
|
|
@@ -4123,24 +4119,14 @@ class MotionManager extends utils$1.EventEmitter {
|
|
|
4123
4119
|
const file = soundURL;
|
|
4124
4120
|
if (file) {
|
|
4125
4121
|
try {
|
|
4126
|
-
audio = yield SoundManager.add(
|
|
4127
|
-
|
|
4128
|
-
|
|
4129
|
-
|
|
4130
|
-
|
|
4131
|
-
that.expressionManager.resetExpression();
|
|
4132
|
-
}
|
|
4133
|
-
that.currentAudio = void 0;
|
|
4134
|
-
},
|
|
4135
|
-
(e, that = this) => {
|
|
4136
|
-
logger.error(this.tag, "Error during audio playback:", e);
|
|
4137
|
-
onError == null ? void 0 : onError(e);
|
|
4138
|
-
if (resetExpression && expression && that.expressionManager) {
|
|
4139
|
-
that.expressionManager.resetExpression();
|
|
4140
|
-
}
|
|
4141
|
-
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();
|
|
4142
4127
|
}
|
|
4143
|
-
|
|
4128
|
+
that.currentAudio = void 0;
|
|
4129
|
+
});
|
|
4144
4130
|
this.initializeAudio(audio, volume);
|
|
4145
4131
|
} catch (e) {
|
|
4146
4132
|
logger.warn(this.tag, "Failed to create audio", soundURL, e);
|
|
@@ -4150,7 +4136,13 @@ class MotionManager extends utils$1.EventEmitter {
|
|
|
4150
4136
|
if (audio) {
|
|
4151
4137
|
if (config.motionSync) {
|
|
4152
4138
|
try {
|
|
4153
|
-
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
|
+
});
|
|
4154
4146
|
} catch (e) {
|
|
4155
4147
|
logger.warn(this.tag, "Failed to play audio", audio.url, e);
|
|
4156
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,10 +3722,6 @@ 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`));
|
|
@@ -3746,9 +3741,15 @@ var __async = (__this, __arguments, generator) => {
|
|
|
3746
3741
|
/**
|
|
3747
3742
|
* Plays the sound.
|
|
3748
3743
|
* @param audio - An audio element.
|
|
3744
|
+
* @param onFinish - Callback invoked when the playback has finished.
|
|
3749
3745
|
*/
|
|
3750
|
-
static play(audio) {
|
|
3751
|
-
audio.play(
|
|
3746
|
+
static play(audio, onFinish) {
|
|
3747
|
+
audio.play({
|
|
3748
|
+
complete: () => {
|
|
3749
|
+
onFinish == null ? void 0 : onFinish();
|
|
3750
|
+
audio.destroy();
|
|
3751
|
+
}
|
|
3752
|
+
});
|
|
3752
3753
|
}
|
|
3753
3754
|
static addAnalyzer(audio, context) {
|
|
3754
3755
|
const media = audio.media;
|
|
@@ -4017,25 +4018,14 @@ var __async = (__this, __arguments, generator) => {
|
|
|
4017
4018
|
const file = sound2;
|
|
4018
4019
|
if (file) {
|
|
4019
4020
|
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;
|
|
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();
|
|
4037
4026
|
}
|
|
4038
|
-
|
|
4027
|
+
that.currentAudio = void 0;
|
|
4028
|
+
});
|
|
4039
4029
|
this.initializeAudio(audio, volume);
|
|
4040
4030
|
} catch (e) {
|
|
4041
4031
|
logger.warn(this.tag, "Failed to create audio", soundURL, e);
|
|
@@ -4046,7 +4036,13 @@ var __async = (__this, __arguments, generator) => {
|
|
|
4046
4036
|
let playSuccess = true;
|
|
4047
4037
|
try {
|
|
4048
4038
|
if (config.motionSync) {
|
|
4049
|
-
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
|
+
});
|
|
4050
4046
|
}
|
|
4051
4047
|
} catch (e) {
|
|
4052
4048
|
logger.warn(this.tag, "Failed to play audio", audio.url, e);
|
|
@@ -4124,24 +4120,14 @@ var __async = (__this, __arguments, generator) => {
|
|
|
4124
4120
|
const file = soundURL;
|
|
4125
4121
|
if (file) {
|
|
4126
4122
|
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;
|
|
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();
|
|
4143
4128
|
}
|
|
4144
|
-
|
|
4129
|
+
that.currentAudio = void 0;
|
|
4130
|
+
});
|
|
4145
4131
|
this.initializeAudio(audio, volume);
|
|
4146
4132
|
} catch (e) {
|
|
4147
4133
|
logger.warn(this.tag, "Failed to create audio", soundURL, e);
|
|
@@ -4151,7 +4137,13 @@ var __async = (__this, __arguments, generator) => {
|
|
|
4151
4137
|
if (audio) {
|
|
4152
4138
|
if (config.motionSync) {
|
|
4153
4139
|
try {
|
|
4154
|
-
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
|
+
});
|
|
4155
4147
|
} catch (e) {
|
|
4156
4148
|
logger.warn(this.tag, "Failed to play audio", audio.url, e);
|
|
4157
4149
|
}
|