CSL 5.2

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | Static Protected Attributes
csl::MIDIPlayer Class Reference

MIDI stream/file player. More...

`#include <MIDIIOJ.h>`

Inheritance diagram for csl::MIDIPlayer:

List of all members.

## Public Member Functions
| MIDIPlayer (string nam, InstrumentLibrary *lib)
| MIDIPlayer (string folder, string nam, InstrumentLibrary *lib)
| ~MIDIPlayer ()
void | open (int devID)
| open a device
void | start (int index)
| open a device (empty method)
void | stop ()
| stop playing
void | open ()
| open the abstract
bool | isOpen ()
| true if MIDI stream is opened.
virtual void | close ()
| closing MIDI stream
void | close ()
| closing MIDI stream
virtual void | start ()
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
virtual int | evaluate (void *argument)

## Static Public Member Functions
static int | countDevices ()
static void | dumpDevices ()
| printing device info for all devices.

## Public Attributes
MidiFile | mFile
| JUCE MIDI file.
int | mNumTrax
| num tracks
MidiMessageSequence * | mTrak
| track ptr
bool | mIsOn
| Active flag.
InstrumentLibrary * | mLibrary
| instrument library
float | mTempoScale
| tempo scale (secs/beat / ticks/beat)
int | mDeviceID
| device ID which will/is opened.
CMIDIMessage | mMsg
| current message (its flags determine the port state)
CMIDIMessage | mMsg2
MidiBuffer | mBuffer
| I/O buffer.

## Protected Member Functions
void | init (String namS)
MidiMessageSequence * | mergeTrax ()
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
PmDeviceID | mDeviceID
| device ID which will/is opened.
MidiMessage * | mJMsg
| JUCE-format message.
bool | mIsOpen
| instance status indicators
long | mBufferSize
long | mFilterFlag
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

MIDI stream/file player.

Definition at line 187 of file MIDIIOJ.h.

## Constructor & Destructor Documentation

MIDIPlayer::MIDIPlayer | ( | string | nam,
|  | InstrumentLibrary * | lib
| ) |  |

Definition at line 410 of file MIDIIOJ.cpp.

References init(), and mLibrary.

MIDIPlayer::MIDIPlayer | ( | string | folder,
|  | string | nam,
|  | InstrumentLibrary * | lib
| ) |  |

Definition at line 418 of file MIDIIOJ.cpp.

References init(), and mLibrary.

csl::MIDIPlayer::~MIDIPlayer | ( |  | ) |
| inline

Definition at line 191 of file MIDIIOJ.h.

## Member Function Documentation

void csl::MIDIPlayer::open | ( | int | devID | ) |
| inline virtual

open a device

Implements csl::MIDIIO.

Definition at line 193 of file MIDIIOJ.h.

void MIDIPlayer::start | ( | int | index | ) |

open a device (empty method)

play a track; merges tracks if index< 0

Definition at line 428 of file MIDIIOJ.cpp.

References csl::CMIDIMessage::channel, csl::MIDIIO::copyMessage(), csl::CMIDIMessage::data1, csl::CMIDIMessage::data2, csl::fRand1(), csl::fTimeNow(), csl::Instrument::isActive(), csl::CMIDIMessage::isNoteOn(), csl::logMsg(), mergeTrax(), mFile, mIsOn, mLibrary, csl::MIDIIO::mMsg, mTempoScale, mTrak, csl::Instrument::playMIDI(), set_position_f, csl::Instrument::setParameter(), and csl::sleepSec().

void MIDIPlayer::stop | ( | void |  | ) |
| virtual

stop playing

Reimplemented from csl::MIDIIO.

Definition at line 501 of file MIDIIOJ.cpp.

References mIsOn.

void MIDIPlayer::init | ( | String | namS | ) |
| protected

Definition at line 383 of file MIDIIOJ.cpp.

References csl::logMsg(), mFile, mIsOn, mNumTrax, mTempoScale, and mTrak.

Referenced by MIDIPlayer().

MidiMessageSequence * MIDIPlayer::mergeTrax | ( |  | ) |
| protected

Definition at line 507 of file MIDIIOJ.cpp.

References mFile, and mNumTrax.

