Csound Csound-dev Csound-tekno Search About

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

Date2004-02-26 13:33
From"Michael Gogins"
Subject[CSOUND-DEV:4176] Re: POLL_EVENTS problem solved!
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.

============================================
Michael Gogins
gogins at pipeline period com
Irreducible Productions
CsoundVST, an extended version of Csound for programming music and sound
Available at http://sourceforge.net/projects/csound/
============================================


----- Original Message ----- 
From: "Anthony Kozar" 
To: "Csound Developers Discussion List" 
Sent: Thursday, February 26, 2004 2:43 AM
Subject: [CSOUND-DEV:4171] POLL_EVENTS problem solved!


> I finally tracked down where POLL_EVENTS was being called too often.  In
> version 4.22, the function kperf() in file insert.c contains these lines:
>
>       while ((ip = ip->nxtact) != NULL) { /*   for each instr active */
> #ifdef CWIN
>         if (!POLL_EVENTS()) longjmp(cglob.exitjmp,1); /* PC GUI needs
>                                                          attention */
> #endif
>         pds = (OPDS *)ip;
>         while ((pds = pds->nxtp) != NULL) {
>           (*pds->opadr)(pds); /*      run each opcode    */
>         }
>       }
>
>
> In version 4.23, the #ifdef CWIN was removed for some reason.  This causes
> POLL_EVENTS to be called tens of thousands of times during a short
> performance instead of only a couple of hundred times.
>
> On Mac OS 9, these extra calls are devastating to performance.  Adding the
> #ifdef back improved rendering times by a factor of 10-80 for me.
>
> In addition to fixing this problem, I have compiled 4.23f10 for Mac OS 9.
> The same compilation problems that I noted for 4.23f07 are still present
> (see post [CSOUND-DEV:3118]).  The #include "autoheader.h" statements in
> every file are a problem now and it seems that the necessary gets.r file
is
> no longer in the source tarball like it used to be.
>
> I will post detailed changes needed for compiling 4.23f10 on OS 9
tomorrow.
> If I had developer status on Sourceforge, I could make the necessary
> corrections myself.
>
> Anthony Kozar
> anthony.kozar@utoledo.edu
>

Date2004-02-26 19:33
FromAnthony Kozar
Subject[CSOUND-DEV:4178] Re: POLL_EVENTS problem solved!
OK.  I compared the changes to the version I have, and it looks great.  If
we could get a similar fix in 4.23f11, that would be appreciated.

Thanks.

Anthony Kozar
anthony.kozar@utoledo.edu

On 2/26/04 8:33 AM, Michael Gogins etched in stone:

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

Date2004-02-28 15:05
Fromramsdell@mitre.org (John D. Ramsdell)
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]$