comparison data/fileio/WavFileReader.h @ 1513:75d92155fa20 import-audio-data

Add normalisation option
author Chris Cannam
date Fri, 07 Sep 2018 16:13:21 +0100
parents 1bc6f70cb4c7
children 954d0cf29ca7
comparison
equal deleted inserted replaced
1512:c9c2aa17439a 1513:75d92155fa20
39 * to an intermediate cached file). 39 * to an intermediate cached file).
40 */ 40 */
41 class WavFileReader : public AudioFileReader 41 class WavFileReader : public AudioFileReader
42 { 42 {
43 public: 43 public:
44 WavFileReader(FileSource source, bool fileUpdating = false); 44 WavFileReader(FileSource source,
45 bool fileUpdating = false,
46 bool normalise = false);
45 virtual ~WavFileReader(); 47 virtual ~WavFileReader();
46 48
47 virtual QString getLocation() const { return m_source.getLocation(); } 49 virtual QString getLocation() const { return m_source.getLocation(); }
48 virtual QString getError() const { return m_error; } 50 virtual QString getError() const { return m_error; }
49 51
53 55
54 /** 56 /**
55 * Must be safe to call from multiple threads with different 57 * Must be safe to call from multiple threads with different
56 * arguments on the same object at the same time. 58 * arguments on the same object at the same time.
57 */ 59 */
58 virtual floatvec_t getInterleavedFrames(sv_frame_t start, sv_frame_t count) const; 60 virtual floatvec_t getInterleavedFrames(sv_frame_t start, sv_frame_t count)
61 const;
59 62
60 static void getSupportedExtensions(std::set<QString> &extensions); 63 static void getSupportedExtensions(std::set<QString> &extensions);
61 static bool supportsExtension(QString ext); 64 static bool supportsExtension(QString ext);
62 static bool supportsContentType(QString type); 65 static bool supportsContentType(QString type);
63 static bool supports(FileSource &source); 66 static bool supports(FileSource &source);
82 mutable QMutex m_mutex; 85 mutable QMutex m_mutex;
83 mutable floatvec_t m_buffer; 86 mutable floatvec_t m_buffer;
84 mutable sv_frame_t m_lastStart; 87 mutable sv_frame_t m_lastStart;
85 mutable sv_frame_t m_lastCount; 88 mutable sv_frame_t m_lastCount;
86 89
90 bool m_normalise;
91 float m_max;
92
87 bool m_updating; 93 bool m_updating;
94
95 floatvec_t getInterleavedFramesUnnormalised(sv_frame_t start,
96 sv_frame_t count) const;
97 float getMax() const;
88 }; 98 };
89 99
90 #endif 100 #endif