Referenced by start().

int MIDIIO::countDevices | ( |  | ) |
| static inherited

Definition at line 51 of file MIDIIOJ.cpp.

void MIDIIO::dumpDevices | ( |  | ) |
| static inherited

printing device info for all devices.

Definition at line 58 of file MIDIIOJ.cpp.

References csl::logMsg().

void MIDIIO::open | ( |  | ) |
| inherited

open the abstract

Reimplemented in csl::MIDIOut, and csl::MIDIIn.

Definition at line 87 of file MIDIIOJ.cpp.

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 | ( |  | ) |
| virtual inherited

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

virtual void csl::MIDIIO::start | ( | void |  | ) |
| inline virtual inherited

Reimplemented in csl::MIDIIn.

Definition at line 98 of file MIDIIOJ.h.

void MIDIIO::clear | ( |  | ) |
| virtual inherited

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 | ) |
| protected inherited

error handler

Definition at line 194 of file MIDIIOJ.cpp.

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

void MIDIIO::copyMessage | ( | CMIDIMessage & | source,
|  | CMIDIMessage & | dest
| ) |  |
| protected inherited

copy csl::CMIDIMessage <–> juce::MidiMessage

Definition at line 109 of file MIDIIOJ.cpp.

References csl::CMIDIMessage::channel, csl::CMIDIMessage::command, csl::CMIDIMessage::data1, csl::CMIDIMessage::data2, csl::CMIDIMessage::message, and csl::CMIDIMessage::time.

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

void MIDIIO::copyMessage | ( | CMIDIMessage & | source,
|  | MidiMessage * | dest
| ) |  |
| protected inherited

Definition at line 118 of file MIDIIOJ.cpp.

References csl::CMIDIMessage::channel, csl::CMIDIMessage::command, csl::CMIDIMessage::data1, csl::CMIDIMessage::data2, and csl::CMIDIMessage::time.

void MIDIIO::copyMessage | ( | const MidiMessage & | source,
|  | CMIDIMessage & | dest
| ) |  |
| protected inherited

Definition at line 127 of file MIDIIOJ.cpp.

References CCOPY_MSG, csl::CMIDIMessage::channel, csl::CMIDIMessage::command, data, csl::CMIDIMessage::data1, csl::CMIDIMessage::data2, csl::kAftertouch, csl::kControlChange, csl::kLogError, csl::kNoteOff, csl::kNoteOn, csl::kPitchWheel, csl::kPolyTouch, csl::kProgramChange, csl::kSysEX, csl::logMsg(), csl::CMIDIMessage::message, csl::MIDIIO::mMsg, and csl::CMIDIMessage::time.

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 csl::MIDIIn::open(), and csl::MIDIOut::open().

void MIDIIO::handle_error | ( | PmError | err | ) |
| protected inherited

Definition at line 156 of file MIDIIOP.cpp.

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

Referenced by csl::MIDIIn::filter_active_sensing(), csl::MIDIIn::filter_clock_msg(), csl::MIDIIn::filter_sysex(), csl::MIDIIn::open(), csl::MIDIOut::open(), csl::MIDIIn::read(), csl::MIDIIn::setFilter(), csl::MIDIOut::write(), csl::MIDIOut::write_Aftertouch(), csl::MIDIOut::write_ControlChange(), csl::MIDIOut::write_NoteOff(), csl::MIDIOut::write_NoteOn(), csl::MIDIOut::write_PitchWheel(), csl::MIDIOut::write_PolyTouch(), csl::MIDIOut::write_ProgramChange(), csl::MIDIOut::write_short(), and csl::MIDIOut::write_SysEX().

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

Definition at line 507 of file CGestalt.cpp.

References csl::logMsg().

Referenced by csl::SpatialPanner::setSpeakerLayout(), and csl::SpatialPanner::~SpatialPanner().

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(), csl::MIDIIn::handleIncomingMidiMessage(), and csl::SpeakerLayout::setDefaultSpeakerLayout().

virtual int csl::Model::evaluate | ( | void * | argument | ) |
| inline virtual inherited

Reimplemented in csl::MIDIIn.

Definition at line 259 of file CGestalt.h.

## Member Data Documentation

