Mercurial > hg > tony
comparison src/Analyser.h @ 199:0ba33d6c0a71
Properly rationalise the show/hide/add/remove layer logic for pitch candidates: ctrl+return maps through to a show layer command (but the layers remain in the view) while the add/remove layer flow is used for layer creation after selection and for abandoning an edit or discarding a selection.
author | Chris Cannam |
---|---|
date | Wed, 05 Mar 2014 13:20:26 +0000 |
parents | bb391844e2aa |
children | 9bdff8d10a86 |
comparison
equal
deleted
inserted
replaced
198:bb391844e2aa | 199:0ba33d6c0a71 |
---|---|
102 */ | 102 */ |
103 QString reAnalyseSelection(Selection sel, FrequencyRange range); | 103 QString reAnalyseSelection(Selection sel, FrequencyRange range); |
104 | 104 |
105 /** | 105 /** |
106 * Return true if the analysed pitch candidates are currently | 106 * Return true if the analysed pitch candidates are currently |
107 * visible (by default they are hidden after construction until | 107 * visible (they are hidden from the call to reAnalyseSelection |
108 * the user requests them). Note that the shown/hidden state is | 108 * until they are requested through showPitchCandidates()). Note |
109 * independent of whether any pitch candidates actually exist -- | 109 * that this may return true even when no pitch candidate layers |
110 * it's possible they might be shown but not have been created yet | 110 * actually exist yet, because they are constructed |
111 * because creation (through reAnalyseSelection) is asynchronous. | 111 * asynchronously. If that is the case, then the layers will |
112 * | 112 * appear when they are created (otherwise they will remain hidden |
113 *!!! this interface is not right | 113 * after creation). |
114 */ | 114 */ |
115 bool arePitchCandidatesShown() const; | 115 bool arePitchCandidatesShown() const; |
116 | 116 |
117 /** | 117 /** |
118 * Show or hide the analysed pitch candidate layers. As in | 118 * Show or hide the analysed pitch candidate layers. This is reset |
119 * arePitchCandidatesShown, this is independent of whether the | 119 * (to "hide") with each new call to reAnalyseSelection. Because |
120 * candidate layers actually exist. Call reAnalyseSelection to | 120 * the layers are created asynchronously, setting this to true |
121 * schedule creation of those layers. | 121 * does not guarantee that they appear immediately, only that they |
122 * | 122 * will appear once they have been created. |
123 *!!! this interface is not right | |
124 */ | 123 */ |
125 void showPitchCandidates(bool shown); | 124 void showPitchCandidates(bool shown); |
126 | |
127 bool haveHigherPitchCandidate() const; | |
128 bool haveLowerPitchCandidate() const; | |
129 | 125 |
130 /** | 126 /** |
131 * If a re-analysis has been activated, switch the selected area | 127 * If a re-analysis has been activated, switch the selected area |
132 * of the main pitch track to a different candidate from the | 128 * of the main pitch track to a different candidate from the |
133 * analysis results. | 129 * analysis results. |
134 */ | 130 */ |
135 void switchPitchCandidate(Selection sel, bool up); | 131 void switchPitchCandidate(Selection sel, bool up); |
136 | 132 |
137 /** | 133 /** |
134 * Return true if it is possible to switch up to another pitch | |
135 * candidate. This may mean that the currently selected pitch | |
136 * candidate is not the highest, or it may mean that no alternate | |
137 * pitch candidate has been selected at all yet (but some are | |
138 * available). | |
139 */ | |
140 bool haveHigherPitchCandidate() const; | |
141 | |
142 /** | |
143 * Return true if it is possible to switch down to another pitch | |
144 * candidate. This may mean that the currently selected pitch | |
145 * candidate is not the lowest, or it may mean that no alternate | |
146 * pitch candidate has been selected at all yet (but some are | |
147 * available). | |
148 */ | |
149 bool haveLowerPitchCandidate() const; | |
150 | |
151 /** | |
138 * Delete the pitch estimates from the selected area of the main | 152 * Delete the pitch estimates from the selected area of the main |
139 * pitch track. | 153 * pitch track. |
140 */ | 154 */ |
141 void deletePitches(Selection sel); | 155 void deletePitches(Selection sel); |
142 | 156 |
145 * tracks up or down an octave in the selected area. | 159 * tracks up or down an octave in the selected area. |
146 */ | 160 */ |
147 void shiftOctave(Selection sel, bool up); | 161 void shiftOctave(Selection sel, bool up); |
148 | 162 |
149 /** | 163 /** |
150 * Remove any re-analysis layers (equivalent to | 164 * Remove any re-analysis layers and also reset the pitch track in |
151 * showPitchCandidates(false)) and also reset the pitch track in | |
152 * the given selection to its state prior to the last re-analysis, | 165 * the given selection to its state prior to the last re-analysis, |
153 * abandoning any changes made since then. | 166 * abandoning any changes made since then. No re-analysis layers |
154 */ | 167 * will be available until after the next call to |
155 void clearReAnalysis(Selection sel); | 168 * reAnalyseSelection. |
169 */ | |
170 void abandonReAnalysis(Selection sel); | |
156 | 171 |
157 /** | 172 /** |
158 * Import the pitch track from the given layer into our | 173 * Import the pitch track from the given layer into our |
159 * pitch-track layer. | 174 * pitch-track layer. |
160 */ | 175 */ |
187 | 202 |
188 QString addVisualisations(); | 203 QString addVisualisations(); |
189 QString addWaveform(); | 204 QString addWaveform(); |
190 QString addAnalyses(); | 205 QString addAnalyses(); |
191 | 206 |
207 void discardPitchCandidates(); | |
208 | |
192 // Document::LayerCreationHandler method | 209 // Document::LayerCreationHandler method |
193 void layersCreated(std::vector<Layer *>, std::vector<Layer *>); | 210 void layersCreated(std::vector<Layer *>, std::vector<Layer *>); |
194 | 211 |
195 void saveState(Component c) const; | 212 void saveState(Component c) const; |
196 void loadState(Component c); | 213 void loadState(Component c); |