Closed vfrz closed 3 years ago
That sounds good to me. Do you plan to add that to this PR or do you want me to go ahead and merge it?
I can't get the callback working on my linux right now, seems it's an OS issue because even the getNumDrivers() remain the same while I plug/unplug different audio devices to my PC. From what I've read from the FMOD forums, they are checking difference using getNumDrivers() in the system.update() method to fire the callback so it's pretty much the same as what you've done in your C# implementation. (But that means ultraviolet is doing the job twice which isn't optimal).
I will give it a try on a Windows machine and maybe contact the FMOD support to know a bit more about that. I think you can keep the PR open for now, I'll let you know if I have any news.
I've implemented the FMOD_System_SetCallback
interop method, that part is working fine.
I still get the problem about linux not detecting device changes but it doesn't break anything.
The PR is almost ready, I'll do some more tests on Windows tomorrow before merging.
I've removed all the sealed
keywords in the two implementation classes since they are already sealed.
Out of subject question: is there any reason you are using the "capital named" primitive types? (Like String
vs string
or Boolean
vs bool
)
I've fixed the last bug I had about the GC collecting the callback.
PR is ready!
Out of subject question: is there any reason you are using the "capital named" primitive types? (Like
String
vsstring
orBoolean
vsbool
)
I have Visual Studio configured to show reference types and value types in different colors, which helps me see potential issues with garbage collection. This doesn't work if you use the type keywords, because all keywords have the same color.
This PR looks good to me with the exception noted above; if you can fix that, I'll merge it.
Next step would be to use FMOD callbacks to update device list (currently it is updating devices every update).
https://fmod.com/resources/documentation-api?version=2.0&page=core-api-system.html#system_setcallback There is a specific callback for device list changes named
FMOD_SYSTEM_CALLBACK_DEVICELISTCHANGED
Are you ok with this?