if you start a comment line with “#”, then a warning/error is printed to the console as the pre-processor is expecting a directive.
If you start a comment line with “##” the warning/error is generally removed and the whole comment line appears in the output file.
If there is an apostrophe(') in the comment this generates a warning.
If you start a comment line with #// this removes such a warning, but the comment line will not appear in the output file.
The pre-processor inserts a few “comments” itself in the output file to indicate certain things such as where an include file has been inserted, but these always begin with # so are happily ignored by NG!
I’m very glad to use the pre processor as it allows to break up a huge *.ngc into smaller components that can be named appropriately, I’m now exploring how #defines can be used to streamline, save typing, and provide more global control e.g easily replace values, etc.
It works, you can to maths on expressions and the output is single constants, parse-able by MIDIbox NG.
I tested the simple offset example like above and it definitely works.
I’ll play with it some more, and post back with the details of where to install the library, and examples of use.
In the near future I plan to try some more interesting uses, such as velocity scaling for MAP tables and for constructing sysex messages from #define’d data.
In the near future I plan to try some more interesting uses, such as velocity scaling for MAP tables and for constructing sysex messages from #define’d data.
I’d be very interested in learning more about this, especially the #define / SysEx part!
I’ve got the macros working, but I now discover that the arithmetic saturates at 256. Another hassle is that there is no way to insert line breaks with the preprocessor so I’ve had to run an additional utility to achieve this. So I’m now looking at M4…
[edit] I’ve downloaded M4 from GnuWin, I’d assume there is a GNU M4 for other platforms.
Its a full featured macro language with 32bit arithmetic and it’s design to do these kind of jobs, unlike the C preprocessor which isn’t really. Unfortunately, it’s not as familiar as cpp, but will do everything I need.
The sysex job is to construct sysex messages containing 16 bit data from lists of defined constants, into a sysex message (that is of course only 7bits per byte).
Anyhow it’s working, so I’ll continue on, and post back with the methods and results.