diff options
author | Damien Zammit <damien@zamaudio.com> | 2015-08-05 01:37:31 +1000 |
---|---|---|
committer | Damien Zammit <damien@zamaudio.com> | 2015-08-05 01:39:23 +1000 |
commit | f1265817f419c468bc6f9a4a6f69bc5f1025131f (patch) | |
tree | 6956bc7a5ebf0a2c9e4d708500b9b140b37a1a06 | |
parent | 495e041ad09e2a8ef39cfa4827911fe4c26a0585 (diff) |
Fixed typo with 0x79 lookup, added PT version
Signed-off-by: Damien Zammit <damien@zamaudio.com>
-rw-r--r-- | ptfformat.cc | 58 | ||||
-rw-r--r-- | ptfformat.h | 13 | ||||
-rw-r--r-- | ptftool.cc | 2 |
3 files changed, 70 insertions, 3 deletions
diff --git a/ptfformat.cc b/ptfformat.cc index 471a2da..4cd01c6 100644 --- a/ptfformat.cc +++ b/ptfformat.cc @@ -206,11 +206,67 @@ PTFFormat::load(std::string path) { void PTFFormat::parse(void) { + this->version = ptfunxored[61]; + + if (this->version == 8) { + parse8(); + } else if (this->version == 9) { + parse8(); + } else { + // Should not occur + } +} + +void +PTFFormat::parse9(void) +{ +/* int i; int j; - int k; int l; +*/ + int k; + // Find session sample rate + k = 0; + while (k < len) { + if ( (ptfunxored[k ] == 0x5a) && + (ptfunxored[k+1] == 0x05)) { + break; + } + k++; + } + this->sessionrate = ptfunxored[k+11]; + switch (this->sessionrate) { + case SR44100: + this->sessionrate = 44100; + break; + case SR48000: + this->sessionrate = 48000; + break; + case SR88200: + this->sessionrate = 88200; + break; + case SR96000: + this->sessionrate = 96000; + break; + case SR176400: + this->sessionrate = 176400; + break; + case SR192000: + this->sessionrate = 192000; + break; + default: + this->sessionrate = 0; + break; + } +} +void +PTFFormat::parse8(void) { + int i; + int j; + int k; + int l; // Find session sample rate k = 0; while (k < len) { diff --git a/ptfformat.h b/ptfformat.h index fb8c109..230f1c5 100644 --- a/ptfformat.h +++ b/ptfformat.h @@ -468,7 +468,7 @@ static const unsigned char ptflut[256][64] = { 1, 1, 3, 1, 3, 1, 3, 1, 3, 1, 1, 3, 1, 3, 1, 3, 1, 3, 1, 1, 3, 1, 3, 1, 3, 1, 3, 1, 1, 3, 1, 3, 1, 3, 1, 3, 1, 1, 3, 1, 3, 1, 3, 1, 3, 1, 1, 3, - 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, + 1, 3, 1, 3, 1, 3, 1, 1, 3, 1, 3, 1, 3, 1, 3, 1, }, /*7a */ {}, /*7b */ { @@ -1024,6 +1024,7 @@ public: } uint32_t sessionrate; + uint8_t version; unsigned char c0; unsigned char c1; @@ -1033,7 +1034,17 @@ public: private: bool foundin(std::string haystack, std::string needle); void parse(void); + void parse8(void); + void parse9(void); std::vector<wav_t> actualwavs; + enum samplerates { + SR44100 = 1, + SR48000, + SR88200, + SR96000, + SR176400, + SR192000 + }; }; @@ -34,7 +34,7 @@ int main (int argc, char **argv) { exit(-1); break; case 0: - printf("PT8 Session: Samplerate = %dHz\n\n", ptf.sessionrate); + printf("ProTools %d Session: Samplerate = %dHz\n\n", ptf.version, ptf.sessionrate); if (ptf.audiofiles.size() > 0) { printf("%lu wavs, %lu regions, %lu active regions\n\n", ptf.audiofiles.size(), |