summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien Zammit <damien@zamaudio.com>2015-07-24 20:19:29 +1000
committerDamien Zammit <damien@zamaudio.com>2015-07-24 20:19:29 +1000
commit9cf7d1cff5341a04e6e0e499e8152ee644899e20 (patch)
treeb889eed870a6961d0489a2bace4c2f660b3a5597
parentef2aac70376b5b19ede006cda6f5deb7c62d049b (diff)
Added other track basic identification parsing
Signed-off-by: Damien Zammit <damien@zamaudio.com>
-rw-r--r--ptfformat.cc18
-rw-r--r--ptfformat.h1
-rw-r--r--ptftool.cc7
3 files changed, 17 insertions, 9 deletions
diff --git a/ptfformat.cc b/ptfformat.cc
index c443b72..c68bef2 100644
--- a/ptfformat.cc
+++ b/ptfformat.cc
@@ -68,7 +68,7 @@ PTFFormat::load(std::string path) {
switch (c0) {
case 0x00:
- //fprintf(stderr, "Success! easy one\n");
+ // Success! easy one
xxor[0] = c0;
xxor[1] = c1;
for (i = 2; i < 64; i++) {
@@ -95,7 +95,7 @@ PTFFormat::load(std::string path) {
}
break;
case 0x80:
- //fprintf(stderr, "Success! easy two\n");
+ //Success! easy two
xxor[0] = c0;
xxor[1] = c1;
for (i = 2; i < 256; i++) {
@@ -135,9 +135,9 @@ PTFFormat::load(std::string path) {
case 0xc0:
li = c1;
if (ptflutseenwild[li]) {
- //fprintf(stderr, "Success! Found lookup table 0x%x\n", li);
+ //Success! [li]
} else {
- //fprintf(stderr, "Can't find lookup table for c1=0x%x\n", li);
+ //Can't find lookup table for c1=li
free(ptfunxored);
fclose(fp);
return li;
@@ -184,7 +184,7 @@ PTFFormat::load(std::string path) {
break;
break;
default:
- //fprintf(stderr, "Failed c[0] c[1]: %02x %02x\n", c0, c1);
+ //Should not happen, failed c[0] c[1]
return -1;
break;
}
@@ -217,6 +217,7 @@ PTFFormat::parse(void) {
j = 0;
l = 0;
+ // Find actual wav names
char wavname[256];
for (i = k; i > 4; i--) {
if ( (ptfunxored[i ] == 'W') &&
@@ -267,8 +268,6 @@ PTFFormat::parse(void) {
if ((samplebytes1 == 3) && (samplebytehigh == 0xfe)) {
samplebytes1 = 4;
}
- //int samplebytes2 = (ptfunxored[j+1] & 0xf0) >> 4;
- //printf("sbh=0x%x\n", samplebytehigh);
int samplebytes = samplebytes1;
if (type == 1) {
uint32_t offset = 0;
@@ -284,14 +283,15 @@ PTFFormat::parse(void) {
default:
break;
}
- //printf("%s sampleoffset = %08x = %d\n", name, offset, offset);
- //printf("%s\t%u\n", name, offset);
std::string filename = string(name) + ".wav";
files_t f = { filename, (int64_t)offset };
vector<files_t>::iterator start = this->actualwavs.begin();
vector<files_t>::iterator finish = this->actualwavs.end();
+ // Add file to list only if it is an actual wav
if (std::find(start, finish, f) != finish) {
this->audiofiles.push_back(f);
+ } else {
+ this->othertracks.push_back(f);
}
}
}
diff --git a/ptfformat.h b/ptfformat.h
index ac3dd4f..cfd55cf 100644
--- a/ptfformat.h
+++ b/ptfformat.h
@@ -932,6 +932,7 @@ public:
std::vector<files_t> audiofiles;
+ std::vector<files_t> othertracks;
std::vector<files_t> actualwavs;
private:
diff --git a/ptftool.cc b/ptftool.cc
index 820ebd9..e358e06 100644
--- a/ptftool.cc
+++ b/ptftool.cc
@@ -35,11 +35,18 @@ int main (int argc, char **argv) {
break;
case 0:
if (ptf.audiofiles.size() > 0) {
+ printf("Audio file @ offset:\n");
for (vector<PTFFormat::files_t>::iterator
a = ptf.audiofiles.begin();
a != ptf.audiofiles.end(); ++a) {
printf("%s @ %ld\n", a->filename.c_str(), a->posabsolute);
}
+ printf("\nOther track @ offset:\n");
+ for (vector<PTFFormat::files_t>::iterator
+ a = ptf.othertracks.begin();
+ a != ptf.othertracks.end(); ++a) {
+ printf("%s @ %ld\n", a->filename.c_str(), a->posabsolute);
+ }
} else {
printf("No audio files in session, quit\n");
}