Mixxx

/home/maxime/Projets/Mixxx/1.10/mixxx/src/engine/cuecontrol.h

Go to the documentation of this file.
00001 // cuecontrol.h
00002 // Created 11/5/2009 by RJ Ryan (rryan@mit.edu)
00003 
00004 #ifndef CUECONTROL_H
00005 #define CUECONTROL_H
00006 
00007 #include <QList>
00008 #include <QMutex>
00009 
00010 #include "engine/enginecontrol.h"
00011 #include "configobject.h"
00012 #include "trackinfoobject.h"
00013 
00014 class ControlObject;
00015 class ControlPushButton;
00016 class Cue;
00017 
00018 class HotcueControl : public QObject {
00019     Q_OBJECT
00020   public:
00021     HotcueControl(const char* pGroup, int hotcueNumber);
00022     virtual ~HotcueControl();
00023 
00024     inline int getHotcueNumber() { return m_iHotcueNumber; }
00025     inline Cue* getCue() { return m_pCue; }
00026     inline void setCue(Cue* pCue) { m_pCue = pCue; }
00027     inline ControlObject* getPosition() { return m_hotcuePosition; }
00028     inline ControlObject* getEnabled() { return m_hotcueEnabled; }
00029 
00030     // Used for caching the preview state of this hotcue control.
00031     inline bool isPreviewing() { return m_bPreviewing; }
00032     inline void setPreviewing(bool bPreviewing) { m_bPreviewing = bPreviewing; }
00033     inline int getPreviewingPosition() { return m_iPreviewingPosition; }
00034     inline void setPreviewingPosition(int iPosition) { m_iPreviewingPosition = iPosition; }
00035 
00036   private slots:
00037     void slotHotcueSet(double v);
00038     void slotHotcueGoto(double v);
00039     void slotHotcueGotoAndStop(double v);
00040     void slotHotcueActivate(double v);
00041     void slotHotcueActivatePreview(double v);
00042     void slotHotcueClear(double v);
00043     void slotHotcuePositionChanged(double newPosition);
00044 
00045   signals:
00046     void hotcueSet(HotcueControl* pHotcue, double v);
00047     void hotcueGoto(HotcueControl* pHotcue, double v);
00048     void hotcueGotoAndStop(HotcueControl* pHotcue, double v);
00049     void hotcueActivate(HotcueControl* pHotcue, double v);
00050     void hotcueActivatePreview(HotcueControl* pHotcue, double v);
00051     void hotcueClear(HotcueControl* pHotcue, double v);
00052     void hotcuePositionChanged(HotcueControl* pHotcue, double newPosition);
00053     void hotcuePlay(double v);
00054 
00055   private:
00056     ConfigKey keyForControl(int hotcue, QString name);
00057 
00058     const char* m_pGroup;
00059     int m_iHotcueNumber;
00060     Cue* m_pCue;
00061 
00062     // Hotcue state controls
00063     ControlObject* m_hotcuePosition;
00064     ControlObject* m_hotcueEnabled;
00065     // Hotcue button controls
00066     ControlObject* m_hotcueSet;
00067     ControlObject* m_hotcueGoto;
00068     ControlObject* m_hotcueGotoAndStop;
00069     ControlObject* m_hotcueActivate;
00070     ControlObject* m_hotcueActivatePreview;
00071     ControlObject* m_hotcueClear;
00072 
00073     bool m_bPreviewing;
00074     int m_iPreviewingPosition;
00075 };
00076 
00077 class CueControl : public EngineControl {
00078     Q_OBJECT
00079   public:
00080     CueControl(const char * _group,
00081                ConfigObject<ConfigValue> * _config);
00082     virtual ~CueControl();
00083 
00084     virtual void hintReader(QList<Hint>& hintList);
00085 
00086   public slots:
00087     void loadTrack(TrackPointer pTrack);
00088     void unloadTrack(TrackPointer pTrack);
00089 
00090   private slots:
00091     void cueUpdated();
00092     void trackCuesUpdated();
00093     void hotcueSet(HotcueControl* pControl, double v);
00094     void hotcueGoto(HotcueControl* pControl, double v);
00095     void hotcueGotoAndStop(HotcueControl* pControl, double v);
00096     void hotcueActivate(HotcueControl* pControl, double v);
00097     void hotcueActivatePreview(HotcueControl* pControl, double v);
00098     void hotcueClear(HotcueControl* pControl, double v);
00099     void hotcuePositionChanged(HotcueControl* pControl, double newPosition);
00100 
00101     void cueSet(double v);
00102     void cueGoto(double v);
00103     void cueGotoAndStop(double v);
00104     void cueSimple(double v);
00105     void cuePreview(double v);
00106     void cueCDJ(double v);
00107     void cueDefault(double v);
00108     void cuePlay(double v);
00109 
00110   private:
00111     // These methods are not thread safe, only call them when the lock is held.
00112     void createControls();
00113     void attachCue(Cue* pCue, int hotcueNumber);
00114     void detachCue(int hotcueNumber);
00115     void saveCuePoint(double cuePoint);
00116 
00117     bool m_bHotcueCancel;
00118     bool m_bPreviewing;
00119     bool m_bPreviewingHotcue;
00120     ControlObject* m_pPlayButton;
00121     int m_iCurrentlyPreviewingHotcues;
00122     ControlObject* m_pQuantizeEnabled;
00123     ControlObject* m_pNextBeat;
00124     ControlObject* m_pClosestBeat;
00125 
00126     const int m_iNumHotCues;
00127     QList<HotcueControl*> m_hotcueControl;
00128 
00129     ControlObject* m_pTrackSamples;
00130     ControlObject* m_pCuePoint;
00131     ControlObject* m_pCueMode;
00132     ControlPushButton* m_pCueSet;
00133     ControlPushButton* m_pCueSimple;
00134     ControlPushButton* m_pCueCDJ;
00135     ControlPushButton* m_pCueDefault;
00136     ControlPushButton* m_pCueGoto;
00137     ControlPushButton* m_pCueGotoAndStop;
00138     ControlPushButton* m_pCuePreview;
00139 
00140     TrackPointer m_pLoadedTrack;
00141 
00142     // Tells us which controls map to which hotcue
00143     QMap<QObject*, int> m_controlMap;
00144 
00145     QMutex m_mutex;
00146 };
00147 
00148 
00149 #endif /* CUECONTROL_H */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines