Csound Csound-dev Csound-tekno Search About

[Cs-dev] David's bug

Date2006-12-11 09:30
Fromjpff
Subject[Cs-dev] David's bug
I have this fix.  In Top/csound.c there is a function kperf that loops
over instruments, using a local variable ip.  That variable is read
from the csound->actanchor.nxtact location at the start of the cycle,
so any instrument deactivated in instr1 will still be run in that cycle.
  If however the look re-read the chain after each performance call it
would not do this overrun.

eg (line 182 of Top/csound.c)

    while (ip != NULL) {                /* for each instr active:  */
      INSDS *nxt = ip->nxtact;
      csound->pds = (OPDS*) ip;
      while ((csound->pds = csound->pds->nxtp) != NULL) {
        (*csound->pds->opadr)(csound, csound->pds); /* run each opcode */
      }
      ip = ip->nxtact; /* ***** was ip = nxt ****** */
    }

This is not my code so I am uncertain about it.  I have tried it and
it certainly fixes the problem.

Am I right here or am I off in hyper space?

==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

Date2006-12-11 10:29
FromDavid Akbari
SubjectRe: [Cs-dev] David's bug
I can confirm that this does indeed fix the error that had been 
occuring!

Thanks to all who contributed to this conclusion; however now the 
question to ask is: will the change to line 1099 in Top/csound.c

>       ip = ip->nxtact; /* ***** was ip = nxt ****** */

Introduce any other types of backwards compatibility issues in other 
situations?


The compiler says

Top/csound.c:597: warning: missing braces around initializer
Top/csound.c:597: warning: (near initialization for 
`cenviron_.SVrecvbuf.data')
Top/csound.c: In function `kperf':
Top/csound.c:1094: warning: unused variable `nxt'


Anyway, I can confirm that it fixes the issue on GNU/Linux and Mac OSX. 
As long as it doesn't conflict with other .csd files, I would be very 
happy if this change made it into the CVS.


-David

On Dec 11, 2006, at 3:30 AM, jpff wrote:

> I have this fix.  In Top/csound.c there is a function kperf that loops
> over instruments, using a local variable ip.  That variable is read
> from the csound->actanchor.nxtact location at the start of the cycle,
> so any instrument deactivated in instr1 will still be run in that 
> cycle.
>   If however the look re-read the chain after each performance call it
> would not do this overrun.
>
> eg (line 182 of Top/csound.c)
>
>     while (ip != NULL) {                /* for each instr active:  */
>       INSDS *nxt = ip->nxtact;
>       csound->pds = (OPDS*) ip;
>       while ((csound->pds = csound->pds->nxtp) != NULL) {
>         (*csound->pds->opadr)(csound, csound->pds); /* run each opcode 
> */
>       }
>       ip = ip->nxtact; /* ***** was ip = nxt ****** */
>     }
>
> This is not my code so I am uncertain about it.  I have tried it and
> it certainly fixes the problem.
>
> Am I right here or am I off in hyper space?
>
> ==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

Date2006-12-11 11:37
FromVictor Lazzarini
SubjectRe: [Cs-dev] David's bug
I'd say this at least is just a matter of code tidying up.

At 10:29 11/12/2006, you wrote:
>The compiler says
>
>Top/csound.c:597: warning: missing braces around initializer
>Top/csound.c:597: warning: (near initialization for
>`cenviron_.SVrecvbuf.data')
>Top/csound.c: In function `kperf':
>Top/csound.c:1094: warning: unused variable `nxt'

Victor Lazzarini
Music Technology Laboratory
Music Department
National University of Ireland, Maynooth 


-------------------------------------------------------------------------
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