diff options
author | Damien Zammit <damien@zamaudio.com> | 2018-10-07 15:55:03 +1100 |
---|---|---|
committer | Damien Zammit <damien@zamaudio.com> | 2018-10-07 15:55:03 +1100 |
commit | fbe48876dc562167f75bca5e38b93a81840f4b2e (patch) | |
tree | 14daa473deee74bee15d1d84d4e7ebea4801fec1 | |
parent | cddc573ddc6fc1262e94d96eea5b0f05a7b0d4c5 (diff) |
Read length of audiofiles (source length) && update test
-rw-r--r-- | ptfformat.cc | 22 | ||||
-rwxr-xr-x | tests/t.12/basicmidi | 8 |
2 files changed, 26 insertions, 4 deletions
diff --git a/ptfformat.cc b/ptfformat.cc index 71c7d47..774142c 100644 --- a/ptfformat.cc +++ b/ptfformat.cc @@ -1273,6 +1273,28 @@ PTFFormat::parseaudio(void) { std::reverse(actualwavs.begin(), actualwavs.end()); //resort(audiofiles); //resort(actualwavs); + + // Jump to end of wav file list + if (!jumpto(&k, ptfunxored, len, (const unsigned char *)"\xff\xff\xff\xff", 4)) + return; + + // Loop through all the sources + for (vector<wav_t>::iterator w = audiofiles.begin(); w != audiofiles.end(); ++w) { + // Jump to start of source metadata for this source + if (!jumpto(&k, ptfunxored, len, (const unsigned char *)"\x5a\x07", 2)) + return; + if (!jumpto(&k, ptfunxored, len, (const unsigned char *)"\x5a\x02", 2)) + return; + k++; + if (!jumpto(&k, ptfunxored, len, (const unsigned char *)"\x5a\x02", 2)) + return; + + w->length = 0; + w->length |= (uint32_t)(ptfunxored[k-22]) << 24; + w->length |= (uint32_t)(ptfunxored[k-23]) << 16; + w->length |= (uint32_t)(ptfunxored[k-24]) << 8; + w->length |= (uint32_t)(ptfunxored[k-25]); + } } void diff --git a/tests/t.12/basicmidi b/tests/t.12/basicmidi index b839bfc..ec3f9a7 100755 --- a/tests/t.12/basicmidi +++ b/tests/t.12/basicmidi @@ -10,10 +10,10 @@ Target samplerate = 48000 4 wavs, 4 regions, 3 active regions Audio file (WAV#) @ offset, length: -`monoTone.wav` w(0) @ 0, 0 -`monoTone.1.aif` w(1) @ 0, 0 -`stereoTone.L.aif` w(2) @ 0, 0 -`stereoTone.R.aif` w(3) @ 0, 0 +`monoTone.wav` w(0) @ 0, 480000 +`monoTone.1.aif` w(1) @ 0, 480000 +`stereoTone.L.aif` w(2) @ 0, 480000 +`stereoTone.R.aif` w(3) @ 0, 480000 Region (Region#) (WAV#) @ into-sample, length: `monoTone` r(0) w(1) @ 0, 480000 |