Chris@320: /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ Chris@320: Chris@320: /* Chris@320: Sonic Visualiser Chris@320: An audio file viewer and annotation editor. Chris@320: Centre for Digital Music, Queen Mary, University of London. Chris@328: This file copyright 2006-2007 Chris Cannam and QMUL. Chris@320: Chris@320: This program is free software; you can redistribute it and/or Chris@320: modify it under the terms of the GNU General Public License as Chris@320: published by the Free Software Foundation; either version 2 of the Chris@320: License, or (at your option) any later version. See the file Chris@320: COPYING included with this distribution for more information. Chris@320: */ Chris@320: Chris@320: #ifndef _TRANSFORM_H_ Chris@320: #define _TRANSFORM_H_ Chris@320: Chris@328: #include "base/XmlExportable.h" Chris@328: #include "base/Window.h" Chris@320: Chris@328: #include Chris@328: Chris@328: #include Chris@320: Chris@320: typedef QString TransformId; Chris@320: Chris@328: namespace Vamp { Chris@328: class PluginBase; Chris@328: } Chris@320: Chris@328: class Transform : public XmlExportable Chris@320: { Chris@320: public: Chris@328: Transform(); Chris@320: virtual ~Transform(); Chris@320: Chris@328: void setIdentifier(TransformId id) { m_id = id; } Chris@328: TransformId getIdentifier() const { return m_id; } Chris@328: Chris@328: void setPlugin(QString pluginIdentifier); Chris@328: void setOutput(QString output); Chris@320: Chris@328: enum Type { FeatureExtraction, RealTimeEffect }; Chris@328: Chris@328: Type getType() const; Chris@328: QString getPluginIdentifier() const; Chris@328: QString getOutput() const; Chris@328: Chris@328: typedef std::map ParameterMap; Chris@328: Chris@328: ParameterMap getParameters() const { return m_parameters; } Chris@328: void setParameters(const ParameterMap &pm) { m_parameters = pm; } Chris@328: Chris@328: typedef std::map ConfigurationMap; Chris@328: Chris@328: ConfigurationMap getConfiguration() const { return m_configuration; } Chris@328: void setConfiguration(const ConfigurationMap &cm) { m_configuration = cm; } Chris@328: Chris@328: QString getProgram() const { return m_program; } Chris@328: void setProgram(QString program) { m_program = program; } Chris@328: Chris@328: size_t getStepSize() const { return m_stepSize; } Chris@328: void setStepSize(size_t s) { m_stepSize = s; } Chris@328: Chris@328: size_t getBlockSize() const { return m_blockSize; } Chris@328: void setBlockSize(size_t s) { m_blockSize = s; } Chris@328: Chris@328: WindowType getWindowType() const { return m_windowType; } Chris@328: void setWindowType(WindowType type) { m_windowType = type; } Chris@328: Chris@328: Vamp::RealTime getStartTime() const { return m_startTime; } Chris@328: void setStartTime(Vamp::RealTime t) { m_startTime = t; } Chris@328: Chris@328: Vamp::RealTime getDuration() const { return m_duration; } // 0 -> all Chris@328: void setDuration(Vamp::RealTime d) { m_duration = d; } Chris@328: Chris@328: float getSampleRate() const { return m_sampleRate; } // 0 -> as input Chris@328: void setSampleRate(float rate) { m_sampleRate = rate; } Chris@328: Chris@328: void toXml(QTextStream &stream, QString indent = "", Chris@328: QString extraAttributes = "") const; Chris@328: Chris@328: static Transform fromXmlString(QString xml); Chris@320: Chris@320: protected: Chris@328: TransformId m_id; // pluginid:output, that is type:soname:label:output Chris@328: Chris@328: static QString createIdentifier Chris@328: (QString type, QString soName, QString label, QString output); Chris@320: Chris@328: static void parseIdentifier Chris@328: (QString identifier, Chris@328: QString &type, QString &soName, QString &label, QString &output); Chris@328: Chris@328: ParameterMap m_parameters; Chris@328: ConfigurationMap m_configuration; Chris@328: QString m_program; Chris@328: size_t m_stepSize; Chris@328: size_t m_blockSize; Chris@328: WindowType m_windowType; Chris@328: Vamp::RealTime m_startTime; Chris@328: Vamp::RealTime m_duration; Chris@328: float m_sampleRate; Chris@320: }; Chris@320: Chris@320: #endif Chris@328: