Mercurial > hg > svcore
comparison data/model/AggregateWaveModel.cpp @ 929:59e7fe1b1003 warnfix_no_size_t
Unsigned removals and warning fixes in data/
author | Chris Cannam |
---|---|
date | Tue, 17 Jun 2014 14:33:42 +0100 |
parents | 1424aa29ae95 |
children | cd42620e3f40 |
comparison
equal
deleted
inserted
replaced
928:6a94bb528e9d | 929:59e7fe1b1003 |
---|---|
63 } | 63 } |
64 } | 64 } |
65 return ready; | 65 return ready; |
66 } | 66 } |
67 | 67 |
68 size_t | 68 int |
69 AggregateWaveModel::getFrameCount() const | 69 AggregateWaveModel::getFrameCount() const |
70 { | 70 { |
71 size_t count = 0; | 71 int count = 0; |
72 | 72 |
73 for (ChannelSpecList::const_iterator i = m_components.begin(); | 73 for (ChannelSpecList::const_iterator i = m_components.begin(); |
74 i != m_components.end(); ++i) { | 74 i != m_components.end(); ++i) { |
75 size_t thisCount = i->model->getEndFrame() - i->model->getStartFrame(); | 75 int thisCount = i->model->getEndFrame() - i->model->getStartFrame(); |
76 if (thisCount > count) count = thisCount; | 76 if (thisCount > count) count = thisCount; |
77 } | 77 } |
78 | 78 |
79 return count; | 79 return count; |
80 } | 80 } |
81 | 81 |
82 size_t | 82 int |
83 AggregateWaveModel::getChannelCount() const | 83 AggregateWaveModel::getChannelCount() const |
84 { | 84 { |
85 return m_components.size(); | 85 return m_components.size(); |
86 } | 86 } |
87 | 87 |
88 size_t | 88 int |
89 AggregateWaveModel::getSampleRate() const | 89 AggregateWaveModel::getSampleRate() const |
90 { | 90 { |
91 if (m_components.empty()) return 0; | 91 if (m_components.empty()) return 0; |
92 return m_components.begin()->model->getSampleRate(); | 92 return m_components.begin()->model->getSampleRate(); |
93 } | 93 } |
96 AggregateWaveModel::clone() const | 96 AggregateWaveModel::clone() const |
97 { | 97 { |
98 return new AggregateWaveModel(m_components); | 98 return new AggregateWaveModel(m_components); |
99 } | 99 } |
100 | 100 |
101 size_t | 101 int |
102 AggregateWaveModel::getData(int channel, size_t start, size_t count, | 102 AggregateWaveModel::getData(int channel, int start, int count, |
103 float *buffer) const | 103 float *buffer) const |
104 { | 104 { |
105 int ch0 = channel, ch1 = channel; | 105 int ch0 = channel, ch1 = channel; |
106 bool mixing = false; | 106 bool mixing = false; |
107 if (channel == -1) { | 107 if (channel == -1) { |
111 } | 111 } |
112 | 112 |
113 float *readbuf = buffer; | 113 float *readbuf = buffer; |
114 if (mixing) { | 114 if (mixing) { |
115 readbuf = new float[count]; | 115 readbuf = new float[count]; |
116 for (size_t i = 0; i < count; ++i) { | 116 for (int i = 0; i < count; ++i) { |
117 buffer[i] = 0.f; | 117 buffer[i] = 0.f; |
118 } | 118 } |
119 } | 119 } |
120 | 120 |
121 size_t sz = count; | 121 int sz = count; |
122 | 122 |
123 for (int c = ch0; c <= ch1; ++c) { | 123 for (int c = ch0; c <= ch1; ++c) { |
124 size_t szHere = | 124 int szHere = |
125 m_components[c].model->getData(m_components[c].channel, | 125 m_components[c].model->getData(m_components[c].channel, |
126 start, count, | 126 start, count, |
127 readbuf); | 127 readbuf); |
128 if (szHere < sz) sz = szHere; | 128 if (szHere < sz) sz = szHere; |
129 if (mixing) { | 129 if (mixing) { |
130 for (size_t i = 0; i < count; ++i) { | 130 for (int i = 0; i < count; ++i) { |
131 buffer[i] += readbuf[i]; | 131 buffer[i] += readbuf[i]; |
132 } | 132 } |
133 } | 133 } |
134 } | 134 } |
135 | 135 |
136 if (mixing) delete[] readbuf; | 136 if (mixing) delete[] readbuf; |
137 return sz; | 137 return sz; |
138 } | 138 } |
139 | 139 |
140 size_t | 140 int |
141 AggregateWaveModel::getData(int channel, size_t start, size_t count, | 141 AggregateWaveModel::getData(int channel, int start, int count, |
142 double *buffer) const | 142 double *buffer) const |
143 { | 143 { |
144 int ch0 = channel, ch1 = channel; | 144 int ch0 = channel, ch1 = channel; |
145 bool mixing = false; | 145 bool mixing = false; |
146 if (channel == -1) { | 146 if (channel == -1) { |
150 } | 150 } |
151 | 151 |
152 double *readbuf = buffer; | 152 double *readbuf = buffer; |
153 if (mixing) { | 153 if (mixing) { |
154 readbuf = new double[count]; | 154 readbuf = new double[count]; |
155 for (size_t i = 0; i < count; ++i) { | 155 for (int i = 0; i < count; ++i) { |
156 buffer[i] = 0.0; | 156 buffer[i] = 0.0; |
157 } | 157 } |
158 } | 158 } |
159 | 159 |
160 size_t sz = count; | 160 int sz = count; |
161 | 161 |
162 for (int c = ch0; c <= ch1; ++c) { | 162 for (int c = ch0; c <= ch1; ++c) { |
163 size_t szHere = | 163 int szHere = |
164 m_components[c].model->getData(m_components[c].channel, | 164 m_components[c].model->getData(m_components[c].channel, |
165 start, count, | 165 start, count, |
166 readbuf); | 166 readbuf); |
167 if (szHere < sz) sz = szHere; | 167 if (szHere < sz) sz = szHere; |
168 if (mixing) { | 168 if (mixing) { |
169 for (size_t i = 0; i < count; ++i) { | 169 for (int i = 0; i < count; ++i) { |
170 buffer[i] += readbuf[i]; | 170 buffer[i] += readbuf[i]; |
171 } | 171 } |
172 } | 172 } |
173 } | 173 } |
174 | 174 |
175 if (mixing) delete[] readbuf; | 175 if (mixing) delete[] readbuf; |
176 return sz; | 176 return sz; |
177 } | 177 } |
178 | 178 |
179 size_t | 179 int |
180 AggregateWaveModel::getData(size_t fromchannel, size_t tochannel, | 180 AggregateWaveModel::getData(int fromchannel, int tochannel, |
181 size_t start, size_t count, | 181 int start, int count, |
182 float **buffer) const | 182 float **buffer) const |
183 { | 183 { |
184 size_t min = count; | 184 int min = count; |
185 | 185 |
186 for (size_t c = fromchannel; c <= tochannel; ++c) { | 186 for (int c = fromchannel; c <= tochannel; ++c) { |
187 size_t here = getData(c, start, count, buffer[c - fromchannel]); | 187 int here = getData(c, start, count, buffer[c - fromchannel]); |
188 if (here < min) min = here; | 188 if (here < min) min = here; |
189 } | 189 } |
190 | 190 |
191 return min; | 191 return min; |
192 } | 192 } |
193 | 193 |
194 size_t | 194 int |
195 AggregateWaveModel::getSummaryBlockSize(size_t desired) const | 195 AggregateWaveModel::getSummaryBlockSize(int desired) const |
196 { | 196 { |
197 //!!! complete | 197 //!!! complete |
198 return desired; | 198 return desired; |
199 } | 199 } |
200 | 200 |
201 void | 201 void |
202 AggregateWaveModel::getSummaries(size_t channel, size_t start, size_t count, | 202 AggregateWaveModel::getSummaries(int, int, int, |
203 RangeBlock &ranges, size_t &blockSize) const | 203 RangeBlock &, int &) const |
204 { | 204 { |
205 //!!! complete | 205 //!!! complete |
206 } | 206 } |
207 | 207 |
208 AggregateWaveModel::Range | 208 AggregateWaveModel::Range |
209 AggregateWaveModel::getSummary(size_t channel, size_t start, size_t count) const | 209 AggregateWaveModel::getSummary(int, int, int) const |
210 { | 210 { |
211 //!!! complete | 211 //!!! complete |
212 return Range(); | 212 return Range(); |
213 } | 213 } |
214 | 214 |
215 size_t | 215 int |
216 AggregateWaveModel::getComponentCount() const | 216 AggregateWaveModel::getComponentCount() const |
217 { | 217 { |
218 return m_components.size(); | 218 return m_components.size(); |
219 } | 219 } |
220 | 220 |
221 AggregateWaveModel::ModelChannelSpec | 221 AggregateWaveModel::ModelChannelSpec |
222 AggregateWaveModel::getComponent(size_t c) const | 222 AggregateWaveModel::getComponent(int c) const |
223 { | 223 { |
224 return m_components[c]; | 224 return m_components[c]; |
225 } | 225 } |
226 | 226 |
227 void | 227 void |
229 { | 229 { |
230 emit modelChanged(); | 230 emit modelChanged(); |
231 } | 231 } |
232 | 232 |
233 void | 233 void |
234 AggregateWaveModel::componentModelChanged(size_t start, size_t end) | 234 AggregateWaveModel::componentModelChanged(int start, int end) |
235 { | 235 { |
236 emit modelChanged(start, end); | 236 emit modelChanged(start, end); |
237 } | 237 } |
238 | 238 |
239 void | 239 void |
241 { | 241 { |
242 emit completionChanged(); | 242 emit completionChanged(); |
243 } | 243 } |
244 | 244 |
245 void | 245 void |
246 AggregateWaveModel::toXml(QTextStream &out, | 246 AggregateWaveModel::toXml(QTextStream &, |
247 QString indent, | 247 QString , |
248 QString extraAttributes) const | 248 QString ) const |
249 { | 249 { |
250 //!!! complete | 250 //!!! complete |
251 } | 251 } |
252 | 252 |