1 #pragma once
2 
3 #include "control/controlproxy.h"
4 #include "effects/effectsmanager.h"
5 #include "engine/engineobject.h"
6 #include "engine/channelhandle.h"
7 #include "engine/enginevumeter.h"
8 #include "preferences/usersettings.h"
9 
10 class ControlObject;
11 class EngineBuffer;
12 class EngineFilterBlock;
13 class ControlPushButton;
14 
15 class EngineChannel : public EngineObject {
16     Q_OBJECT
17   public:
18     enum ChannelOrientation {
19         LEFT = 0,
20         CENTER,
21         RIGHT,
22     };
23 
24     EngineChannel(const ChannelHandleAndGroup& handle_group,
25             ChannelOrientation defaultOrientation,
26             EffectsManager* pEffectsManager,
27             bool isTalkoverChannel,
28             bool isPrimaryDeck);
29     virtual ~EngineChannel();
30 
31     virtual ChannelOrientation getOrientation() const;
32 
getHandle()33     inline const ChannelHandle& getHandle() const {
34         return m_group.handle();
35     }
36 
getGroup()37     const QString& getGroup() const {
38         return m_group.name();
39     }
40 
41     virtual bool isActive() = 0;
42     void setPfl(bool enabled);
43     virtual bool isPflEnabled() const;
44     void setMaster(bool enabled);
45     virtual bool isMasterEnabled() const;
46     void setTalkover(bool enabled);
47     virtual bool isTalkoverEnabled() const;
isTalkoverChannel()48     inline bool isTalkoverChannel() { return m_bIsTalkoverChannel; };
isPrimaryDeck()49     inline bool isPrimaryDeck() {
50         return m_bIsPrimaryDeck;
51     };
getChannelIndex()52     int getChannelIndex() {
53         return m_channelIndex;
54     }
setChannelIndex(int channelIndex)55     void setChannelIndex(int channelIndex) {
56         m_channelIndex = channelIndex;
57     }
58 
59     virtual void process(CSAMPLE* pOut, const int iBufferSize) = 0;
60     virtual void collectFeatures(GroupFeatureState* pGroupFeatures) const = 0;
61     virtual void postProcess(const int iBuffersize) = 0;
62 
63     // TODO(XXX) This hack needs to be removed.
getEngineBuffer()64     virtual EngineBuffer* getEngineBuffer() {
65         return NULL;
66     }
67 
68   protected:
69     const ChannelHandleAndGroup m_group;
70     EffectsManager* m_pEffectsManager;
71 
72     EngineVuMeter m_vuMeter;
73     ControlProxy* m_pSampleRate;
74     const CSAMPLE* volatile m_sampleBuffer;
75 
76     // If set to true, this engine channel represents one of the primary playback decks.
77     // It is used to check for valid bpm targets by the sync code.
78     const bool m_bIsPrimaryDeck;
79 
80   private slots:
81     void slotOrientationLeft(double v);
82     void slotOrientationRight(double v);
83     void slotOrientationCenter(double v);
84 
85   private:
86     ControlPushButton* m_pMaster;
87     ControlPushButton* m_pPFL;
88     ControlPushButton* m_pOrientation;
89     ControlPushButton* m_pOrientationLeft;
90     ControlPushButton* m_pOrientationRight;
91     ControlPushButton* m_pOrientationCenter;
92     ControlPushButton* m_pTalkover;
93     bool m_bIsTalkoverChannel;
94     int m_channelIndex;
95 };
96