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

The following class allows sending MIDI input messages to a Csound instance. More...

#include <cs_glue.hpp>

+ Inheritance diagram for CsoundMidiInputStream:

Public Member Functions

 CsoundMidiInputStream (CSOUND *csound)
 CsoundMidiInputStream (Csound *csound)
void EnableMidiInput (CsoundArgVList *argv)
 Enables MIDI input for the associated Csound instance.
void SendChannelPressure (int channel, int value)
 Sets channel pressure to 'value' (0 to 127) on 'channel' (1 to 16).
void SendControlChange (int channel, int ctl, int value)
 Sets controller 'ctl' (0 to 127) to 'value' (0 to 127) on 'channel' (1 to 16).
void SendMessage (int msg)
 Sends a MIDI message, 'msg' is calculated as follows: STATUS + DATA1 * 256 + DATA2 * 65536.
void SendMessage (int status, int channel, int data1, int data2)
 Sends a MIDI message; 'channel' should be in the range 1 to 16, and data1 and data2 should be in the range 0 to 127.
void SendNoteOff (int channel, int key, int velocity)
 Sends a note-off message on 'channel' (1 to 16) for 'key' (0 to 127) with 'velocity' (0 to 127).
void SendNoteOff (int channel, int key)
 Sends a note-off message on 'channel' (1 to 16) for 'key', using a 0x90 status with zero velocity.
void SendNoteOn (int channel, int key, int velocity)
 Sends a note-on message on 'channel' (1 to 16) for 'key' (0 to 127) with 'velocity' (0 to 127).
void SendPitchBend (int channel, int value)
 Sets pitch bend to 'value' (-8192 to 8191) on 'channel' (1 to 16).
void SendPolyphonicPressure (int channel, int key, int value)
 Sets polyphonic pressure on 'channel' (1 to 16) to 'value' (0 to 127) for 'key' (0 to 127).
void SendProgramChange (int channel, int pgm)
 Sends program change to 'pgm' (1 to 128) on 'channel' (1 to 16).
 ~CsoundMidiInputStream ()

Protected Member Functions

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

Static Private Member Functions

static int midiInCloseCallback (CSOUND *, void *)
static int midiInOpenCallback (CSOUND *, void **, const char *)
static int midiInReadCallback (CSOUND *, void *, unsigned char *, int)

Private Attributes

unsigned char buf_ [4096]
CSOUNDcsound

Detailed Description

The following class allows sending MIDI input messages to a Csound instance.

Constructor & Destructor Documentation

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

Member Function Documentation

void CsoundMidiInputStream::EnableMidiInput ( CsoundArgVList argv)

Enables MIDI input for the associated Csound instance.

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

int CsoundMidiInputBuffer::GetMidiData ( unsigned char *  buf,
int  nBytes 
)
protectedinherited

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

Returns the number of bytes copied.

static int CsoundMidiInputStream::midiInCloseCallback ( CSOUND ,
void *   
)
staticprivate
static int CsoundMidiInputStream::midiInOpenCallback ( CSOUND ,
void **  ,
const char *   
)
staticprivate
static int CsoundMidiInputStream::midiInReadCallback ( CSOUND ,
void *  ,
unsigned char *  ,
int   
)
staticprivate
void CsoundMidiInputBuffer::SendChannelPressure ( int  channel,
int  value 
)
inherited

Sets channel pressure to 'value' (0 to 127) on 'channel' (1 to 16).

void CsoundMidiInputBuffer::SendControlChange ( int  channel,
int  ctl,
int  value 
)
inherited

Sets controller 'ctl' (0 to 127) to 'value' (0 to 127) on 'channel' (1 to 16).

void CsoundMidiInputBuffer::SendMessage ( int  msg)
inherited

Sends a MIDI message, 'msg' is calculated as follows: STATUS + DATA1 * 256 + DATA2 * 65536.

void CsoundMidiInputBuffer::SendMessage ( int  status,
int  channel,
int  data1,
int  data2 
)
inherited

Sends a MIDI message; 'channel' should be in the range 1 to 16, and data1 and data2 should be in the range 0 to 127.

void CsoundMidiInputBuffer::SendNoteOff ( int  channel,
int  key,
int  velocity 
)
inherited

Sends a note-off message on 'channel' (1 to 16) for 'key' (0 to 127) with 'velocity' (0 to 127).

void CsoundMidiInputBuffer::SendNoteOff ( int  channel,
int  key 
)
inherited

Sends a note-off message on 'channel' (1 to 16) for 'key', using a 0x90 status with zero velocity.

void CsoundMidiInputBuffer::SendNoteOn ( int  channel,
int  key,
int  velocity 
)
inherited

Sends a note-on message on 'channel' (1 to 16) for 'key' (0 to 127) with 'velocity' (0 to 127).

void CsoundMidiInputBuffer::SendPitchBend ( int  channel,
int  value 
)
inherited

Sets pitch bend to 'value' (-8192 to 8191) on 'channel' (1 to 16).

void CsoundMidiInputBuffer::SendPolyphonicPressure ( int  channel,
int  key,
int  value 
)
inherited

Sets polyphonic pressure on 'channel' (1 to 16) to 'value' (0 to 127) for 'key' (0 to 127).

void CsoundMidiInputBuffer::SendProgramChange ( int  channel,
int  pgm 
)
inherited

Sends program change to 'pgm' (1 to 128) on 'channel' (1 to 16).

Field Documentation

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