comparison framework/Document.cpp @ 70:716e9d2f91c7

* Skip ID3 block when reading MP3 files (so long as ID3 support is included) * Show progress when retrieving audio file from playlist * Avoid -- but do not actually fix -- segmentation fault on exit. I am totally stumped at the moment about why both the PA and JACK audio targets should crash when properly shut down. For the moment, we just don't shut them down... * Fix incorrect behaviour (introduced on Friday as part of a different fix) when replacing main model in situation where no current main model exists
author Chris Cannam
date Fri, 30 Nov 2007 17:31:09 +0000
parents cedeab01d4c8
children 4aa40182321f 22bf057ea151
comparison
equal deleted inserted replaced
68:cedeab01d4c8 70:716e9d2f91c7
257 // any of the old derived models as its model. Either replace the 257 // any of the old derived models as its model. Either replace the
258 // model, or delete the layer for each layer that is currently 258 // model, or delete the layer for each layer that is currently
259 // using one of these. Carry out this replacement before we 259 // using one of these. Carry out this replacement before we
260 // delete any of the models. 260 // delete any of the models.
261 261
262 std::cerr << "Document::setMainModel: Have " 262 // std::cerr << "Document::setMainModel: Have "
263 << m_layers.size() << " layers" << std::endl; 263 // << m_layers.size() << " layers" << std::endl;
264 264
265 for (LayerSet::iterator i = m_layers.begin(); i != m_layers.end(); ++i) { 265 for (LayerSet::iterator i = m_layers.begin(); i != m_layers.end(); ++i) {
266 266
267 Layer *layer = *i; 267 Layer *layer = *i;
268 Model *model = layer->getModel(); 268 Model *model = layer->getModel();
269 269
270 // std::cerr << "Document::setMainModel: inspecting model " 270 // std::cerr << "Document::setMainModel: inspecting model "
271 // << (model ? model->objectName().toStdString() : "(null)") << " in layer " 271 // << (model ? model->objectName().toStdString() : "(null)") << " in layer "
272 // << layer->objectName().toStdString() << std::endl; 272 // << layer->objectName().toStdString() << std::endl;
273 273
274 if (model && (model == oldMainModel)) { 274 if (model == oldMainModel) {
275 // std::cerr << "... it uses the old main model, replacing" << std::endl; 275 // std::cerr << "... it uses the old main model, replacing" << std::endl;
276 LayerFactory::getInstance()->setModel(layer, m_mainModel); 276 LayerFactory::getInstance()->setModel(layer, m_mainModel);
277 continue; 277 continue;
278 } 278 }
279 279
280 if (m_models.find(model) == m_models.end()) { 280 if (model && (m_models.find(model) == m_models.end())) {
281 std::cerr << "WARNING: Document::setMainModel: Unknown model " 281 std::cerr << "WARNING: Document::setMainModel: Unknown model "
282 << model << " in layer " << layer << std::endl; 282 << model << " in layer " << layer << std::endl;
283 // get rid of this hideous degenerate 283 // get rid of this hideous degenerate
284 obsoleteLayers.push_back(layer); 284 obsoleteLayers.push_back(layer);
285 continue; 285 continue;
286 } 286 }
287 287
288 if (m_models[model].source && (m_models[model].source == oldMainModel)) { 288 if (m_models[model].source &&
289 (m_models[model].source == oldMainModel)) {
289 290
290 // std::cerr << "... it uses a model derived from the old main model, regenerating" << std::endl; 291 // std::cerr << "... it uses a model derived from the old main model, regenerating" << std::endl;
291 292
292 // This model was derived from the previous main 293 // This model was derived from the previous main
293 // model: regenerate it. 294 // model: regenerate it.
309 transform); 310 transform);
310 failedTransformers.insert(transform); 311 failedTransformers.insert(transform);
311 } 312 }
312 obsoleteLayers.push_back(layer); 313 obsoleteLayers.push_back(layer);
313 } else { 314 } else {
314 std::cerr << "Replacing model " << model << " (type " 315 // std::cerr << "Replacing model " << model << " (type "
315 << typeid(*model).name() << ") with model " 316 // << typeid(*model).name() << ") with model "
316 << replacementModel << " (type " 317 // << replacementModel << " (type "
317 << typeid(*replacementModel).name() << ") in layer " 318 // << typeid(*replacementModel).name() << ") in layer "
318 << layer << " (name " << layer->objectName().toStdString() << ")" 319 // << layer << " (name " << layer->objectName().toStdString() << ")"
319 << std::endl; 320 // << std::endl;
320 RangeSummarisableTimeValueModel *rm = 321 RangeSummarisableTimeValueModel *rm =
321 dynamic_cast<RangeSummarisableTimeValueModel *>(replacementModel); 322 dynamic_cast<RangeSummarisableTimeValueModel *>(replacementModel);
322 if (rm) { 323 if (rm) {
323 std::cerr << "new model has " << rm->getChannelCount() << " channels " << std::endl; 324 std::cerr << "new model has " << rm->getChannelCount() << " channels " << std::endl;
324 } else { 325 } else {