# HG changeset patch # User Chris Cannam # Date 1160664988 0 # Node ID ec77936c268e3e2d5582843cc24913285a3bb0e2 # Parent 94f1c2747de4bf523addf265c0d484d7ca48df4d * Add system-specific LADSPA and DSSI plugin paths (for OS/X and Windows) * Add ability to open more than one audio file at once from the command line * Add plugin input source selection (with some caveats) * Show name of file being decoded in Ogg/mp3 decode progress dialog diff -r 94f1c2747de4 -r ec77936c268e document/Document.cpp --- a/document/Document.cpp Wed Oct 11 16:18:51 2006 +0000 +++ b/document/Document.cpp Thu Oct 12 14:56:28 2006 +0000 @@ -318,6 +318,8 @@ return; } + std::cerr << "Document::addDerivedModel: source is " << inputModel << " \"" << inputModel->objectName().toStdString() << std::endl; + ModelRecord rec; rec.source = inputModel; rec.transform = transform; diff -r 94f1c2747de4 -r ec77936c268e main/MainWindow.cpp --- a/main/MainWindow.cpp Wed Oct 11 16:18:51 2006 +0000 +++ b/main/MainWindow.cpp Thu Oct 12 14:56:28 2006 +0000 @@ -2282,9 +2282,9 @@ } bool -MainWindow::openSomeFile(QString path) +MainWindow::openSomeFile(QString path, AudioFileOpenMode mode) { - if (openAudioFile(path)) { + if (openAudioFile(path, mode)) { return true; } else if (openSessionFile(path)) { return true; @@ -2993,15 +2993,17 @@ } } - bool ok = factory->getConfigurationForTransform(transform, - candidateInputModels, - context, - configurationXml, - m_playSource); - if (!ok) return; + Model *inputModel = factory->getConfigurationForTransform(transform, + candidateInputModels, + context, + configurationXml, + m_playSource); + if (!inputModel) return; + + std::cerr << "Input model is " << inputModel << " \"" << inputModel->objectName().toStdString() << std::endl; Layer *newLayer = m_document->createDerivedLayer(transform, - m_document->getMainModel(), + inputModel, context, configurationXml); diff -r 94f1c2747de4 -r ec77936c268e main/MainWindow.h --- a/main/MainWindow.h Wed Oct 11 16:18:51 2006 +0000 +++ b/main/MainWindow.h Thu Oct 12 14:56:28 2006 +0000 @@ -64,7 +64,7 @@ AskUser }; - bool openSomeFile(QString path); + bool openSomeFile(QString path, AudioFileOpenMode = AskUser); bool openAudioFile(QString path, AudioFileOpenMode = AskUser); bool openLayerFile(QString path); bool openSessionFile(QString path); diff -r 94f1c2747de4 -r ec77936c268e main/main.cpp --- a/main/main.cpp Wed Oct 11 16:18:51 2006 +0000 +++ b/main/main.cpp Thu Oct 12 14:56:28 2006 +0000 @@ -138,17 +138,56 @@ settings.endGroup(); gui.show(); - - QString path; +/* + QStringList pathList; for (QStringList::iterator i = args.begin(); i != args.end(); ++i) { if (i == args.begin()) continue; if (!i->startsWith('-')) { - path = *i; - break; + pathList.push_back(*i); } } +*/ + bool haveSession = false; + bool haveMainModel = false; - if (!path.isEmpty()) { + for (QStringList::iterator i = args.begin(); i != args.end(); ++i) { + + bool success = false; + + if (i == args.begin()) continue; + if (i->startsWith('-')) continue; + + QString path = *i; + + if (path.endsWith("sv")) { + if (!haveSession) { + success = gui.openSessionFile(path); + if (success) { + haveSession = true; + haveMainModel = true; + } + } else { + std::cerr << "WARNING: Ignoring additional session file argument \"" << path.toStdString() << "\"" << std::endl; + success = true; + } + } + if (!success) { + if (!haveMainModel) { + success = gui.openSomeFile(path, MainWindow::ReplaceMainModel); + if (success) haveMainModel = true; + } else { + success = gui.openSomeFile(path, MainWindow::CreateAdditionalModel); + } + } + if (!success) { + QMessageBox::critical + (&gui, QMessageBox::tr("Failed to open file"), + QMessageBox::tr("File \"%1\" could not be opened").arg(path)); + } + } + /* + + if (!pathList.isEmpty()) { bool success = false; if (path.endsWith(".sv")) { success = gui.openSessionFile(path); @@ -161,6 +200,7 @@ QMessageBox::tr("File \"%1\" could not be opened").arg(path)); } } + */ int rv = application.exec(); std::cerr << "application.exec() returned " << rv << std::endl; diff -r 94f1c2747de4 -r ec77936c268e transform/TransformFactory.cpp --- a/transform/TransformFactory.cpp Wed Oct 11 16:18:51 2006 +0000 +++ b/transform/TransformFactory.cpp Thu Oct 12 14:56:28 2006 +0000 @@ -450,7 +450,22 @@ { if (candidateInputModels.empty()) return 0; + //!!! This will need revision -- we'll have to have a callback + //from the dialog for when the candidate input model is changed, + //as we'll need to reinitialise the channel settings in the dialog Model *inputModel = candidateInputModels[0]; //!!! for now + QStringList candidateModelNames; + std::map modelMap; + for (size_t i = 0; i < candidateInputModels.size(); ++i) { + QString modelName = candidateInputModels[i]->objectName(); + QString origModelName = modelName; + int dupcount = 1; + while (modelMap.find(modelName) != modelMap.end()) { + modelName = tr("%1 <%2>").arg(origModelName).arg(++dupcount); + } + modelMap[modelName] = candidateInputModels[i]; + candidateModelNames.push_back(modelName); + } QString id = name.section(':', 0, 2); QString output = name.section(':', 3); @@ -553,6 +568,10 @@ PluginParameterDialog *dialog = new PluginParameterDialog(plugin); + if (candidateModelNames.size() > 1) { + dialog->setCandidateInputModels(candidateModelNames); + } + dialog->setChannelArrangement(sourceChannels, targetChannels, defaultChannel); @@ -564,6 +583,16 @@ ok = true; } + QString selectedInput = dialog->getInputModel(); + if (selectedInput != "") { + if (modelMap.find(selectedInput) != modelMap.end()) { + inputModel = modelMap[selectedInput]; + std::cerr << "Found selected input \"" << selectedInput.toStdString() << "\" in model map, result is " << inputModel << std::endl; + } else { + std::cerr << "Failed to find selected input \"" << selectedInput.toStdString() << "\" in model map" << std::endl; + } + } + configurationXml = PluginXml(plugin).toXmlString(); context.channel = dialog->getChannel();