# HG changeset patch # User Chris Cannam # Date 1197046051 0 # Node ID b5a2428f647bb0b0413a549c2eaf1c85e7c83aa1 # Parent a3011df6ddade47196ae35abd29da2a04809768b * Merge from transforms branch -- switch over to using Transform object properly diff -r a3011df6ddad -r b5a2428f647b main/MainWindow.cpp --- a/main/MainWindow.cpp Fri Nov 30 17:31:09 2007 +0000 +++ b/main/MainWindow.cpp Fri Dec 07 16:47:31 2007 +0000 @@ -911,7 +911,7 @@ }; std::vector models; - if (m_document) models = m_document->getTransformerInputModels(); //!!! not well named for this! + if (m_document) models = m_document->getTransformInputModels(); bool plural = (models.size() > 1); if (models.empty()) { models.push_back(getMainModel()); // probably 0 @@ -1184,7 +1184,7 @@ } TransformList transforms = - TransformFactory::getInstance()->getAllTransforms(); + TransformFactory::getInstance()->getAllTransformDescriptions(); vector types = TransformFactory::getInstance()->getAllTransformTypes(); @@ -2734,7 +2734,7 @@ if (suggestedModel) { // check its validity - std::vector inputModels = m_document->getTransformerInputModels(); + std::vector inputModels = m_document->getTransformInputModels(); for (size_t j = 0; j < inputModels.size(); ++j) { if (inputModels[j] == suggestedModel) { model = suggestedModel; @@ -2855,11 +2855,9 @@ return; } - TransformId transform = i->second; - ModelTransformerFactory *factory = ModelTransformerFactory::getInstance(); - - QString configurationXml; - + //!!! want to do something like this, but it's not supported in + //ModelTransformerFactory yet + /* int channel = -1; // pick up the default channel from any existing layers on the same pane for (int j = 0; j < pane->getLayerCount(); ++j) { @@ -2869,15 +2867,18 @@ break; } } + */ // We always ask for configuration, even if the plugin isn't // supposed to be configurable, because we need to let the user // change the execution context (block size etc). - PluginTransformer::ExecutionContext context(channel); + QString transformId = i->second; + Transform transform = TransformFactory::getInstance()-> + getDefaultTransformFor(transformId); std::vector candidateInputModels = - m_document->getTransformerInputModels(); + m_document->getTransformInputModels(); Model *defaultInputModel = 0; for (int j = 0; j < pane->getLayerCount(); ++j) { @@ -2900,29 +2901,25 @@ if (endFrame > startFrame) duration = endFrame - startFrame; else startFrame = 0; - Model *inputModel = factory->getConfigurationForTransformer + ModelTransformer::Input input = ModelTransformerFactory::getInstance()-> + getConfigurationForTransform (transform, candidateInputModels, defaultInputModel, - context, - configurationXml, m_playSource, startFrame, duration); - if (!inputModel) return; - -// std::cerr << "MainWindow::addLayer: Input model is " << inputModel << " \"" << inputModel->objectName().toStdString() << "\"" << std::endl; - - Layer *newLayer = m_document->createDerivedLayer(transform, - inputModel, - context, - configurationXml); + if (!input.getModel()) return; + +// std::cerr << "MainWindow::addLayer: Input model is " << input.getModel() << " \"" << input.getModel()->objectName().toStdString() << "\"" << std::endl; + + Layer *newLayer = m_document->createDerivedLayer(transform, input); if (newLayer) { m_document->addLayerToView(pane, newLayer); - m_document->setChannel(newLayer, context.channel); - m_recentTransforms.add(transform); + m_document->setChannel(newLayer, input.getChannel()); + m_recentTransforms.add(transformId); m_paneStack->setCurrentLayer(pane, newLayer); } diff -r a3011df6ddad -r b5a2428f647b main/OSCHandler.cpp --- a/main/OSCHandler.cpp Fri Nov 30 17:31:09 2007 +0000 +++ b/main/OSCHandler.cpp Fri Dec 07 16:47:31 2007 +0000 @@ -1,3 +1,17 @@ +/* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ + +/* + Sonic Visualiser + An audio file viewer and annotation editor. + Centre for Digital Music, Queen Mary, University of London. + This file copyright 2006-2007 Chris Cannam and QMUL. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. See the file + COPYING included with this distribution for more information. +*/ #include "MainWindow.h" #include "data/osc/OSCQueue.h" @@ -12,7 +26,7 @@ #include "audioio/AudioCallbackPlayTarget.h" #include "framework/Document.h" #include "data/fileio/WavFileWriter.h" -#include "plugin/transform/ModelTransformerFactory.h" +#include "plugin/transform/TransformFactory.h" #include "widgets/Fader.h" #include "widgets/AudioDial.h" @@ -482,18 +496,17 @@ message.getArgCount() == 1 && message.getArg(0).canConvert(QVariant::String)) { - TransformId transform = message.getArg(0).toString(); + TransformId transformId = message.getArg(0).toString(); + Transform transform = TransformFactory::getInstance()-> + getDefaultTransformFor(transformId); + Layer *newLayer = m_document->createDerivedLayer - (transform, - getMainModel(), - ModelTransformerFactory::getInstance()->getDefaultContextForTransformer - (transform, getMainModel()), - ""); + (transform, getMainModel()); if (newLayer) { m_document->addLayerToView(pane, newLayer); - m_recentTransforms.add(transform); + m_recentTransforms.add(transformId); m_paneStack->setCurrentLayer(pane, newLayer); } }