1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356
|
#pragma once
#include <libmscore/score.h>
#include <libmscore/mscore.h>
#include <libmscore/fraction.h>
#include <libmscore/fret.h>
#include <libmscore/chordrest.h>
#include <libmscore/slur.h>
#include <libmscore/clef.h>
#include <libmscore/keysig.h>
#include <libmscore/chordrest.h>
#include <libmscore/clef.h>
#include <libmscore/keysig.h>
#include <libmscore/hairpin.h>
#include <libmscore/ottava.h>
#include <libmscore/drumset.h>
namespace Ms {
class PalmMute;
class PowerTab {
QFile* _file;
MasterScore* score;
bool readBoolean();
unsigned char readUChar();
char readChar();
unsigned short readShort();
int readInt();
void skip(int len = 1);
std::string readString(int length = -1);
struct ptSongInfo {
int classification{ 0 };
int releaseType{ 0 };
int albumType{ 0 };
int day{ 0 };
int month{ 0 };
int year{ 0 };
int style{ 0 };
int level{ 0 };
bool liverecording{ 0 };
std::string name;
std::string interpret;
std::string album;
std::string author;
std::string lyricist;
std::string arrenger;
std::string guitarTranscriber;
std::string bassTranscriber;
std::string lyrics;
std::string guitarInstructions;
std::string bassInstructions;
std::string instructions;
std::string copyright;
};
struct ptComponent {
enum Type {
Empty,
GuitarIn,
Tempo,
Symbol,
Bar,
Note,
Beat,
TDirection
};
virtual Type type() {
return Empty;
};
};
struct stRhytmSlash : public ptComponent {
int position {0};
int duration {0};
bool triplet{ false };
bool tripletend{ false };
bool dotted{ false };
bool doubleDotted{ false };
bool is_rest{ false };
};
struct ptGuitarIn : public ptComponent {
int rhytmSlash{ true };
int staff{ 0 };
int trackinfo{ 0 };
int section{ 0 };
int position{ 0 };
Type type() {
return GuitarIn;
}
};
struct ptSymbol : public ptComponent {
int value{ 0 };
ptSymbol(int val) : value(val) {}
Type type() {
return Symbol;
}
};
struct ptBar : public ptComponent {
int measureNo{ 0 };
int repeatClose{ 0 };
bool repeatStart{ false };
int numerator{ 0 };
int denominator{ 0 };
Type type() {
return Bar;
}
};
std::vector<ptBar*> bars;
struct ptNote : public ptComponent {
int value{ 0 };
int str{ 0 };
int bend{0};
bool tied{ false };
bool dead{ false };
bool hammer{ false };
int slide{ 0 };
Type type() {
return Note;
}
};
struct ptChord : public ptComponent {
int key;
int formula;
int modification;
int extra;
int top_fret;
std::vector<int> frets;
};
struct ptChordText : public ptComponent {
int position;
int key;
int formula;
int formula_mod;
int extra;
};
struct ptBeat : public ptComponent {
int position{ 0 };
int staff{ 0 };
int voice{ 0 };
int mmrest{ 0 };
bool isRest{ false };
int duration{ 0 };
int enters{ 0 };
int times{ 0 };
bool dotted{ false };
bool tuplet{ false };
bool doubleDotted{ false };
bool vibrato{ false };
bool grace{ false };
bool arpegioUp{ false };
bool arpegioDown{ false };
bool palmMute{ false };
bool accent{ false };
bool staccato{ false };
std::vector<ptNote> notes;
ptBeat(int _staff, int _voice) : staff(_staff), voice(_voice) {}
Type type() {
return Beat;
}
};
struct ptDirection : public ptComponent {
enum Direction {
DIRECTION_CODA = 0,
DIRECTION_DOUBLE_CODA = 1,
DIRECTION_SEGNO = 2,
DIRECTION_SEGNO_SEGNO = 3,
DIRECTION_FINE = 4,
DIRECTION_DA_CAPO = 5,
DIRECTION_DAL_SEGNO = 6,
DIRECTION_DAL_SEGNO_SEGNO = 7,
DIRECTION_TO_CODA = 8,
DIRECTION_TO_DOUBLE_CODA = 9,
DIRECTION_DA_CAPO_AL_CODA = 10,
DIRECTION_DA_CAPO_AL_DOUBLE_CODA = 11,
DIRECTION_DAL_SEGNO_AL_CODA = 12,
DIRECTION_DAL_SEGNO_AL_DOUBLE_CODA = 13,
DIRECTION_DAL_SEGNO_SEGNO_AL_CODA = 14,
DIRECTION_DAL_SEGNO_SEGNO_AL_DOUBLE_CODA = 15,
DIRECTION_DA_CAPO_AL_FINE = 16,
DIRECTION_DAL_SEGNO_AL_FINE = 17,
DIRECTION_DAL_SEGNO_SEGNO_AL_FINE = 18
};
enum ActiveSym {
ACTIVE_SYMBOL_NONE = 0,
ACTIVE_SYMBOL_DC = 1,
ACTIVE_SYMBOL_DS = 2,
ACTIVE_SYMBOL_DSS = 3
};
Direction direction{ DIRECTION_CODA };
ActiveSym activeSymbol{ ACTIVE_SYMBOL_NONE };
int repeat{ 0 };
ptDirection(int dir, int sym, int rep) : direction((Direction)dir),
activeSymbol((ActiveSym)sym), repeat(rep) {}
Type type() {
return TDirection;
}
};
struct ptPosition {
int position{ 0 };
std::vector<shared_ptr<ptComponent>> components;
void addComponent(ptComponent* c);
};
struct TrackInfo {
int number{ 0 };
std::string name;
int instrument{ 0 };
int volume{ 0 };
int balance{ 0 };
int reverb{ 0 };
int chorus{ 0 };
int tremolo{ 0 };
int phaser{ 0 };
int capo{ 0 };
std::string tuningName;
int offset{ 0 };
std::vector<int> strings;
int notes_count{ 0 };
};
typedef std::list<shared_ptr<ptBeat>> tBeatList;
struct ptTrack;
struct ptSection {
int number{ 0 };
int staffs{ 0 };
std::string partName;
char partMarker;
std::vector<ptPosition> positions;
std::vector<int> staffMap;
int tempo{ 0 };
std::list<stRhytmSlash> rhytm;
std::map<int, ptChordText> chordTextMap;
std::vector<tBeatList> beats;
std::list<shared_ptr<ptBar>> bars;
bool readed{ false };
void copyTracks(ptTrack*);
ptSection(int num);
ptPosition& getPosition(int pos);
int getNextPositionNumber();
};
struct chordData {
int a[3];
bool operator > (const chordData& other) const {
if (a[0] == other.a[0]) {
if (a[1] == other.a[1]) {
return a[2] > other.a[2];
}
return a[1] > other.a[1];
}
return a[0] > other.a[0];
}
bool operator < (const chordData& other) const {
if (a[0] == other.a[0]) {
if (a[1] == other.a[1]) {
return a[2] < other.a[2];
}
return a[1] < other.a[1];
}
return a[0] < other.a[0];
}
bool operator == (const chordData& other) const {
return memcmp(a, other.a, 3 * sizeof(int)) == 0;
}
};
struct ptTrack {
std::vector<TrackInfo> infos;
std::vector<ptSection> sections;
ptSection& getSection(int ind);
std::map < chordData, ptChord > diagramMap;
std::list<ptGuitarIn> guitar_ins;
};
struct ptSong {
ptSongInfo info;
ptTrack track1;
ptTrack track2;
};
void readSongInfo(ptSongInfo& info);
void readDataInstruments(ptTrack& info);
void readTrackInfo(ptTrack& info);
void readGuitarIn(ptTrack& info);
void readTempoMarker(ptTrack& info);
void readSectionSymbol(ptTrack& info);
void readSection(ptSection& sec);
void readBarLine(ptSection& sec);
void readDirection(ptSection& sec);
void readTimeSignature(ptBar* bar);
void readStaff(int staff, ptSection& sec);
void readPosition(int staff, int voice, ptSection& sec);
void readNote(ptBeat* beat);
void readRehearsalSign(ptSection& sec);
void readChordText(ptSection& sec);
void readChord(ptTrack& si);
void readRhytmSlash(ptSection& sec);
void readFloatingText();
void readFontSettings();
void readDynamic();
void readKeySignature();
bool readVersion();
int readHeaderItems();
std::vector<int> lastStaffMap;
std::vector<int> getStaffMap(ptSection& sec);
int repeatCount{ 0 };
void addToScore(ptSection& sec);
Measure* createMeasure(ptBar* bar, const Fraction& tick);
void fillMeasure(tBeatList& elist, Measure* measure, int staff, std::vector<Note*>&);
int staves{ 0 };
ptTrack* curTrack;
int staffInc{ 0 };
char lastPart{ 0 };
ptSection* cur_section;
std::vector<PalmMute*> _palmMutes;
void addPalmMute(Chord*);
public:
PowerTab(QFile* f, MasterScore* s) : _file(f), score(s) {}
Score::FileError read();
};
}
|