Canorus  0.0
Public Member Functions | Private Member Functions | Private Attributes | List of all members
CAMidiExport Class Reference

Midi file export filter This class is used to export the document or parts of the document to a midi file. The most common use is to simply call one of the constructors. More...

#include <midiexport.h>

Inheritance diagram for CAMidiExport:
Inheritance graph
[legend]

Public Member Functions

 CAMidiExport (QTextStream *out=0)
 
QMap< int, QString > getOutputPorts ()
 
QMap< int, QString > getInputPorts ()
 
bool openOutputPort (int port)
 
bool openInputPort (int port)
 
void closeOutputPort ()
 
void closeInputPort ()
 
void send (QVector< unsigned char > message, int time)
 
void sendMetaEvent (int timeLength, int event, int a, int b, int c)
 
void writeFile ()
 
- Public Member Functions inherited from CAExport
 CAExport (QTextStream *stream=0)
 
virtual ~CAExport ()
 
virtual const QString readableStatus ()
 
void exportDocument (CADocument *, bool bStartThread=true)
 
void exportSheet (CASheet *)
 
void exportStaff (CAStaff *)
 
void exportVoice (CAVoice *)
 
void exportLyricsContext (CALyricsContext *)
 
void exportFunctionMarkContext (CAFunctionMarkContext *)
 
CADocumentexportedDocument ()
 
CASheetexportedSheet ()
 
CAStaffexportedStaff ()
 
CAVoiceexportedVoice ()
 
CALyricsContextexportedLyricsContext ()
 
CAFunctionMarkContextexportedFunctionMarkContext ()
 
virtual void setStreamToFile (const QString filename)
 
bool wait (unsigned long time=ULONG_MAX)
 
- Public Member Functions inherited from CAFile
 CAFile ()
 
virtual ~CAFile ()
 
const int status ()
 
const int progress ()
 
void setStreamFromFile (const QString filename)
 
void setStreamToFile (const QString filename)
 
void setStreamFromDevice (QIODevice *device)
 
void setStreamToDevice (QIODevice *device)
 
void setStreamToString ()
 
QString getStreamAsString ()
 
- Public Member Functions inherited from CAMidiDevice
 CAMidiDevice ()
 
virtual ~CAMidiDevice ()
 
CAMidiDeviceType midiDeviceType ()
 
bool isRealTime ()
 

Private Member Functions

QByteArray writeTime (int time)
 
void exportDocumentImpl (CADocument *doc)
 
void exportSheetImpl (CASheet *sheet)
 
int timeIncrement (int time)
 
void streamQByteArray (QByteArray x)
 
QByteArray variableLengthValue (int value)
 
QByteArray word16 (int x)
 
QByteArray textEvent (int time, QString s)
 
QByteArray trackEnd (void)
 
QByteArray timeSignature (void)
 
QByteArray keySignature (void)
 
void setChunkLength (QByteArray *x)
 
void setCurVoice (CAVoice *voice)
 
void setCurSheet (CASheet *sheet)
 

Private Attributes

int midiTrackCount
 
QByteArray trackChunk
 
int _trackTime
 
QVector< QByteArray > trackChunks
 
QVector< int > trackTimes
 
CAVoice_curVoice
 
CASheet_curSheet
 
QMap< int, QString > m_InputPorts
 
QMap< int, QString > m_OutputPorts
 

Additional Inherited Members

- Public Types inherited from CAMidiDevice
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 inherited from CAExport
void documentExported (CADocument *)
 
void sheetExported (CASheet *)
 
void staffExported (CAStaff *)
 
void voiceExported (CAVoice *)
 
void lyricsContextExported (CALyricsContext *)
 
void functionMarkContextExported (CAFunctionMarkContext *)
 
void exportDone (int status)
 
- Signals inherited from CAMidiDevice
void midiInEvent (QVector< unsigned char > message)
 
- Static Public Member Functions inherited from CAMidiDevice
static QStringList gmInstrumentList ()
 
static QString instrumentName (int midiProgram)
 
static QStringList instrumentNames ()
 
