Fix issues with audio playback

This commit is contained in:
JannisX11 2021-01-24 22:35:22 +01:00
parent 3fd1ae7b8e
commit dd64a9755b
2 changed files with 8 additions and 6 deletions

View File

@ -1007,8 +1007,8 @@ class EffectAnimator extends GeneralAnimator {
keyframe.animator = this; keyframe.animator = this;
return this; return this;
} }
displayFrame() { displayFrame(in_loop) {
if (!this.muted.sound) { if (in_loop && !this.muted.sound) {
this.sound.forEach(kf => { this.sound.forEach(kf => {
var diff = kf.time - Timeline.time; var diff = kf.time - Timeline.time;
if (diff >= 0 && diff < (1/60) * (Timeline.playback_speed/100)) { if (diff >= 0 && diff < (1/60) * (Timeline.playback_speed/100)) {
@ -1355,7 +1355,7 @@ const Animator = {
object.scale.set(scale, scale, scale) object.scale.set(scale, scale, scale)
}) })
}, },
preview() { preview(in_loop) {
// Bones // Bones
Animator.showDefaultPose(true); Animator.showDefaultPose(true);
Group.all.forEach(group => { Group.all.forEach(group => {
@ -1373,7 +1373,7 @@ const Animator = {
Animator.animations.forEach(animation => { Animator.animations.forEach(animation => {
if (animation.playing) { if (animation.playing) {
if (animation.animators.effects) { if (animation.animators.effects) {
animation.animators.effects.displayFrame(); animation.animators.effects.displayFrame(in_loop);
} }
} }
}) })

View File

@ -449,7 +449,9 @@ const Timeline = {
start() { start() {
if (!Animation.selected) return; if (!Animation.selected) return;
Animation.selected.getMaxLength() Animation.selected.getMaxLength()
Timeline.pause() if (Timeline.playing) {
Timeline.pause()
}
Timeline.playing = true Timeline.playing = true
BarItems.play_animation.setIcon('pause') BarItems.play_animation.setIcon('pause')
Timeline.last_frame_timecode = Date.now(); Timeline.last_frame_timecode = Date.now();
@ -467,7 +469,7 @@ const Timeline = {
Timeline.loop() Timeline.loop()
}, },
loop() { loop() {
Animator.preview() Animator.preview(true);
if (Animation.selected && Timeline.time < (Animation.selected.length||1e3)) { if (Animation.selected && Timeline.time < (Animation.selected.length||1e3)) {
var new_time; var new_time;