From 5fd0b5d964fbeb7e29c6bb2fa422d4ce9715ff57 Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Thu, 8 Feb 2024 03:56:12 -0500 Subject: [PATCH] less mess --- .../backend/native/NativeAudioSource.hx | 24 ++++++------------- 1 file changed, 7 insertions(+), 17 deletions(-) diff --git a/src/lime/_internal/backend/native/NativeAudioSource.hx b/src/lime/_internal/backend/native/NativeAudioSource.hx index 404df1114..44ee45b12 100644 --- a/src/lime/_internal/backend/native/NativeAudioSource.hx +++ b/src/lime/_internal/backend/native/NativeAudioSource.hx @@ -386,23 +386,13 @@ class NativeAudioSource // var time = (sampleTime / parent.buffer.sampleRate * 1000) - parent.offset; // var time = Std.int(totalSeconds * ratio * 1000) - parent.offset; // var time = Std.int (AL.getSourcef (handle, AL.SEC_OFFSET) * 1000) - parent.offset; - try - { - var value = AL.getSourcedvSOFT(handle, AL.SEC_OFFSET_LATENCY_SOFT, 2); - var deviceOffset:Float = value[1]; - var realOffset:Float = value[0]; - trace("deviceOffset: " + deviceOffset); - trace("realOffset: " + realOffset); - var time:Float = ((realOffset - deviceOffset) * 1000) - parent.offset; - - if (time < 0) return 0; - return Math.round(time); - } - catch (e:Dynamic) - { - trace(e.messsage); - trace(e.stack); - } + var value = AL.getSourcedvSOFT(handle, AL.SEC_OFFSET_LATENCY_SOFT, 2); + var deviceOffset:Float = value[1]; + var realOffset:Float = value[0]; + var time:Float = ((realOffset - deviceOffset) * 1000) - parent.offset; + + if (time < 0) return 0; + return Std.int(time); } }