CSL  5.2
csl::MIDIIn Class Reference

MIDIIn class is-a MidiInputCallback too, and an "input-ready" flag. More...

#include <MIDIIOJ.h>

+ Inheritance diagram for csl::MIDIIn:

List of all members.

Public Member Functions

 MIDIIn ()
unsigned bufferSize ()
void setBufferSize (unsigned bufferSize)
virtual void open (int deviceID)
 open a device
bool poll ()
 poll returns a bool (really quickly)
void nextEvent ()
 step to next event or reset flag
void dumpMessage ()
 print current msg
virtual void start ()
 start MIDI stream
virtual void stop ()
 stop MIDI stream
int evaluate (void *arg)
 evaluate answers the message command
void handleIncomingMidiMessage (MidiInput *source, const MidiMessage &message)
 implement inherited MidiInputCallback
 MIDIIn ()
unsigned buffer_size ()
void set_buffer_size (unsigned bufferSize)
void open ()
 method for opening the default stream.
void open (int deviceID)
 open a device
bool poll ()
void read ()
 generic read method. gets MIDI message and store it in mBuffer
void read_interpret ()
 read method and sets internal flag for which message was received
PmEvent buffer ()
void dump_buffer ()
CSL_MIDIMessage message ()
void dump_CSL_MIDIMessage ()
bool is_NoteOn_received ()
bool is_NoteOff_received ()
bool is_PolyTouch_received ()
bool is_ControlChange_received ()
bool is_ProgramChange_received ()
bool is_Aftertouch_received ()
bool is_PitchWheel_received ()
bool is_SysEX_received ()
unsigned get_note ()
unsigned get_velocity ()
unsigned get_PolyAftertouch ()
unsigned get_ControlChange_function ()
unsigned get_ControlChange_value ()
unsigned get_ProgramNumber ()
unsigned get_Aftertouch ()
unsigned get_PitchWheel ()
float get_frequency ()
float get_velocity_float ()
 has range of [0.0 1.0] mapped to [0 127]
void setFilter ()
void filter_active_sensing (bool flag)
void filter_sysex (bool flag)
void filter_clock_msg (bool flag)
bool isOpen ()
 true if MIDI stream is opened.
virtual void close ()
 closing MIDI stream
void close ()
 closing MIDI stream
virtual void clear ()
 stop MIDI stream
void dumpBuffer ()
bool is_open ()
 can't open the abstract class
void dump_device_info ()
 printing device info for all devices.
void dump_count_devices ()
 printing total number of devices available
int count_devices ()
int get_default_input_id ()
int get_default_output_id ()
const PmDeviceInfo * get_device_info (int deviceID)
void attachObserver (Observer *)
 (possibly notify obersvers on my death)
void detachObserver (Observer *)
void changed (void *argument)
 this is what I send to myself to notify my observers; It's not overridden in general. It results in the observers receiving update() calls < override evaluate to filter updates to the observer map

Static Public Member Functions

static int countDevices ()
static void dumpDevices ()
 printing device info for all devices.

Public Attributes

MidiInput * mDevice
 my device ptr
double mStartTime
 the time I was started
int mDeviceID
 device ID which will/is opened.
CMIDIMessage mMsg2

Protected Member Functions

void handleError (CException *err)
 error handler
void copyMessage (CMIDIMessage &source, CMIDIMessage &dest)
 copy csl::CMIDIMessage <–> juce::MidiMessage
void copyMessage (CMIDIMessage &source, MidiMessage *dest)
void copyMessage (const MidiMessage &source, CMIDIMessage &dest)
void handle_error (PmError err)

Protected Attributes

long mBufferSize
 fundamental members
long mFilterFlag
CSL_MIDIMessage mMsg
 current message (its flags determine the port state)
PmEvent mBuffer [1]
 buffer which gets filled by read()
PmError mLength
 length
PmDeviceID mDeviceID
 device ID which will/is opened.
MidiMessage * mJMsg
 JUCE-format message.
bool mIsOpen
 instance status indicators
PmStream * mMIDIStream
 opened stream
bool mIsInput
bool mIsOutput

Static Protected Attributes

static bool mIsInitialized = false
 < static flags to keep track of driver state
static unsigned mNumInstantiated = 0
static bool mIsPortTimeStarted = false
 status indicators

Detailed Description

MIDIIn class is-a MidiInputCallback too, and an "input-ready" flag.

MIDIIn class.

Definition at line 130 of file MIDIIOJ.h.


Constructor & Destructor Documentation

MIDIIn::MIDIIn ( )

Definition at line 202 of file MIDIIOJ.cpp.

References mBufferSize, mDevice, csl::MIDIIO::mDeviceID, and mFilterFlag.

