Mercurial > hg > svcore
comparison data/fileio/test/AudioFileReaderTest.h @ 1041:843f67be0ed9 cxx11
Replace the get*Frames calls in AudioFileReader with less stupid API
author | Chris Cannam |
---|---|
date | Wed, 04 Mar 2015 12:30:41 +0000 |
parents | a1cd5abcb38b |
children | abfc498c52bc |
comparison
equal
deleted
inserted
replaced
1040:a1cd5abcb38b | 1041:843f67be0ed9 |
---|---|
93 AudioTestData tdata(readRate, channels); | 93 AudioTestData tdata(readRate, channels); |
94 | 94 |
95 float *reference = tdata.getInterleavedData(); | 95 float *reference = tdata.getInterleavedData(); |
96 sv_frame_t refFrames = tdata.getFrameCount(); | 96 sv_frame_t refFrames = tdata.getFrameCount(); |
97 | 97 |
98 vector<float> test; | |
99 | |
100 // The reader should give us exactly the expected number of | 98 // The reader should give us exactly the expected number of |
101 // frames, except for mp3/aac files. We ask for quite a lot | 99 // frames, except for mp3/aac files. We ask for quite a lot |
102 // more, though, so we can (a) check that we only get the | 100 // more, though, so we can (a) check that we only get the |
103 // expected number back (if this is not mp3/aac) or (b) take | 101 // expected number back (if this is not mp3/aac) or (b) take |
104 // into account silence at beginning and end (if it is). | 102 // into account silence at beginning and end (if it is). |
105 reader->getInterleavedFrames(0, refFrames + 5000, test); | 103 vector<float> test = reader->getInterleavedFrames(0, refFrames + 5000); |
106 sv_frame_t read = test.size() / channels; | 104 sv_frame_t read = test.size() / channels; |
107 | 105 |
108 if (extension == "mp3" || extension == "aac" || extension == "m4a") { | 106 if (extension == "mp3" || extension == "aac" || extension == "m4a") { |
109 // mp3s and aacs can have silence at start and end | 107 // mp3s and aacs can have silence at start and end |
110 QVERIFY(read >= refFrames); | 108 QVERIFY(read >= refFrames); |