Chris@320
|
1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
|
Chris@320
|
2
|
Chris@320
|
3 /*
|
Chris@320
|
4 Sonic Visualiser
|
Chris@320
|
5 An audio file viewer and annotation editor.
|
Chris@320
|
6 Centre for Digital Music, Queen Mary, University of London.
|
Chris@328
|
7 This file copyright 2006-2007 Chris Cannam and QMUL.
|
Chris@320
|
8
|
Chris@320
|
9 This program is free software; you can redistribute it and/or
|
Chris@320
|
10 modify it under the terms of the GNU General Public License as
|
Chris@320
|
11 published by the Free Software Foundation; either version 2 of the
|
Chris@320
|
12 License, or (at your option) any later version. See the file
|
Chris@320
|
13 COPYING included with this distribution for more information.
|
Chris@320
|
14 */
|
Chris@320
|
15
|
Chris@320
|
16 #ifndef _TRANSFORM_H_
|
Chris@320
|
17 #define _TRANSFORM_H_
|
Chris@320
|
18
|
Chris@328
|
19 #include "base/XmlExportable.h"
|
Chris@328
|
20 #include "base/Window.h"
|
Chris@320
|
21
|
Chris@328
|
22 #include <vamp-sdk/RealTime.h>
|
Chris@328
|
23
|
Chris@328
|
24 #include <QString>
|
Chris@320
|
25
|
Chris@320
|
26 typedef QString TransformId;
|
Chris@320
|
27
|
Chris@328
|
28 namespace Vamp {
|
Chris@328
|
29 class PluginBase;
|
Chris@328
|
30 }
|
Chris@320
|
31
|
Chris@328
|
32 class Transform : public XmlExportable
|
Chris@320
|
33 {
|
Chris@320
|
34 public:
|
Chris@328
|
35 Transform();
|
Chris@320
|
36 virtual ~Transform();
|
Chris@320
|
37
|
Chris@328
|
38 void setIdentifier(TransformId id) { m_id = id; }
|
Chris@328
|
39 TransformId getIdentifier() const { return m_id; }
|
Chris@328
|
40
|
Chris@328
|
41 void setPlugin(QString pluginIdentifier);
|
Chris@328
|
42 void setOutput(QString output);
|
Chris@320
|
43
|
Chris@328
|
44 enum Type { FeatureExtraction, RealTimeEffect };
|
Chris@328
|
45
|
Chris@328
|
46 Type getType() const;
|
Chris@328
|
47 QString getPluginIdentifier() const;
|
Chris@328
|
48 QString getOutput() const;
|
Chris@328
|
49
|
Chris@328
|
50 typedef std::map<QString, float> ParameterMap;
|
Chris@328
|
51
|
Chris@328
|
52 ParameterMap getParameters() const { return m_parameters; }
|
Chris@328
|
53 void setParameters(const ParameterMap &pm) { m_parameters = pm; }
|
Chris@328
|
54
|
Chris@328
|
55 typedef std::map<QString, QString> ConfigurationMap;
|
Chris@328
|
56
|
Chris@328
|
57 ConfigurationMap getConfiguration() const { return m_configuration; }
|
Chris@328
|
58 void setConfiguration(const ConfigurationMap &cm) { m_configuration = cm; }
|
Chris@328
|
59
|
Chris@328
|
60 QString getProgram() const { return m_program; }
|
Chris@328
|
61 void setProgram(QString program) { m_program = program; }
|
Chris@328
|
62
|
Chris@328
|
63 size_t getStepSize() const { return m_stepSize; }
|
Chris@328
|
64 void setStepSize(size_t s) { m_stepSize = s; }
|
Chris@328
|
65
|
Chris@328
|
66 size_t getBlockSize() const { return m_blockSize; }
|
Chris@328
|
67 void setBlockSize(size_t s) { m_blockSize = s; }
|
Chris@328
|
68
|
Chris@328
|
69 WindowType getWindowType() const { return m_windowType; }
|
Chris@328
|
70 void setWindowType(WindowType type) { m_windowType = type; }
|
Chris@328
|
71
|
Chris@328
|
72 Vamp::RealTime getStartTime() const { return m_startTime; }
|
Chris@328
|
73 void setStartTime(Vamp::RealTime t) { m_startTime = t; }
|
Chris@328
|
74
|
Chris@328
|
75 Vamp::RealTime getDuration() const { return m_duration; } // 0 -> all
|
Chris@328
|
76 void setDuration(Vamp::RealTime d) { m_duration = d; }
|
Chris@328
|
77
|
Chris@328
|
78 float getSampleRate() const { return m_sampleRate; } // 0 -> as input
|
Chris@328
|
79 void setSampleRate(float rate) { m_sampleRate = rate; }
|
Chris@328
|
80
|
Chris@328
|
81 void toXml(QTextStream &stream, QString indent = "",
|
Chris@328
|
82 QString extraAttributes = "") const;
|
Chris@328
|
83
|
Chris@328
|
84 static Transform fromXmlString(QString xml);
|
Chris@320
|
85
|
Chris@320
|
86 protected:
|
Chris@328
|
87 TransformId m_id; // pluginid:output, that is type:soname:label:output
|
Chris@328
|
88
|
Chris@328
|
89 static QString createIdentifier
|
Chris@328
|
90 (QString type, QString soName, QString label, QString output);
|
Chris@320
|
91
|
Chris@328
|
92 static void parseIdentifier
|
Chris@328
|
93 (QString identifier,
|
Chris@328
|
94 QString &type, QString &soName, QString &label, QString &output);
|
Chris@328
|
95
|
Chris@328
|
96 ParameterMap m_parameters;
|
Chris@328
|
97 ConfigurationMap m_configuration;
|
Chris@328
|
98 QString m_program;
|
Chris@328
|
99 size_t m_stepSize;
|
Chris@328
|
100 size_t m_blockSize;
|
Chris@328
|
101 WindowType m_windowType;
|
Chris@328
|
102 Vamp::RealTime m_startTime;
|
Chris@328
|
103 Vamp::RealTime m_duration;
|
Chris@328
|
104 float m_sampleRate;
|
Chris@320
|
105 };
|
Chris@320
|
106
|
Chris@320
|
107 #endif
|
Chris@328
|
108
|