Canorus  0.7
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
midiexport.h
Go to the documentation of this file.
1 
8 #ifndef MIDIEXPORT_H_
9 #define MIDIEXPORT_H_
10 
11 #include <QTextStream>
12 #include <QString>
13 #include <QList>
14 #include <QVector>
15 #include <QByteArray>
16 
17 #include "core/keysignature.h"
18 #include "core/timesignature.h"
19 #include "core/clef.h"
20 #include "core/barline.h"
21 #include "core/note.h"
22 #include "core/rest.h"
23 #include "core/document.h"
24 #include "core/lyricscontext.h"
25 #include "core/syllable.h"
26 
27 #include "export/export.h"
28 #include "interface/mididevice.h"
29 #include "interface/playback.h"
30 
31 
32 class CAMidiExport : public CAExport, public CAMidiDevice {
33 public:
34  CAMidiExport( QTextStream *out=0 );
35 
36 /*
38  // Interface to file export //
40 */
41  QMap<int, QString> getOutputPorts() { };
42  QMap<int, QString> getInputPorts() { };
43 
44  bool openOutputPort(int port) { return true; } // return true on success, false otherwise
45  bool openInputPort(int port) { return true; } // return true on success, false otherwise
46  void closeOutputPort() { }
47  void closeInputPort() { }
48  void send(QVector<unsigned char> message, int time);
49  void writeFile(); // direct access to the writing
50 
51 /*
53  // Polling export status //
55  // Setter methods are private!
56 */
57 
58 private:
59  QByteArray writeTime(int time);
60  void exportDocumentImpl(CADocument *doc);
62  QByteArray trackChunk; // for the time beeing we build one big track
63  int trackTime; // which this is the time line for
64  QVector<QByteArray> trackChunks; // for the future
65  QVector<int> trackTimes;
66  void printQByteArray( QByteArray x ); // for debugging only
67  QByteArray variableLengthValue(int value);
68  QByteArray word16(int x);
69  QByteArray textEvent(int time, QString s);
70  QByteArray trackEnd(void);
71  QByteArray timeSignature(void);
72  QByteArray keySignature(void);
73  void setChunkLength( QByteArray *x );
74 
75 /*
76 
78  // Helper methods //
80 
82  // Getter/Setter methods //
84 */
85  inline void setCurVoice(CAVoice *voice) { _curVoice = voice; }
86  inline void setCurSheet(CASheet *sheet) { _curSheet = sheet; }
87 /*
89  // Members //
91  QTextStream *_out;
92 */
95 /*
96  CAContext *_curContext;
97  int _curContextIndex;
98  int _curIndentLevel;
99 */
100 };
101 
102 #endif /* MIDIEXPORT_H_*/