MidiFile csl::MIDIPlayer::mFile

JUCE MIDI file.

Definition at line 197 of file MIDIIOJ.h.

Referenced by init(), mergeTrax(), and start().

int csl::MIDIPlayer::mNumTrax

num tracks

Definition at line 198 of file MIDIIOJ.h.

Referenced by init(), and mergeTrax().

MidiMessageSequence* csl::MIDIPlayer::mTrak

track ptr

Definition at line 199 of file MIDIIOJ.h.

Referenced by init(), and start().

bool csl::MIDIPlayer::mIsOn

Active flag.

Definition at line 200 of file MIDIIOJ.h.

Referenced by init(), start(), and stop().

InstrumentLibrary* csl::MIDIPlayer::mLibrary

instrument library

Definition at line 202 of file MIDIIOJ.h.

Referenced by MIDIPlayer(), and start().

float csl::MIDIPlayer::mTempoScale

tempo scale (secs/beat / ticks/beat)

Definition at line 203 of file MIDIIOJ.h.

Referenced by init(), and start().

int csl::MIDIIO::mDeviceID
| inherited

device ID which will/is opened.

Definition at line 103 of file MIDIIOJ.h.

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

PmDeviceID csl::MIDIIO::mDeviceID
| protected inherited

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::mMsg
| inherited

current message (its flags determine the port state)

Reimplemented in csl::MIDIOut, and csl::MIDIIn.

Definition at line 104 of file MIDIIOJ.h.

Referenced by csl::MIDIIO::clear(), csl::MIDIIO::copyMessage(), csl::MIDIIO::MIDIIO(), and start().

CMIDIMessage csl::MIDIIO::mMsg2
| inherited

Definition at line 105 of file MIDIIOJ.h.

Referenced by csl::MIDIIn::handleIncomingMidiMessage().

MidiBuffer csl::MIDIIO::mBuffer
| inherited

I/O buffer.

Reimplemented in csl::MIDIIn.

Definition at line 106 of file MIDIIOJ.h.

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

static bool csl::MIDIIO::mIsInitialized = false
| static protected inherited

< 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
| protected inherited

JUCE-format message.

Definition at line 111 of file MIDIIOJ.h.

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

bool csl::MIDIIO::mIsOpen
| protected inherited

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 csl::MIDIIn::open().

long csl::MIDIIO::mBufferSize
| protected inherited

Reimplemented in csl::MIDIIn, and csl::MIDIOut.

Definition at line 114 of file MIDIIOJ.h.

long csl::MIDIIO::mFilterFlag
| protected inherited

Reimplemented in csl::MIDIIn.

Definition at line 115 of file MIDIIOJ.h.

PmStream* csl::MIDIIO::mMIDIStream
| protected inherited

opened stream

Definition at line 113 of file MIDIIOP.h.

Referenced by csl::MIDIIn::filter_active_sensing(), csl::MIDIIn::filter_clock_msg(), csl::MIDIIn::filter_sysex(), csl::MIDIIn::open(), csl::MIDIOut::open(), csl::MIDIIn::read(), csl::MIDIIn::setFilter(), csl::MIDIOut::write(), csl::MIDIOut::write_Aftertouch(), csl::MIDIOut::write_ControlChange(), csl::MIDIOut::write_NoteOff(), csl::MIDIOut::write_NoteOn(), csl::MIDIOut::write_PitchWheel(), csl::MIDIOut::write_PolyTouch(), csl::MIDIOut::write_ProgramChange(), csl::MIDIOut::write_short(), and csl::MIDIOut::write_SysEX().

unsigned MIDIIO::mNumInstantiated = 0
| static protected inherited

Definition at line 118 of file MIDIIOP.h.

bool MIDIIO::mIsPortTimeStarted = false
| static protected inherited

status indicators

Definition at line 121 of file MIDIIOP.h.

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

bool csl::MIDIIO::mIsInput
| protected inherited

Definition at line 122 of file MIDIIOP.h.

bool csl::MIDIIO::mIsOutput
| protected inherited

Definition at line 123 of file MIDIIOP.h.

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

- CSL/IO/MIDIIOJ.h
- CSL/IO/MIDIIOJ.cpp