So I’ve run into a problem, and it makes me think the way widget code is being included creates problems in certain instances, and it’s probably completely due to my own bad suggestion early on.
Here’s the problem:
It appears that the imported widget’s csound code is imported after the rest of the cabbage file’s csound code. This means UDOs from the widget can’t be called by any custom UDOs in the cabbage file.
Here’s the why:
Probably because I wanted to be able to have macros, UDOs, and all other included stuff available to the imported widgets. I remember us discussing it early on. I think I chose poorly
Here’s the workaround:
I’ve been moving imported widget group’s UDOs back into regular include files rather than in the .xml, and having the xml code section include the files there. Wrapping the include files in an “#ifndef ALREADY_INCLUDED” style block to avoid duplicated includes means no issues arise if the group includes a file and then the instrument does the same. This separates the widgets from the actual code again, which is not ideal… but allows both widget groups and cabbage file UDOs to call as needed.
Here’s the proposed change/solution:
Imported widget code goes first, before the cabbage file’s code… simple as that. If the widget group’s code needs access to any “libraries” etc, it can include them itself.
What are your thoughts, Rory? Is there a better workaround, or does this seem like a reasonable change in the overall design? And feel free to blame me for this one… I’m pretty sure it’s all my fault