Skip to content

Commit

Permalink
less mess
Browse files Browse the repository at this point in the history
  • Loading branch information
ninjamuffin99 committed Feb 8, 2024
1 parent 67f755b commit a1db3b3
Showing 1 changed file with 7 additions and 17 deletions.
24 changes: 7 additions & 17 deletions src/lime/_internal/backend/native/NativeAudioSource.hx
Original file line number Diff line number Diff line change
Expand Up @@ -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);

}
}
Expand Down

0 comments on commit a1db3b3

Please sign in to comment.