Mercurial > hg > svcore
comparison data/fileio/AudioFileReader.h @ 327:1d656dcda8ef
* some tweaks to improve usability of these classes in a console application
author | Chris Cannam |
---|---|
date | Fri, 02 Nov 2007 16:50:31 +0000 |
parents | c324d410b096 |
children | 1afaf98dbf11 |
comparison
equal
deleted
inserted
replaced
326:bb6e4c46e202 | 327:1d656dcda8ef |
---|---|
15 | 15 |
16 #ifndef _AUDIO_FILE_READER_H_ | 16 #ifndef _AUDIO_FILE_READER_H_ |
17 #define _AUDIO_FILE_READER_H_ | 17 #define _AUDIO_FILE_READER_H_ |
18 | 18 |
19 #include <QString> | 19 #include <QString> |
20 #include "model/Model.h" // for SampleBlock | |
21 | 20 |
22 #include "FileSource.h" | 21 #include "FileSource.h" |
22 | |
23 #include <vector> | |
24 | |
25 typedef std::vector<float> SampleBlock; | |
23 | 26 |
24 class AudioFileReader : public QObject | 27 class AudioFileReader : public QObject |
25 { | 28 { |
26 Q_OBJECT | 29 Q_OBJECT |
27 | 30 |
43 * This is not the same thing as the file name. | 46 * This is not the same thing as the file name. |
44 */ | 47 */ |
45 virtual QString getTitle() const { return ""; } | 48 virtual QString getTitle() const { return ""; } |
46 | 49 |
47 /** | 50 /** |
51 * Return interleaved samples for count frames from index start. | |
52 * The resulting sample block will contain count * | |
53 * getChannelCount() samples (or fewer if end of file is reached). | |
54 * | |
48 * The subclass implementations of this function must be | 55 * The subclass implementations of this function must be |
49 * thread-safe -- that is, safe to call from multiple threads with | 56 * thread-safe -- that is, safe to call from multiple threads with |
50 * different arguments on the same object at the same time. | 57 * different arguments on the same object at the same time. |
51 */ | 58 */ |
52 virtual void getInterleavedFrames(size_t start, size_t count, | 59 virtual void getInterleavedFrames(size_t start, size_t count, |
53 SampleBlock &frames) const = 0; | 60 SampleBlock &frames) const = 0; |
61 | |
62 /** | |
63 * Return de-interleaved samples for count frames from index | |
64 * start. Implemented in this class (it calls | |
65 * getInterleavedFrames and de-interleaves). The resulting vector | |
66 * will contain getChannelCount() sample blocks of count samples | |
67 * each (or fewer if end of file is reached). | |
68 */ | |
69 virtual void getDeInterleavedFrames(size_t start, size_t count, | |
70 std::vector<SampleBlock> &frames) const; | |
54 | 71 |
55 // only subclasses that do not know exactly how long the audio | 72 // only subclasses that do not know exactly how long the audio |
56 // file is until it's been completely decoded should implement this | 73 // file is until it's been completely decoded should implement this |
57 virtual int getDecodeCompletion() const { return 100; } // % | 74 virtual int getDecodeCompletion() const { return 100; } // % |
58 | 75 |