Mixxx

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

Go to the documentation of this file.
00001 // enginecontrol.h
00002 // Created 7/5/2009 by RJ Ryan (rryan@mit.edu)
00003 
00004 #ifndef ENGINECONTROL_H
00005 #define ENGINECONTROL_H
00006 
00007 #include <QObject>
00008 #include <QList>
00009 
00010 #include "configobject.h"
00011 #include "trackinfoobject.h"
00012 
00013 class EngineBuffer;
00014 struct Hint;
00015 
00016 const double kNoTrigger = -1;
00017 
00039 class EngineControl : public QObject {
00040     Q_OBJECT
00041   public:
00042     EngineControl(const char * _group,
00043                   ConfigObject<ConfigValue> * _config);
00044     virtual ~EngineControl();
00045 
00046     // Called by EngineBuffer::process every latency period. See the above
00047     // comments for information about guarantees that hold during this call. An
00048     // EngineControl can perform any upkeep operations that are necessary during
00049     // this call. If the EngineControl would like to request the playback
00050     // position to be altered, it should return the sample to seek to from this
00051     // method. Otherwise it should return kNoTrigger.
00052     virtual double process(const double dRate,
00053                            const double dCurrentSample,
00054                            const double dTotalSamples,
00055                            const int iBufferSize);
00056 
00057     virtual double nextTrigger(const double dRate,
00058                                const double dCurrentSample,
00059                                const double dTotalSamples,
00060                                const int iBufferSize);
00061 
00062     virtual double getTrigger(const double dRate,
00063                               const double dCurrentSample,
00064                               const double dTotalSamples,
00065                               const int iBufferSize);
00066 
00067     // hintReader allows the EngineControl to provide hints to the reader to
00068     // indicate that the given portion of a song is a potential imminent seek
00069     // target.
00070     virtual void hintReader(QList<Hint>& hintList);
00071 
00072     void setOtherEngineBuffer(EngineBuffer* pOtherEngineBuffer);
00073     void setCurrentSample(const double dCurrentSample, const double dTotalSamples);
00074     double getCurrentSample() const;
00075     double getTotalSamples() const;
00076 
00077     // Called whenever a seek occurs to allow the EngineControl to respond.
00078     virtual void notifySeek(double dNewPlaypo);
00079 
00080   public slots:
00081     virtual void trackLoaded(TrackPointer pTrack);
00082     virtual void trackUnloaded(TrackPointer pTrack);
00083 
00084   signals:
00085     void seek(double fractionalPosition);
00086     void seekAbs(double sample);
00087 
00088   protected:
00089     const char* getGroup();
00090     ConfigObject<ConfigValue>* getConfig();
00091     EngineBuffer* getOtherEngineBuffer();
00092 
00093   private:
00094     const char* m_pGroup;
00095     ConfigObject<ConfigValue>* m_pConfig;
00096     double m_dCurrentSample;
00097     double m_dTotalSamples;
00098     EngineBuffer* m_pOtherEngineBuffer;
00099 };
00100 
00101 #endif /* ENGINECONTROL_H */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines