Mercurial > hg > svcore
comparison data/fileio/AudioFileReader.h @ 1038:cc27f35aa75c cxx11
Introducing the signed 64-bit frame index type, and fixing build failures from inclusion of -Wconversion with -Werror. Not finished yet.
author | Chris Cannam |
---|---|
date | Tue, 03 Mar 2015 15:18:24 +0000 |
parents | 36f79bc5c3d7 |
children | a1cd5abcb38b |
comparison
equal
deleted
inserted
replaced
1037:bf0e5944289b | 1038:cc27f35aa75c |
---|---|
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 int getSampleRate() const { return m_sampleRate; } |
42 | 43 |
43 virtual int getNativeRate() const { return m_sampleRate; } // if resampled | 44 virtual int getNativeRate() const { return m_sampleRate; } // if resampled |
44 | 45 |
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 void getInterleavedFrames(sv_frame_t start, sv_frame_t count, |
97 SampleBlock &frames) const = 0; | 98 SampleBlock &frames) const = 0; |
98 | 99 |
99 /** | 100 /** |
100 * Return de-interleaved samples for count frames from index | 101 * Return de-interleaved samples for count frames from index |
101 * start. Implemented in this class (it calls | 102 * start. Implemented in this class (it calls |
102 * getInterleavedFrames and de-interleaves). The resulting vector | 103 * getInterleavedFrames and de-interleaves). The resulting vector |
103 * will contain getChannelCount() sample blocks of count samples | 104 * will contain getChannelCount() sample blocks of count samples |
104 * each (or fewer if end of file is reached). | 105 * each (or fewer if end of file is reached). |
105 */ | 106 */ |
106 virtual void getDeInterleavedFrames(int start, int count, | 107 virtual void getDeInterleavedFrames(sv_frame_t start, sv_frame_t count, |
107 std::vector<SampleBlock> &frames) const; | 108 std::vector<SampleBlock> &frames) const; |
108 | 109 |
109 // only subclasses that do not know exactly how long the audio | 110 // only subclasses that do not know exactly how long the audio |
110 // file is until it's been completely decoded should implement this | 111 // file is until it's been completely decoded should implement this |
111 virtual int getDecodeCompletion() const { return 100; } // % | 112 virtual int getDecodeCompletion() const { return 100; } // % |
114 | 115 |
115 signals: | 116 signals: |
116 void frameCountChanged(); | 117 void frameCountChanged(); |
117 | 118 |
118 protected: | 119 protected: |
119 int m_frameCount; | 120 sv_frame_t m_frameCount; |
120 int m_channelCount; | 121 int m_channelCount; |
121 int m_sampleRate; | 122 int m_sampleRate; |
122 }; | 123 }; |
123 | 124 |
124 #endif | 125 #endif |