Mercurial > hg > svapp
comparison align/Align.h @ 753:31289e8592c7 pitch-align
Switch to using the pulled-out TransformAligner and ExternalProgramAligner
author | Chris Cannam |
---|---|
date | Fri, 24 Apr 2020 14:38:22 +0100 |
parents | 36772d79cf44 |
children | d0d47127d8cc |
comparison
equal
deleted
inserted
replaced
752:32654e402f8b | 753:31289e8592c7 |
---|---|
19 #include <QObject> | 19 #include <QObject> |
20 #include <QProcess> | 20 #include <QProcess> |
21 #include <QMutex> | 21 #include <QMutex> |
22 #include <set> | 22 #include <set> |
23 | 23 |
24 #include "data/model/Model.h" | 24 #include "Aligner.h" |
25 | 25 |
26 class AlignmentModel; | 26 class AlignmentModel; |
27 class SparseTimeValueModel; | |
28 class AggregateWaveModel; | |
29 class Document; | 27 class Document; |
30 | 28 |
31 class Align : public QObject | 29 class Align : public QObject |
32 { | 30 { |
33 Q_OBJECT | 31 Q_OBJECT |
64 */ | 62 */ |
65 bool alignModel(Document *doc, | 63 bool alignModel(Document *doc, |
66 ModelId reference, | 64 ModelId reference, |
67 ModelId toAlign, | 65 ModelId toAlign, |
68 QString &error); | 66 QString &error); |
69 | |
70 bool alignModelViaTransform(Document *doc, | |
71 ModelId reference, | |
72 ModelId toAlign, | |
73 QString &error); | |
74 | |
75 bool alignModelViaProgram(Document *doc, | |
76 ModelId reference, | |
77 ModelId toAlign, | |
78 QString program, | |
79 QString &error); | |
80 | 67 |
81 /** | 68 /** |
82 * Return true if the alignment facility is available (relevant | 69 * Return true if the alignment facility is available (relevant |
83 * plugin installed, etc). | 70 * plugin installed, etc). |
84 */ | 71 */ |
91 * model. | 78 * model. |
92 */ | 79 */ |
93 void alignmentComplete(ModelId alignmentModel); // an AlignmentModel | 80 void alignmentComplete(ModelId alignmentModel); // an AlignmentModel |
94 | 81 |
95 private slots: | 82 private slots: |
96 void alignmentCompletionChanged(ModelId); | 83 void alignerComplete(ModelId alignmentModel); // an AlignmentModel |
97 void tuningDifferenceCompletionChanged(ModelId); | |
98 void alignmentProgramFinished(int, QProcess::ExitStatus); | |
99 | 84 |
100 private: | 85 private: |
101 static QString getAlignmentTransformName(); | |
102 static QString getTuningDifferenceTransformName(); | |
103 | |
104 bool beginTransformDrivenAlignment(ModelId, // an AggregateWaveModel | |
105 ModelId, // an AlignmentModel | |
106 float tuningFrequency = 0.f); | |
107 | |
108 void abandonOngoingAlignment(ModelId otherId); | |
109 | |
110 QMutex m_mutex; | 86 QMutex m_mutex; |
111 | 87 |
112 struct TuningDiffRec { | 88 // maps toAlign -> aligner for ongoing alignment - note that |
113 ModelId input; // an AggregateWaveModel | 89 // although we can calculate alignments with different references, |
114 ModelId alignment; // an AlignmentModel | 90 // we can only have one alignment on any given toAlign model, so |
115 ModelId preparatory; // a SparseTimeValueModel | 91 // we don't key this on the whole (reference, toAlign) pair |
116 }; | 92 std::map<ModelId, std::shared_ptr<Aligner>> m_aligners; |
117 | |
118 // tuning-difference output model (a SparseTimeValueModel) -> data | |
119 // needed for subsequent alignment | |
120 std::map<ModelId, TuningDiffRec> m_pendingTuningDiffs; | |
121 | 93 |
122 // alignment model id -> path output model id | 94 static void getAlignerPreference(bool useProgram, QString program); |
123 std::map<ModelId, ModelId> m_pendingAlignments; | |
124 | |
125 // external alignment subprocess -> model into which to stuff the | |
126 // results (an AlignmentModel) | |
127 std::map<QProcess *, ModelId> m_pendingProcesses; | |
128 }; | 95 }; |
129 | 96 |
130 #endif | 97 #endif |
131 | 98 |