Hello again. Thanks very much for your reply back in June, and really sorry that it took so long to return to this, but I am focusing on this now.
Your uncommenting out suggestion worked well for Windows/Editor. Basically, I created a StreamingAssets/CsoundFiles folder and copied the sf2 file in there. It worked first time.
I wanted to give a quick update on where I’m at with Quest/Android, which I don’t yet have working, in case there’s anything different you would suggest.
I tried the uncommenting the corresponding lines for Android, and I was confused for a while as to why it didn’t work. The assets folder in the apk file was correctly populated, but sfload() wasn’t finding it at runtime with the same error message. After some head-scratching I went to look at how it was working in Hector’s Android-only version, and I noticed two things:
- The persistent directory on the sd card (sdcard/Android/data//files) was being populated with the csound files, but only after the app had been run at least once. This was where sfload() was finding it
- There is code in CsoundUnity.Awake() that explicitly copies files from the apk onto persistent storage (in this case it was intended to be sound files rather than soundfont files) :
#elif UNITY_ANDROID
// other stuff …
foreach (var item in filesObj.fileNames)
{
if (!item.EndsWith(".json") && !item.EndsWith(".meta") && !item.EndsWith(".csd") && !item.EndsWith(".orc"))
{
csoundFileTmp = “jar:file://” + Application.dataPath + “!/assets/CsoundFiles/” + item;
webrequest = UnityWebRequest.Get(csoundFileTmp);
webrequest.SendWebRequest();
while (!webrequest.isDone) { }
getCsoundAudioFile(webrequest.downloadHandler.data, item);
}
}
#endif
I’m relatively certain this addresses the issue because if I manually copy the .sf2 file intoQuest sd storage (using SideQuest) it works.
I will first try adding some of Hector’s code into my version of CsoundUnity.cs, and if I get that working, I will publish it here, and we can discuss if it makes any sense to include, or whether I should take a look at externalizing it into a helper class (that would have to be configured in execution order to run ahead of CsoundUnity.Awake, which wouldn’t be that great).
If you have any feedback or suggestions let me know, in any case I will report back in the next couple of days (this time:)
Thanks again for this excellent new release