comparison data/fileio/AudioFileReader.h @ 285:20028c634494

* change some QStrings to std::strings etc
author Chris Cannam
date Thu, 09 Aug 2007 16:29:29 +0000
parents 822bd7fd526c
children 92e8dbde73cd
comparison
equal deleted inserted replaced
284:41d64b873d87 285:20028c634494
14 */ 14 */
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 <QObject>
20 #include "model/Model.h" // for SampleBlock 20
21 #include <string>
22 #include <vector>
21 23
22 class AudioFileReader : public QObject 24 class AudioFileReader : public QObject
23 { 25 {
24 Q_OBJECT 26 Q_OBJECT
25 27
26 public: 28 public:
27 virtual ~AudioFileReader() { } 29 virtual ~AudioFileReader() { }
28 30
31 typedef std::vector<float> SampleBlock;
32
29 bool isOK() const { return (m_channelCount > 0); } 33 bool isOK() const { return (m_channelCount > 0); }
30 34
31 virtual QString getError() const { return ""; } 35 virtual std::string getError() const { return m_error; }
32 36
33 size_t getFrameCount() const { return m_frameCount; } 37 size_t getFrameCount() const { return m_frameCount; }
34 size_t getChannelCount() const { return m_channelCount; } 38 size_t getChannelCount() const { return m_channelCount; }
35 size_t getSampleRate() const { return m_sampleRate; } 39 size_t getSampleRate() const { return m_sampleRate; }
36 40
37 /** 41 /**
38 * Return the title of the work in the audio file, if known. This 42 * Return the title of the work in the audio file, if known. This
39 * may be implemented by subclasses that support file tagging. 43 * may be implemented by subclasses that support file tagging.
40 * This is not the same thing as the file name. 44 * This is not the same thing as the file name.
41 */ 45 */
42 virtual QString getTitle() const { return ""; } 46 virtual std::string getTitle() const { return ""; }
43 47
44 /** 48 /**
45 * The subclass implementations of this function must be 49 * The subclass implementations of this function must be
46 * thread-safe -- that is, safe to call from multiple threads with 50 * thread-safe -- that is, safe to call from multiple threads with
47 * different arguments on the same object at the same time. 51 * different arguments on the same object at the same time.
60 64
61 protected: 65 protected:
62 size_t m_frameCount; 66 size_t m_frameCount;
63 size_t m_channelCount; 67 size_t m_channelCount;
64 size_t m_sampleRate; 68 size_t m_sampleRate;
69
70 std::string m_error;
71 void setError(std::string text, std::string arg = "");
72 void setError(std::string text, int arg);
65 }; 73 };
66 74
67 #endif 75 #endif