/* BufFiCtNd2 - creates two non deferred function tables from a stereo soundfile and returns the length DESCRIPTION Creates two non deferred function tables from a stereo (or any multichannel) soundfile and returns the length as table size (= sample frames). This can be useful is you want to use opcodes (for instance table3) which do not work with deferred size function tables SYNTAX iftL, iftR, ilen BufFiCtNd2 Sfilenam [, ichnL [, ichnR [, iftnumL [, iftnumR [, inorm]]]]] INITIALIZATION Sfilenam - file name or path as string ichnL, ichnR - channels in Sfilenam to read (default = 1 for ichnL and 2 for ichnR) iftnumL, iftnumR - if zero (which is also the default), the number of the function table is given by Csound. Any other positive integer will represent the function table, but the user must take care of not using a number twice inorm - if zero, the table is not normalized. This is also the default, while any other number creates a normalized table iftL, iftR - output table number ilen - length of the function table created (which is also the length of the soundfile in samples) CREDITS joachim heintz 2010 */ opcode BufFiCtNd2, iii, Sjjpoo Sfilenam, ichnL, ichnR, iftnumL, iftnumR, inorm xin ichnL = (ichnL == -1 ? 1 : ichnL) ;default for chnL = 1 ichnR = (ichnR == -1 ? 2 : ichnR) ;default for chnR = 2 igen = (inorm == 0 ? -1 : 1) ifttmpL ftgen 0, 0, 0, igen, Sfilenam, 0, 0, ichnL ifttmpR ftgen 0, 0, 0, igen, Sfilenam, 0, 0, ichnR ilen tableng ifttmpL iftL ftgen iftnumL, 0, -ilen, -2, 0 iftR ftgen iftnumR, 0, -ilen, -2, 0 vcopy_i iftL, ifttmpL, ilen vcopy_i iftR, ifttmpR, ilen ftfree ifttmpL, 0 ftfree ifttmpR, 0 xout iftL, iftR, ilen endop