| 67 | } |
| 68 | |
| 69 | void testFileValidity() { |
| 70 | // Use libsndfile to read the file. Make sure: |
| 71 | // 1. it is correctly recognized as an AU file |
| 72 | // 2. it has all the header information we expect |
| 73 | |
| 74 | std::cout << "\tthe created files should be valid AU files with the expected number of samples..."; |
| 75 | std::cout << std::flush; |
| 76 | |
| 77 | BlockFile *theFiles[] = {int16BlockFile, int24BlockFile, floatBlockFile}; |
| 78 | |
| 79 | for(int i = 0; i < 3; i++) |
| 80 | { |
| 81 | BlockFile *bf = theFiles[i]; |
| 82 | SF_INFO info; |
| 83 | |
| 84 | memset(&info, 0, sizeof(info)); |
| 85 | SNDFILE *sf = sf_open(bf->GetFileName().GetFullPath(), SFM_READ, &info); |
| 86 | |
| 87 | assert(sf); |
| 88 | assert(info.frames == dataLen); |
| 89 | assert(info.channels == 1); |
| 90 | assert(info.format & SF_FORMAT_AU); |
| 91 | |
| 92 | sf_close(sf); |
| 93 | } |
| 94 | |
| 95 | std::cout << "OK\n"; |
| 96 | } |
| 97 | |
| 98 | template<class T> void AssertBuffersEqual(T *b1, T *b2, int len) |
| 99 | { |