|
Canorus
0.7
|
00001 00008 #ifndef MIDIEXPORT_H_ 00009 #define MIDIEXPORT_H_ 00010 00011 #include <QTextStream> 00012 #include <QString> 00013 #include <QList> 00014 #include <QVector> 00015 #include <QByteArray> 00016 00017 #include "core/keysignature.h" 00018 #include "core/timesignature.h" 00019 #include "core/clef.h" 00020 #include "core/barline.h" 00021 #include "core/note.h" 00022 #include "core/rest.h" 00023 #include "core/document.h" 00024 #include "core/lyricscontext.h" 00025 #include "core/syllable.h" 00026 00027 #include "export/export.h" 00028 #include "interface/mididevice.h" 00029 #include "interface/playback.h" 00030 00031 00032 class CAMidiExport : public CAExport, public CAMidiDevice { 00033 public: 00034 CAMidiExport( QTextStream *out=0 ); 00035 00036 /* 00038 // Interface to file export // 00040 */ 00041 QMap<int, QString> getOutputPorts() { }; 00042 QMap<int, QString> getInputPorts() { }; 00043 00044 bool openOutputPort(int port) { return true; } // return true on success, false otherwise 00045 bool openInputPort(int port) { return true; } // return true on success, false otherwise 00046 void closeOutputPort() { } 00047 void closeInputPort() { } 00048 void send(QVector<unsigned char> message, int time); 00049 void writeFile(); // direct access to the writing 00050 00051 /* 00053 // Polling export status // 00055 // Setter methods are private! 00056 */ 00057 00058 private: 00059 QByteArray writeTime(int time); 00060 void exportDocumentImpl(CADocument *doc); 00061 int midiTrackCount; 00062 QByteArray trackChunk; // for the time beeing we build one big track 00063 int trackTime; // which this is the time line for 00064 QVector<QByteArray> trackChunks; // for the future 00065 QVector<int> trackTimes; 00066 void printQByteArray( QByteArray x ); // for debugging only 00067 QByteArray variableLengthValue(int value); 00068 QByteArray word16(int x); 00069 QByteArray textEvent(int time, QString s); 00070 QByteArray trackEnd(void); 00071 QByteArray timeSignature(void); 00072 QByteArray keySignature(void); 00073 void setChunkLength( QByteArray *x ); 00074 00075 /* 00076 00078 // Helper methods // 00080 00082 // Getter/Setter methods // 00084 */ 00085 inline void setCurVoice(CAVoice *voice) { _curVoice = voice; } 00086 inline void setCurSheet(CASheet *sheet) { _curSheet = sheet; } 00087 /* 00089 // Members // 00091 QTextStream *_out; 00092 */ 00093 CAVoice *_curVoice; 00094 CASheet *_curSheet; 00095 /* 00096 CAContext *_curContext; 00097 int _curContextIndex; 00098 int _curIndentLevel; 00099 */ 00100 }; 00101 00102 #endif /* MIDIEXPORT_H_*/
1.8.0