Question on "Statement never runs" Warning...

From: Michael J McGonagle (fndsnd@earthlink.net)
Date: Sun Nov 26 2000 - 04:57:03 EST


Hello all,

I have been trying to understand an error that I have been getting.
Basically, I am trying to set an ivar from a tableread, but all I get
from sfront is that the statements never run. There is an example in the
Spec that uses the exact form of code that I am using (on page 40), so I
would think that this is valid code. Here is a copy of my code.

kopcode eg(ksig rel, ivar rscale, table rts, table lvs) {
 ivar s0, s1, s2, s3, r0, r1, r2, r3;
 ksig kinit; // init flag
 ksig expire; // stage expire time
 ksig triggered; // final stage init
 ksig stage; // stage counter, 0-based
 ksig eg; // the envelope signal
 ksig fin; // the final envelope starting level

 // i-rate - these next eight statements are the
 // ones that do not execute...
 s0 = tableread(lvs, 0);
 s1 = tableread(lvs, 1);
 s2 = tableread(lvs, 2);
 s3 = tableread(lvs, 3);
 r0 = tableread(rts, 0) * rscale;
 r1 = tableread(rts, 1) * rscale;
 r2 = tableread(rts, 2) * rscale;
 r3 = tableread(rts, 3) * rscale;

 // k-rate
 if (!kinit) {
  kinit = 1;
  expire = r0;
 }
 if (!rel && !triggered) {
  if (stage == 0) {
   eg = ENVSEG(s3, r0, s0);
   if (itime >= expire) {
    stage = stage + 1;
    expire = expire + r1;
   }
  }
  if (stage == 1) {
   eg = ENVSEG(s0, r1, s1);
   if (itime >= expire) {
    stage = stage + 1;
    expire = expire + r2;
   }
  }
  if (stage == 2) {
   eg = ENVSEG(s1, r2, s2);
   if (itime >= expire) {
    stage = stage + 1;
    eg = s2;
   }
  }
 } else {
  if (!triggered) {
   triggered = 1;
   expire = itime + r3;
   fin = eg;
  }
  if (itime < expire) {
   eg = ENVSEG(s2, r3, s3);
  } else {
   eg = s3;
  }
 }
 return(eg);
}

I had originally written this opcode so that the tablereads were inside
the kline opcode calls (part of the ENVSEG macro), but I was getting a
rate-mismatch error.

This is really starting to get to me, I just don't understand this. I
did try saolc to process the orchestra, and it got to the point of
generating sound, but still crashed. I don't know if it was due to
related issues.

Mike



This archive was generated by hypermail 2b29 : Mon Jan 28 2002 - 11:46:41 EST