Skip to content

Commit

Permalink
hashlink finally...
Browse files Browse the repository at this point in the history
  • Loading branch information
ninjamuffin99 committed Feb 9, 2024
1 parent e1b17f9 commit 2cec1a0
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 9 deletions.
16 changes: 14 additions & 2 deletions project/src/media/openal/OpenALBindings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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
}


Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 2 additions & 0 deletions src/lime/_internal/backend/native/NativeAudioSource.hx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
17 changes: 11 additions & 6 deletions src/lime/_internal/backend/native/NativeCFFI.hx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
Expand Down Expand Up @@ -1545,7 +1545,7 @@ class NativeCFFI

@:cffi private static function lime_al_get_sourcefv(source:CFFIPointer, param:Int, count:Int):Array<Float>;

@:cffi private static function lime_al_get_sourcedv_SOFT(source:CFFIPointer, param:Int, count:Int):Array<Float>;
@:cffi private static function lime_al_get_sourcedv_soft(source:CFFIPointer, param:Int, count:Int):Array<Float>;

@:cffi private static function lime_al_get_sourcei(source:CFFIPointer, param:Int):Dynamic;

Expand Down Expand Up @@ -1737,7 +1737,7 @@ class NativeCFFI
private static var lime_al_get_sourcef = new cpp.Callable<cpp.Object->Int->cpp.Float32>(cpp.Prime._loadPrime("lime", "lime_al_get_sourcef", "oif", false));
private static var lime_al_get_sourcefv = new cpp.Callable<cpp.Object->Int->Int->cpp.Object>(cpp.Prime._loadPrime("lime", "lime_al_get_sourcefv", "oiio",
false));
private static var lime_al_get_sourcedv_SOFT = new cpp.Callable<cpp.Object->Int->Int->cpp.Object>(cpp.Prime._loadPrime("lime", "lime_al_get_sourcedv_SOFT",
private static var lime_al_get_sourcedv_soft = new cpp.Callable<cpp.Object->Int->Int->cpp.Object>(cpp.Prime._loadPrime("lime", "lime_al_get_sourcedv_soft",
"oiio", false));
private static var lime_al_get_sourcei = new cpp.Callable<cpp.Object->Int->cpp.Object>(cpp.Prime._loadPrime("lime", "lime_al_get_sourcei", "oio", false));
private static var lime_al_get_sourceiv = new cpp.Callable<cpp.Object->Int->Int->cpp.Object>(cpp.Prime._loadPrime("lime", "lime_al_get_sourceiv", "oiio",
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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<hl.F64>
{
return null;
}

@:hlNative("lime", "hl_al_get_sourcei") private static function lime_al_get_sourcei(source:CFFIPointer, param:Int):Dynamic
{
return null;
Expand Down
2 changes: 1 addition & 1 deletion src/lime/media/openal/AL.hx
Original file line number Diff line number Diff line change
Expand Up @@ -977,7 +977,7 @@ class AL
public static function getSourcedvSOFT(source:ALSource, param:Int, count:Int = 2):Array<Float>
{
#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<Float> = [];
Expand Down

0 comments on commit 2cec1a0

Please sign in to comment.