csl::MIDIIn::MIDIIn ( )

Member Function Documentation

unsigned MIDIIn::bufferSize ( )

Definition at line 209 of file MIDIIOJ.cpp.

References mBufferSize.

Referenced by set_buffer_size(), and setBufferSize().

void MIDIIn::setBufferSize ( unsigned  bufferSize)

Definition at line 213 of file MIDIIOJ.cpp.

References bufferSize(), and mBufferSize.

void MIDIIn::open ( int  deviceID)
virtual

open a device

start MIDI stream

Implements csl::MIDIIO.

Definition at line 218 of file MIDIIOJ.cpp.

References gAudioDeviceManager, csl::kLogError, csl::logMsg(), mDevice, csl::MIDIIO::mDeviceID, and csl::MIDIIO::mIsOpen.

bool MIDIIn::poll ( )

poll returns a bool (really quickly)

Definition at line 263 of file MIDIIOJ.cpp.

References csl::kNone, csl::CSL_MIDIMessage::message, and mMsg.

void MIDIIn::nextEvent ( )

step to next event or reset flag

Definition at line 269 of file MIDIIOJ.cpp.

References csl::MIDIIO::copyMessage(), csl::kNone, mBuffer, csl::CSL_MIDIMessage::message, csl::MIDIIO::mJMsg, and mMsg.

void MIDIIn::start ( void  )
virtual

start MIDI stream

stop MIDI stream

Reimplemented from csl::MIDIIO.

Definition at line 233 of file MIDIIOJ.cpp.

References mDevice, and mStartTime.

void MIDIIn::stop ( void  )
virtual

stop MIDI stream

Reimplemented from csl::MIDIIO.

Definition at line 241 of file MIDIIOJ.cpp.

References mDevice.

int MIDIIn::evaluate ( void *  arg)
virtual

evaluate answers the message command

Reimplemented from csl::Model.

Definition at line 319 of file MIDIIOJ.cpp.

References csl::CMIDIMessage::message.

void MIDIIn::handleIncomingMidiMessage ( MidiInput *  source,
const MidiMessage &  message 
)
unsigned MIDIIn::buffer_size ( )

Definition at line 174 of file MIDIIOP.cpp.

References mBufferSize.

void MIDIIn::set_buffer_size ( unsigned  bufferSize)

Definition at line 178 of file MIDIIOP.cpp.

References bufferSize(), and mBufferSize.

void MIDIIn::open ( )
void csl::MIDIIn::open ( int  devID)
virtual

open a device

Implements csl::MIDIIO.

bool csl::MIDIIn::poll ( )
void MIDIIn::read ( )

generic read method. gets MIDI message and store it in mBuffer

Definition at line 221 of file MIDIIOP.cpp.

References csl::MIDIIO::handle_error(), csl::logMsg(), mBuffer, mLength, and csl::MIDIIO::mMIDIStream.

Referenced by read_interpret().

PmEvent csl::MIDIIn::buffer ( )
inline

Definition at line 145 of file MIDIIOP.h.

References mBuffer.

void MIDIIn::dump_buffer ( )

Definition at line 313 of file MIDIIOP.cpp.

References mBuffer.

CSL_MIDIMessage csl::MIDIIn::message ( )
inline

Definition at line 148 of file MIDIIOP.h.

References mMsg.

bool MIDIIn::is_NoteOn_received ( )

Definition at line 361 of file MIDIIOP.cpp.

References csl::kNoteOn, csl::CSL_MIDIMessage::message, and mMsg.

bool MIDIIn::is_NoteOff_received ( )

Definition at line 365 of file MIDIIOP.cpp.

References csl::kNoteOff, csl::CSL_MIDIMessage::message, and mMsg.

bool MIDIIn::is_PolyTouch_received ( )

Definition at line 369 of file MIDIIOP.cpp.

References csl::kPolyTouch, csl::CSL_MIDIMessage::message, and mMsg.

bool MIDIIn::is_ControlChange_received ( )

Definition at line 373 of file MIDIIOP.cpp.

References csl::kControlChange, csl::CSL_MIDIMessage::message, and mMsg.

bool MIDIIn::is_ProgramChange_received ( )

Definition at line 377 of file MIDIIOP.cpp.

References csl::kProgramChange, csl::CSL_MIDIMessage::message, and mMsg.

bool MIDIIn::is_Aftertouch_received ( )

Definition at line 381 of file MIDIIOP.cpp.

References csl::kAftertouch, csl::CSL_MIDIMessage::message, and mMsg.

bool MIDIIn::is_PitchWheel_received ( )

Definition at line 385 of file MIDIIOP.cpp.

References csl::kPitchWheel, csl::CSL_MIDIMessage::message, and mMsg.

