diff --git a/project/src/media/openal/OpenALBindings.cpp b/project/src/media/openal/OpenALBindings.cpp index 8f88feaeb..93390cf3e 100644 --- a/project/src/media/openal/OpenALBindings.cpp +++ b/project/src/media/openal/OpenALBindings.cpp @@ -2098,8 +2098,9 @@ namespace lime { } - value lime_al_get_sourcedv_SOFT (value source, int param, int count) + value lime_al_get_sourcedv_soft (value source, int param, int count) { + #ifdef LIME_OPENALSOFT ALuint id = (ALuint)(uintptr_t)val_data (source); ALdouble* values = new ALdouble[count]; alGetSourcedvSOFT(id, param, values); @@ -2113,7 +2114,17 @@ namespace lime { delete[] values; return result; + #endif + } + HL_PRIM varray* HL_NAME(hl_al_get_sourcedv_soft) (HL_CFFIPointer* source, int param, int count) + { + #ifdef LIME_OPENALSOFT + ALuint id = (ALuint)(uintptr_t)source->ptr; + varray* result = hl_alloc_array(&hlt_f64, count); + alGetSourcedvSOFT(id, param, hl_aptr (result, double)); + return result; + #endif } @@ -3590,8 +3601,8 @@ namespace lime { DEFINE_PRIME2 (lime_al_get_source3f); DEFINE_PRIME2 (lime_al_get_source3i); DEFINE_PRIME2 (lime_al_get_sourcef); - DEFINE_PRIME3 (lime_al_get_sourcedv_SOFT); DEFINE_PRIME3 (lime_al_get_sourcefv); + DEFINE_PRIME3 (lime_al_get_sourcedv_soft); DEFINE_PRIME2 (lime_al_get_sourcei); DEFINE_PRIME3 (lime_al_get_sourceiv); DEFINE_PRIME1 (lime_al_get_string); @@ -3716,6 +3727,7 @@ namespace lime { DEFINE_HL_PRIM (_ARR, hl_al_get_source3i, _TCFFIPOINTER _I32); DEFINE_HL_PRIM (_F32, hl_al_get_sourcef, _TCFFIPOINTER _I32); DEFINE_HL_PRIM (_ARR, hl_al_get_sourcefv, _TCFFIPOINTER _I32 _I32); + DEFINE_HL_PRIM (_ARR, hl_al_get_sourcedv_soft, _TCFFIPOINTER _I32 _I32); DEFINE_HL_PRIM (_DYN, hl_al_get_sourcei, _TCFFIPOINTER _I32); DEFINE_HL_PRIM (_ARR, hl_al_get_sourceiv, _TCFFIPOINTER _I32 _I32); DEFINE_HL_PRIM (_BYTES, hl_al_get_string, _I32); diff --git a/src/lime/_internal/backend/native/NativeAudioSource.hx b/src/lime/_internal/backend/native/NativeAudioSource.hx index 8eb7a58f3..404df1114 100644 --- a/src/lime/_internal/backend/native/NativeAudioSource.hx +++ b/src/lime/_internal/backend/native/NativeAudioSource.hx @@ -391,6 +391,8 @@ class NativeAudioSource var value = AL.getSourcedvSOFT(handle, AL.SEC_OFFSET_LATENCY_SOFT, 2); var deviceOffset:Float = value[1]; var realOffset:Float = value[0]; + trace("deviceOffset: " + deviceOffset); + trace("realOffset: " + realOffset); var time:Float = ((realOffset - deviceOffset) * 1000) - parent.offset; if (time < 0) return 0; diff --git a/src/lime/_internal/backend/native/NativeCFFI.hx b/src/lime/_internal/backend/native/NativeCFFI.hx index 7fd530676..50db64155 100644 --- a/src/lime/_internal/backend/native/NativeCFFI.hx +++ b/src/lime/_internal/backend/native/NativeCFFI.hx @@ -2,14 +2,14 @@ package lime._internal.backend.native; import haxe.Int64; import haxe.io.Bytes; +import lime.graphics.Image; +import lime.graphics.ImageBuffer; import lime.graphics.opengl.GLBuffer; import lime.graphics.opengl.GLFramebuffer; import lime.graphics.opengl.GLProgram; import lime.graphics.opengl.GLRenderbuffer; import lime.graphics.opengl.GLShader; import lime.graphics.opengl.GLTexture; -import lime.graphics.Image; -import lime.graphics.ImageBuffer; import lime.math.Rectangle; import lime.media.openal.ALAuxiliaryEffectSlot; import lime.utils.DataPointer; @@ -19,9 +19,9 @@ import lime.graphics.cairo.CairoGlyph; import lime.graphics.opengl.GL; import lime.math.Matrix3; import lime.math.Vector2; +import lime.media.AudioBuffer; import lime.media.openal.ALContext; import lime.media.openal.ALDevice; -import lime.media.AudioBuffer; import lime.system.DisplayMode; import lime.utils.ArrayBufferView; #end @@ -1545,7 +1545,7 @@ class NativeCFFI @:cffi private static function lime_al_get_sourcefv(source:CFFIPointer, param:Int, count:Int):Array; - @:cffi private static function lime_al_get_sourcedv_SOFT(source:CFFIPointer, param:Int, count:Int):Array; + @:cffi private static function lime_al_get_sourcedv_soft(source:CFFIPointer, param:Int, count:Int):Array; @:cffi private static function lime_al_get_sourcei(source:CFFIPointer, param:Int):Dynamic; @@ -1737,7 +1737,7 @@ class NativeCFFI private static var lime_al_get_sourcef = new cpp.CallableInt->cpp.Float32>(cpp.Prime._loadPrime("lime", "lime_al_get_sourcef", "oif", false)); private static var lime_al_get_sourcefv = new cpp.CallableInt->Int->cpp.Object>(cpp.Prime._loadPrime("lime", "lime_al_get_sourcefv", "oiio", false)); - private static var lime_al_get_sourcedv_SOFT = new cpp.CallableInt->Int->cpp.Object>(cpp.Prime._loadPrime("lime", "lime_al_get_sourcedv_SOFT", + private static var lime_al_get_sourcedv_soft = new cpp.CallableInt->Int->cpp.Object>(cpp.Prime._loadPrime("lime", "lime_al_get_sourcedv_soft", "oiio", false)); private static var lime_al_get_sourcei = new cpp.CallableInt->cpp.Object>(cpp.Prime._loadPrime("lime", "lime_al_get_sourcei", "oio", false)); private static var lime_al_get_sourceiv = new cpp.CallableInt->Int->cpp.Object>(cpp.Prime._loadPrime("lime", "lime_al_get_sourceiv", "oiio", @@ -1880,7 +1880,7 @@ class NativeCFFI private static var lime_al_get_source3i = CFFI.load("lime", "lime_al_get_source3i", 2); private static var lime_al_get_sourcef = CFFI.load("lime", "lime_al_get_sourcef", 2); private static var lime_al_get_sourcefv = CFFI.load("lime", "lime_al_get_sourcefv", 3); - private static var lime_al_get_sourcedv_SOFT = CFFI.load("lime", "lime_al_get_sourcedv_SOFT", 3); + private static var lime_al_get_sourcedv_soft = CFFI.load("lime", "lime_al_get_sourcedv_soft", 3); private static var lime_al_get_sourcei = CFFI.load("lime", "lime_al_get_sourcei", 2); private static var lime_al_get_sourceiv = CFFI.load("lime", "lime_al_get_sourceiv", 3); private static var lime_al_get_string = CFFI.load("lime", "lime_al_get_string", 1); @@ -2138,6 +2138,11 @@ class NativeCFFI return null; } + @:hlNative("lime", "hl_al_get_sourcedv_soft") private static function lime_al_get_sourcedv_soft(source:CFFIPointer, param:Int, count:Int):hl.NativeArray + { + return null; + } + @:hlNative("lime", "hl_al_get_sourcei") private static function lime_al_get_sourcei(source:CFFIPointer, param:Int):Dynamic { return null; diff --git a/src/lime/media/openal/AL.hx b/src/lime/media/openal/AL.hx index 9f7db835d..ce6ff3c1c 100644 --- a/src/lime/media/openal/AL.hx +++ b/src/lime/media/openal/AL.hx @@ -977,7 +977,7 @@ class AL public static function getSourcedvSOFT(source:ALSource, param:Int, count:Int = 2):Array { #if (lime_cffi && lime_openal && !macro) - var result = NativeCFFI.lime_al_get_sourcedv_SOFT(source, param, count); + var result = NativeCFFI.lime_al_get_sourcedv_soft(source, param, count); #if hl if (result == null) return []; var _result:Array = [];