[CSOUND-DEV:4925] macro enhancement suggestion
Date | 2004-07-12 21:55 |
From | iainduncan@telus.net |
Subject | [CSOUND-DEV:4925] macro enhancement suggestion |
As my code becomes bloated and huge, I've found the macro system to be enormously helpful, especially for instances where we duplicate the same thing a bunch of times, like mixer channels. Ie we use the below for mixer files instr 300 #define TRACK #0# #define TRIM #0.5# #include 'mixerchannel.orc' #undef TRACK #undef TRIM endin instr 301 #define TRACK #1# #define TRIM #0.6# #include 'mixerchannel.orc' #undef TRACK #undef TRIM endin Each instrument can then reuse the file mixerchannel.orc with any labels and instance specific differences being handled by using the $TRACK macro. This works like a hot damn, but would be even cooler if the macro system could include some conditional expansion. I would love to see some sort IFDEF thing so we could say #IFDEF $CHORUSON to expand optional parts of the mixer channel at preprocessing time depending. Would such a thing be easy to do? Anyone else think it would be cool? Thanks for listening, Iain |
Date | 2004-07-13 00:47 |
From | iain duncan |
Subject | [CSOUND-DEV:4937] Re: macro enhancement suggestion |
> Iain, I don't know how many new feature requests are going to make it into > CS5 immediately. Perhaps in the mean time, you might be able to do what you > want with some other tool. Have you considered simply using the C > preprocessor to accomplish the conditional expansion? I have also been > wanting to look into the Unix program m4 for some time now. It is supposed > to be a very powerful macro preprocessor. Yeah I understand. I just thought I'd throw it out there in case someone thought it was a good but easy idea. ; ) And thanks for the suggestion, I'll look into that. No reason I couldn't do it with some other preprocessor I suppose! Iain |
Date | 2004-07-13 01:43 |
From | iain duncan |
Subject | [CSOUND-DEV:4941] Re: macro enhancement suggestion |
jpff@codemist.co.uk wrote: > #ifdef would not be terribly hard. Will think about it > ==John ffitch That would be awesome. That alone would be incredibly useful for large orchestra with many channels of similar code. Thanks for thinking about it. = ) Iain |
Date | 2004-07-13 07:29 |
From | Anthony Kozar |
Subject | [CSOUND-DEV:4936] Re: macro enhancement suggestion |
I've often wanted conditional macros too. Uses that I have imagined include "nchnls-independent" instruments or orchestras which use different output code depending on the value of nchnls. Also, to be able to switch between "draft" and "final" quality for the orchestra performance via a single macro symbol would be advantageous. "Final" mode would use a higher kr (and perhaps sr), interpolating oscillators, etc. Other features I have wanted in the macro system would be: * allowing macro expansions to refer to other macros * testing a defined macro against some value * some sort of computational and/or looping ability * the ability to define a macro from the command-line to allow options to be turned on or to pass input values (e.g. reverb time for an orchestra which reverberates a sound file) In essence, I have sometimes wanted a "Turing complete" macro system (as the C++ template mechanism is). I guess at this stage, however, that just using a full programming language to write my orchestras might be cleaner. Iain, I don't know how many new feature requests are going to make it into CS5 immediately. Perhaps in the mean time, you might be able to do what you want with some other tool. Have you considered simply using the C preprocessor to accomplish the conditional expansion? I have also been wanting to look into the Unix program m4 for some time now. It is supposed to be a very powerful macro preprocessor. Anthony Kozar anthony.kozar@utoledo.edu http://akozar.spymac.net/ On 7/12/04 4:55 PM, iainduncan@telus.net |
Date | 2004-07-13 08:06 |
From | Anthony Kozar |
Subject | [CSOUND-DEV:4939] Re: macro enhancement suggestion |
I _do_ think that it is a good idea. But, you know, there is this "code freeze" thing going on and all :) I hope that someone on the dev team has been keeping a list of all the various suggestions and requests that we have been receiving lately so that we can start working on them after the initial release of CS5. Anthony On 7/12/04 7:47 PM, iain duncan |
Date | 2004-07-13 08:36 |
From | jpff@codemist.co.uk |
Subject | [CSOUND-DEV:4940] Re: macro enhancement suggestion |
#ifdef would not be terribly hard. Will think about it ==John ffitch |
Date | 2004-07-13 11:13 |
From | jpff@codemist.co.uk |
Subject | [CSOUND-DEV:4946] Re: macro enhancement suggestion |
Decoding #ifdef was as I suspected easy. Now comes the problems of skipping and nesting. Do not expect this immediately as I need to think a bit (and the Tour de France re-starts in 90mins). So far just looking at orchestras but the code is largely the same. I usually write my more 'interesting' scores in C so I can avoid some of these issues. ==John ffitch |
Date | 2004-07-13 17:02 |
From | stevenyi |
Subject | [CSOUND-DEV:4952] Re: macro enhancement suggestion |
It might be useful to get everyone to use the Sourceforge features for bug tracking and RFE's (request for enhancements (?)); it'd be managed at least. steven > I hope that someone on the dev team has been keeping a list of all the > various suggestions and requests that we have been receiving lately so that > we can start working on them after the initial release of CS5. |