bool MIDIIn::is_SysEX_received ( )

Definition at line 389 of file MIDIIOP.cpp.

References csl::kSysEX, csl::CSL_MIDIMessage::message, and mMsg.

unsigned MIDIIn::get_note ( )

Definition at line 393 of file MIDIIOP.cpp.

References csl::CSL_MIDIMessage::data1, and mMsg.

unsigned MIDIIn::get_velocity ( )

Definition at line 394 of file MIDIIOP.cpp.

References csl::CSL_MIDIMessage::data2, and mMsg.

unsigned MIDIIn::get_PolyAftertouch ( )

Definition at line 395 of file MIDIIOP.cpp.

References csl::CSL_MIDIMessage::data2, and mMsg.

unsigned MIDIIn::get_ControlChange_function ( )

Definition at line 396 of file MIDIIOP.cpp.

References csl::CSL_MIDIMessage::data1, and mMsg.

unsigned MIDIIn::get_ControlChange_value ( )

Definition at line 397 of file MIDIIOP.cpp.

References csl::CSL_MIDIMessage::data2, and mMsg.

unsigned MIDIIn::get_ProgramNumber ( )

Definition at line 398 of file MIDIIOP.cpp.

References csl::CSL_MIDIMessage::data1, and mMsg.

unsigned MIDIIn::get_Aftertouch ( )

Definition at line 399 of file MIDIIOP.cpp.

References csl::CSL_MIDIMessage::data1, and mMsg.

unsigned MIDIIn::get_PitchWheel ( )

Definition at line 400 of file MIDIIOP.cpp.

References csl::CSL_MIDIMessage::data1, csl::CSL_MIDIMessage::data2, and mMsg.

float MIDIIn::get_frequency ( )

Definition at line 401 of file MIDIIOP.cpp.

References csl::CSL_MIDIMessage::data1, csl::keyToFreq(), and mMsg.

float MIDIIn::get_velocity_float ( )

has range of [0.0 1.0] mapped to [0 127]

Definition at line 402 of file MIDIIOP.cpp.

References csl::CSL_MIDIMessage::data2, and mMsg.

void MIDIIn::setFilter ( )

Definition at line 404 of file MIDIIOP.cpp.

References csl::MIDIIO::handle_error(), and csl::MIDIIO::mMIDIStream.

void MIDIIn::filter_active_sensing ( bool  flag)
void MIDIIn::filter_sysex ( bool  flag)
void MIDIIn::filter_clock_msg ( bool  flag)
int MIDIIO::countDevices ( )
staticinherited

Definition at line 51 of file MIDIIOJ.cpp.

void MIDIIO::dumpDevices ( )
staticinherited

printing device info for all devices.

Definition at line 58 of file MIDIIOJ.cpp.

References csl::logMsg().

bool MIDIIO::isOpen ( )
inherited

true if MIDI stream is opened.

Definition at line 91 of file MIDIIOJ.cpp.

References csl::MIDIIO::mIsOpen.

void MIDIIO::close ( )
virtualinherited

closing MIDI stream

Definition at line 95 of file MIDIIOJ.cpp.

References csl::MIDIIO::clear(), and csl::MIDIIO::mIsOpen.

void csl::MIDIIO::close ( )
inherited

closing MIDI stream

void MIDIIO::clear ( )
virtualinherited

stop MIDI stream

clear MIDI stream

Definition at line 102 of file MIDIIOJ.cpp.

References csl::kNone, csl::MIDIIO::mBuffer, csl::CMIDIMessage::message, and csl::MIDIIO::mMsg.

Referenced by csl::MIDIIO::close().

void MIDIIO::dumpBuffer ( )
inherited

Definition at line 179 of file MIDIIOJ.cpp.

void MIDIIO::handleError ( CException err)
protectedinherited

error handler

Definition at line 194 of file MIDIIOJ.cpp.

References csl::kLogError, csl::logMsg(), and csl::CException::what().

void MIDIIO::copyMessage ( CMIDIMessage source,
MidiMessage *  dest 
)
protectedinherited
bool MIDIIO::is_open ( )
inherited

can't open the abstract class

true if MIDI stream is opened.

Definition at line 102 of file MIDIIOP.cpp.

References csl::MIDIIO::mIsOpen.

void MIDIIO::dump_device_info ( )
inherited

printing device info for all devices.

Definition at line 113 of file MIDIIOP.cpp.

void MIDIIO::dump_count_devices ( )
inherited

printing total number of devices available

thin wrapper for PortMidi functions. made available for flexibility.

Definition at line 132 of file MIDIIOP.cpp.

int MIDIIO::count_devices ( )
inherited

Definition at line 138 of file MIDIIOP.cpp.

