Chris@330: /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ Chris@330: Chris@330: /* Chris@330: Sonic Visualiser Chris@330: An audio file viewer and annotation editor. Chris@330: Centre for Digital Music, Queen Mary, University of London. Chris@330: This file copyright 2006-2007 Chris Cannam and QMUL. Chris@330: Chris@330: This program is free software; you can redistribute it and/or Chris@330: modify it under the terms of the GNU General Public License as Chris@330: published by the Free Software Foundation; either version 2 of the Chris@330: License, or (at your option) any later version. See the file Chris@330: COPYING included with this distribution for more information. Chris@330: */ Chris@330: Chris@330: #ifndef _TRANSFORM_FACTORY_H_ Chris@330: #define _TRANSFORM_FACTORY_H_ Chris@330: Chris@330: #include "TransformDescription.h" Chris@330: Chris@330: #include Chris@330: #include Chris@330: Chris@330: namespace Vamp { class PluginBase; } Chris@330: Chris@330: class TransformFactory : public QObject Chris@330: { Chris@330: Q_OBJECT Chris@330: Chris@330: public: Chris@330: virtual ~TransformFactory(); Chris@330: Chris@330: static TransformFactory *getInstance(); Chris@330: Chris@330: TransformList getAllTransforms(); Chris@330: Chris@330: std::vector getAllTransformTypes(); Chris@330: Chris@330: std::vector getTransformCategories(QString transformType); Chris@330: std::vector getTransformMakers(QString transformType); Chris@330: Chris@330: /** Chris@330: * Return true if the given transform is known. Chris@330: */ Chris@330: bool haveTransform(TransformId identifier); Chris@330: Chris@330: /** Chris@330: * Full name of a transform, suitable for putting on a menu. Chris@330: */ Chris@330: QString getTransformName(TransformId identifier); Chris@330: Chris@330: /** Chris@330: * Brief but friendly name of a transform, suitable for use Chris@330: * as the name of the output layer. Chris@330: */ Chris@330: QString getTransformFriendlyName(TransformId identifier); Chris@330: Chris@330: QString getTransformUnits(TransformId identifier); Chris@330: Chris@330: /** Chris@330: * Return true if the transform has any configurable parameters, Chris@330: * i.e. if getConfigurationForTransform can ever return a non-trivial Chris@330: * (not equivalent to empty) configuration string. Chris@330: */ Chris@330: bool isTransformConfigurable(TransformId identifier); Chris@330: Chris@330: /** Chris@330: * If the transform has a prescribed number or range of channel Chris@330: * inputs, return true and set minChannels and maxChannels to the Chris@330: * minimum and maximum number of channel inputs the transform can Chris@330: * accept. Return false if it doesn't care. Chris@330: */ Chris@330: bool getTransformChannelRange(TransformId identifier, Chris@330: int &minChannels, int &maxChannels); Chris@330: Chris@330: protected: Chris@330: typedef std::map TransformDescriptionMap; Chris@330: TransformDescriptionMap m_transforms; Chris@330: Chris@330: void populateTransforms(); Chris@330: void populateFeatureExtractionPlugins(TransformDescriptionMap &); Chris@330: void populateRealTimePlugins(TransformDescriptionMap &); Chris@330: Chris@330: static TransformFactory *m_instance; Chris@330: }; Chris@330: Chris@330: Chris@330: #endif