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

void PUBLIC csoundEnableMessageBuffer ( CSOUND csound,
int  toStdOut 
)

Creates a buffer for storing messages printed by Csound. Should be called after creating a Csound instance; note that the message buffer uses the host data pointer, and the buffer should be freed by calling csoundDestroyMessageBuffer() before deleting the Csound instance. If 'toStdOut' is non-zero, the messages are also printed to stdout and stderr (depending on the type of the message), in addition to being stored in the buffer.

Definition at line 3030 of file csound.c.

References csoundDestroyMessageBuffer(), csoundEnableMessageBuffer(), and csoundSetMessageCallback().

Referenced by csoundEnableMessageBuffer().

  {
      csMsgBuffer *pp;
      size_t      nBytes;

      csoundDestroyMessageBuffer(csound);
      nBytes = sizeof(csMsgBuffer);
      if (!toStdOut)
        nBytes += (size_t) 16384;
      pp = (csMsgBuffer*) malloc(nBytes);
      pp->mutex_ = csoundCreateMutex(0);
      pp->firstMsg = (csMsgStruct*) 0;
      pp->lastMsg = (csMsgStruct*) 0;
      pp->msgCnt = 0;
      if (!toStdOut) {
        pp->buf = (char*) pp + (int) sizeof(csMsgBuffer);
        pp->buf[0] = (char) '\0';
      }
      else
        pp->buf = (char*) 0;
      csoundSetHostData(csound, (void*) pp);
      if (!toStdOut)
        csoundSetMessageCallback(csound, csoundMessageBufferCallback_1_);
      else
        csoundSetMessageCallback(csound, csoundMessageBufferCallback_2_);
  }


Generated by  Doxygen 1.6.0   Back to index