int MIDIIO::get_default_input_id ( )
inherited

Definition at line 142 of file MIDIIOP.cpp.

int MIDIIO::get_default_output_id ( )
inherited

Definition at line 146 of file MIDIIOP.cpp.

const PmDeviceInfo * MIDIIO::get_device_info ( int  deviceID)
inherited

Definition at line 150 of file MIDIIOP.cpp.

Referenced by open(), and csl::MIDIOut::open().

void Model::attachObserver ( Observer o)
inherited

(possibly notify obersvers on my death)

register/remove observers

Definition at line 491 of file CGestalt.cpp.

References csl::logMsg(), csl::Observer::mKey, and csl::Observer::mPeriod.

Referenced by csl::SpatialPanner::setSpeakerLayout().

void Model::detachObserver ( Observer o)
inherited
void Model::changed ( void *  argument)
inherited

this is what I send to myself to notify my observers; It's not overridden in general. It results in the observers receiving update() calls < override evaluate to filter updates to the observer map

Definition at line 529 of file CGestalt.cpp.

References csl::logMsg().

Referenced by csl::SpeakerLayout::addSpeaker(), handleIncomingMidiMessage(), and csl::SpeakerLayout::setDefaultSpeakerLayout().


Member Data Documentation

MidiInput* csl::MIDIIn::mDevice

my device ptr

Definition at line 147 of file MIDIIOJ.h.

Referenced by MIDIIn(), open(), start(), and stop().

double csl::MIDIIn::mStartTime

the time I was started

Definition at line 148 of file MIDIIOJ.h.

Referenced by handleIncomingMidiMessage(), and start().

long csl::MIDIIn::mBufferSize
protected

fundamental members

Reimplemented from csl::MIDIIO.

Definition at line 179 of file MIDIIOP.h.

Referenced by buffer_size(), bufferSize(), MIDIIn(), open(), set_buffer_size(), and setBufferSize().

long csl::MIDIIn::mFilterFlag
protected

Reimplemented from csl::MIDIIO.

Definition at line 180 of file MIDIIOP.h.

Referenced by filter_active_sensing(), filter_clock_msg(), filter_sysex(), MIDIIn(), and open().

PmEvent csl::MIDIIn::mBuffer[1]
protected

buffer which gets filled by read()

Reimplemented from csl::MIDIIO.

Definition at line 184 of file MIDIIOP.h.

Referenced by buffer(), dump_buffer(), handleIncomingMidiMessage(), nextEvent(), read(), and read_interpret().

PmError csl::MIDIIn::mLength
protected

length

Definition at line 185 of file MIDIIOP.h.

Referenced by read().

int csl::MIDIIO::mDeviceID
inherited

device ID which will/is opened.

Definition at line 103 of file MIDIIOJ.h.

Referenced by MIDIIn(), csl::MIDIOut::MIDIOut(), open(), and csl::MIDIOut::open().

PmDeviceID csl::MIDIIO::mDeviceID
protectedinherited

device ID which will/is opened.

static to keep track of Pm_Initialize() / Pm_Terminate()

Definition at line 114 of file MIDIIOP.h.

CMIDIMessage csl::MIDIIO::mMsg2
inherited

Definition at line 105 of file MIDIIOJ.h.

Referenced by handleIncomingMidiMessage().

static bool csl::MIDIIO::mIsInitialized = false
staticprotectedinherited

< static flags to keep track of driver state

Definition at line 109 of file MIDIIOJ.h.

Referenced by csl::MIDIIO::MIDIIO(), and csl::MIDIIO::~MIDIIO().

MidiMessage* csl::MIDIIO::mJMsg
protectedinherited

JUCE-format message.

Definition at line 111 of file MIDIIOJ.h.

Referenced by nextEvent(), and csl::MIDIOut::write().

bool csl::MIDIIO::mIsOpen
protectedinherited

instance status indicators

Definition at line 113 of file MIDIIOJ.h.

Referenced by csl::MIDIIO::close(), csl::MIDIIO::is_open(), csl::MIDIIO::isOpen(), csl::MIDIIO::MIDIIO(), and open().

unsigned MIDIIO::mNumInstantiated = 0
staticprotectedinherited

Definition at line 118 of file MIDIIOP.h.

bool MIDIIO::mIsPortTimeStarted = false
staticprotectedinherited

status indicators

Definition at line 121 of file MIDIIOP.h.

Referenced by open(), and csl::MIDIOut::open().

bool csl::MIDIIO::mIsInput
protectedinherited

Definition at line 122 of file MIDIIOP.h.

bool csl::MIDIIO::mIsOutput
protectedinherited

Definition at line 123 of file MIDIIOP.h.


The documentation for this class was generated from the following files: