Skip to content

Commit

Permalink
Bind alcIsExtensionPresent
Browse files Browse the repository at this point in the history
  • Loading branch information
ACrazyTown committed Aug 16, 2024
1 parent 8f631fe commit fddf985
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 0 deletions.
24 changes: 24 additions & 0 deletions project/src/media/openal/OpenALBindings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2301,6 +2301,17 @@ namespace lime {
}


bool lime_alc_is_extension_present (HxString extname) {

#ifdef LIME_OPENALSOFT
return alcIsExtensionPresent (extname.__s);
#else
return false;
#endif

}


HL_PRIM bool HL_NAME(hl_al_is_extension_present) (hl_vstring* extname) {

#ifdef LIME_OPENALSOFT
Expand All @@ -2312,6 +2323,17 @@ namespace lime {
}


HL_PRIM bool HL_NAME(hl_alc_is_extension_present) (hl_vstring* extname) {

#ifdef LIME_OPENALSOFT
return alcIsExtensionPresent (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 +3602,7 @@ namespace lime {
DEFINE_PRIME1 (lime_al_is_effect);
DEFINE_PRIME1 (lime_al_is_enabled);
DEFINE_PRIME1 (lime_al_is_extension_present);
DEFINE_PRIME1 (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 +3727,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, _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(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<String->Bool>(cpp.Prime._loadPrime("lime", "lime_alc_is_extension_present", "sb",
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", 1);
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(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
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(extname:String):Bool
{
#if (lime_cffi && lime_openal && !macro)
return NativeCFFI.lime_alc_is_extension_present(extname);
#else
return false;
#end
}
}
#end

0 comments on commit fddf985

Please sign in to comment.