comparison plugin/transform/Transform.cpp @ 328:21bd032ae791

* Introduce new Transform class which contains data necessary to describe the context for a plugin -- the plugin's name and output, the step/block size etc (formerly spread across ExecutionContext and TransformFactory). Other code hasn't been updated to use this yet. * Rename existing Transform stuff to Transformers (because they run Transforms) I'm still not 100% sure about this change, don't rely on it.
author Chris Cannam
date Mon, 05 Nov 2007 15:31:06 +0000
parents 32e50b620a6c
children 13e5870040e6
comparison
equal deleted inserted replaced
327:1d656dcda8ef 328:21bd032ae791
2 2
3 /* 3 /*
4 Sonic Visualiser 4 Sonic Visualiser
5 An audio file viewer and annotation editor. 5 An audio file viewer and annotation editor.
6 Centre for Digital Music, Queen Mary, University of London. 6 Centre for Digital Music, Queen Mary, University of London.
7 This file copyright 2006 Chris Cannam. 7 This file copyright 2006-2007 Chris Cannam and QMUL.
8 8
9 This program is free software; you can redistribute it and/or 9 This program is free software; you can redistribute it and/or
10 modify it under the terms of the GNU General Public License as 10 modify it under the terms of the GNU General Public License as
11 published by the Free Software Foundation; either version 2 of the 11 published by the Free Software Foundation; either version 2 of the
12 License, or (at your option) any later version. See the file 12 License, or (at your option) any later version. See the file
13 COPYING included with this distribution for more information. 13 COPYING included with this distribution for more information.
14 */ 14 */
15 15
16 #include "Transform.h" 16 #include "Transform.h"
17 17
18 Transform::Transform(Model *m) : 18 #include "plugin/PluginIdentifier.h"
19 m_input(m), 19
20 m_output(0), 20 Transform::Transform() :
21 m_detached(false), 21 m_stepSize(0),
22 m_abandoned(false) 22 m_blockSize(0),
23 m_windowType(HanningWindow),
24 m_sampleRate(0)
23 { 25 {
24 } 26 }
25 27
26 Transform::~Transform() 28 Transform::~Transform()
27 { 29 {
28 m_abandoned = true;
29 wait();
30 if (!m_detached) delete m_output;
31 } 30 }
32 31
32 QString
33 Transform::createIdentifier(QString type, QString soName, QString label,
34 QString output)
35 {
36 QString pluginId = PluginIdentifier::createIdentifier(type, soName, label);
37 return pluginId + ":" + output;
38 }
39
40 void
41 Transform::parseIdentifier(QString identifier,
42 QString &type, QString &soName,
43 QString &label, QString &output)
44 {
45 output = identifier.section(':', 3);
46 PluginIdentifier::parseIdentifier(identifier.section(':', 0, 2),
47 type, soName, label);
48 }
49
50 Transform::Type
51 Transform::getType() const
52 {
53 QString type, soName, label, output;
54 parseIdentifier(m_id, type, soName, label, output);
55 if (type == "vamp") return FeatureExtraction; //!!! lousy
56 else return RealTimeEffect;
57 }
58
59 QString
60 Transform::getPluginIdentifier() const
61 {
62 return m_id.section(':', 0, 2);
63 }
64
65 QString
66 Transform::getOutput() const
67 {
68 return m_id.section(':', 3);
69 }
70
71 void
72 Transform::toXml(QTextStream &stream, QString indent, QString extraAttributes) const
73 {
74
75 }