Csound and CsoundAC API  5.17
Public Member Functions | Protected Member Functions | Static Private Member Functions | Private Attributes
CsoundMidiOutputStream Class Reference

The following class allows receiving MIDI output messages from a Csound instance. More...

#include <cs_glue.hpp>

+ Inheritance diagram for CsoundMidiOutputStream:

Public Member Functions

 CsoundMidiOutputStream (CSOUND *csound)
 CsoundMidiOutputStream (Csound *csound)
void EnableMidiOutput (CsoundArgVList *argv)
 Enables MIDI output for the associated Csound instance.
int GetChannel ()
 Returns the channel number (1 to 16) for the first message in the buffer.
int GetData1 ()
 Returns the first data byte (0 to 127) for the first message in the buffer.
int GetData2 ()
 Returns the second data byte (0 to 127) for the first message in the buffer.
int GetStatus ()
 Returns the status byte for the first message in the buffer, not including the channel number in the case of channel messages.
int PopMessage ()
 Pops and returns the first message from the buffer, in the following format: STATUS + DATA1 * 256 + DATA2 * 65536 where STATUS also includes the channel number (0 to 15), if any.
 ~CsoundMidiOutputStream ()

Protected Member Functions

int SendMidiData (const unsigned char *buf, int nBytes)
 Copies at most 'nBytes' bytes of MIDI data to the buffer from 'buf'.

Static Private Member Functions

static int midiOutCloseCallback (CSOUND *, void *)
static int midiOutOpenCallback (CSOUND *, void **, const char *)
static int midiOutWriteCallback (CSOUND *, void *, const unsigned char *, int)

Private Attributes

unsigned char buf_ [4096]
CSOUNDcsound

Detailed Description

The following class allows receiving MIDI output messages from a Csound instance.

Constructor & Destructor Documentation

CsoundMidiOutputStream::CsoundMidiOutputStream ( CSOUND csound)
CsoundMidiOutputStream::CsoundMidiOutputStream ( Csound *  csound)
CsoundMidiOutputStream::~CsoundMidiOutputStream ( )
inline

Member Function Documentation

void CsoundMidiOutputStream::EnableMidiOutput ( CsoundArgVList argv)

Enables MIDI output for the associated Csound instance.

Should be called between csoundPreCompile() and csoundCompile(). If 'argv' is not NULL, the command line arguments required for MIDI output are appended.

int CsoundMidiOutputBuffer::GetChannel ( )
inherited

Returns the channel number (1 to 16) for the first message in the buffer.

The return value is zero if there are no messages, or the first message is not a channel message.

int CsoundMidiOutputBuffer::GetData1 ( )
inherited

Returns the first data byte (0 to 127) for the first message in the buffer.

The return value is zero if there are no messages, or the first message does not have any data bytes.

int CsoundMidiOutputBuffer::GetData2 ( )
inherited

Returns the second data byte (0 to 127) for the first message in the buffer.

The return value is zero if there are no messages, or the first message has less than two data bytes.

int CsoundMidiOutputBuffer::GetStatus ( )
inherited

Returns the status byte for the first message in the buffer, not including the channel number in the case of channel messages.

The return value is zero if there are no messages.

static int CsoundMidiOutputStream::midiOutCloseCallback ( CSOUND ,
void *   
)
staticprivate
static int CsoundMidiOutputStream::midiOutOpenCallback ( CSOUND ,
void **  ,
const char *   
)
staticprivate
static int CsoundMidiOutputStream::midiOutWriteCallback ( CSOUND ,
void *  ,
const unsigned char *  ,
int   
)
staticprivate
int CsoundMidiOutputBuffer::PopMessage ( )
inherited

Pops and returns the first message from the buffer, in the following format: STATUS + DATA1 * 256 + DATA2 * 65536 where STATUS also includes the channel number (0 to 15), if any.

The return value is zero if there are no messages.

int CsoundMidiOutputBuffer::SendMidiData ( const unsigned char *  buf,
int  nBytes 
)
protectedinherited

Copies at most 'nBytes' bytes of MIDI data to the buffer from 'buf'.

Returns the number of bytes copied.

Field Documentation

unsigned char CsoundMidiOutputStream::buf_[4096]
private
CSOUND* CsoundMidiOutputStream::csound
private