00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef TSE3_FILEOPS2_H
00018 #define TSE3_FILEOPS2_H
00019
00020 #include "tse3/Midi.h"
00021
00022 #include <string>
00023 #include <iostream>
00024 #include <cstddef>
00025
00026 namespace TSE3
00027 {
00028 class Song;
00029 class Track;
00030 class Part;
00031 class Progress;
00032
00053 class TSE2MDL
00054 {
00055
00056 public:
00057
00068 TSE2MDL(const std::string &appname = "",
00069 bool verbose = false,
00070 std::ostream &out = std::cout);
00071
00082 Song *load(const std::string &filename, Progress *progress = 0);
00083
00084 private:
00085
00086
00087
00088
00089 bool load_header(std::istream &in);
00090 bool load_songTitle(std::istream &in);
00091 bool load_songAuthor(std::istream &in);
00092 bool load_songCopyright(std::istream &in);
00093 bool load_songDate(std::istream &in);
00094 bool load_TempoTrack(std::istream &in, int len);
00095 bool load_TimeSigTrack(std::istream &in, int len);
00096 bool load_FlagTrack(std::istream &in, int len);
00097 bool load_Track(std::istream &in);
00098 bool load_ExtendedTrack(std::istream &in, int length);
00099 bool load_Phrase(std::istream &in, int len);
00100 bool load_Part(std::istream &in);
00101 bool load_ExtendedPart(std::istream &in, int len);
00102 bool load_Choices(std::istream &in, int len);
00103 bool skip(std::istream &in, int len);
00104
00105 int freadInt(std::istream &in, int size);
00106 int freadPString(std::istream &in, char *buffer);
00107
00108 std::string appname;
00109 bool verbose;
00110 std::ostream &out;
00111
00112 Track *prevTrack;
00113 Part *prevPart;
00114 Clock file_PPQN;
00115 size_t file_noTracks;
00116 int file_size;
00117 Song *song;
00118 };
00119 }
00120
00121 #endif