comparison framework/Align.h @ 520:c3648c667a0b 3.0-integration

Merge from branch "alignment-simple"
author Chris Cannam
date Thu, 21 Apr 2016 15:06:43 +0100
parents b23db4cef02f
children 06db8f3ceb95
comparison
equal deleted inserted replaced
518:f7ec9e410108 520:c3648c667a0b
1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
2
3 /*
4 Sonic Visualiser
5 An audio file viewer and annotation editor.
6 Centre for Digital Music, Queen Mary, University of London.
7 This file copyright 2006 Chris Cannam and QMUL.
8
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
11 published by the Free Software Foundation; either version 2 of the
12 License, or (at your option) any later version. See the file
13 COPYING included with this distribution for more information.
14 */
15
16 #ifndef ALIGN_H
17 #define ALIGN_H
18
19 #include <QString>
20 #include <QObject>
21 #include <QProcess>
22 #include <set>
23
24 class Model;
25 class AlignmentModel;
26
27 class Align : public QObject
28 {
29 Q_OBJECT
30
31 public:
32 Align() : m_error("") { }
33
34 /**
35 * Align the "other" model to the reference, attaching an
36 * AlignmentModel to it. Alignment is carried out by the method
37 * configured in the user preferences (either a plugin transform
38 * or an external process) and is done asynchronously.
39 *
40 * A single Align object may carry out many simultanous alignment
41 * calls -- you do not need to create a new Align object each
42 * time, nor to wait for an alignment to be complete before
43 * starting a new one.
44 *
45 * The Align object must survive after this call, for at least as
46 * long as the alignment takes. The usual expectation is that the
47 * Align object will simply share the process or document
48 * lifespan.
49 */
50 bool alignModel(Model *reference, Model *other); // via user preference
51
52 bool alignModelViaTransform(Model *reference, Model *other);
53 bool alignModelViaProgram(Model *reference, Model *other, QString program);
54
55 /**
56 * Return true if the alignment facility is available (relevant
57 * plugin installed, etc).
58 */
59 static bool canAlign();
60
61 QString getError() const { return m_error; }
62
63 signals:
64 /**
65 * Emitted when an alignment is successfully completed. The
66 * reference and other models can be queried from the alignment
67 * model.
68 */
69 void alignmentComplete(AlignmentModel *alignment);
70
71 private slots:
72 void alignmentCompletionChanged();
73 void alignmentProgramFinished(int, QProcess::ExitStatus);
74
75 private:
76 static QString getAlignmentTransformName();
77
78 QString m_error;
79 std::map<QProcess *, AlignmentModel *> m_processModels;
80 };
81
82 #endif
83