[Cs-dev] Bug in p()
Date | 2006-12-13 20:31 |
From | Anthony Kozar |
Subject | [Cs-dev] Bug in p() |
The p() function seems to be buggy. It prints the index of the pfield rather than its value: int pfun(CSOUND *csound, PFUN *p) { int n = (int)(*p->pnum + FL(0.5)); MYFLT ans; csound->Message(csound, "p(%d) %f\n", n,*p->pnum); if (n<1 || n>PMAX) ans = FL(0.0); else ans = csound->currevent->p[n]; *p->ans = ans; return OK; } The code should probably be something like this instead: int pfun(CSOUND *csound, PFUN *p) { int n = (int)(*p->pnum + FL(0.5)); MYFLT ans; if (n<1 || n>PMAX) ans = FL(0.0); else ans = csound->currevent->p[n]; csound->Message(csound, "p(%d) %f\n", n, ans); *p->ans = ans; return OK; } ------------------------------------------------------------------------- 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 |
Date | 2006-12-14 09:39 |
From | jpff |
Subject | Re: [Cs-dev] Bug in p() |
Surely pfun should not print anything. Looks more like soem debugging information left in. ==John ffitch >>>>> "Anthony" == Anthony Kozar |
Date | 2006-12-14 13:50 |
From | Anthony Kozar |
Subject | Re: [Cs-dev] Bug in p() |
Could be. I thought it was annoying myself. But the manual does say that p() "Shows the value in a given p-field." The new opcode pindex allows retrieving any pfield without printing a message. But I don't think that it can be called as a function. Anthony jpff wrote on 12/14/06 4:39 AM: > Surely pfun should not print anything. Looks more like soem debugging > information left in. > ==John ffitch ------------------------------------------------------------------------- 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 |