diff options
author | RJ Ryan <rryan@mixxx.org> | 2014-11-29 15:22:52 -0500 |
---|---|---|
committer | RJ Ryan <rryan@mixxx.org> | 2014-11-29 15:22:52 -0500 |
commit | 943e029f2841e84f1aad873ae8c74c8ec7570c11 (patch) | |
tree | b9e77cbed4d6f83aa3928bfdca46cf199eb55bfe /src/basetrackplayer.h | |
parent | f143ea23c467fabba3612a4b896ac4187bcadc75 (diff) |
Extract interface from BaseTrackPlayer and PlayerManager.
This will make mocking and faking them much easier and prevent
implementation details from being exposed elsewhere in Mixxx.
Diffstat (limited to 'src/basetrackplayer.h')
-rw-r--r-- | src/basetrackplayer.h | 45 |
1 files changed, 29 insertions, 16 deletions
diff --git a/src/basetrackplayer.h b/src/basetrackplayer.h index 63231d5b73..a444935ed7 100644 --- a/src/basetrackplayer.h +++ b/src/basetrackplayer.h @@ -15,18 +15,38 @@ class ControlObjectSlave; class AnalyserQueue; class EffectsManager; +// Interface for not leaking implementation details of BaseTrackPlayer into the +// rest of Mixxx. Also makes testing a lot easier. class BaseTrackPlayer : public BasePlayer { Q_OBJECT public: - BaseTrackPlayer(QObject* pParent, - ConfigObject<ConfigValue>* pConfig, - EngineMaster* pMixingEngine, - EffectsManager* pEffectsManager, - EngineChannel::ChannelOrientation defaultOrientation, - QString group, - bool defaultMaster, - bool defaultHeadphones); - virtual ~BaseTrackPlayer(); + BaseTrackPlayer(QObject* pParent, const QString& group); + virtual ~BaseTrackPlayer() {} + + virtual TrackPointer getLoadedTrack() const = 0; + + public slots: + virtual void slotLoadTrack(TrackPointer pTrack, bool bPlay=false) = 0; + + signals: + void loadTrack(TrackPointer pTrack, bool bPlay=false); + void loadTrackFailed(TrackPointer pTrack); + void newTrackLoaded(TrackPointer pLoadedTrack); + void unloadingTrack(TrackPointer pAboutToBeUnloaded); +}; + +class BaseTrackPlayerImpl : public BaseTrackPlayer { + Q_OBJECT + public: + BaseTrackPlayerImpl(QObject* pParent, + ConfigObject<ConfigValue>* pConfig, + EngineMaster* pMixingEngine, + EffectsManager* pEffectsManager, + EngineChannel::ChannelOrientation defaultOrientation, + QString group, + bool defaultMaster, + bool defaultHeadphones); + virtual ~BaseTrackPlayerImpl(); TrackPointer getLoadedTrack() const; @@ -44,12 +64,6 @@ class BaseTrackPlayer : public BasePlayer { void slotSetReplayGain(double replayGain); void slotPlayToggled(double); - signals: - void loadTrack(TrackPointer pTrack, bool bPlay=false); - void loadTrackFailed(TrackPointer pTrack); - void newTrackLoaded(TrackPointer pLoadedTrack); - void unloadingTrack(TrackPointer pAboutToBeUnloaded); - private: ConfigObject<ConfigValue>* m_pConfig; TrackPointer m_pLoadedTrack; @@ -77,5 +91,4 @@ class BaseTrackPlayer : public BasePlayer { bool m_replaygainPending; }; - #endif // BASETRACKPLAYER_H |