Canorus  0.0
Public Types | Signals | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Static Private Attributes | Friends | List of all members
CAMidiDevice Class Referenceabstract

Canorus<->Midi bridge. More...

#include <mididevice.h>

Inheritance diagram for CAMidiDevice:
Inheritance graph
[legend]

Public Types

enum  CAMidiDeviceType { RtMidiDevice, MidiExportDevice }
 
enum  midiCommands {
  Meta_Text = 0x01, Meta_Copyright = 0x02, Meta_SeqTrkName = 0x03, Meta_InstrName = 0x04,
  Meta_Lyric = 0x05, Meta_Marker = 0x06, Meta_CuePoint = 0x07, Meta_Tempo = 0x51,
  Meta_SMPTEOffs = 0x54, Meta_Timesig = 0x58, Meta_Keysig = 0x59, Meta_Track_End = 0x2f,
  Midi_Ctl_Reverb = 0x5b, Midi_Ctl_Chorus = 0x5d, Midi_Ctl_Pan = 0x0a, Midi_Ctl_Volume = 0x07,
  Midi_Ctl_Sustain = 0x40, Midi_Ctl_Event = 0xff, Midi_Note_Off = 0x80, Midi_Note_On = 0x90,
  Midi_Prog_Change = 0xc0, Midi_Control_Chg = 0xb0
}
 

Signals

void midiInEvent (QVector< unsigned char > message)
 

Public Member Functions

 CAMidiDevice ()
 
virtual ~CAMidiDevice ()
 
CAMidiDeviceType midiDeviceType ()
 
bool isRealTime ()
 
virtual QMap< int, QString > getOutputPorts ()=0
 
virtual QMap< int, QString > getInputPorts ()=0
 
virtual bool openOutputPort (int port)=0
 
virtual bool openInputPort (int port)=0
 
virtual void closeOutputPort ()=0
 
virtual void closeInputPort ()=0
 
virtual void send (QVector< unsigned char > message, int time)=0
 
virtual void sendMetaEvent (int time, int event, int a, int b, int c)=0
 

Static Public Member Functions

static QStringList gmInstrumentList ()
 
static QString instrumentName (int midiProgram)
 
static QStringList instrumentNames ()
 
static unsigned char freeMidiChannel (CASheet *)
 

Protected Member Functions

void setRealTime (bool r)
 
void setMidiDeviceType (CAMidiDeviceType t)
 

Protected Attributes

CAMidiDeviceType _midiDeviceType
 
bool _realTime
 

Static Private Attributes

static QStringList GM_INSTRUMENTS
 

Friends

void rtMidiInCallback (double deltatime, std::vector< unsigned char > *message, void *userData)
 

Detailed Description

Canorus<->Midi bridge.

This class represents generic Midiinterface to Canorus. Any Midi wrapper class should extend this class.

Currently CARtMidi is one of the Midi libraries implemented. This class is an example of the so called real-time Midi classes. This means that the midi event will be heard at the moment it is sent.

Another example is CAMidiExport. This is a Midi file writer. The class is an example of the non-real-time Midi classes. It needs also the time to write the midi event to a file.

Warning
MIDI INPUT is not available for Swig and therefore scripting languages yet.

Member Enumeration Documentation

◆ CAMidiDeviceType

Enumerator
RtMidiDevice 
MidiExportDevice 

◆ midiCommands

Enumerator
Meta_Text 
Meta_Copyright 
Meta_SeqTrkName 
Meta_InstrName 
Meta_Lyric 
Meta_Marker 
Meta_CuePoint 
Meta_Tempo 
Meta_SMPTEOffs 
Meta_Timesig 
Meta_Keysig 
Meta_Track_End 
Midi_Ctl_Reverb 
Midi_Ctl_Chorus 
Midi_Ctl_Pan 
Midi_Ctl_Volume 
Midi_Ctl_Sustain 
Midi_Ctl_Event 
Midi_Note_Off 
Midi_Note_On 
Midi_Prog_Change 
Midi_Control_Chg 

Constructor & Destructor Documentation

◆ CAMidiDevice()

CAMidiDevice::CAMidiDevice ( )

◆ ~CAMidiDevice()

virtual CAMidiDevice::~CAMidiDevice ( )
inlinevirtual

Member Function Documentation

◆ closeInputPort()

virtual void CAMidiDevice::closeInputPort ( )
pure virtual

Implemented in CARtMidiDevice, and CAMidiExport.

Referenced by CASettings::setMidiInPort().

Here is the caller graph for this function:

◆ closeOutputPort()

virtual void CAMidiDevice::closeOutputPort ( )
pure virtual

Implemented in CARtMidiDevice, and CAMidiExport.

Referenced by CAMainWin::playbackFinished().

Here is the caller graph for this function:

◆ freeMidiChannel()

unsigned char CAMidiDevice::freeMidiChannel ( CASheet s)
static

