diff --git a/src/lime/_internal/backend/native/NativeAudioSource.hx b/src/lime/_internal/backend/native/NativeAudioSource.hx index ab85e0e002..68d97c1893 100644 --- a/src/lime/_internal/backend/native/NativeAudioSource.hx +++ b/src/lime/_internal/backend/native/NativeAudioSource.hx @@ -26,6 +26,10 @@ class NativeAudioSource #end private static var STREAM_TIMER_FREQUENCY = 100; + #if lime_openalsoft + private static var hasDirectChannelsExt:Null; + #end + private var buffers:Array; private var bufferTimeBlocks:Array; private var completed:Bool; @@ -136,6 +140,18 @@ class NativeAudioSource } } + #if lime_openalsoft + if (hasDirectChannelsExt == null) + { + hasDirectChannelsExt = AL.isExtensionPresent("AL_SOFT_direct_channels") && AL.isExtensionPresent("AL_SOFT_direct_channels_remix"); + } + + if (hasDirectChannelsExt) + { + AL.sourcei(handle, AL.DIRECT_CHANNELS_SOFT, AL.REMIX_UNMATCHED_SOFT); + } + #end + samples = Std.int((dataLength * 8.0) / (parent.buffer.channels * parent.buffer.bitsPerSample)); } diff --git a/src/lime/media/openal/AL.hx b/src/lime/media/openal/AL.hx index f1bcdb7a33..4d34f36f4c 100644 --- a/src/lime/media/openal/AL.hx +++ b/src/lime/media/openal/AL.hx @@ -233,6 +233,13 @@ class AL public static inline var FILTER_LOWPASS:Int = 0x0001; public static inline var FILTER_HIGHPASS:Int = 0x0002; public static inline var FILTER_BANDPASS:Int = 0x0003; + #if lime_openalsoft + /* AL_SOFT_direct_channels extension */ + public static inline var DIRECT_CHANNELS_SOFT:Int = 0x1033; + /* AL_SOFT_direct_channels_remix extension */ + public static inline var DROP_UNMATCHED_SOFT:Int = 0x0001; + public static inline var REMIX_UNMATCHED_SOFT:Int = 0x0002; + #end public static function removeDirectFilter(source:ALSource) {