static unsigned char freeMidiChannel (CASheet *)
 
- Protected Member Functions inherited from CAExport
virtual void exportStaffImpl (CAStaff *)
 
virtual void exportVoiceImpl (CAVoice *)
 
virtual void exportLyricsContextImpl (CALyricsContext *)
 
virtual void exportFunctionMarkContextImpl (CAFunctionMarkContext *)
 
QTextStream & out ()
 
void run ()
 
- Protected Member Functions inherited from CAFile
void setStatus (const int status)
 
void setProgress (const int progress)
 
QTextStream * stream ()
 
virtual void setStream (QTextStream *stream)
 
QFile * file ()
 
void setFile (QFile *file)
 
- Protected Member Functions inherited from CAMidiDevice
void setRealTime (bool r)
 
void setMidiDeviceType (CAMidiDeviceType t)
 
- Protected Attributes inherited from CAMidiDevice
CAMidiDeviceType _midiDeviceType
 
bool _realTime
 

Detailed Description

Midi file export filter This class is used to export the document or parts of the document to a midi file. The most common use is to simply call one of the constructors.

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 LICENSE.GPL for details.

CAMidiExport( myDocument, &textStream );

textStream is usually the file stream.

See also
CAMidiImport

Constructor & Destructor Documentation

◆ CAMidiExport()

CAMidiExport::CAMidiExport ( QTextStream *  out = 0)

Constructor for midi file export. Called when choosing the mid/midi file extension in the export dialog. Exports all voices to the given text stream.

References CAMidiDevice::_midiDeviceType, _trackTime, CAMidiDevice::MidiExportDevice, and CAMidiDevice::setRealTime().

Here is the call graph for this function:

Member Function Documentation

◆ closeInputPort()

void CAMidiExport::closeInputPort ( )
inlinevirtual

Implements CAMidiDevice.

◆ closeOutputPort()

void CAMidiExport::closeOutputPort ( )
inlinevirtual

Implements CAMidiDevice.

◆ exportDocumentImpl()

void CAMidiExport::exportDocumentImpl ( CADocument doc)
privatevirtual

Exports the current document to Lilypond syntax as a complete .ly file.

Reimplemented from CAExport.

References CASheet::contextList(), CAContext::FiguredBassContext, CAContext::FunctionMarkContext, CAContext::LyricsContext, CAPlayback::run(), setCurSheet(), setCurVoice(), CADocument::sheetList(), CAContext::Staff, trackChunk, CAStaff::voiceList(), and writeFile().

Here is the call graph for this function:

◆ exportSheetImpl()

void CAMidiExport::exportSheetImpl ( CASheet sheet)
privatevirtual

Exports the current document to Lilypond syntax as a complete .ly file.

Reimplemented from CAExport.

References CASheet::contextList(), CAContext::FiguredBassContext, CAContext::FunctionMarkContext, CAContext::LyricsContext, CAPlayback::run(), setCurSheet(), setCurVoice(), CAContext::Staff, trackChunk, CAStaff::voiceList(), and writeFile().

Here is the call graph for this function:

◆ getInputPorts()

QMap<int, QString> CAMidiExport::getInputPorts ( )
inlinevirtual

Implements CAMidiDevice.

References m_OutputPorts.

◆ getOutputPorts()

QMap<int, QString> CAMidiExport::getOutputPorts ( )
inlinevirtual

Implements CAMidiDevice.

References m_InputPorts.

◆ keySignature()

QByteArray CAMidiExport::keySignature ( void  )
private

◆ openInputPort()

bool CAMidiExport::openInputPort ( int  port)
inlinevirtual

Implements CAMidiDevice.

◆ openOutputPort()

bool CAMidiExport::openOutputPort ( int  port)
inlinevirtual

Implements CAMidiDevice.

◆ send()

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

Implements CAMidiDevice.

References timeIncrement(), trackChunk, and writeTime().

Referenced by CAMidiRecorder::onMidiInEvent().

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

◆ sendMetaEvent()

void CAMidiExport::sendMetaEvent ( int  timeLength,
int  event,
int  a,
int  b,
int  c 
)
virtual

Implements CAMidiDevice.

References CAMidiDevice::Meta_Keysig, CAMidiDevice::Meta_Tempo, CAMidiDevice::Meta_Timesig, CAMidiDevice::Midi_Ctl_Event, timeIncrement(), trackChunk, variableLengthValue(), and writeTime().

Referenced by CAMidiRecorder::startRecording().

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

◆ setChunkLength()

void CAMidiExport::setChunkLength ( QByteArray *  x)
private

Referenced by writeFile().

Here is the caller graph for this function:

◆ setCurSheet()

void CAMidiExport::setCurSheet ( CASheet sheet)
inlineprivate

References _curSheet.

Referenced by exportDocumentImpl(), and exportSheetImpl().

Here is the caller graph for this function:

◆ setCurVoice()

void CAMidiExport::setCurVoice ( CAVoice voice)
inlineprivate

References _curVoice.

Referenced by exportDocumentImpl(), and exportSheetImpl().

Here is the caller graph for this function:

◆ streamQByteArray()

void CAMidiExport::streamQByteArray ( QByteArray  x)
private

References CAExport::out().

Referenced by writeFile().

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

◆ textEvent()

QByteArray CAMidiExport::textEvent ( int  time,
QString  s 
)
private

References META_TEXT, MIDI_CTL_EVENT, variableLengthValue(), and writeTime().

Referenced by writeFile().

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

◆ timeIncrement()

int CAMidiExport::timeIncrement ( int  time)
private

Compute the time offset for a new event and update the current track time.

References _trackTime.

Referenced by send(), and sendMetaEvent().

Here is the caller graph for this function:

◆ timeSignature()

QByteArray CAMidiExport::timeSignature ( void  )
private

◆ trackEnd()

QByteArray CAMidiExport::trackEnd ( void  )
private

References META_TRACK_END, MIDI_CTL_EVENT, and writeTime().

Referenced by writeFile().

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

◆ variableLengthValue()

QByteArray CAMidiExport::variableLengthValue ( int  value)
private

Referenced by sendMetaEvent(), and textEvent().

Here is the caller graph for this function:

◆ word16()

QByteArray CAMidiExport::word16 ( int  x)
private

Referenced by writeFile().

Here is the caller graph for this function:

◆ writeFile()

void CAMidiExport::writeFile ( )

References CAPlayableLength::playableLengthToTimeLength(), CAPlayableLength::Quarter, setChunkLength(), streamQByteArray(), textEvent(), trackChunk, trackEnd(), and word16().

Referenced by exportDocumentImpl(), exportSheetImpl(), and CAMidiRecorder::stopRecording().

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

◆ writeTime()

QByteArray CAMidiExport::writeTime ( int  time)
private

Referenced by send(), sendMetaEvent(), textEvent(), and trackEnd().

Here is the caller graph for this function:

Member Data Documentation

◆ _curSheet

CASheet* CAMidiExport::_curSheet
private

Referenced by setCurSheet().

◆ _curVoice

CAVoice* CAMidiExport::_curVoice
private

Referenced by setCurVoice().

◆ _trackTime

int CAMidiExport::_trackTime
private

Referenced by CAMidiExport(), and timeIncrement().

◆ m_InputPorts

QMap<int, QString> CAMidiExport::m_InputPorts
private

Referenced by getOutputPorts().

◆ m_OutputPorts

QMap<int, QString> CAMidiExport::m_OutputPorts
private

Referenced by getInputPorts().

◆ midiTrackCount

int CAMidiExport::midiTrackCount
private

◆ trackChunk

QByteArray CAMidiExport::trackChunk
private

◆ trackChunks

QVector<QByteArray> CAMidiExport::trackChunks
private

◆ trackTimes

QVector<int> CAMidiExport::trackTimes
private

The documentation for this class was generated from the following files:
CAMidiExport::CAMidiExport
CAMidiExport(QTextStream *out=0)
Definition: midiexport.cpp:44