[Cs-dev] k-rate system bug
| Date | 2007-03-07 16:34 |
| From | Jonathan Murphy |
| Subject | [Cs-dev] k-rate system bug |
Hi Folks,
Revision 1.8 to system_call.c breaks system (fixes system_i but breaks
system). It seems that call_system_set and call_system_k are buggy. I
have an idea for a partial fix, but I'm not sure how sane it
is (the while loop is probably not a good idea. Anyway, for what it's
worth, it allows an actual k-rate trigger, but it's still just a
one-shot trigger. I'm sure that there's probably a better way to do this.
Jonathan.
Remove everything from line 89 down, and insert the following
int call_system_k(CSOUND *csound, SYSTEM *p)
{
IGN(csound);
p->prv_ktrig = FL(0.0);
while (p->prv_ktrig = FL(0.0))
{
p->prv_ktrig = *p->ktrig;
if (*p->ktrig != FL(0.0))
break;
}
return (call_system(csound, p));
}
#define S(x) sizeof(x)
static OENTRY localops[] = {
{ "system", S(SYSTEM), 1, "k", "kSO", (SUBR)call_system_k},
{ "system_i", S(SYSTEM), 1, "i", "iSo", (SUBR)call_system_i}
};
LINKAGE
-------------------------------------------------------------------------
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 | 2007-03-09 07:17 |
| From | jpff |
| Subject | Re: [Cs-dev] k-rate system bug |
Sorry, do not understand your code. If *p->ktrig is zero it just loops infinitely. Can you explain the bug you are trying to fix? ==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 |
| Date | 2007-03-09 08:16 |
| From | Jonathan Murphy |
| Subject | Re: [Cs-dev] k-rate system bug |
Hi John,
The k-rate version of system does not work. I'm not altogether
confident that I understand your code either, but for one reason or
another, this conditional
if (p->prv_ktrig > FL(0.0))
is never true, so call_system is never called.
I know that the loop is a bad idea, but my understanding of a k-rate
trigger is something like this:
ktrig metro 1
Once every second, the trigger is pulled, and you get the chance to
shoot yourself in the foot with something like:
kret system ktrig, {{echo "Bang!"}}
I can't think of a way to do this that doesn't involve an infinite
loop, so I put in the break; that way when *p->ktrig != 0, call_system
returns and the loop ends. This should always happen eventually (with
a trigger similar to the one above), but also will only ever happen
once.
I'm testing this on a standard linux box, using cvs from
yesterday.
Jonathan.
|
| Date | 2007-03-09 08:34 |
| From | Jonathan Murphy |
| Subject | Re: [Cs-dev] k-rate system bug |
> The k-rate version of system does not work. I'm not altogether > confident that I understand your code either, but for one reason or > another, this conditional I've just read this back. To avoid confusion, what I meant to say was that I'm not sure that I understand your code, not because it seems insane but because I'm inexperienced and can't spot the bug. No disrespect was intended. Jonathan. ------------------------------------------------------------------------- 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 |