Mercurial > hg > svgui
comparison view/ViewManager.cpp @ 1479:9bf8aa2916e9 by-id
Further ModelId updates
author | Chris Cannam |
---|---|
date | Wed, 03 Jul 2019 14:20:42 +0100 |
parents | de41a11cabc2 |
children | 4e466690bf20 |
comparison
equal
deleted
inserted
replaced
1478:d39db4673676 | 1479:9bf8aa2916e9 |
---|---|
33 m_playSource(nullptr), | 33 m_playSource(nullptr), |
34 m_recordTarget(nullptr), | 34 m_recordTarget(nullptr), |
35 m_globalCentreFrame(0), | 35 m_globalCentreFrame(0), |
36 m_globalZoom(ZoomLevel::FramesPerPixel, 1024), | 36 m_globalZoom(ZoomLevel::FramesPerPixel, 1024), |
37 m_playbackFrame(0), | 37 m_playbackFrame(0), |
38 m_playbackModel(nullptr), | |
39 m_mainModelSampleRate(0), | 38 m_mainModelSampleRate(0), |
40 m_lastLeft(0), | 39 m_lastLeft(0), |
41 m_lastRight(0), | 40 m_lastRight(0), |
42 m_inProgressExclusive(true), | 41 m_inProgressExclusive(true), |
43 m_toolMode(NavigateMode), | 42 m_toolMode(NavigateMode), |
192 m_playSource->play(f); | 191 m_playSource->play(f); |
193 } | 192 } |
194 } | 193 } |
195 } | 194 } |
196 | 195 |
197 Model * | 196 ModelId |
198 ViewManager::getPlaybackModel() const | 197 ViewManager::getPlaybackModel() const |
199 { | 198 { |
200 return m_playbackModel; | 199 return m_playbackModel; |
201 } | 200 } |
202 | 201 |
203 void | 202 void |
204 ViewManager::setPlaybackModel(Model *model) | 203 ViewManager::setPlaybackModel(ModelId model) |
205 { | 204 { |
206 m_playbackModel = model; | 205 m_playbackModel = model; |
207 } | 206 } |
208 | 207 |
209 sv_frame_t | 208 sv_frame_t |
210 ViewManager::alignPlaybackFrameToReference(sv_frame_t frame) const | 209 ViewManager::alignPlaybackFrameToReference(sv_frame_t frame) const |
211 { | 210 { |
212 #ifdef DEBUG_VIEW_MANAGER | 211 #ifdef DEBUG_VIEW_MANAGER |
213 cerr << "ViewManager::alignPlaybackFrameToReference(" << frame << "): playback model is " << m_playbackModel << endl; | 212 cerr << "ViewManager::alignPlaybackFrameToReference(" << frame << "): playback model is " << m_playbackModel << endl; |
214 #endif | 213 #endif |
215 if (!m_playbackModel || !m_alignMode) { | 214 if (m_playbackModel.isNone() || !m_alignMode) { |
216 return frame; | 215 return frame; |
217 } else { | 216 } else { |
218 sv_frame_t f = m_playbackModel->alignToReference(frame); | 217 auto playbackModel = ModelById::get(m_playbackModel); |
218 if (!playbackModel) { | |
219 return frame; | |
220 } | |
221 sv_frame_t f = playbackModel->alignToReference(frame); | |
219 #ifdef DEBUG_VIEW_MANAGER | 222 #ifdef DEBUG_VIEW_MANAGER |
220 cerr << "aligned frame = " << f << endl; | 223 cerr << "aligned frame = " << f << endl; |
221 #endif | 224 #endif |
222 return f; | 225 return f; |
223 } | 226 } |
227 ViewManager::alignReferenceToPlaybackFrame(sv_frame_t frame) const | 230 ViewManager::alignReferenceToPlaybackFrame(sv_frame_t frame) const |
228 { | 231 { |
229 #ifdef DEBUG_VIEW_MANAGER | 232 #ifdef DEBUG_VIEW_MANAGER |
230 cerr << "ViewManager::alignReferenceToPlaybackFrame(" << frame << "): playback model is " << m_playbackModel << endl; | 233 cerr << "ViewManager::alignReferenceToPlaybackFrame(" << frame << "): playback model is " << m_playbackModel << endl; |
231 #endif | 234 #endif |
232 if (!m_playbackModel || !m_alignMode) { | 235 if (m_playbackModel.isNone() || !m_alignMode) { |
233 return frame; | 236 return frame; |
234 } else { | 237 } else { |
235 sv_frame_t f = m_playbackModel->alignFromReference(frame); | 238 auto playbackModel = ModelById::get(m_playbackModel); |
239 if (!playbackModel) { | |
240 return frame; | |
241 } | |
242 sv_frame_t f = playbackModel->alignFromReference(frame); | |
236 #ifdef DEBUG_VIEW_MANAGER | 243 #ifdef DEBUG_VIEW_MANAGER |
237 cerr << "aligned frame = " << f << endl; | 244 cerr << "aligned frame = " << f << endl; |
238 #endif | 245 #endif |
239 return f; | 246 return f; |
240 } | 247 } |