Csound Csound-dev Csound-tekno Search About

some 3.482 bug fix patches offered

Date1998-06-06 03:39
FromNicola Bernardini
Subjectsome 3.482 bug fix patches offered
The 3.482 distribution still suffers some of the problems I reported
some time ago for 3.481 (altough many other have been fixed, I suppose).
Here are some context diff patches if you want to solve the problems
described below. You can feed this mail to 'patch' and it'll fix the
sources.

Nicola

------------------------------------------------------------------------
Nicola Bernardini
E-mail: nicb@axnet.it
 
Re graphics: A picture is worth 10K words -- but only those to describe
the picture.  Hardly any sets of 10K words can be adequately described
with pictures.
------------------------------------------------------------------------

opcode diskin:

1) skip time did not work at all, and file sample rate was incorrectely
   displayed (maybe Linux-specific, at any rate the code was wrong)

2) when transposition factor < 0, sound did not play if skiptime == 0

context-diff patch:
*** ./diskin.c.orig	Sun Apr  5 17:45:00 1998
--- ./diskin.c	Sat Jun  6 04:00:05 1998
***************
*** 140,146 ****
      hdrsize = hdr->hdrsize;
      p->filetyp = hdr->filetyp;  		/* copy type from headata */
      p->aiffdata = hdr->aiffdata;
!     p->sr = (short)hdr->sr;
      p->nchnls = (short)hdr->nchnls;
    }
    else {                                  /* no hdr:  find info elsewhere */
--- 140,146 ----
      hdrsize = hdr->hdrsize;
      p->filetyp = hdr->filetyp;  		/* copy type from headata */
      p->aiffdata = hdr->aiffdata;
!     p->sr = (long)hdr->sr;
      p->nchnls = (short)hdr->nchnls;
    }
    else {                                  /* no hdr:  find info elsewhere */
***************
*** 220,226 ****
      }
      else {
        p->begfile = TRUE;
!       if (*p->ktransp < 0) p->endfile = TRUE;
      }
  	 	    
      if ((n = sreadinew(sinfd,p->inbuf,SNDINEWBUFSIZ,p)) == 0) /* now rd fulbuf */
--- 220,226 ----
      }
      else {
        p->begfile = TRUE;
!       if (*p->ktransp < 0 && nbytes == p->audrem) p->endfile = TRUE;
      }
  	 	    
      if ((n = sreadinew(sinfd,p->inbuf,SNDINEWBUFSIZ,p)) == 0) /* now rd fulbuf */

------------------------------------------------------------------------
score reader:

comments get evaluated by recursive getscochar()/flushin() calls, and
special characters inside comments get evaluated (probably not what was
intended, I guess). To see what i mean, just try a sco file with a comment
like this:

; this [is] a comment

The square brackets get evaluated and the compiler stops.  The fix is
different from the previous one in trying to be nicer to the historical
sources (it's smaller and better, thanks to Robin Whittle's suggestions).
It does fix the problem reported.

context-diff patch:
*** ./sread.c.orig	Sat Jun  6 02:56:03 1998
--- ./sread.c	Sat Jun  6 02:56:51 1998
***************
*** 768,773 ****
--- 768,791 ----
  	linpos = 0;
  }
  
+ /*
+  * getscochar() does so much evaluation now that we cannot use flushlin()
+  * anymore to flush comment lines (otherwise they end up being evaluated too)
+  * so I added this one just to flush comment lines; this
+  * solution is ugly as hell but hey! I'm too afraid to break things in this
+  * glass house...
+  * [nicb@axnet.it]
+  */
+ static void flushcomments(void)
+ {
+ 	int c;
+ 
+ 	while ((c = getc(str->file)) != LF && c != EOF)
+ 		;
+ 	lincnt++;
+ 	linpos = 0;
+ }
+ 
  static int sget1(void)		/* get first non-white, non-comment char */
  {
  	int c;
***************
*** 778,784 ****
  			linpos = 0;
  		}
          if (c == ';' || c == 'c') {
! 		flushlin();
  		goto srch;
  	}
          if (c == '\\') {            /* Deal with continuations and specials */
--- 796,802 ----
  			linpos = 0;
  		}
          if (c == ';' || c == 'c') {
! 		flushcomments();
  		goto srch;
  	}
          if (c == '\\') {            /* Deal with continuations and specials */