Skip to content

Commit e2ed000

Browse files
committed
Move hasALSoftLatencyExt, hasDirectChannelsExt to AudioManager instead
1 parent 724fc6a commit e2ed000

2 files changed

Lines changed: 7 additions & 15 deletions

File tree

src/lime/_internal/backend/native/NativeAudioSource.hx

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,6 @@ import lime.utils.UInt8Array;
1717
@:access(lime.media.AudioBuffer)
1818
class NativeAudioSource
1919
{
20-
private static var hasDirectChannelsExt:Null<Bool>;
21-
private static var hasALSoftLatencyExt:Null<Bool>;
22-
2320
private var completed:Bool;
2421
private var dataLength:Int;
2522
private var format:Int;
@@ -62,16 +59,6 @@ class NativeAudioSource
6259

6360
public function init():Void
6461
{
65-
if (hasALSoftLatencyExt == null)
66-
{
67-
hasALSoftLatencyExt = AL.isExtensionPresent("AL_SOFT_source_latency");
68-
}
69-
70-
if (hasDirectChannelsExt == null)
71-
{
72-
hasDirectChannelsExt = AL.isExtensionPresent("AL_SOFT_direct_channels") && AL.isExtensionPresent("AL_SOFT_direct_channels_remix");
73-
}
74-
7562
format = 0;
7663

7764
switch (parent.buffer.dataFormat)
@@ -110,7 +97,7 @@ class NativeAudioSource
11097

11198
AL.sourcei(handle, AL.BUFFER, parent.buffer.__srcBuffer);
11299

113-
if (hasDirectChannelsExt)
100+
if (AudioManager.__directChannelsExtSupported)
114101
{
115102
AL.sourcei(handle, AL.DIRECT_CHANNELS_SOFT, AL.REMIX_UNMATCHED_SOFT);
116103
}
@@ -345,7 +332,7 @@ class NativeAudioSource
345332

346333
public function getLatency():Float
347334
{
348-
if (hasALSoftLatencyExt)
335+
if (AudioManager.__latencyExtSupported)
349336
{
350337
var offsets = AL.getSourcedvSOFT(handle, AL.SEC_OFFSET_LATENCY_SOFT, 2);
351338

src/lime/media/AudioManager.hx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,10 @@ class AudioManager
121121
@:noCompletion private static var __pendingDefaultCaptureDevice:Bool;
122122

123123
@:noCompletion private static var __captureExtSupported:Bool;
124+
@:noCompletion private static var __directChannelsExtSupported:Bool;
124125
@:noCompletion private static var __disconnectExtSupported:Bool;
125126
@:noCompletion private static var __enumerateAllSupported:Bool;
127+
@:noCompletion private static var __latencyExtSupported:Bool;
126128
@:noCompletion private static var __resumeOnFocus:Bool;
127129
@:noCompletion private static var __reopenDeviceSupported:Bool;
128130
@:noCompletion private static var __systemEventsSupported:Bool;
@@ -507,6 +509,9 @@ class AudioManager
507509
__reopenDeviceSupported = ALC.isExtensionPresent(null, 'ALC_SOFT_reopen_device');
508510
__systemEventsSupported = ALC.isExtensionPresent(null, 'ALC_SOFT_system_events');
509511

512+
__latencyExtSupported = AL.isExtensionPresent('AL_SOFT_source_latency');
513+
__directChannelsExtSupported = AL.isExtensionPresent('AL_SOFT_direct_channels') && AL.isExtensionPresent('AL_SOFT_direct_channels_remix');
514+
510515
gain = __gain;
511516
AL.distanceModel(AL.NONE);
512517
}

0 commit comments

Comments
 (0)