diff --git a/source/flixel/sound/FlxSound.hx b/source/flixel/sound/FlxSound.hx index 6e83609e..146cdf1a 100644 --- a/source/flixel/sound/FlxSound.hx +++ b/source/flixel/sound/FlxSound.hx @@ -880,7 +880,7 @@ class FlxSound extends FlxBasic { cleanup(false, true); startSound(time); } - else if (playing) { + else { _source.offset = 0; _source.currentTime = time + _offset; } diff --git a/source/funkin/editors/ui/UIAudioPlayer.hx b/source/funkin/editors/ui/UIAudioPlayer.hx index 4b87dd4d..da1707b7 100644 --- a/source/funkin/editors/ui/UIAudioPlayer.hx +++ b/source/funkin/editors/ui/UIAudioPlayer.hx @@ -107,20 +107,17 @@ class UIAudioPlayer extends UIButton { var spritePos:FlxPoint = sprite.getScreenPosition(FlxPoint.get(), __lastDrawCameras[0]); - if (((mousePos.x > (spritePos.x)) && (mousePos.x < (spritePos.x) + timeBar.barWidth)) - && ((mousePos.y > (spritePos.y)) && (mousePos.y < (spritePos.y) + timeBar.barHeight))) { - if (FlxG.mouse.justPressed) { - draggingObj = sprite; - wasPlaying = draggingObj == timeBar ? sound.playing : false; - } + if (((mousePos.x > spritePos.x) && (mousePos.x < spritePos.x + sprite.barWidth)) + && ((mousePos.y > spritePos.y) && (mousePos.y < spritePos.y + sprite.barHeight))) { + if (FlxG.mouse.justPressed) { + if ((draggingObj = sprite) == timeBar && (wasPlaying = sound.playing)) sound.pause(); + } if (FlxG.mouse.pressed) { - if (draggingObj == timeBar) { - if (sound.playing) sound.pause(); + if (draggingObj == timeBar) sound.time = FlxMath.remapToRange(mousePos.x - spritePos.x, 0, timeBar.barWidth, 0, sound.length); - } else if (draggingObj == volumeBar) { + else if (draggingObj == volumeBar) sound.volume = FlxMath.remapToRange(mousePos.x - spritePos.x, 0, volumeBar.barWidth, 0, 1); - } } } spritePos.put(); @@ -128,8 +125,10 @@ class UIAudioPlayer extends UIButton { mousePos.put(); if (FlxG.mouse.released) { - if (draggingObj == timeBar && wasPlaying) - sound.play(wasPlaying = false, sound.time); + if (draggingObj == timeBar && wasPlaying) { + sound.resume(); + wasPlaying = false; + } draggingObj = null; } }