changes: - fix broken detection of string parameter for ifnstif parameter (i.e. the filename of the connection matrix) - handle connection matrix files in CRLF format as well as LF format - scsnux_initw now initialises x0 (and x2) as well as x1. this causes correct initialisation of the mass displacements, (i.e. as per the manual description) when init > 0. without this, this present initiation of x1 will simply be lost on the first iteration. (if there is a better procedure for submitting patches, please point me to it) cheers, lily. --- csound5/Opcodes/scansynx.c 2005-12-28 00:07:02.000000000 +1300 +++ ../Csound5.04/Opcodes/scansynx.c 2007-01-14 16:29:36.000000000 +1300 @@ -91,8 +91,11 @@ } if (fi->flen != len) csound->Die(csound, Str("scanux: Init table has bad size")); - for (i = 0 ; i != len ; i++) + for (i = 0 ; i != len ; i++) { + p->x0[i] = fi->ftable[i]; p->x1[i] = fi->ftable[i]; + p->x2[i] = fi->ftable[i]; + } return OK; } @@ -273,7 +276,7 @@ p->d = f->ftable; /* Spring stiffness */ - if (*p->i_f != SSTRCOD) { + if (!p->XSTRCODE) { int j, ilen; /* Get the table */ @@ -325,18 +328,28 @@ return csound->InitError(csound, Str("SCANU cannot load %s"), filnam); } else { -#define MATRIX "\n" -#define MATLEN (sizeof(MATRIX)-1) -#define NMATRIX "\n" -#define NMATLEN (sizeof(NMATRIX)-1) +#define MATRIXLF "\n" +#define MATLENLF (sizeof(MATRIXLF)-1) +#define MATRIXCRLF "\r\n" +#define MATLENCRLF (sizeof(MATRIXCRLF)-1) +#define NMATRIXLF "\n" +#define NMATLENLF (sizeof(NMATRIXLF)-1) +#define NMATRIXCRLF "\r\n" +#define NMATLENCRLF (sizeof(NMATRIXCRLF)-1) int j; char *pp = mfp->beginp; - if ((i=strncmp(pp, MATRIX, MATLEN))) { + if ((i=strncmp(pp, MATRIXLF, MATLENLF))==0) { + pp += MATLENLF; + } + else if ((i=strncmp(pp, MATRIXCRLF, MATLENCRLF))==0) { + pp += MATLENCRLF; + } + else { csound->Message(csound, "%d: Looking for (%ld)%s Found %.12s\n", - i, (long) MATLEN, MATRIX, pp); + i, (long) MATLENLF, MATRIXLF, pp); return csound->InitError(csound, "Not a valid matrix"); } - else pp += MATLEN; + #ifdef USING_CHAR csound->AuxAlloc(csound, len*len * sizeof(char), &p->aux_f); p->f = (char*)p->aux_f.auxp; @@ -346,7 +359,8 @@ p->f = (unsigned long*)p->aux_f.auxp; #endif while (pp < mfp->endp) { - if (strncmp(pp, NMATRIX, NMATLEN)==0) break; + if (strncmp(pp, NMATRIXLF, NMATLENLF)==0) break; + if (strncmp(pp, NMATRIXCRLF, NMATLENCRLF)==0) break; if (2 != sscanf(pp, "%d %d", &i, &j)) break; #ifdef USING_CHAR p->f[i*len+j] = 1; ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ Csound-devel mailing list Csound-devel@lists.sourceforge.net