Chris@0: /* -*- c-basic-offset: 4 -*- vi:set ts=8 sts=4 sw=4: */ Chris@0: Chris@0: /* Chris@0: A waveform viewer and audio annotation editor. Chris@0: Chris Cannam, Queen Mary University of London, 2005 Chris@0: Chris@0: This is experimental software. Not for distribution. Chris@0: */ Chris@0: Chris@0: #ifndef _VIEW_MANAGER_H_ Chris@0: #define _VIEW_MANAGER_H_ Chris@0: Chris@0: #include Chris@0: #include Chris@0: Chris@0: #include Chris@0: Chris@0: class AudioPlaySource; Chris@0: class PlayParameters; Chris@0: class Model; Chris@0: Chris@0: /** Chris@0: * The ViewManager manages properties that may need to be synchronised Chris@0: * between separate Views. For example, it handles signals associated Chris@0: * with changes to the global pan and zoom. It also handles playback Chris@0: * properties and play synchronisation. Chris@0: * Chris@0: * Views should be implemented in such a way as to work Chris@0: * correctly whether they are supplied with a ViewManager or not. Chris@0: */ Chris@0: Chris@0: class ViewManager : public QObject Chris@0: { Chris@0: Q_OBJECT Chris@0: Chris@0: public: Chris@0: ViewManager(); Chris@0: Chris@0: void setAudioPlaySource(AudioPlaySource *source); Chris@0: Chris@0: //!!! No way to remove a model! Chris@0: PlayParameters *getPlayParameters(const Model *model); Chris@0: void clearPlayParameters(); Chris@0: Chris@0: unsigned long getGlobalCentreFrame() const; Chris@0: unsigned long getGlobalZoom() const; Chris@0: Chris@0: signals: Chris@0: /** Emitted when a widget pans. The originator identifies the widget. */ Chris@0: void centreFrameChanged(void *originator, unsigned long frame, bool locked); Chris@0: Chris@0: /** Emitted when a widget zooms. The originator identifies the widget. */ Chris@0: void zoomLevelChanged(void *originator, unsigned long zoom, bool locked); Chris@0: Chris@0: /** Emitted when the playback frame changes. */ Chris@0: void playbackFrameChanged(unsigned long frame); Chris@0: Chris@0: /** Emitted when the output levels change. Values in range 0.0 -> 1.0. */ Chris@0: void outputLevelsChanged(float left, float right); Chris@0: Chris@0: protected slots: Chris@0: void checkPlayStatus(); Chris@0: void considerSeek(void *, unsigned long, bool); Chris@0: void considerZoomChange(void *, unsigned long, bool); Chris@0: Chris@0: protected: Chris@0: AudioPlaySource *m_playSource; Chris@0: unsigned long m_globalCentreFrame; Chris@0: unsigned long m_globalZoom; Chris@0: Chris@0: float m_lastLeft; Chris@0: float m_lastRight; Chris@0: Chris@0: std::map m_playParameters; Chris@0: }; Chris@0: Chris@0: #endif Chris@0: