annotate framework/Align.h @ 569:1cc23cee4ebf 3.0-integration

Report audio driver startup error
author Chris Cannam
date Wed, 04 Jan 2017 09:57:13 +0000
parents b23db4cef02f
children 06db8f3ceb95
rev   line source
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@428 46 * long as the alignment takes. The usual expectation is that the
Chris@428 47 * Align object will simply share the process or document
Chris@428 48 * lifespan.
Chris@423 49 */
Chris@422 50 bool alignModel(Model *reference, Model *other); // via user preference
Chris@422 51
Chris@420 52 bool alignModelViaTransform(Model *reference, Model *other);
Chris@422 53 bool alignModelViaProgram(Model *reference, Model *other, QString program);
Chris@420 54
Chris@428 55 /**
Chris@428 56 * Return true if the alignment facility is available (relevant
Chris@428 57 * plugin installed, etc).
Chris@428 58 */
Chris@428 59 static bool canAlign();
Chris@428 60
Chris@420 61 QString getError() const { return m_error; }
Chris@428 62
Chris@428 63 signals:
Chris@428 64 /**
Chris@428 65 * Emitted when an alignment is successfully completed. The
Chris@428 66 * reference and other models can be queried from the alignment
Chris@428 67 * model.
Chris@428 68 */
Chris@428 69 void alignmentComplete(AlignmentModel *alignment);
Chris@428 70
Chris@423 71 private slots:
Chris@428 72 void alignmentCompletionChanged();
Chris@423 73 void alignmentProgramFinished(int, QProcess::ExitStatus);
Chris@423 74
Chris@420 75 private:
Chris@428 76 static QString getAlignmentTransformName();
Chris@428 77
Chris@420 78 QString m_error;
Chris@423 79 std::map<QProcess *, AlignmentModel *> m_processModels;
Chris@420 80 };
Chris@420 81
Chris@420 82 #endif
Chris@420 83