13
0

ptformat: Update to upstream d5a73a0

This commit is contained in:
Damien Zammit 2018-04-08 15:27:21 +10:00
parent dd5f124c60
commit 572b3940fb
2 changed files with 1135 additions and 454 deletions

File diff suppressed because it is too large Load Diff

View File

@ -28,10 +28,15 @@ public:
~PTFFormat();
/* Return values: 0 success
-1 could not open file as ptf
-1 could not parse pt session
*/
int load(std::string path, int64_t targetsr);
/* Return values: 0 success
-1 could not decrypt pt session
*/
int unxor(std::string path);
struct wav_t {
std::string filename;
uint16_t index;
@ -70,8 +75,22 @@ public:
bool operator ==(const struct region& other) {
return (this->index == other.index);
}
bool operator <(const struct region& other) const {
return (strcasecmp(this->name.c_str(),
other.name.c_str()) < 0);
}
} region_t;
typedef struct compound {
uint16_t curr_index;
uint16_t unknown1;
uint16_t level;
uint16_t ontopof_index;
uint16_t next_index;
std::string name;
} compound_t;
typedef struct track {
std::string name;
uint16_t index;
@ -86,6 +105,7 @@ public:
std::vector<wav_t> audiofiles;
std::vector<region_t> regions;
std::vector<region_t> midiregions;
std::vector<compound_t> compounds;
std::vector<track_t> tracks;
std::vector<track_t> miditracks;
@ -129,6 +149,8 @@ public:
uint64_t len;
private:
bool jumpback(uint32_t *currpos, unsigned char *buf, const uint32_t maxoffset, const unsigned char *needle, const uint32_t needlelen);
bool jumpto(uint32_t *currpos, unsigned char *buf, const uint32_t maxoffset, const unsigned char *needle, const uint32_t needlelen);
bool foundin(std::string haystack, std::string needle);
int64_t foundat(unsigned char *haystack, uint64_t n, const char *needle);
int parse(void);
@ -142,16 +164,17 @@ private:
void parse10header(void);
void parserest5(void);
void parserest89(void);
void parserest10(void);
void parserest12(void);
void parseaudio5(void);
void parseaudio(void);
void parsemidi(void);
void parsemidi12(void);
void resort(std::vector<wav_t>& ws);
void resort(std::vector<region_t>& rs);
void filter(std::vector<region_t>& rs);
std::vector<wav_t> actualwavs;
float ratefactor;
std::string extension;
unsigned char key10a;
unsigned char key10b;
};