Returns the first midi channel that isn't occupied by voices in the given sheet s yet. Returns 0, if all the channels are occupied.

Warning
This function never returns midi channel 10 as it's reserved for percussion instruments only.

References CASheet::voiceList().

Referenced by CAVoice::CAVoice().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getInputPorts()

virtual QMap<int, QString> CAMidiDevice::getInputPorts ( )
pure virtual

Implemented in CARtMidiDevice, and CAMidiExport.

Referenced by CASettingsDialog::setupPages().

Here is the caller graph for this function:

◆ getOutputPorts()

virtual QMap<int, QString> CAMidiDevice::getOutputPorts ( )
pure virtual

Implemented in CARtMidiDevice, and CAMidiExport.

Referenced by CASettingsDialog::setupPages().

Here is the caller graph for this function:

◆ gmInstrumentList()

static QStringList CAMidiDevice::gmInstrumentList ( )
inlinestatic

References GM_INSTRUMENTS.

◆ instrumentName()

QString CAMidiDevice::instrumentName ( int  midiProgram)
static

This function returns translated instrument name for the given MIDI program.

See also
instrumentNames(), GM_INSTRUMENTS

References GM_INSTRUMENTS.

Referenced by CADrawableMark::CADrawableMark(), and CADrawableMark::draw().

Here is the caller graph for this function:

◆ instrumentNames()

QStringList CAMidiDevice::instrumentNames ( )
static

This function returns a list of translated GM instruments.

See also
instrumentName(), GM_INSTRUMENTS

References GM_INSTRUMENTS.

Referenced by CAMainWin::createCustomActions().

Here is the caller graph for this function:

◆ isRealTime()

bool CAMidiDevice::isRealTime ( )
inline

References _realTime.

◆ midiDeviceType()

CAMidiDeviceType CAMidiDevice::midiDeviceType ( )
inline

References _midiDeviceType.

◆ midiInEvent

void CAMidiDevice::midiInEvent ( QVector< unsigned char >  message)
signal

Referenced by rtMidiInCallback().

Here is the caller graph for this function:

◆ openInputPort()

virtual bool CAMidiDevice::openInputPort ( int  port)
pure virtual

Implemented in CARtMidiDevice, and CAMidiExport.

Referenced by CASettings::setMidiInPort().

Here is the caller graph for this function:

◆ openOutputPort()

virtual bool CAMidiDevice::openOutputPort ( int  port)
pure virtual

Implemented in CARtMidiDevice, and CAMidiExport.

Referenced by CAMainWin::on_uiPlayFromSelection_toggled(), and CAPlayback::playImmediately().

Here is the caller graph for this function:

◆ send()

virtual void CAMidiDevice::send ( QVector< unsigned char >  message,
int  time 
)
pure virtual

Implemented in CARtMidiDevice, and CAMidiExport.

Referenced by CAPlayback::initStreams(), CAPlayback::playSelectionImpl(), and CAPlayback::run().

Here is the caller graph for this function:

◆ sendMetaEvent()

virtual void CAMidiDevice::sendMetaEvent ( int  time,
int  event,
int  a,
int  b,
int  c 
)
pure virtual

Implemented in CAMidiExport, and CARtMidiDevice.

Referenced by CAPlayback::loopUntilPlayable(), and CAPlayback::run().

Here is the caller graph for this function:

◆ setMidiDeviceType()

void CAMidiDevice::setMidiDeviceType ( CAMidiDeviceType  t)
inlineprotected

References _midiDeviceType.

◆ setRealTime()

void CAMidiDevice::setRealTime ( bool  r)
inlineprotected

References _realTime.

Referenced by CAMidiExport::CAMidiExport(), and CARtMidiDevice::CARtMidiDevice().

Here is the caller graph for this function:

Friends And Related Function Documentation

◆ rtMidiInCallback

void rtMidiInCallback ( double  deltatime,
std::vector< unsigned char > *  message,
void *  userData 
)
friend

Callback function which gets called by RtMidi automatically when an information on MidiIn device has come.

Referenced by CARtMidiDevice::openInputPort().

Member Data Documentation

◆ _midiDeviceType

CAMidiDeviceType CAMidiDevice::_midiDeviceType
protected

◆ _realTime

bool CAMidiDevice::_realTime
protected

Referenced by isRealTime(), and setRealTime().

◆ GM_INSTRUMENTS

CAMidiDevice::GM_INSTRUMENTS
staticprivate

Copyright (c) 2007, Matevž Jekovec, Canorus development team All Rights Reserved. See AUTHORS for a complete list of authors.

Licensed under the GNU GENERAL PUBLIC LICENSE. See COPYING for details.

Original General Midi Instruments (program) names. Call instrumentName() or instrumentNames() to get translated strings.

Referenced by gmInstrumentList(), instrumentName(), and instrumentNames().


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