[Csnd] $FILEDIR Proposal
Date | 2012-11-10 13:32 |
From | Steven Yi |
Subject | [Csnd] $FILEDIR Proposal |
Hi all, One thing I am wondering about with packages and Includes as a whole, is depending on other files. For example, I am thinking about if you distribute a UDO that depends on an impulse response. My thought is that Csound could have a built-in macro called FILEDIR that would be updated during parsing to hav the absolute path of the most file being read. The it could be used in ftgen statements or where ever. This proposal seems a little clunky to me, so I'd love to hear thoughts from others. Thanks! |
Date | 2012-11-10 14:13 |
From | Adam Puckett |
Subject | Re: [Csnd] $FILEDIR Proposal |
But then wouldn't we have to have dynamic parsing? Sorry I don't know all the details, but that's just a gut reaction. Maybe something like in-memory parsing? Like parsing the orch, and then updating $FILEDIR on every dynamic parse? Sorry again for the noise. On 11/10/12, Steven Yi |
Date | 2012-11-10 16:16 |
From | Steven Yi |
Subject | Re: [Csnd] $FILEDIR Proposal |
Hi Adam, I don't think this would be dynamic parsing. The idea is that as each file is loaded, the $FILEDIR macro would be updated to the dir of the file, then parsing continues. The $FILEDIR macro would get expanded as any other macro would.
I imagine most of the things that would be packaged in packages initially would be UDO's or helpful macros. If we start coming up with a good scheme for packaging instruments, then this would become an issue more. For example, imagine a pre-made drum machine instrument that uses samples. The instrument might encapsulate all of its tables with it. Perhaps pseudo-code would be like: instr MySampler itab ftgenonce 0,0, 0, 1, "mySample.wav" ... sample playing code... endin if the packaged instrument was in a folder like this:
packages +MySampler-1.0 +MySampler.instr +mySample.wav You'd want to use it like: #include "MySampler-1.0/MySampler.instr"
but, then how does the instrument know where to load the sample from? If we had: itab ftgenonce 0,0, 0, 1, "$FILEDIR/mySample.wav"
then no matter where the MySampler.instr file is, as long as the mySample.wav is in the same directory, it would load alright. Hopefully that explains the issue a bit more!
steven On Sat, Nov 10, 2012 at 2:13 PM, Adam Puckett <adotsdothmusic@gmail.com> wrote: But then wouldn't we have to have dynamic parsing? Sorry I don't know |