Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement bindings for alcIsExtensionPresent #1832

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open
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
26 changes: 26 additions & 0 deletions project/src/media/openal/OpenALBindings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2312,6 +2312,30 @@ namespace lime {
}


bool lime_alc_is_extension_present (value device, HxString extname) {

#ifdef LIME_OPENALSOFT
ALCdevice* alcDevice = (ALCdevice*)val_data (device);
return alcIsExtensionPresent (alcDevice, extname.__s);
#else
return false;
#endif

}


HL_PRIM bool HL_NAME(hl_alc_is_extension_present) (HL_CFFIPointer* device, hl_vstring* extname) {

#ifdef LIME_OPENALSOFT
ALCdevice* alcDevice = (ALCdevice*)device->ptr;
return alcIsExtensionPresent (alcDevice, extname ? hl_to_utf8 (extname->bytes) : NULL);
#else
return false;
#endif

}


bool lime_al_is_filter (value filter) {

#ifdef LIME_OPENALSOFT
Expand Down Expand Up @@ -3580,6 +3604,7 @@ namespace lime {
DEFINE_PRIME1 (lime_al_is_effect);
DEFINE_PRIME1 (lime_al_is_enabled);
DEFINE_PRIME1 (lime_al_is_extension_present);
DEFINE_PRIME2 (lime_alc_is_extension_present);
DEFINE_PRIME1 (lime_al_is_filter);
DEFINE_PRIME1 (lime_al_is_source);
DEFINE_PRIME4v (lime_al_listener3f);
Expand Down Expand Up @@ -3704,6 +3729,7 @@ namespace lime {
DEFINE_HL_PRIM (_BOOL, hl_al_is_effect, _TCFFIPOINTER);
DEFINE_HL_PRIM (_BOOL, hl_al_is_enabled, _I32);
DEFINE_HL_PRIM (_BOOL, hl_al_is_extension_present, _STRING);
DEFINE_HL_PRIM (_BOOL, hl_alc_is_extension_present, _TCFFIPOINTER _STRING);
DEFINE_HL_PRIM (_BOOL, hl_al_is_filter, _TCFFIPOINTER);
DEFINE_HL_PRIM (_BOOL, hl_al_is_source, _TCFFIPOINTER);
DEFINE_HL_PRIM (_VOID, hl_al_listener3f, _I32 _F32 _F32 _F32);
Expand Down
10 changes: 10 additions & 0 deletions src/lime/_internal/backend/native/NativeCFFI.hx
Original file line number Diff line number Diff line change
Expand Up @@ -1574,6 +1574,8 @@ class NativeCFFI

@:cffi private static function lime_al_is_extension_present(extname:String):Bool;

@:cffi private static function lime_alc_is_extension_present(device:CFFIPointer, extname:String):Bool;

@:cffi private static function lime_al_is_source(source:CFFIPointer):Bool;

@:cffi private static function lime_al_listener3f(param:Int, value1:Float32, value2:Float32, value3:Float32):Void;
Expand Down Expand Up @@ -1760,6 +1762,8 @@ class NativeCFFI
private static var lime_al_is_enabled = new cpp.Callable<Int->Bool>(cpp.Prime._loadPrime("lime", "lime_al_is_enabled", "ib", false));
private static var lime_al_is_extension_present = new cpp.Callable<String->Bool>(cpp.Prime._loadPrime("lime", "lime_al_is_extension_present", "sb",
false));
private static var lime_alc_is_extension_present = new cpp.Callable<cpp.Object->String->Bool>(cpp.Prime._loadPrime("lime", "lime_alc_is_extension_present", "osb",
false));
private static var lime_al_is_source = new cpp.Callable<cpp.Object->Bool>(cpp.Prime._loadPrime("lime", "lime_al_is_source", "ob", false));
private static var lime_al_listener3f = new cpp.Callable<Int->cpp.Float32->cpp.Float32->cpp.Float32->cpp.Void>(cpp.Prime._loadPrime("lime",
"lime_al_listener3f", "ifffv", false));
Expand Down Expand Up @@ -1899,6 +1903,7 @@ class NativeCFFI
private static var lime_al_is_buffer = CFFI.load("lime", "lime_al_is_buffer", 1);
private static var lime_al_is_enabled = CFFI.load("lime", "lime_al_is_enabled", 1);
private static var lime_al_is_extension_present = CFFI.load("lime", "lime_al_is_extension_present", 1);
private static var lime_alc_is_extension_present = CFFI.load("lime", "lime_alc_is_extension_present", 2);
private static var lime_al_is_source = CFFI.load("lime", "lime_al_is_source", 1);
private static var lime_al_listener3f = CFFI.load("lime", "lime_al_listener3f", 4);
private static var lime_al_listener3i = CFFI.load("lime", "lime_al_listener3i", 4);
Expand Down Expand Up @@ -2180,6 +2185,11 @@ class NativeCFFI
return false;
}

@:hlNative("lime", "hl_alc_is_extension_present") private static function lime_alc_is_extension_present(device:CFFIPointer, extname:String):Bool
{
return false;
}

@:hlNative("lime", "hl_al_is_source") private static function lime_al_is_source(source:CFFIPointer):Bool
{
return false;
Expand Down
11 changes: 9 additions & 2 deletions src/lime/media/OpenALAudioContext.hx
Original file line number Diff line number Diff line change
Expand Up @@ -423,9 +423,16 @@ class OpenALAudioContext
return AL.isEnabled(capability);
}

public function isExtensionPresent(extname:String):Bool
public function isExtensionPresent(extname:String, device:ALDevice = null):Bool
{
return AL.isExtensionPresent(extname);
if (device == null)
{
return AL.isExtensionPresent(extname);
}
else
{
return ALC.isExtensionPresent(device, extname);
}
}

public function isSource(source:ALSource):Bool
Expand Down
9 changes: 9 additions & 0 deletions src/lime/media/openal/ALC.hx
Original file line number Diff line number Diff line change
Expand Up @@ -201,5 +201,14 @@ class ALC
NativeCFFI.lime_alc_suspend_context(context);
#end
}

public static function isExtensionPresent(device:ALDevice, extname:String):Bool
{
#if (lime_cffi && lime_openal && !macro)
return NativeCFFI.lime_alc_is_extension_present(device, extname);
#else
return false;
#end
}
}
#end
Loading