Skip to content

Commit de67731

Browse files
committed
Fix some issues with Hashlink and CFFI
1 parent 7fac0d4 commit de67731

File tree

4 files changed

+14
-9
lines changed

4 files changed

+14
-9
lines changed

project/src/ExternalInterface.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4143,7 +4143,7 @@ namespace lime {
41434143
#define _TTOUCH_EVENT _OBJ (_I32 _F64 _F64 _I32 _F64 _I32 _F64 _F64)
41444144
#define _TVECTOR2 _OBJ (_F64 _F64)
41454145
#define _TVORBISFILE _OBJ (_I32 _DYN)
4146-
#define _TSDL_SOUNDSAMPLE _OBJ (_DYN)
4146+
#define _TSDL_SOUNDSAMPLE _OBJ (_I32 _DYN)
41474147
#define _TWINDOW_EVENT _OBJ (_I32 _I32 _I32 _I32 _I32 _I32)
41484148

41494149
#define _TARRAYBUFFER _TBYTES

src/lime/_internal/backend/native/NativeAudioSource.hx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package lime._internal.backend.native;
33
import lime.media.openal.ext.EXT_float32;
44
import haxe.Int64;
55
import haxe.Timer;
6+
import haxe.io.Bytes;
67
import lime.math.Vector4;
78
import lime.media.openal.AL;
89
import lime.media.openal.ALBuffer;
@@ -282,7 +283,7 @@ class NativeAudioSource
282283
#if lime_sdlsound
283284
if (length == null)
284285
{
285-
var buffer = new UInt8Array(0);
286+
var buffer = new UInt8Array(Bytes.alloc(0));
286287
var read = soundSample.decodeAll(buffer.buffer);
287288

288289
return buffer;

src/lime/_internal/backend/native/NativeCFFI.hx

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6991,8 +6991,8 @@ class NativeCFFI
69916991
private static var lime_sdl_sound_info:Dynamic->Dynamic = CFFI.load("lime", "lime_sdl_sound_info", 1);
69926992
private static var lime_sdl_sound_duration:Dynamic->Int = CFFI.load("lime", "lime_sdl_sound_duration", 1);
69936993
private static var lime_sdl_sound_get_buffer_size:Dynamic->Int = CFFI.load("lime", "lime_sdl_sound_get_buffer_size", 1);
6994-
private static var lime_sdl_sound_set_buffer_size:Dynamic->Int->Bool = CFFI.load("lime", "lime_sdl_sound_get_buffer_size", 2);
6995-
private static var lime_sdl_sound_decode:Dynamic->Dynamic->Void = CFFI.load("lime", "lime_sdl_sound_decode", 2);
6994+
private static var lime_sdl_sound_set_buffer_size:Dynamic->Int->Bool = CFFI.load("lime", "lime_sdl_sound_set_buffer_size", 2);
6995+
private static var lime_sdl_sound_decode:Dynamic->Dynamic->Int = CFFI.load("lime", "lime_sdl_sound_decode", 2);
69966996
private static var lime_sdl_sound_decode_all:Dynamic->Dynamic->Int = CFFI.load("lime", "lime_sdl_sound_decode_all", 2);
69976997
private static var lime_sdl_sound_seekable:Dynamic->Bool = CFFI.load("lime", "lime_sdl_sound_seekable", 1);
69986998
private static var lime_sdl_sound_seek:Dynamic->Int->Void = CFFI.load("lime", "lime_sdl_sound_seek", 2);
@@ -7002,14 +7002,14 @@ class NativeCFFI
70027002

70037003
#if hl
70047004

7005-
@:hlNative("lime", "hl_sdl_sound_from_bytes") private static function lime_sdl_sound_from_bytes(bytes:Dynamic):CFFIPointer
7005+
@:hlNative("lime", "hl_sdl_sound_from_file") private static function lime_sdl_sound_from_file(path:String):CFFIPointer
70067006
{
70077007
return null;
70087008
}
70097009

7010-
@:hlNative("lime", "hl_sdl_sound_from_file") private static function lime_sdl_sound_from_file(path:String):CFFIPointer
7010+
@:hlNative("lime", "hl_sdl_sound_from_bytes") private static function lime_sdl_sound_from_bytes(bytes:Bytes):CFFIPointer
70117011
{
7012-
return null;
7012+
return 0;
70137013
}
70147014

70157015
@:hlNative("lime", "hl_sdl_sound_free") private static function lime_sdl_sound_free(sample:CFFIPointer):Void {}
@@ -7034,7 +7034,10 @@ class NativeCFFI
70347034
return false;
70357035
}
70367036

7037-
@:hlNative("lime", "hl_sdl_sound_decode") private static function lime_sdl_sound_decode(sample:CFFIPointer, buffer:Bytes):Void {}
7037+
@:hlNative("lime", "hl_sdl_sound_decode") private static function lime_sdl_sound_decode(sample:CFFIPointer, buffer:Bytes):Int
7038+
{
7039+
return 0;
7040+
}
70387041

70397042
@:hlNative("lime", "hl_sdl_sound_decode_all") private static function lime_sdl_sound_decode_all(sample:CFFIPointer, buffer:Bytes):Int
70407043
{

src/lime/media/sdlsound/SDLSoundSample.hx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,10 @@ import haxe.io.Bytes;
1111
@:nullSafety
1212
class SDLSoundSample
1313
{
14-
@:noCompletion private var handle:Dynamic;
1514
public var bytesDecoded(default, null):Int;
1615

16+
@:noCompletion private var handle:Dynamic;
17+
1718
public var bufferSize(get, set):Int;
1819

1920
function get_bufferSize():Int

0 commit comments

Comments
 (0)