Logo Search packages:      
Sourcecode: csound version File versions  Download package

PUBLIC void csoundSetScoreOffsetSeconds ( CSOUND *  ,
MYFLT  time 
)

Csound score events prior to the specified time are not performed, and performance begins immediately at the specified time (real-time events will continue to be performed as they are received). Can be used by external software, such as a VST host, to begin score performance midway through a Csound score, for example to repeat a loop in a sequencer, or to synchronize other events with the Csound score.

Definition at line 1591 of file csound.c.

References event::opcod, event::p, event::pcnt, and event::strarg.

  {
      double  aTime;
      MYFLT   prv = (MYFLT) csound->csoundScoreOffsetSeconds_;

      csound->csoundScoreOffsetSeconds_ = offset;
      if (offset < FL(0.0))
        return;
      /* if csoundCompile() was not called yet, just store the offset */
      if (!(csound->engineState & CS_STATE_COMP))
        return;
      /* otherwise seek to the requested time now */
      aTime = (double) offset - (csound->icurTime/csound->esr);
      if (aTime < 0.0 || offset < prv) {
        csoundRewindScore(csound);    /* will call csoundSetScoreOffsetSeconds */
        return;
      }
      if (aTime > 0.0) {
        EVTBLK  evt;
        evt.strarg = NULL;
        evt.opcod = 'a';
        evt.pcnt = 3;
        evt.p[2] = evt.p[1] = FL(0.0);
        evt.p[3] = (MYFLT) aTime;
        insert_score_event_at_sample(csound, &evt, csound->icurTime);
      }
  }


Generated by  Doxygen 1.6.0   Back to index