Mercurial > hg > svcore
comparison data/fileio/AudioFileReader.h @ 1069:32ab6c48efaa
Merge from branch tonioni
author | Chris Cannam |
---|---|
date | Mon, 20 Apr 2015 09:11:34 +0100 |
parents | 843f67be0ed9 |
children | 4d9816ba0ebe |
comparison
equal
deleted
inserted
replaced
1036:682d64f05e72 | 1069:32ab6c48efaa |
---|---|
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 | 20 |
21 #include "base/BaseTypes.h" | |
21 #include "FileSource.h" | 22 #include "FileSource.h" |
22 | 23 |
23 #include <vector> | 24 #include <vector> |
24 #include <map> | 25 #include <map> |
25 | 26 |
34 | 35 |
35 bool isOK() const { return (m_channelCount > 0); } | 36 bool isOK() const { return (m_channelCount > 0); } |
36 | 37 |
37 virtual QString getError() const { return ""; } | 38 virtual QString getError() const { return ""; } |
38 | 39 |
39 int getFrameCount() const { return m_frameCount; } | 40 sv_frame_t getFrameCount() const { return m_frameCount; } |
40 int getChannelCount() const { return m_channelCount; } | 41 int getChannelCount() const { return m_channelCount; } |
41 int getSampleRate() const { return m_sampleRate; } | 42 sv_samplerate_t getSampleRate() const { return m_sampleRate; } |
42 | 43 |
43 virtual int getNativeRate() const { return m_sampleRate; } // if resampled | 44 virtual sv_samplerate_t getNativeRate() const { return m_sampleRate; } // if resampled |
44 | 45 |
45 /** | 46 /** |
46 * Return the location of the audio data in the reader (as passed | 47 * Return the location of the audio data in the reader (as passed |
47 * in to the FileSource constructor, for example). | 48 * in to the FileSource constructor, for example). |
48 */ | 49 */ |
91 * | 92 * |
92 * The subclass implementations of this function must be | 93 * The subclass implementations of this function must be |
93 * thread-safe -- that is, safe to call from multiple threads with | 94 * thread-safe -- that is, safe to call from multiple threads with |
94 * different arguments on the same object at the same time. | 95 * different arguments on the same object at the same time. |
95 */ | 96 */ |
96 virtual void getInterleavedFrames(int start, int count, | 97 virtual SampleBlock getInterleavedFrames(sv_frame_t start, sv_frame_t count) const = 0; |
97 SampleBlock &frames) const = 0; | |
98 | 98 |
99 /** | 99 /** |
100 * Return de-interleaved samples for count frames from index | 100 * Return de-interleaved samples for count frames from index |
101 * start. Implemented in this class (it calls | 101 * start. Implemented in this class (it calls |
102 * getInterleavedFrames and de-interleaves). The resulting vector | 102 * getInterleavedFrames and de-interleaves). The resulting vector |
103 * will contain getChannelCount() sample blocks of count samples | 103 * will contain getChannelCount() sample blocks of count samples |
104 * each (or fewer if end of file is reached). | 104 * each (or fewer if end of file is reached). |
105 */ | 105 */ |
106 virtual void getDeInterleavedFrames(int start, int count, | 106 virtual std::vector<SampleBlock> getDeInterleavedFrames(sv_frame_t start, sv_frame_t count) const; |
107 std::vector<SampleBlock> &frames) const; | |
108 | 107 |
109 // only subclasses that do not know exactly how long the audio | 108 // only subclasses that do not know exactly how long the audio |
110 // file is until it's been completely decoded should implement this | 109 // file is until it's been completely decoded should implement this |
111 virtual int getDecodeCompletion() const { return 100; } // % | 110 virtual int getDecodeCompletion() const { return 100; } // % |
112 | 111 |
114 | 113 |
115 signals: | 114 signals: |
116 void frameCountChanged(); | 115 void frameCountChanged(); |
117 | 116 |
118 protected: | 117 protected: |
119 int m_frameCount; | 118 sv_frame_t m_frameCount; |
120 int m_channelCount; | 119 int m_channelCount; |
121 int m_sampleRate; | 120 sv_samplerate_t m_sampleRate; |
122 }; | 121 }; |
123 | 122 |
124 #endif | 123 #endif |