Mercurial > hg > svcore
comparison data/fileio/AudioFileReaderFactory.cpp @ 1040:a1cd5abcb38b cxx11
Introduce and use a samplerate type
author | Chris Cannam |
---|---|
date | Wed, 04 Mar 2015 12:01:04 +0000 |
parents | d03b3d956358 |
children | abc309f507ae 5b463c7727e5 |
comparison
equal
deleted
inserted
replaced
1039:b14064bd1f97 | 1040:a1cd5abcb38b |
---|---|
57 return rv; | 57 return rv; |
58 } | 58 } |
59 | 59 |
60 AudioFileReader * | 60 AudioFileReader * |
61 AudioFileReaderFactory::createReader(FileSource source, | 61 AudioFileReaderFactory::createReader(FileSource source, |
62 int targetRate, | 62 sv_samplerate_t targetRate, |
63 bool normalised, | 63 bool normalised, |
64 ProgressReporter *reporter) | 64 ProgressReporter *reporter) |
65 { | 65 { |
66 return create(source, targetRate, normalised, false, reporter); | 66 return create(source, targetRate, normalised, false, reporter); |
67 } | 67 } |
68 | 68 |
69 AudioFileReader * | 69 AudioFileReader * |
70 AudioFileReaderFactory::createThreadingReader(FileSource source, | 70 AudioFileReaderFactory::createThreadingReader(FileSource source, |
71 int targetRate, | 71 sv_samplerate_t targetRate, |
72 bool normalised, | 72 bool normalised, |
73 ProgressReporter *reporter) | 73 ProgressReporter *reporter) |
74 { | 74 { |
75 return create(source, targetRate, normalised, true, reporter); | 75 return create(source, targetRate, normalised, true, reporter); |
76 } | 76 } |
77 | 77 |
78 AudioFileReader * | 78 AudioFileReader * |
79 AudioFileReaderFactory::create(FileSource source, | 79 AudioFileReaderFactory::create(FileSource source, |
80 int targetRate, | 80 sv_samplerate_t targetRate, |
81 bool normalised, | 81 bool normalised, |
82 bool threading, | 82 bool threading, |
83 ProgressReporter *reporter) | 83 ProgressReporter *reporter) |
84 { | 84 { |
85 QString err; | 85 QString err; |
103 | 103 |
104 if (WavFileReader::supports(source)) { | 104 if (WavFileReader::supports(source)) { |
105 | 105 |
106 reader = new WavFileReader(source); | 106 reader = new WavFileReader(source); |
107 | 107 |
108 int fileRate = reader->getSampleRate(); | 108 sv_samplerate_t fileRate = reader->getSampleRate(); |
109 | 109 |
110 if (reader->isOK() && | 110 if (reader->isOK() && |
111 (!reader->isQuicklySeekable() || | 111 (!reader->isQuicklySeekable() || |
112 normalised || | 112 normalised || |
113 (targetRate != 0 && fileRate != targetRate))) { | 113 (targetRate != 0 && fileRate != targetRate))) { |
222 | 222 |
223 if (!reader) { | 223 if (!reader) { |
224 | 224 |
225 reader = new WavFileReader(source); | 225 reader = new WavFileReader(source); |
226 | 226 |
227 int fileRate = reader->getSampleRate(); | 227 sv_samplerate_t fileRate = reader->getSampleRate(); |
228 | 228 |
229 if (reader->isOK() && | 229 if (reader->isOK() && |
230 (!reader->isQuicklySeekable() || | 230 (!reader->isQuicklySeekable() || |
231 normalised || | 231 normalised || |
232 (targetRate != 0 && fileRate != targetRate))) { | 232 (targetRate != 0 && fileRate != targetRate))) { |