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

PUBLIC int csoundRegisterSenseEventCallback ( CSOUND *  csound,
void(*)(CSOUND *, void *)  func,
void *  userData 
)

Register a function to be called once in every control period by sensevents(). Any number of functions may be registered, and will be called in the order of registration. The callback function takes two arguments: the Csound instance pointer, and the userData pointer as passed to this function. Returns zero on success.

Definition at line 1243 of file musmon.c.

{
    EVT_CB_FUNC *fp = (EVT_CB_FUNC*) csound->evtFuncChain;

    if (fp == NULL) {
      fp = (EVT_CB_FUNC*) calloc((size_t) 1, sizeof(EVT_CB_FUNC));
      csound->evtFuncChain = (void*) fp;
    }
    else {
      while (fp->nxt != NULL)
        fp = fp->nxt;
      fp->nxt = (EVT_CB_FUNC*) calloc((size_t) 1, sizeof(EVT_CB_FUNC));
      fp = fp->nxt;
    }
    if (UNLIKELY(fp == NULL))
      return CSOUND_MEMORY;
    fp->func = func;
    fp->userData = userData;
    fp->nxt = NULL;
    csound->oparms->RTevents = 1;

    return 0;
}


Generated by  Doxygen 1.6.0   Back to index