Chris@420
|
1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
|
Chris@420
|
2
|
Chris@420
|
3 /*
|
Chris@420
|
4 Sonic Visualiser
|
Chris@420
|
5 An audio file viewer and annotation editor.
|
Chris@420
|
6 Centre for Digital Music, Queen Mary, University of London.
|
Chris@420
|
7 This file copyright 2006 Chris Cannam and QMUL.
|
Chris@420
|
8
|
Chris@420
|
9 This program is free software; you can redistribute it and/or
|
Chris@420
|
10 modify it under the terms of the GNU General Public License as
|
Chris@420
|
11 published by the Free Software Foundation; either version 2 of the
|
Chris@420
|
12 License, or (at your option) any later version. See the file
|
Chris@420
|
13 COPYING included with this distribution for more information.
|
Chris@420
|
14 */
|
Chris@420
|
15
|
Chris@420
|
16 #ifndef ALIGN_H
|
Chris@420
|
17 #define ALIGN_H
|
Chris@420
|
18
|
Chris@420
|
19 #include <QString>
|
Chris@423
|
20 #include <QObject>
|
Chris@423
|
21 #include <QProcess>
|
Chris@423
|
22 #include <set>
|
Chris@420
|
23
|
Chris@420
|
24 class Model;
|
Chris@423
|
25 class AlignmentModel;
|
Chris@420
|
26
|
Chris@423
|
27 class Align : public QObject
|
Chris@420
|
28 {
|
Chris@423
|
29 Q_OBJECT
|
Chris@423
|
30
|
Chris@420
|
31 public:
|
Chris@420
|
32 Align() : m_error("") { }
|
Chris@420
|
33
|
Chris@423
|
34 /**
|
Chris@423
|
35 * Align the "other" model to the reference, attaching an
|
Chris@423
|
36 * AlignmentModel to it. Alignment is carried out by the method
|
Chris@423
|
37 * configured in the user preferences (either a plugin transform
|
Chris@423
|
38 * or an external process) and is done asynchronously.
|
Chris@423
|
39 *
|
Chris@423
|
40 * A single Align object may carry out many simultanous alignment
|
Chris@423
|
41 * calls -- you do not need to create a new Align object each
|
Chris@423
|
42 * time, nor to wait for an alignment to be complete before
|
Chris@423
|
43 * starting a new one.
|
Chris@423
|
44 *
|
Chris@423
|
45 * The Align object must survive after this call, for at least as
|
Chris@423
|
46 * long as the alignment takes. There is currently no way in this
|
Chris@423
|
47 * API to discover when an alignment is complete -- the
|
Chris@423
|
48 * expectation is that the Align object will simply share the
|
Chris@423
|
49 * process or document lifespan.
|
Chris@423
|
50 */
|
Chris@422
|
51 bool alignModel(Model *reference, Model *other); // via user preference
|
Chris@422
|
52
|
Chris@420
|
53 bool alignModelViaTransform(Model *reference, Model *other);
|
Chris@422
|
54 bool alignModelViaProgram(Model *reference, Model *other, QString program);
|
Chris@420
|
55
|
Chris@420
|
56 QString getError() const { return m_error; }
|
Chris@423
|
57
|
Chris@423
|
58 private slots:
|
Chris@423
|
59 void alignmentProgramFinished(int, QProcess::ExitStatus);
|
Chris@423
|
60
|
Chris@420
|
61 private:
|
Chris@420
|
62 QString m_error;
|
Chris@423
|
63 std::map<QProcess *, AlignmentModel *> m_processModels;
|
Chris@420
|
64 };
|
Chris@420
|
65
|
Chris@420
|
66 #endif
|
Chris@420
|
67
|