Csound Csound-dev Csound-tekno Search About

Re: [Csnd] Score finished in csoundPerformKsmps() with 2.

Date2018-01-26 14:01
FromJoel Ramsbottom
SubjectRe: [Csnd] Score finished in csoundPerformKsmps() with 2.
Okay, i've put it in the score and it now seems happy? Why did it work without it for a while then all of a sudden not and whats f0 360 doing now to make the program work?

Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here

Date2018-01-26 14:38
FromMichael Gogins
SubjectRe: [Csnd] Score finished in csoundPerformKsmps() with 2.
f 0 360 tells Csound to run, no matter what, for 360 beats which by
default is 360 seconds or one hour.

What changed, I am not sure. I suspect it was something to do with
changing the API behavior of csoundCompile, csoundStart,
csoundPerform. I observed the same changing behavior myself. I think I
understand the current behavior pretty well. It is documented in the
comments in csound.h as follows (corrections welcome):

The Csound API defines two modes of operation for hosts. In the first mode,
 * a regular Csound score is performed and then performance automatically
 * ends. This could be called "score mode." In the second mode, Csound
 * continues to perform indefinitely until performance is explicitly ended by
 * calling csoundStop. This could be called "live mode." Which mode is used is
 * determined by when csoundStart is called. In more detail:
 *
 * \subsection s1 Score Mode
 *
 * \li The  section of the CSD file is processed.
 *
 * \li Either csoundStart must be called after csoundCompileCsd or
csoundReadScore,
 *     or csoundReadScore must be called before csoundCompile.
 *
 * \li The score is pre-processed, and events are dispatched as regular score
 *     events. "f", "s", and "e" events are permitted in the score.
 *
 * \code
 * #include "csound.h"
 *
 * const char *csd_text = "blah blah blah";
 *
 * int main(int argc, char **argv)
 * {
 *   void *csound = csoundCreate(0);
 *   int result = csoundCompileCsdText(csound, csd_text);
 *   result = csoundStart(csound);
 *   while (1) {
 *      result = csoundPerformKsmps(csound);
 *      if (result != 0) {
 *         break;
 *      }
 *   }
 *   result = csoundCleanup(csound);
 *   csoundReset(csound);
 *   csoundDestroy(csound);
 *   return result;
 * }
 * \endcode
 *
 * \subsection s2 Live Mode
 *
 * \li The  section of the CSD file not processed; options must
 *     be set by calling csoundSetOption.
 *
 * \li csoundStart must be called before csoundCompileCsd or csoundReadScore.
 *
 * \li The score is not pre-processed, and events are dispatched as real-time
 *     events. "f", "s", and "e" events are not permitted.
 *
 * \code
 * #include "csound.h"
 *
 * const char *orc_text = "blah blah blah";
 * const char *sco_text = "blah blah blah";
 *
 * int main(int argc, char **argv)
 * {
 *   void *csound = csoundCreate(0);
 *   int result = csoundSetOption(csound, "-d");
 *   result = csoundSetOption(csound, "-odac");
 *   result = csoundStart(csound);
 *   result = csoundCompileOrc(csound, orc_text);
 *   result = csoundReadScore(csound, sco_text);
 *   while (1) {
 *      result = csoundPerformKsmps(csound);
 *      if (result != 0) {
 *         break;
 *      }
 *   }
 *   result = csoundCleanup(csound);
 *   csoundReset(csound);
 *   csoundDestroy(csound);
 *   return result;
 * }
 * \endcode

 *

-----------------------------------------------------
Michael Gogins
Irreducible Productions
http://michaelgogins.tumblr.com
Michael dot Gogins at gmail dot com


On Fri, Jan 26, 2018 at 9:01 AM, Joel Ramsbottom
 wrote:
> Okay, i've put it in the score and it now seems happy? Why did it work without it for a while then all of a sudden not and whats f0 360 doing now to make the program work?
>
> Csound mailing list
> Csound@listserv.heanet.ie
> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
> Send bugs reports to
>         https://github.com/csound/csound/issues
> Discussions of bugs and features can be posted here

Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here