Fix UIAudioPlayer again... and AudioSource.time

This commit is contained in:
Ralty
2025-07-27 19:28:50 +07:00
parent 8524395c74
commit 235d23a2f2
2 changed files with 4 additions and 3 deletions
+3 -3
View File
@@ -29,9 +29,9 @@ class UIAudioPlayer extends UIButton {
public function new(x:Float, y:Float, bytes:Bytes) {
sound = FlxG.sound.load(Sound.fromAudioBuffer(AudioBuffer.fromBytes(bytes)));
super(x, y, null, function () {
super(x, y, null, () -> {
if (sound.playing) sound.pause();
else sound.play(false, sound.time);
else sound.play();
}, 58 - 16, 58 - 16);
playingSprite = new FlxSprite(x + ((58 - 16)/2) - 8, y + ((58 - 16)/2) - 8).loadGraphic(Paths.image('editors/ui/audio-buttons'), true, 16, 16);
@@ -126,7 +126,7 @@ class UIAudioPlayer extends UIButton {
if (FlxG.mouse.released) {
if (draggingObj == timeBar && wasPlaying) {
sound.resume();
sound.play();
wasPlaying = false;
}
draggingObj = null;
@@ -394,6 +394,7 @@ class NativeAudioSource {
AL.sourcePlay(handle);
}
}
else completed = value + 1 < getLength();
if (!playing && streamed) bufferTimes[STREAM_MAX_BUFFERS - (requestBuffers = queuedBuffers = 1)] = value / 1000;