Cabbage Logo
Back to Cabbage Site

Opcodes not getting linked correctly at runtime (CsoundUnity, macOS)

Not too many details, but basically the sound should be influenced by your gps position, the app is intended to be used in an open space, with AR elements around which will guide the user with their sound. The interesting fact is that the app can be also used without watching the screen at all!
I hope that this project starts, and to be assigned to it! :crossed_fingers:
But first of all, there’s a lot of work to do on CsoundUnity :sweat_smile:

Sounds interesting. And it will be great to have you working on CsoundUnity again!

1 Like

Thanks Rory :wink:
Yes I hope to be back to it soon! There are still lots of things to do!

So I just ran into something and fixed it, thought I’d share the fix if anyone else runs into it:
So I’m using libfluidOpcodes.dll in my csd, but in a build it wasn’t finding that dll, my workaround was to make a folder in Application.persistentDataPath called CsoundLibs, put the dll in it, and then in the CsoundUnityBridge constructor, add a preprocessor to switch the opcode lib depending on if youre in editor or player:

public CsoundUnityBridge(string csoundDir, string csdFile)
Debug.Log(“CsoundUnityBridge constructor from dir: " + csoundDir + " csdFile: " + csdFile);
Csound6.NativeMethods.csoundSetGlobalEnv(“OPCODE6DIR64”, csoundDir);
Csound6.NativeMethods.csoundSetGlobalEnv(“OPCODE6DIR64”, $”{Application.persistentDataPath}/CsoundLibs");

and the library gets linked as expected, there may be a more elegant workaround but for now this works, thought I’d share!