Chris@329: /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ Chris@329: Chris@329: /* Chris@329: Sonic Visualiser Chris@329: An audio file viewer and annotation editor. Chris@329: Centre for Digital Music, Queen Mary, University of London. Chris@329: This file copyright 2006-2007 Chris Cannam and QMUL. Chris@329: Chris@329: This program is free software; you can redistribute it and/or Chris@329: modify it under the terms of the GNU General Public License as Chris@329: published by the Free Software Foundation; either version 2 of the Chris@329: License, or (at your option) any later version. See the file Chris@329: COPYING included with this distribution for more information. Chris@329: */ Chris@329: Chris@1546: #ifndef SV_TRANSFORM_DESCRIPTION_H Chris@1546: #define SV_TRANSFORM_DESCRIPTION_H Chris@329: Chris@329: #include "Transform.h" Chris@329: Chris@329: #include Chris@329: Chris@329: #include Chris@329: Chris@329: /** Chris@329: * Metadata associated with a transform. Chris@329: * Chris@329: * The transform ID is the same as that used in the Transform class. Chris@329: * It is intended to be computer-referenceable and unique within the Chris@329: * application. Chris@329: * Chris@329: * The name is intended to be human readable. In principle it doesn't Chris@329: * have to be unique, but the factory that creates these objects Chris@329: * should add suffixes to ensure that it is, all the same (just to Chris@329: * avoid user confusion). Chris@329: * Chris@329: * The friendly name is a shorter version of the name. Chris@329: * Chris@329: * The type is also intended to be user-readable, for use in menus. Chris@350: * Chris@350: * To obtain these objects, use Chris@350: * TransformFactory::getAllTransformDescriptions and Chris@350: * TransformFactory::getTransformDescription. Chris@329: */ Chris@329: Chris@329: struct TransformDescription Chris@329: { Chris@487: enum Type { Chris@487: Analysis, // e.g. vamp plugin output Chris@487: Effects, // e.g. ladspa plugin with audio in and out Chris@487: EffectsData, // e.g. control output of ladspa plugin Chris@487: Generator, // e.g. audio out of ladspa plugin with no audio in Chris@487: UnknownType Chris@487: }; Chris@487: Chris@976: TransformDescription() : Chris@976: type(UnknownType), configurable(false) { } Chris@487: TransformDescription(Type _type, QString _category, Chris@329: TransformId _identifier, QString _name, Chris@329: QString _friendlyName, QString _description, Chris@443: QString _longDescription, Chris@329: QString _maker, QString _units, bool _configurable) : Chris@329: type(_type), category(_category), Chris@329: identifier(_identifier), name(_name), Chris@329: friendlyName(_friendlyName), description(_description), Chris@443: longDescription(_longDescription), Chris@329: maker(_maker), units(_units), configurable(_configurable) { } Chris@329: Chris@487: Type type; Chris@329: QString category; // e.g. time > onsets Chris@329: TransformId identifier; // e.g. vamp:vamp-aubio:aubioonset Chris@329: QString name; // plugin's name if 1 output, else "name: output" Chris@329: QString friendlyName; // short text for layer name Chris@329: QString description; // sentence describing transform Chris@443: QString longDescription; // description "using" plugin name "by" maker Chris@329: QString maker; Chris@462: QString infoUrl; Chris@329: QString units; Chris@329: bool configurable; Chris@1546: Chris@1546: // User-visible strings (name, maker etc) should be sorted in a Chris@1546: // locale-aware way Chris@1546: static bool compareUserStrings(QString s1, QString s2) { Chris@1546: return QString::localeAwareCompare(s1, s2) < 0; Chris@1546: }; Chris@329: Chris@329: bool operator<(const TransformDescription &od) const { Chris@1546: if (name == od.name) { Chris@1546: return identifier < od.identifier; Chris@1546: } else { Chris@1546: return compareUserStrings(name, od.name); Chris@1546: } Chris@329: }; Chris@329: }; Chris@329: Chris@329: typedef std::vector TransformList; Chris@329: Chris@329: #endif