2 Copyright (C) 2015 Damien Zammit
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 3 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
28 /* Return values: 0 success
29 -1 could not open file as ptf
31 int load(std::string path, int64_t targetsr);
40 bool operator ==(const struct wav& other) {
41 return (this->filename == other.filename ||
42 this->index == other.index);
47 typedef struct region {
55 bool operator ==(const struct region& other) {
56 return (this->index == other.index);
60 typedef struct track {
66 bool operator ==(const struct track& other) {
67 return (this->name == other.name);
71 std::vector<wav_t> audiofiles;
72 std::vector<region_t> regions;
73 std::vector<track_t> tracks;
75 static bool regionexistsin(std::vector<region_t> reg, uint16_t index) {
76 std::vector<region_t>::iterator begin = reg.begin();
77 std::vector<region_t>::iterator finish = reg.end();
78 std::vector<region_t>::iterator found;
80 wav_t w = { std::string(""), 0, 0, 0 };
81 region_t r = { std::string(""), index, 0, 0, 0, w };
83 if ((found = std::find(begin, finish, r)) != finish) {
89 static bool wavexistsin(std::vector<wav_t> wv, uint16_t index) {
90 std::vector<wav_t>::iterator begin = wv.begin();
91 std::vector<wav_t>::iterator finish = wv.end();
92 std::vector<wav_t>::iterator found;
94 wav_t w = { std::string(""), index, 0, 0 };
96 if ((found = std::find(begin, finish, w)) != finish) {
108 unsigned char *ptfunxored;
112 bool foundin(std::string haystack, std::string needle);
116 void parse5header(void);
117 void parse7header(void);
118 void parse8header(void);
119 void parse9header(void);
120 void parse10header(void);
121 void parserest5(void);
122 void parserest89(void);
123 void parserest10(void);
124 void parseaudio5(void);
125 void parseaudio(void);
126 std::vector<wav_t> actualwavs;
128 std::string extension;
129 unsigned char key10a;
130 unsigned char key10b;