Sophie

Sophie

distrib > Fedora > 15 > i386 > by-pkgid > 4bca59c8d454b03fb775ab065fc58f09 > files > 8

csound-5.13.0-5.fc15.src.rpm

--- Csound5.13.0/Top/csound.c.orig	2011-04-07 10:36:19.738489172 +0100
+++ Csound5.13.0/Top/csound.c	2011-04-07 10:41:09.834581223 +0100
@@ -1382,6 +1382,10 @@
     {
         int done;
         int returnValue;
+        /* WTB - Oct 15 2009: only perform if CS_STATE_COMP set. */
+        if (UNLIKELY((csound->engineState & CS_STATE_COMP) == 0)) {
+           return 1;
+        }
         /* setup jmp for return after an exit() */
         if ((returnValue = setjmp(csound->exitjmp))) {
 #ifndef MACOSX
@@ -1402,6 +1406,10 @@
     {
         int done = 0;
         int returnValue;
+        /* WTB - Oct 15 2009: only perform if CS_STATE_COMP set. */
+        if (UNLIKELY((csound->engineState & CS_STATE_COMP) == 0)) {
+           return 1;
+        }
         /* setup jmp for return after an exit() */
         if ((returnValue = setjmp(csound->exitjmp))) {
 #ifndef MACOSX
@@ -1447,6 +1455,10 @@
         int done;
         int returnValue;
         csound->performState = 0;
+        /* WTB - Oct 15 2009: only perform if CS_STATE_COMP set. */
+        if (UNLIKELY((csound->engineState & CS_STATE_COMP) == 0)) {
+           return 1;
+        }
         /* setup jmp for return after an exit() */
         if ((returnValue = setjmp(csound->exitjmp))) {
 #ifndef MACOSX
--- Csound5.13.0/Top/main.c.orig	2011-04-07 10:36:24.745611983 +0100
+++ Csound5.13.0/Top/main.c	2011-04-07 10:43:02.001313569 +0100
@@ -89,7 +89,9 @@
     dbfs_init(csound, DFLT_DBFS);
     csound->csRtClock = (RTCLOCK*) csound->Calloc(csound, sizeof(RTCLOCK));
     csoundInitTimerStruct(csound->csRtClock);
-    csound->engineState |= CS_STATE_COMP | CS_STATE_CLN;
+    /* WTB - Oct 15 2009: only set CS_STATE_CLN; CS_STATE_COMP set when retval=0. */
+    csound->engineState |= /*CS_STATE_COMP |*/ CS_STATE_CLN;
+
 
 #ifndef USE_DOUBLE
 #ifdef BETA
@@ -409,6 +411,13 @@
     if (O->Midioutname != NULL || O->FMidioutname != NULL)
       openMIDIout(csound);
 
-    return musmon(csound);
+    n = musmon(csound);
+
+    /* WTB - Oct 15 2009: CS_STATE_COMP set when retval=0. */
+    if (n == 0) {
+               csound->engineState |= CS_STATE_COMP;
+    }
+
+    return n;
 }