Open nspitko opened 1 year ago
Minor update to this PR: I fixed postEvent to return its ID so you can disambiguate multiple events using the same callback, and fixed an alignment issue in the struct layout.
Ok this has some issues still. It turns out that accessing a non-static member in the callback will cause hl to implode. I'm not quite sure how to solve this yet.
I tried letting haxe create the worker threads but this was a disaster (and I'm not even sure those threads are responsible for firing the callbacks)
The solution may be to just copy the data off to a shared struct and fire them off in the main thread during render, but this will add some latency to them, which is less than ideal. I'm not sure which version is more useful right now.
Ok this should be good. I misunderstood the earlier crash; it has nothing to do with threading and everything to do with vclosures getting GC'd. These changes alloc a struct for us to hl_add_root
to, and ensure we clean up buy always registering for AK_EndOfEvent. I've tested to confirm wwise will always fire this event, even when it's stopped via another event.
It's still a bit more convoluted than I'd like, but I don't think there's an easier way to handle all of the edge cases
This registers and unregisters the wwise thread every time we get a callback. There's PROBABLY a better way to do this, but for now we'll do the dumb thing and not worry about it.
example syntax: