Canorus  0.7
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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 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)
 
- 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 printQByteArray (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
 

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 unsigned char freeMidiChannel (CASheet *)
 
static int diatonicPitchToMidiPitch (CADiatonicPitch)
 
static CADiatonicPitch midiPitchToDiatonicPitch (int)
 
static CADiatonicPitch midiPitchToDiatonicPitch (int, CADiatonicKey k)
 
- Public Attributes inherited from CAMidiDevice
QStringList GM_INSTRUMENTS
 
- Protected Member Functions inherited from CAExport
virtual void exportSheetImpl (CASheet *)
 
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 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 ( 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, CAMidiDevice::MidiExportDevice, CAMidiDevice::setRealTime(), and trackTime.

Here is the call graph for this function:

Member Function Documentation

void CAMidiExport::closeInputPort ( )
inlinevirtual

Implements CAMidiDevice.

void CAMidiExport::closeOutputPort ( )
inlinevirtual

Implements CAMidiDevice.

void CAMidiExport::exportDocumentImpl ( CADocument doc)
privatevirtual

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

Reimplemented from CAExport.

References CASheet::contextAt(), CASheet::contextCount(), CAContext::contextType(), CAPlayback::run(), setCurSheet(), setCurVoice(), CADocument::sheetAt(), CADocument::sheetCount(), CAContext::Staff, trackChunk, CAStaff::voiceAt(), CAStaff::voiceCount(), and writeFile().

Here is the call graph for this function:

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

Implements CAMidiDevice.

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

Implements CAMidiDevice.

QByteArray CAMidiExport::keySignature ( void  )
private

References META_KEYSIG, 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:

bool CAMidiExport::openInputPort ( int  port)
inlinevirtual

Implements CAMidiDevice.

bool CAMidiExport::openOutputPort ( int  port)
inlinevirtual

Implements CAMidiDevice.

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

Implements CAMidiDevice.

References trackChunk, trackTime, and writeTime().

Referenced by CAMidiRecorder::onMidiInEvent().

Here is the call graph for this function:

Here is the caller graph for this function:

void CAMidiExport::setChunkLength ( QByteArray *  x)
private

Referenced by writeFile().

Here is the caller graph for this function:

void CAMidiExport::setCurSheet ( CASheet sheet)
inlineprivate

References _curSheet.

Referenced by exportDocumentImpl().

Here is the caller graph for this function:

void CAMidiExport::setCurVoice ( CAVoice voice)
inlineprivate

References _curVoice.

Referenced by exportDocumentImpl().

Here is the caller graph for this function:

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:

QByteArray CAMidiExport::timeSignature ( void  )
private

References META_TIMESIG, 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:

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:

QByteArray CAMidiExport::variableLengthValue ( int  value)
private

Referenced by keySignature(), textEvent(), and timeSignature().

Here is the caller graph for this function:

QByteArray CAMidiExport::word16 ( int  x)
private

Referenced by writeFile().

Here is the caller graph for this function:

void CAMidiExport::writeFile ( )

References keySignature(), CAExport::out(), setChunkLength(), CAFile::stream(), textEvent(), timeSignature(), trackChunk, trackEnd(), and word16().

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

Here is the call graph for this function:

Here is the caller graph for this function:

QByteArray CAMidiExport::writeTime ( int  time)
private

Referenced by keySignature(), send(), textEvent(), timeSignature(), and trackEnd().

Here is the caller graph for this function:

Member Data Documentation

CASheet* CAMidiExport::_curSheet
private

Referenced by setCurSheet().

CAVoice* CAMidiExport::_curVoice
private

Referenced by setCurVoice().

int CAMidiExport::midiTrackCount
private
QByteArray CAMidiExport::trackChunk
private

Referenced by exportDocumentImpl(), send(), and writeFile().

QVector<QByteArray> CAMidiExport::trackChunks
private
int CAMidiExport::trackTime
private

Referenced by CAMidiExport(), and send().

QVector<int> CAMidiExport::trackTimes
private

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