Skip to content

Commit

Permalink
more hashlink stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
ACrazyTown committed Sep 22, 2024
1 parent 1f84de9 commit a969a10
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 13 deletions.
15 changes: 6 additions & 9 deletions project/src/media/openal/OpenALBindings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3569,30 +3569,27 @@ namespace lime {
void ALC_APIENTRY hl_alsoft_callback_function(ALCenum eventType, ALCenum deviceType,
ALCdevice* device, ALCsizei length, const ALCchar* message, void* userParam) ALC_API_NOEXCEPT17 {

//gc_set_top_of_stack((int*)99, true);
vdynamic* ret;
hl_register_thread (&ret);

if (alSoftEventCallback) {

//value devicePtr = HL_CFFIPointer (device);
//value userParamPtr = HL_CFFIPointer (userParam);

al_gc_mutex.Lock ();
// alSoftEventCallback->Call ((void*)(int)eventType, (void*)(int)deviceType, (void*)device, (void*)(vbyte*)message, userParam);

vdynamic* _eventType = hl_alloc_dynamic(&hlt_i32);
vdynamic* _eventType = hl_alloc_dynamic (&hlt_i32);
_eventType->v.i = (int)eventType;
vdynamic* _deviceType = hl_alloc_dynamic(&hlt_i32);
vdynamic* _deviceType = hl_alloc_dynamic (&hlt_i32);
_deviceType->v.i = (int)deviceType;
alSoftEventCallback->Call (_eventType, _deviceType, 0, 0, 0);
vdynamic* _message = hl_alloc_dynamic (&hlt_bytes);
_message->v.bytes = (vbyte*)message;

alSoftEventCallback->Call (_eventType, _deviceType, (void*)device, _message, (void*)userParam);

al_gc_mutex.Unlock ();

}

hl_unregister_thread ();
//gc_set_top_of_stack((int*)0, true);

}
#endif
Expand Down
5 changes: 1 addition & 4 deletions src/lime/media/AudioManager.hx
Original file line number Diff line number Diff line change
Expand Up @@ -166,14 +166,11 @@ class AudioManager
}

@:noCompletion static var __audioDeviceChanged:Bool = false;
@:noCompletion static function __deviceEventCallback(eventType:Int, deviceType:Int, device:Dynamic, #if hl message:hl.Bytes #else message:String #end, userParam:Dynamic):Void
@:noCompletion static function __deviceEventCallback(eventType:Int, deviceType:Int, device:Dynamic,#if hl message:hl.Bytes #else message:String #end, userParam:Dynamic):Void
{
#if hl
var message = CFFI.stringValue(message);
#end
trace("Callback received");
//trace("Msg: " + message);
trace(eventType);

if (eventType == ALC.EVENT_TYPE_DEFAULT_DEVICE_CHANGED_SOFT && deviceType == ALC.PLAYBACK_DEVICE_SOFT)
{
Expand Down

0 comments on commit a969a10

Please sign in to comment.