Mercurial > hg > svcore
comparison data/fileio/AudioFileReader.h @ 1126:39019ce29178 tony-2.0-integration
Merge through to branch for Tony 2.0
author | Chris Cannam |
---|---|
date | Thu, 20 Aug 2015 14:54:21 +0100 |
parents | 4d9816ba0ebe |
children | ff9697592bef |
comparison
equal
deleted
inserted
replaced
1119:e22bfe8ca248 | 1126:39019ce29178 |
---|---|
21 #include "base/BaseTypes.h" | 21 #include "base/BaseTypes.h" |
22 #include "FileSource.h" | 22 #include "FileSource.h" |
23 | 23 |
24 #include <vector> | 24 #include <vector> |
25 #include <map> | 25 #include <map> |
26 | |
27 typedef std::vector<float> SampleBlock; | |
28 | 26 |
29 class AudioFileReader : public QObject | 27 class AudioFileReader : public QObject |
30 { | 28 { |
31 Q_OBJECT | 29 Q_OBJECT |
32 | 30 |
83 */ | 81 */ |
84 virtual bool isQuicklySeekable() const = 0; | 82 virtual bool isQuicklySeekable() const = 0; |
85 | 83 |
86 /** | 84 /** |
87 * Return interleaved samples for count frames from index start. | 85 * Return interleaved samples for count frames from index start. |
88 * The resulting sample block will contain count * | 86 * The resulting vector will contain count * getChannelCount() |
89 * getChannelCount() samples (or fewer if end of file is | 87 * samples (or fewer if end of file is reached). |
90 * reached). The caller does not need to allocate space and any | |
91 * existing content in the SampleBlock will be erased. | |
92 * | 88 * |
93 * The subclass implementations of this function must be | 89 * The subclass implementations of this function must be |
94 * thread-safe -- that is, safe to call from multiple threads with | 90 * thread-safe -- that is, safe to call from multiple threads with |
95 * different arguments on the same object at the same time. | 91 * different arguments on the same object at the same time. |
96 */ | 92 */ |
97 virtual SampleBlock getInterleavedFrames(sv_frame_t start, sv_frame_t count) const = 0; | 93 virtual std::vector<float> getInterleavedFrames(sv_frame_t start, sv_frame_t count) const = 0; |
98 | 94 |
99 /** | 95 /** |
100 * Return de-interleaved samples for count frames from index | 96 * Return de-interleaved samples for count frames from index |
101 * start. Implemented in this class (it calls | 97 * start. Implemented in this class (it calls |
102 * getInterleavedFrames and de-interleaves). The resulting vector | 98 * getInterleavedFrames and de-interleaves). The resulting vector |
103 * will contain getChannelCount() sample blocks of count samples | 99 * will contain getChannelCount() sample blocks of count samples |
104 * each (or fewer if end of file is reached). | 100 * each (or fewer if end of file is reached). |
105 */ | 101 */ |
106 virtual std::vector<SampleBlock> getDeInterleavedFrames(sv_frame_t start, sv_frame_t count) const; | 102 virtual std::vector<std::vector<float> > getDeInterleavedFrames(sv_frame_t start, sv_frame_t count) const; |
107 | 103 |
108 // only subclasses that do not know exactly how long the audio | 104 // only subclasses that do not know exactly how long the audio |
109 // file is until it's been completely decoded should implement this | 105 // file is until it's been completely decoded should implement this |
110 virtual int getDecodeCompletion() const { return 100; } // % | 106 virtual int getDecodeCompletion() const { return 100; } // % |
111 | 107 |