Csound Csound-dev Csound-tekno Search About

[CSOUND-DEV:4189] Re: POLL_EVENTS problem solved!

Date2004-02-28 15:40
From"gogins@pipeline.com"
Subject[CSOUND-DEV:4189] Re: POLL_EVENTS problem solved!
I'm sorry, but I've never been able to follow diff logs like this. 

However, as best as I can tell, this isn't quite the same as what I had in
mind. kperf is called with N kperiods to compute, in order to do silent
periods as quickly as possible. We both call POLL_EVENTS (or csoundYield,
which had better be exactly the same thing) just above of the silence
block. But I also call it at every kperiod just above the instrument
performance loop, while you seem to have removed that line. 

There probably isn't a whole of difference in practice, but my code might
provide a slightly more responsive GUI. It might be worth trying it both
ways.

In other words, I have:

		if (!POLL_EVENTS()) longjmp(cenviron.exitjmp_,1);
		kcounter += 1;
		global_kcounter = kcounter;       /* IV - Sep 8 2002 */
		if (O.sfread)           /*   if audio_infile open  */
			(*spinrecv)();        /*      fill the spin buf  */
		spoutactive = 0;        /*   make spout inactive   */
		ip = &actanchor;
		while ((ip = ip->nxtact) != NULL) { /*   for each instr active */
			pds = (OPDS *)ip;
			while ((pds = pds->nxtp) != NULL) {
				(*pds->opadr)(pds); /*      run each opcode    */
			}
		}
		if (spoutactive)        /*   results now in spout? */
			(*spoutran)();        /*      send to audio_out  */
		else (*nzerotran)(1L);  /*   else send zerospout   */
	} while (--kcnt);         /* on Mac/Win, allow system events */




Original Message:
-----------------
From:  ramsdell@mitre.org (John D. Ramsdell)
Date: 28 Feb 2004 10:05:29 -0500
To: csound-dev@eartha.mills.edu
Subject: [CSOUND-DEV:4188] Re: POLL_EVENTS problem solved!


"Michael Gogins"  writes:

> In Csound5, I have moved the POLL_EVENTS call out of the loop. It is now
> called once per kperiod.
> 
> This should be adequate as far as I know, but I would like to hear from
> anyone with reason to think otherwise.

I think I made the equivalent change to csound4's insert.c.  Please
complain if my change is wrong.

[ramsdell@localhost csound]$ sfcvs csound diff -u
ramsdell@cvs.csound.sourceforge.net's password:

? INSTALL
? Makefile
? Makefile.in
? aclocal.m4
? autom4te.cache
? compile
? config.guess
? config.log
? config.status
? config.sub
? configure
? csound.spec
? depcomp
? install-sh
? libtool
? ltmain.sh
? missing
? mkinstalldirs
? anal/Makefile
? anal/Makefile.in
? anal/adsyn/.deps
? anal/adsyn/Makefile
? anal/adsyn/Makefile.in
? anal/adsyn/hetro
? anal/convol/.deps
? anal/convol/Makefile
? anal/convol/Makefile.in
? anal/convol/cvanal
? anal/lpc/.deps
? anal/lpc/Makefile
? anal/lpc/Makefile.in
? anal/lpc/lpanal
? anal/pvoc/.deps
? anal/pvoc/Makefile
? anal/pvoc/Makefile.in
? anal/pvoc/pvanal
? csound/.deps
? csound/English.xmg
? csound/Makefile
? csound/Makefile.in
? csound/config.h
? csound/config.h.in
? csound/csound
? csound/csound-config
? csound/makedb
? csound/sdif2ad
? csound/stamp-h1
? doc/Makefile
? doc/Makefile.in
? doc/csoundgbs.html
? doc/csoundgbs.info
? doc/mdate-sh
? doc/stamp-vti
? doc/texinfo.tex
? util1/Makefile
? util1/Makefile.in
? util1/scot/.deps
? util1/scot/Makefile
? util1/scot/Makefile.in
? util1/scot/scot
? util1/sortex/.deps
? util1/sortex/Makefile
? util1/sortex/Makefile.in
? util1/sortex/extract
? util1/sortex/scsort
? util2/Makefile
? util2/Makefile.in
? util2/dnoise/.deps
? util2/dnoise/Makefile
? util2/dnoise/Makefile.in
? util2/dnoise.dir/srconv
? util2/envext/.deps
? util2/envext/Makefile
? util2/envext/Makefile.in
? util2/mixer/.deps
? util2/mixer/Makefile
? util2/mixer/Makefile.in
? util2/mixer/extractor
? util2/mixer/mixer
? util2/pvlook/.deps
? util2/pvlook/Makefile
? util2/pvlook/Makefile.in
? util2/scale/.deps
? util2/scale/Makefile
? util2/scale/Makefile.in
? util2/sndinfo/.deps
? util2/sndinfo/Makefile
? util2/sndinfo/Makefile.in
? util2/sndinfo/sndinfo
cvs diff: Diffing .
cvs diff: Diffing CsoundCOM
cvs diff: Diffing CsoundVST
cvs diff: Diffing CsoundVST/examples
cvs diff: Diffing CsoundVST/index_files
cvs diff: Diffing CsoundVSTWin
cvs diff: Diffing OSC-Kit
cvs diff: Diffing OSC-Kit/send+dump
cvs diff: Diffing anal
cvs diff: Diffing anal/adsyn
cvs diff: Diffing anal/convol
cvs diff: Diffing anal/lpc
cvs diff: Diffing anal/pvoc
cvs diff: Diffing cscofils
cvs diff: Diffing csound
Index: csound/insert.c
===================================================================
RCS file: /cvsroot/csound/csound/csound/insert.c,v
retrieving revision 1.4
diff -u -r1.4 insert.c
--- csound/insert.c	31 Jan 2004 23:10:09 -0000	1.4
+++ csound/insert.c	28 Feb 2004 14:53:12 -0000
@@ -647,6 +647,7 @@
 #endif
 
     VMSG(printf("perfing %ld kprds\n",kcnt);)
