comparison audioio/AudioCallbackPlaySource.cpp @ 118:b4110b17bca8

* Fix #1672407 confused by plugin-named files in cwd (or home?) * Fix #1491848 crash when loading new file while transform plugin runs * Fix #1502287 Background remains black after spectrogram layer deleted * Fix #1604477 Replacing the main audio file silences secondary audio file * Fix failure to initialise property box layout to last preference on startup * Fix resample/wrong-rate display in Pane, ensure that right rate is chosen if all current models have an acceptable rate even if previous main model had a different one * Fix "global zoom" broken in previous commit * Some fixes to spectrogram cache area updating (makes spectrogram appear more quickly, previously it had a tendency to refresh with empty space) * Fixes to colour 3d plot normalization
author Chris Cannam
date Thu, 08 Mar 2007 16:53:08 +0000
parents f8e362511b2f
children fbd09fcda469
comparison
equal deleted inserted replaced
117:8089a394829a 118:b4110b17bca8
124 if (dtvm) modelChannels = dtvm->getChannelCount(); 124 if (dtvm) modelChannels = dtvm->getChannelCount();
125 if (modelChannels > m_sourceChannelCount) { 125 if (modelChannels > m_sourceChannelCount) {
126 m_sourceChannelCount = modelChannels; 126 m_sourceChannelCount = modelChannels;
127 } 127 }
128 128
129 // std::cout << "Adding model with " << modelChannels << " channels " << std::endl; 129 #ifdef DEBUG_AUDIO_PLAY_SOURCE
130 std::cout << "Adding model with " << modelChannels << " channels " << std::endl;
131 #endif
130 132
131 if (m_sourceSampleRate == 0) { 133 if (m_sourceSampleRate == 0) {
132 134
133 m_sourceSampleRate = model->getSampleRate(); 135 m_sourceSampleRate = model->getSampleRate();
134 srChanged = true; 136 srChanged = true;
142 144
143 bool conflicting = false; 145 bool conflicting = false;
144 146
145 for (std::set<Model *>::const_iterator i = m_models.begin(); 147 for (std::set<Model *>::const_iterator i = m_models.begin();
146 i != m_models.end(); ++i) { 148 i != m_models.end(); ++i) {
147 if (*i != dtvm && dynamic_cast<DenseTimeValueModel *>(*i)) { 149 DenseTimeValueModel *dtvm2 =
150 dynamic_cast<DenseTimeValueModel *>(*i);
151 if (dtvm2 && dtvm2 != dtvm &&
152 dtvm2->getSampleRate() != model->getSampleRate()) {
148 std::cerr << "AudioCallbackPlaySource::addModel: Conflicting dense time-value model " << *i << " found" << std::endl; 153 std::cerr << "AudioCallbackPlaySource::addModel: Conflicting dense time-value model " << *i << " found" << std::endl;
149 conflicting = true; 154 conflicting = true;
150 break; 155 break;
151 } 156 }
152 } 157 }
193 m_fillThread = new AudioCallbackPlaySourceFillThread(*this); 198 m_fillThread = new AudioCallbackPlaySourceFillThread(*this);
194 m_fillThread->start(); 199 m_fillThread->start();
195 } 200 }
196 201
197 #ifdef DEBUG_AUDIO_PLAY_SOURCE 202 #ifdef DEBUG_AUDIO_PLAY_SOURCE
198 std::cout << "AudioCallbackPlaySource::addModel: emitting modelReplaced" << std::endl; 203 std::cout << "AudioCallbackPlaySource::addModel: now have " << m_models.size() << " model(s) -- emitting modelReplaced" << std::endl;
199 #endif 204 #endif
200 205
201 if (buffersChanged || srChanged) { 206 if (buffersChanged || srChanged) {
202 emit modelReplaced(); 207 emit modelReplaced();
203 } 208 }
207 212
208 void 213 void
209 AudioCallbackPlaySource::removeModel(Model *model) 214 AudioCallbackPlaySource::removeModel(Model *model)
210 { 215 {
211 m_mutex.lock(); 216 m_mutex.lock();
217
218 #ifdef DEBUG_AUDIO_PLAY_SOURCE
219 std::cout << "AudioCallbackPlaySource::removeModel(" << model << ")" << std::endl;
220 #endif
212 221
213 m_models.erase(model); 222 m_models.erase(model);
214 223
215 if (m_models.empty()) { 224 if (m_models.empty()) {
216 if (m_converter) { 225 if (m_converter) {
240 249
241 void 250 void
242 AudioCallbackPlaySource::clearModels() 251 AudioCallbackPlaySource::clearModels()
243 { 252 {
244 m_mutex.lock(); 253 m_mutex.lock();
254
255 #ifdef DEBUG_AUDIO_PLAY_SOURCE
256 std::cout << "AudioCallbackPlaySource::clearModels()" << std::endl;
257 #endif
245 258
246 m_models.clear(); 259 m_models.clear();
247 260
248 if (m_converter) { 261 if (m_converter) {
249 src_delete(m_converter); 262 src_delete(m_converter);