Mercurial > hg > svcore
comparison data/fileio/AudioFileSizeEstimator.cpp @ 1104:393134235fa0 simple-fft-model
Two-channel test
author | Chris Cannam |
---|---|
date | Tue, 16 Jun 2015 20:32:44 +0100 |
parents | 329ddaf7415d |
children | 513e4d67d8df |
comparison
equal
deleted
inserted
replaced
1103:e86a7ea3dc38 | 1104:393134235fa0 |
---|---|
15 #include "AudioFileSizeEstimator.h" | 15 #include "AudioFileSizeEstimator.h" |
16 | 16 |
17 #include "WavFileReader.h" | 17 #include "WavFileReader.h" |
18 | 18 |
19 #include <QFile> | 19 #include <QFile> |
20 | |
21 //#define DEBUG_AUDIO_FILE_SIZE_ESTIMATOR 1 | |
20 | 22 |
21 sv_frame_t | 23 sv_frame_t |
22 AudioFileSizeEstimator::estimate(FileSource source, | 24 AudioFileSizeEstimator::estimate(FileSource source, |
23 sv_samplerate_t targetRate) | 25 sv_samplerate_t targetRate) |
24 { | 26 { |
59 | 61 |
60 sv_frame_t sz = 0; | 62 sv_frame_t sz = 0; |
61 { | 63 { |
62 QFile f(source.getLocalFilename()); | 64 QFile f(source.getLocalFilename()); |
63 if (f.open(QFile::ReadOnly)) { | 65 if (f.open(QFile::ReadOnly)) { |
66 #ifdef DEBUG_AUDIO_FILE_SIZE_ESTIMATOR | |
64 cerr << "opened file, size is " << f.size() << endl; | 67 cerr << "opened file, size is " << f.size() << endl; |
68 #endif | |
65 sz = f.size(); | 69 sz = f.size(); |
66 f.close(); | 70 f.close(); |
67 } | 71 } |
68 } | 72 } |
69 | 73 |
88 // conservative. | 92 // conservative. |
89 | 93 |
90 estimate = sv_frame_t(double(sz) * 1.2 * rateRatio); | 94 estimate = sv_frame_t(double(sz) * 1.2 * rateRatio); |
91 } | 95 } |
92 | 96 |
97 #ifdef DEBUG_AUDIO_FILE_SIZE_ESTIMATOR | |
93 cerr << "AudioFileSizeEstimator: for extension " << extension << ", estimate = " << estimate << endl; | 98 cerr << "AudioFileSizeEstimator: for extension " << extension << ", estimate = " << estimate << endl; |
94 | 99 #endif |
95 } | 100 } |
96 | 101 |
102 #ifdef DEBUG_AUDIO_FILE_SIZE_ESTIMATOR | |
97 cerr << "estimate = " << estimate << endl; | 103 cerr << "estimate = " << estimate << endl; |
104 #endif | |
98 | 105 |
99 return estimate; | 106 return estimate; |
100 } | 107 } |
101 | 108 |