summaryrefslogtreecommitdiff
path: root/song.h
blob: 69cdbd5df0a9903d6827e24ee51e82c250f525d1 (plain)
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
#ifndef SONG_H
#define SONG_H

#include <string>
#include <vector>

#include "chordNote.h"
#include "timestamp.h"

#define DIFFICULTY_EASY   0
#define DIFFICULTY_MEDIUM 1
#define DIFFICULTY_HARD   2
#define DIFFICULTY_EXPERT 3

class Song{
  public:
    Song(std::string chartFile);
    ~Song();

    void parseInfo(); // info from "Song" section
    void parseSync(); // timestamps from "SyncTrack" section
    bool parseChords(int difficulty); // chords from "Events" section

    void print();
    void printTimestamps();
    void printChords(int difficulty);

    void consolidateChords(int difficulty); // Merge chords with same start/end times
    void trim(int difficulty); // Trim chord timings from nanoseconds to milliseconds

    std::string getChartFile();
    std::string getTitle();
    std::string getArtist();
    std::string getCharter();
    std::string getAlbum();
    std::string getYear();
    std::string getGenre();
    std::string getAudioFile();

    std::vector<ChordNote> easy;
    std::vector<ChordNote> medium;
    std::vector<ChordNote> hard;
    std::vector<ChordNote> expert;

  private:
    const std::string chartFile;
    std::string title;
    std::string artist;
    std::string charter;
    std::string album;
    std::string year;
    std::string genre;
    std::string audioFile;
    bool difficulty[4]; // Which difficulties are available
    int resolution;
    std::vector<Timestamp> timestamps;
};

//#include "song.cpp"
#endif // SONG_H
// vim: syntax=cpp.doxygen