+    if (!POLL_EVENTS()) longjmp(cglob.exitjmp,1);
     if (!O.ksensing &&
         actanchor.nxtact == NULL) {  /* if !kreads & !instrs_activ, */
       kcounter += kcnt;
@@ -674,10 +675,6 @@
             || (O.OrcEvts && (sensType = sensOrcEvent()))) /* or triginstr
event (re Aug 1999) */
           return(kreq - kcnt); /*      do early return    */
       }
-#if defined(mills_macintosh) || defined(CWIN) || defined(SYMANTEC)
-      else if (O.Midiin && actanchor.nxtact == NULL) /* no midi or notes
on; check events */
-#endif
-        if (!POLL_EVENTS()) longjmp(cglob.exitjmp,1);
       kcounter += 1;
       global_kcounter = kcounter;       /* IV - Sep 8 2002 */
       if (O.sfread)           /*   if audio_infile open  */
@@ -685,7 +682,6 @@
       spoutactive = 0;        /*   make spout inactive   */
       ip = &actanchor;
       while ((ip = ip->nxtact) != NULL) { /*   for each instr active */
-        if (!POLL_EVENTS()) longjmp(cglob.exitjmp,1); /* PC GUI needs
attention */
         pds = (OPDS *)ip;
         while ((pds = pds->nxtp) != NULL) {
           (*pds->opadr)(pds); /*      run each opcode    */
cvs diff: Diffing doc
cvs diff: Diffing pyrun
cvs diff: Diffing soundfonts
cvs diff: Diffing soundfonts/fluidOpcodes
cvs diff: Diffing util1
cvs diff: Diffing util1/cscore
cvs diff: Diffing util1/scot
cvs diff: Diffing util1/sortex
cvs diff: Diffing util2
cvs diff: Diffing util2/dnoise
cvs diff: Diffing util2/dnoise.dir
cvs diff: Diffing util2/envext
cvs diff: Diffing util2/exports
cvs diff: Diffing util2/mixer
cvs diff: Diffing util2/mkgraph
cvs diff: Diffing util2/pvlook
cvs diff: Diffing util2/pvlook.dir
cvs diff: Diffing util2/scale
cvs diff: Diffing util2/scale.dir
cvs diff: Diffing util2/sndinfo
[ramsdell@localhost csound]$ 


--------------------------------------------------------------------
mail2web - Check your email from the web at
http://mail2web.com/ .

Date2004-02-28 15:52
Fromramsdell@mitre.org (John D. Ramsdell)
Subject[CSOUND-DEV:4190] Re: POLL_EVENTS problem solved!
I deleted my csound5 sandbox and checked out a fresh version of the
sources yesterday.  I received a version of insert.c with the code to
which you refer commented out.  Do I have the wrong version?

John

Engine/insert.c:687:----------------------------------
				|| (O.OrcEvts && (sensType = sensOrcEvent()))) /* or triginstr event (re Aug 1999) */
				return(kreq - kcnt); /*      do early return    */
		}
		/* #if defined(mills_macintosh) || defined(SYMANTEC) */
		/*       else if (O.Midiin && actanchor.nxtact == NULL) /\* no midi or notes on; check events *\/ */
		/* #endif */
		/*         if (!POLL_EVENTS()) longjmp(cenviron.exitjmp_,1); */
		kcounter += 1;
		global_kcounter = kcounter;       /* IV - Sep 8 2002 */



