Mercurial > hg > svcore
comparison data/fileio/WavFileReader.h @ 1520:954d0cf29ca7 import-audio-data
Switch the normalisation option in WritableWaveFileModel from normalising on read to normalising on write, so that the saved file is already normalised and therefore can be read again without having to remember to normalise it
author | Chris Cannam |
---|---|
date | Wed, 12 Sep 2018 13:56:56 +0100 |
parents | 75d92155fa20 |
children | c01cbe41aeb5 f8e3dcbafb4d |
comparison
equal
deleted
inserted
replaced
1519:fbe8afdfa8a6 | 1520:954d0cf29ca7 |
---|---|
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 enum class Normalisation { None, Peak }; | |
45 | |
44 WavFileReader(FileSource source, | 46 WavFileReader(FileSource source, |
45 bool fileUpdating = false, | 47 bool fileUpdating = false, |
46 bool normalise = false); | 48 Normalisation normalise = Normalisation::None); |
47 virtual ~WavFileReader(); | 49 virtual ~WavFileReader(); |
48 | 50 |
49 virtual QString getLocation() const { return m_source.getLocation(); } | 51 virtual QString getLocation() const { return m_source.getLocation(); } |
50 virtual QString getError() const { return m_error; } | 52 virtual QString getError() const { return m_error; } |
51 | 53 |
85 mutable QMutex m_mutex; | 87 mutable QMutex m_mutex; |
86 mutable floatvec_t m_buffer; | 88 mutable floatvec_t m_buffer; |
87 mutable sv_frame_t m_lastStart; | 89 mutable sv_frame_t m_lastStart; |
88 mutable sv_frame_t m_lastCount; | 90 mutable sv_frame_t m_lastCount; |
89 | 91 |
90 bool m_normalise; | 92 Normalisation m_normalisation; |
91 float m_max; | 93 float m_max; |
92 | 94 |
93 bool m_updating; | 95 bool m_updating; |
94 | 96 |
95 floatvec_t getInterleavedFramesUnnormalised(sv_frame_t start, | 97 floatvec_t getInterleavedFramesUnnormalised(sv_frame_t start, |