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

PUBLIC CSOUND* csoundCreate ( void *  hostData  ) 

Creates an instance of Csound. Returns an opaque pointer that must be passed to most Csound API functions. The hostData parameter can be NULL, or it can be a pointer to any sort of data; this pointer can be accessed from the Csound instance that is passed to callback routines.

Definition at line 860 of file csound.c.

References csoundInitialize(), CSOUND_::hostdata, and CSOUND_::oparms.

    CSOUND        *csound;
    csInstance_t  *p;

    if (init_done != 1) {
      if (csoundInitialize(NULL, NULL, 0) < 0)
        return NULL;
    csound = (CSOUND*) malloc(sizeof(CSOUND));
    if (UNLIKELY(csound == NULL))
      return NULL;
    memcpy(csound, &cenviron_, sizeof(CSOUND));
    csound->oparms = &(csound->oparms_);
    csound->hostdata = hostdata;
    p = (csInstance_t*) malloc(sizeof(csInstance_t));
    if (UNLIKELY(p == NULL)) {
      return NULL;
    p->csound = csound;
    p->nxt = (csInstance_t*) instance_list;
    instance_list = p;

    return csound;

Generated by  Doxygen 1.6.0   Back to index