comparison base/ViewManager.h @ 0:da6937383da8

initial import
author Chris Cannam
date Tue, 10 Jan 2006 16:33:16 +0000
parents
children d86891498eef
comparison
equal deleted inserted replaced
-1:000000000000 0:da6937383da8
1 /* -*- c-basic-offset: 4 -*- vi:set ts=8 sts=4 sw=4: */
2
3 /*
4 A waveform viewer and audio annotation editor.
5 Chris Cannam, Queen Mary University of London, 2005
6
7 This is experimental software. Not for distribution.
8 */
9
10 #ifndef _VIEW_MANAGER_H_
11 #define _VIEW_MANAGER_H_
12
13 #include <QObject>
14 #include <QTimer>
15
16 #include <map>
17
18 class AudioPlaySource;
19 class PlayParameters;
20 class Model;
21
22 /**
23 * The ViewManager manages properties that may need to be synchronised
24 * between separate Views. For example, it handles signals associated
25 * with changes to the global pan and zoom. It also handles playback
26 * properties and play synchronisation.
27 *
28 * Views should be implemented in such a way as to work
29 * correctly whether they are supplied with a ViewManager or not.
30 */
31
32 class ViewManager : public QObject
33 {
34 Q_OBJECT
35
36 public:
37 ViewManager();
38
39 void setAudioPlaySource(AudioPlaySource *source);
40
41 //!!! No way to remove a model!
42 PlayParameters *getPlayParameters(const Model *model);
43 void clearPlayParameters();
44
45 unsigned long getGlobalCentreFrame() const;
46 unsigned long getGlobalZoom() const;
47
48 signals:
49 /** Emitted when a widget pans. The originator identifies the widget. */
50 void centreFrameChanged(void *originator, unsigned long frame, bool locked);
51
52 /** Emitted when a widget zooms. The originator identifies the widget. */
53 void zoomLevelChanged(void *originator, unsigned long zoom, bool locked);
54
55 /** Emitted when the playback frame changes. */
56 void playbackFrameChanged(unsigned long frame);
57
58 /** Emitted when the output levels change. Values in range 0.0 -> 1.0. */
59 void outputLevelsChanged(float left, float right);
60
61 protected slots:
62 void checkPlayStatus();
63 void considerSeek(void *, unsigned long, bool);
64 void considerZoomChange(void *, unsigned long, bool);
65
66 protected:
67 AudioPlaySource *m_playSource;
68 unsigned long m_globalCentreFrame;
69 unsigned long m_globalZoom;
70
71 float m_lastLeft;
72 float m_lastRight;
73
74 std::map<const Model *, PlayParameters *> m_playParameters;
75 };
76
77 #endif
78