"gogins@pipeline.com"  writes:

> I'm sorry, but I've never been able to follow diff logs like this. 
> 
> However, as best as I can tell, this isn't quite the same as what I had in
> mind. kperf is called with N kperiods to compute, in order to do silent
> periods as quickly as possible. We both call POLL_EVENTS (or csoundYield,
> which had better be exactly the same thing) just above of the silence
> block. But I also call it at every kperiod just above the instrument
> performance loop, while you seem to have removed that line. 
> 
> There probably isn't a whole of difference in practice, but my code might
> provide a slightly more responsive GUI. It might be worth trying it both
> ways.
> 
> In other words, I have:
> 
> 		if (!POLL_EVENTS()) longjmp(cenviron.exitjmp_,1);
> 		kcounter += 1;
> 		global_kcounter = kcounter;       /* IV - Sep 8 2002 */
> 		if (O.sfread)           /*   if audio_infile open  */
> 			(*spinrecv)();        /*      fill the spin buf  */
> 		spoutactive = 0;        /*   make spout inactive   */
> 		ip = &actanchor;
> 		while ((ip = ip->nxtact) != NULL) { /*   for each instr active */
> 			pds = (OPDS *)ip;
> 			while ((pds = pds->nxtp) != NULL) {
> 				(*pds->opadr)(pds); /*      run each opcode    */
> 			}
> 		}
> 		if (spoutactive)        /*   results now in spout? */
> 			(*spoutran)();        /*      send to audio_out  */
> 		else (*nzerotran)(1L);  /*   else send zerospout   */
> 	} while (--kcnt);         /* on Mac/Win, allow system events */
> 
> 
> 
> 
> Original Message:
> -----------------
> From:  ramsdell@mitre.org (John D. Ramsdell)
> Date: 28 Feb 2004 10:05:29 -0500
> To: csound-dev@eartha.mills.edu
> Subject: [CSOUND-DEV:4188] Re: POLL_EVENTS problem solved!
> 
> 
> "Michael Gogins"  writes:
> 
> > In Csound5, I have moved the POLL_EVENTS call out of the loop. It is now
> > called once per kperiod.
> > 
> > This should be adequate as far as I know, but I would like to hear from
> > anyone with reason to think otherwise.
> 
> I think I made the equivalent change to csound4's insert.c.  Please
> complain if my change is wrong.
> 
> [ramsdell@localhost csound]$ sfcvs csound diff -u
> ramsdell@cvs.csound.sourceforge.net's password:
> 
> ? INSTALL
> ? Makefile
> ? Makefile.in
> ? aclocal.m4
> ? autom4te.cache
> ? compile
> ? config.guess
> ? config.log
> ? config.status
> ? config.sub
> ? configure
> ? csound.spec
> ? depcomp
> ? install-sh
> ? libtool
> ? ltmain.sh
> ? missing
> ? mkinstalldirs
> ? anal/Makefile
> ? anal/Makefile.in
> ? anal/adsyn/.deps
> ? anal/adsyn/Makefile
> ? anal/adsyn/Makefile.in
> ? anal/adsyn/hetro
> ? anal/convol/.deps
> ? anal/convol/Makefile
> ? anal/convol/Makefile.in
> ? anal/convol/cvanal
> ? anal/lpc/.deps
> ? anal/lpc/Makefile
> ? anal/lpc/Makefile.in
> ? anal/lpc/lpanal
> ? anal/pvoc/.deps
> ? anal/pvoc/Makefile
> ? anal/pvoc/Makefile.in
> ? anal/pvoc/pvanal
> ? csound/.deps
> ? csound/English.xmg
> ? csound/Makefile
> ? csound/Makefile.in
> ? csound/config.h
> ? csound/config.h.in
> ? csound/csound
> ? csound/csound-config
> ? csound/makedb
> ? csound/sdif2ad
> ? csound/stamp-h1
> ? doc/Makefile
> ? doc/Makefile.in
> ? doc/csoundgbs.html
> ? doc/csoundgbs.info
> ? doc/mdate-sh
> ? doc/stamp-vti
> ? doc/texinfo.tex
> ? util1/Makefile
> ? util1/Makefile.in
> ? util1/scot/.deps
> ? util1/scot/Makefile
> ? util1/scot/Makefile.in
> ? util1/scot/scot
> ? util1/sortex/.deps
> ? util1/sortex/Makefile
> ? util1/sortex/Makefile.in
> ? util1/sortex/extract
> ? util1/sortex/scsort
> ? util2/Makefile
> ? util2/Makefile.in
> ? util2/dnoise/.deps
> ? util2/dnoise/Makefile
> ? util2/dnoise/Makefile.in
> ? util2/dnoise.dir/srconv
> ? util2/envext/.deps
> ? util2/envext/Makefile
> ? util2/envext/Makefile.in
> ? util2/mixer/.deps
> ? util2/mixer/Makefile
> ? util2/mixer/Makefile.in
> ? util2/mixer/extractor
> ? util2/mixer/mixer
> ? util2/pvlook/.deps
> ? util2/pvlook/Makefile
> ? util2/pvlook/Makefile.in
> ? util2/scale/.deps
> ? util2/scale/Makefile
> ? util2/scale/Makefile.in
> ? util2/sndinfo/.deps
> ? util2/sndinfo/Makefile
> ? util2/sndinfo/Makefile.in
> ? util2/sndinfo/sndinfo
> cvs diff: Diffing .
> cvs diff: Diffing CsoundCOM
> cvs diff: Diffing CsoundVST
> cvs diff: Diffing CsoundVST/examples
> cvs diff: Diffing CsoundVST/index_files
> cvs diff: Diffing CsoundVSTWin
> cvs diff: Diffing OSC-Kit
> cvs diff: Diffing OSC-Kit/send+dump
> cvs diff: Diffing anal
> cvs diff: Diffing anal/adsyn
> cvs diff: Diffing anal/convol
> cvs diff: Diffing anal/lpc
> cvs diff: Diffing anal/pvoc
> cvs diff: Diffing cscofils
> cvs diff: Diffing csound
> Index: csound/insert.c
> ===================================================================
> RCS file: /cvsroot/csound/csound/csound/insert.c,v
> retrieving revision 1.4
> diff -u -r1.4 insert.c
> --- csound/insert.c	31 Jan 2004 23:10:09 -0000	1.4
> +++ csound/insert.c	28 Feb 2004 14:53:12 -0000
> @@ -647,6 +647,7 @@
>  #endif
>  
>      VMSG(printf("perfing %ld kprds\n",kcnt);)
> +    if (!POLL_EVENTS()) longjmp(cglob.exitjmp,1);
>      if (!O.ksensing &&
>          actanchor.nxtact == NULL) {  /* if !kreads & !instrs_activ, */
>        kcounter += kcnt;
> @@ -674,10 +675,6 @@
>              || (O.OrcEvts && (sensType = sensOrcEvent()))) /* or triginstr
> event (re Aug 1999) */
>            return(kreq - kcnt); /*      do early return    */
>        }
> -#if defined(mills_macintosh) || defined(CWIN) || defined(SYMANTEC)
> -      else if (O.Midiin && actanchor.nxtact == NULL) /* no midi or notes
> on; check events */
> -#endif
> -        if (!POLL_EVENTS()) longjmp(cglob.exitjmp,1);
>        kcounter += 1;
>        global_kcounter = kcounter;       /* IV - Sep 8 2002 */
>        if (O.sfread)           /*   if audio_infile open  */
> @@ -685,7 +682,6 @@
>        spoutactive = 0;        /*   make spout inactive   */
>        ip = &actanchor;
>        while ((ip = ip->nxtact) != NULL) { /*   for each instr active */
> -        if (!POLL_EVENTS()) longjmp(cglob.exitjmp,1); /* PC GUI needs
> attention */
>          pds = (OPDS *)ip;
>          while ((pds = pds->nxtp) != NULL) {
>            (*pds->opadr)(pds); /*      run each opcode    */
> cvs diff: Diffing doc
> cvs diff: Diffing pyrun
> cvs diff: Diffing soundfonts
> cvs diff: Diffing soundfonts/fluidOpcodes
> cvs diff: Diffing util1
> cvs diff: Diffing util1/cscore
> cvs diff: Diffing util1/scot
> cvs diff: Diffing util1/sortex
> cvs diff: Diffing util2
> cvs diff: Diffing util2/dnoise
> cvs diff: Diffing util2/dnoise.dir
> cvs diff: Diffing util2/envext
> cvs diff: Diffing util2/exports
> cvs diff: Diffing util2/mixer
> cvs diff: Diffing util2/mkgraph
> cvs diff: Diffing util2/pvlook
> cvs diff: Diffing util2/pvlook.dir
> cvs diff: Diffing util2/scale
> cvs diff: Diffing util2/scale.dir
> cvs diff: Diffing util2/sndinfo
> [ramsdell@localhost csound]$ 
> 
> 
> --------------------------------------------------------------------
> mail2web - Check your email from the web at
> http://mail2web.com/ .