Csound Csound-dev Csound-tekno Search About

Re: triginstr - new opcode (re-resend)

Date1999-09-03 12:26
Fromrasmus ekman
SubjectRe: triginstr - new opcode (re-resend)
Peter Neubäcker wrote:
> 
> > triginstr
>  Looking over general csound-sourcecode, I had the impression 
> that csound doesn't provide the possibility to take an arbitrary 
> number of optional k-parameters for an opcode, only i-parameters. 

Nonono! I'm not sure if the parser actually choked on it earlier,
but it was possible to get around several years ago. The 'm' input
argument code in Entry.c just tells the parser to skip checks and 
pass along the rest of the arguments, then the opcode will handle 
them internally.
(I use the 'z' code, which was added in 3.57 or so, but that's just
a notational clarification, it could as well use "km" instead.
See comments in Entry.c after declarations, before opcodlst)

> For example, in schedule you always have to reinit the opcode to 
> take current k-values. Did you change that for triginstr?

Schedule is defined to work at i-time, with i-time arguments, so
the trick of reiniting to use it at k-rate is a hack. 

> With triginstr, does the mechanism of fractional instrument number 
> work for accessing defined instances of that instrument?

Yes, it should - I've done nothing to stop that. The events
are just sent to Csound's standard insertion routine. (gotta
test this now.)

> but when instance numbers are calculated at runtime, there might be 
> someting like i 2.0199999999 instead of i 2.02 ....

Yes. So you'd have to be somewhat careful how the numbers are defined.
Eg set the number by adding a fraction to the instr number rather than 
as the result of a division.

Cheers,