comparison data/model/WaveFileModel.cpp @ 1040:a1cd5abcb38b cxx11

Introduce and use a samplerate type
author Chris Cannam
date Wed, 04 Mar 2015 12:01:04 +0000
parents cc27f35aa75c
children 843f67be0ed9
comparison
equal deleted inserted replaced
1039:b14064bd1f97 1040:a1cd5abcb38b
35 //#define DEBUG_WAVE_FILE_MODEL 1 35 //#define DEBUG_WAVE_FILE_MODEL 1
36 36
37 PowerOfSqrtTwoZoomConstraint 37 PowerOfSqrtTwoZoomConstraint
38 WaveFileModel::m_zoomConstraint; 38 WaveFileModel::m_zoomConstraint;
39 39
40 WaveFileModel::WaveFileModel(FileSource source, int targetRate) : 40 WaveFileModel::WaveFileModel(FileSource source, sv_samplerate_t targetRate) :
41 m_source(source), 41 m_source(source),
42 m_path(source.getLocation()), 42 m_path(source.getLocation()),
43 m_reader(0), 43 m_reader(0),
44 m_myReader(true), 44 m_myReader(true),
45 m_startFrame(0), 45 m_startFrame(0),
143 { 143 {
144 if (!m_reader) return 0; 144 if (!m_reader) return 0;
145 return m_reader->getChannelCount(); 145 return m_reader->getChannelCount();
146 } 146 }
147 147
148 int 148 sv_samplerate_t
149 WaveFileModel::getSampleRate() const 149 WaveFileModel::getSampleRate() const
150 { 150 {
151 if (!m_reader) return 0; 151 if (!m_reader) return 0;
152 return m_reader->getSampleRate(); 152 return m_reader->getSampleRate();
153 } 153 }
154 154
155 int 155 sv_samplerate_t
156 WaveFileModel::getNativeRate() const 156 WaveFileModel::getNativeRate() const
157 { 157 {
158 if (!m_reader) return 0; 158 if (!m_reader) return 0;
159 int rate = m_reader->getNativeRate(); 159 sv_samplerate_t rate = m_reader->getNativeRate();
160 if (rate == 0) rate = getSampleRate(); 160 if (rate == 0) rate = getSampleRate();
161 return rate; 161 return rate;
162 } 162 }
163 163
164 QString 164 QString