Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions src/lime/_internal/backend/native/NativeAudioSource.hx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ class NativeAudioSource
#end
private static var STREAM_TIMER_FREQUENCY = 100;

#if lime_openalsoft
private static var hasDirectChannelsExt:Null<Bool>;
#end

private var buffers:Array<ALBuffer>;
private var bufferTimeBlocks:Array<Float>;
private var completed:Bool;
Expand Down Expand Up @@ -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));
}

Expand Down
7 changes: 7 additions & 0 deletions src/lime/media/openal/AL.hx
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down