Cabbage Logo
Back to Cabbage Site

Idea: allow macro expansion/tokenization of CsOptions

I’m working on a multi-file project that uses includes and macros to help make multiple instruments and effects look and behave the same based on global settings.

One of the things that occurred to me was that it would be nice to be able to tokenize the CsOpts field. For a simple example, while writing and debugging code I might want:
#define CSMIDIOPTS -d -+rtmidi=NULL -M0 --midi-key-cps=4 --midi-velocity-amp=5 -m166

While as I am debugging less and nearing completiong, I might instead opt for:
#define CSMIDIOPTS -d -+rtmidi=NULL -M0 --midi-key-cps=4 --midi-velocity-amp=5 -m0

I know there’s probably very little use case for this, but I think when it is needed it could be very handy!

I’ll add it to the list, but it seems that manually changing -m0 to -m166 is far quicker than the amount of time I’d need to implement this :rofl:

To be fair, for another use case I’ve also debated changing:
--midi-key-cps=4 --midi-velocity-amp=5
to
--midi-key-cps=5 --midi-velocity-amp=4
Since that’s the order I typically use elsewhere like in Blue, and now that I’ve started messing with Blue again flipping back and forth has been getting mildly confusing :wink:

$ ls Effects/*.csd | wc -l
      32
$ ls Instruments/*.csd | wc -l
      13

I agree, and I know that is still not a ton of work for me still when changing things even with all of those… plus some of those files will more than likely get trashed in the end. But I do like being able to affect the entire project directly whenever possible.

And yes, I also agree that it’s not a high priority nor will it be commonly used, but if you see at least a little value in eventually adding it, I can add it as a request on github for better tracking. :slight_smile:

A job for a rainy day perhaps! Of which we get plenty here in Ireland :cloud_with_rain:

1 Like

Ok, I added a request at gh here: https://github.com/rorywalsh/cabbage/issues/90

If it helps describe why this would be useful to me, my macro would be set in a file that already gets imported in the form line by all .csds in the project. It’s where I also define widget color macros and other such utilities… so changing one macro here could change the CsOptions for all instruments. :slight_smile:

1 Like