I wanted to make some small change to “Anykey” which I wrote some time ago, but then went down a deep-deep rabbit hole. First I discovered that the dreaded combobox did not populate. But that I fixed after reading the forum post by going to version 2.9 (and 6.18 of csound).
But then it did not load the “keys” files anymore. First, I thought there were some path issues. (I still don’t know which path ftload uses: The path of the csd? And what if run from a DAW as vst3?) But after trying a lot of possibilities (relative, absolute, “\”, “/”…) I ended up running the attached minimal test. But even that gets the message “unable to open file”.
But when I ran the same file in csound from terminal (Windows Powershell) it produces correctly: “Length of table: 287”.
What is the reason? Does cabbage change the path where ftload looks from the path where the csd resides?
Cabbage used to set the current directory to that of the .csd file. But I had to change it because hosts don’t like this. It was bad practice from the the start and shouldn’t have ever been that way. But unfortunately I didn’t know enough about this stuff when I started writing this software more than 20 years ago. The fix is simple, just grab the csd path, and use that to build an absolute path:
Thanks for this (as always) quick and helpful answer. I implemented it and it works, standalone and in the DAW.
Also thanks for showing me the elegant way to use sprintf with the functional form of chnget. I already feared I need a dozen extra variables and strcats.
What I also noticed is that my test file was not testing the real case. I did not know that the Cabbage section is essential. I thought running the ordinary csound file from Cabbage would be sufficient.
I will post the updated version of Anykey on gitlab after giving it some tests.