Cabbage Logo
Back to Cabbage Site

A Cabbage Macro

Hi Rory, I’ve been switching back and forth using both Cabbage and Csound to test my files. I was just wondering if Cabbage defines a macro for itself? I know I could easily create one, but if it is already there…

I’d like to use it to prevent my Cabbage-only modules from being included when I run from the command line using Csound. I’d also like to have it included some dummy definitions for the Cabbage things that I can’t really remove.

Anyway, like I said, I can do this for myself if it’s not already there.



You can define Cabbage macros, but do you mean something like:

#ifdef Cabbage

This is not possible, it would need to be added to the Csound source code. You can however pass the macro as a command line flag?

-odac --omacro:CABBAGE=1
;sr is set by the host
ksmps       =   32
nchnls      =   2
0dbfs       =   1

#ifndef CABBAGE

instr   1

    prints "Hello\n"



This would work right? You could also query the channel CSD_PATH. This will be empty is you are not running the csd file in Cabbage.

Actually, I think I figured it out… While you gave me the right idea, it is the name of the macro that should be different. I need to know when I am running Csound, so if I create a macro of ‘CSND’ and wrap the Cabbage code with #ifndef/#end, that should work for what I need.

Thanks, I will get back with you on how it works.

Thanks for your help, Rory. This is working out as I need it…

1 Like