| OK, that sounds very good.
-----Original Message-----
From: Istvan Varga
Sent: Apr 27, 2005 2:36 PM
To: csound-devel@lists.sourceforge.net
Subject: Re: [Cs-dev] I am making a habit of this
Richard Dobson wrote:
> Does this mean that opcodes with an S type can no longer read soundfiles
> with a numeric extension ("soundin.1", "soundin.2", etc)?
No, though you need to use T type (which means S-rate or i-rate) instead of S.
entry1.c and entry2.c are already updated for this change, as well as some of
the plugin opcodes.
> That would break a lot of older orchs reading soundfiles with that naming scheme,
> including a lot of the examples in the Csound book. It was not a scheme
> I had much use for, but it had its advantages for many who use(d) Csound
> a lot more than I do!
As an example, here is how soundin handles file names now (note: p->XSTRCODE
is the equivalent of p->XINCODE for strings; that is, you can test
p->XSTRCODE & 1 to find out if the first input argument is a string,
p->XSTRCODE & 2 for the second arg, p->XSTRCODE & 4 for the third, etc.):
csound->strarg2name(csound, p->sndin_.sfname, p->ifilno, "soundin.",
p->XSTRCODE);
This function supports all the following:
* file name as string constant
* file name as string variable (S-type)
* string p-field from score
* strset index
* "soundin.%d" style file names
So, not only is compatibility with old orchestras preserved, but it is
much easier now to "leap thru std hoops to get file name", to quote from
one of the source files.
For completeness, here is the documentation for csound->strarg2name():
/* create file name from opcode argument (string or MYFLT) */
/* ENVIRON *csound: */
/* pointer to Csound instance */
/* char *s: */
/* output buffer, should have enough space; if NULL, the */
/* required amount of memory is allocated and returned */
/* void *p: */
/* opcode argument, is interpreted as char* or MYFLT*, */
/* depending on the 'is_string' parameter */
/* const char *baseName: */
/* name prefix to be used if the 'p' argument is MYFLT, */
/* and it is neither SSTRCOD, nor a valid index to strset */
/* space. */
/* For example, if "soundin." is passed as baseName, file */
/* names in the format "soundin.%d" will be generated. */
/* baseName may be an empty string, but should not be NULL */
/* int is_string: */
/* if non-zero, 'p' is interpreted as a char* pointer and */
/* is used as the file name. Otherwise, it is expected to */
/* point to a MYFLT value, and the following are tried: */
/* 1. if the value is SSTRCOD, the string argument of */
/* the current score event is used (string p-field) */
/* 2. if the value, rounded to the nearest integer, is a */
/* valid index to strset space, the strset string is */
/* used */
/* 3. the file name is generated using baseName and the */
/* value rounded to the nearest integer, as described */
/* above */
/* 'is_string' is usually p->XSTRCODE for an opcode with */
/* only one string argument, otherwise it is */
/* p->XSTRCODE & (1 << (argno - 1)) */
/* return value: */
/* pointer to the output string; if 's' is not NULL, it is */
/* always the same as 's', otherwise it is allocated with */
/* mmalloc() and the caller is responsible for freeing the */
/* allocated memory with mfree() or csound->Free() */
char *strarg2name(ENVIRON *csound, char *s, void *p, const char *baseName,
int is_string);
-------------------------------------------------------
SF.Net email is sponsored by: Tell us your software development plans!
Take this survey and enter to win a one-year sub to SourceForge.net
Plus IDC's 2005 look-ahead and a copy of this survey
Click here to start! http://www.idcswdc.com/cgi-bin/survey?id=105hix
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel
-------------------------------------------------------
SF.Net email is sponsored by: Tell us your software development plans!
Take this survey and enter to win a one-year sub to SourceForge.net
Plus IDC's 2005 look-ahead and a copy of this survey
Click here to start! http://www.idcswdc.com/cgi-bin/survey?id=105hix
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net |