From 32fbf6f3dd44ba5b625edfd9167052c85bb03edf Mon Sep 17 00:00:00 2001 From: RJ Ryan Date: Thu, 19 Dec 2013 14:31:00 -0500 Subject: [PATCH] Fix ugly const-casting required by EngineObject API. --- src/engine/clockcontrol.h | 2 +- src/engine/cuecontrol.cpp | 4 +-- src/engine/cuecontrol.h | 4 +-- src/engine/enginebuffer.cpp | 7 ++--- src/engine/enginebuffer.h | 6 ++-- src/engine/enginebufferscale.h | 4 +-- src/engine/enginebufferscaledummy.cpp | 2 +- src/engine/enginebufferscaledummy.h | 10 +++---- src/engine/enginebufferscalelinear.cpp | 6 ++-- src/engine/enginebufferscalelinear.h | 15 +++++----- src/engine/enginebufferscalest.cpp | 2 +- src/engine/enginebufferscalest.h | 2 +- src/engine/enginechannel.h | 6 ++-- src/engine/engineclipping.cpp | 5 ++-- src/engine/engineclipping.h | 38 +++++++----------------- src/engine/enginecontrol.cpp | 10 +++---- src/engine/enginecontrol.h | 4 +-- src/engine/enginedeck.cpp | 24 +++++++-------- src/engine/enginedeck.h | 4 +-- src/engine/enginedelay.cpp | 5 ++-- src/engine/enginedelay.h | 26 ++++++++-------- src/engine/enginefilter.cpp | 4 +-- src/engine/enginefilter.h | 19 +++++++----- src/engine/enginefilterblock.cpp | 8 ++--- src/engine/enginefilterblock.h | 16 +++++----- src/engine/enginefilterbutterworth8.cpp | 20 +++++-------- src/engine/enginefilterbutterworth8.h | 12 +++++--- src/engine/enginefiltereffect.cpp | 3 +- src/engine/enginefiltereffect.h | 2 +- src/engine/enginefilteriir.cpp | 4 +-- src/engine/enginefilteriir.h | 15 +++++----- src/engine/engineflanger.cpp | 9 +++--- src/engine/engineflanger.h | 13 ++++---- src/engine/engineladspa.cpp | 11 ++++--- src/engine/engineladspa.h | 37 +++++++++++------------ src/engine/enginemaster.cpp | 25 +++++++--------- src/engine/enginemaster.h | 6 ++-- src/engine/enginemicrophone.cpp | 3 +- src/engine/enginemicrophone.h | 2 +- src/engine/engineobject.h | 12 ++------ src/engine/enginepassthrough.cpp | 3 +- src/engine/enginepassthrough.h | 10 +++---- src/engine/enginepregain.cpp | 5 ++-- src/engine/enginepregain.h | 26 ++++++++-------- src/engine/enginevinylsoundemu.cpp | 8 ++--- src/engine/enginevinylsoundemu.h | 28 ++++++++++------- src/engine/enginevumeter.cpp | 6 ++-- src/engine/enginevumeter.h | 20 +++++++------ src/engine/loopingcontrol.cpp | 4 +-- src/engine/loopingcontrol.h | 4 +-- src/engine/positionscratchcontroller.h | 2 +- src/engine/ratecontrol.h | 2 +- src/engine/readaheadmanager.h | 2 +- src/engine/sidechain/engineshoutcast.cpp | 2 +- src/engine/sidechain/engineshoutcast.h | 4 +-- src/engine/sidechain/enginesidechain.cpp | 2 +- src/engine/sidechain/enginesidechain.h | 2 +- src/soundmanager.cpp | 2 +- src/test/enginemastertest.cpp | 14 ++++----- src/test/mockedenginebackendtest.h | 6 +--- 60 files changed, 264 insertions(+), 295 deletions(-) diff --git a/src/engine/clockcontrol.h b/src/engine/clockcontrol.h index aa7441194ab..5eb06cecc0b 100644 --- a/src/engine/clockcontrol.h +++ b/src/engine/clockcontrol.h @@ -12,7 +12,7 @@ class ControlObjectSlave; class ClockControl: public EngineControl { Q_OBJECT public: - ClockControl(const char * pGroup, + ClockControl(const char* pGroup, ConfigObject* pConfig); virtual ~ClockControl(); diff --git a/src/engine/cuecontrol.cpp b/src/engine/cuecontrol.cpp index 373626c50fe..b116e29d620 100644 --- a/src/engine/cuecontrol.cpp +++ b/src/engine/cuecontrol.cpp @@ -12,8 +12,8 @@ #include "cachingreader.h" #include "mathstuff.h" -CueControl::CueControl(const char * _group, - ConfigObject * _config) : +CueControl::CueControl(const char* _group, + ConfigObject* _config) : EngineControl(_group, _config), m_bHotcueCancel(false), m_bPreviewing(false), diff --git a/src/engine/cuecontrol.h b/src/engine/cuecontrol.h index 6876c7fe752..9acfc828e9a 100644 --- a/src/engine/cuecontrol.h +++ b/src/engine/cuecontrol.h @@ -82,8 +82,8 @@ class HotcueControl : public QObject { class CueControl : public EngineControl { Q_OBJECT public: - CueControl(const char * _group, - ConfigObject * _config); + CueControl(const char* _group, + ConfigObject* _config); virtual ~CueControl(); virtual void hintReader(QVector* pHintList); diff --git a/src/engine/enginebuffer.cpp b/src/engine/enginebuffer.cpp index 60d29aed762..cbae94530b9 100644 --- a/src/engine/enginebuffer.cpp +++ b/src/engine/enginebuffer.cpp @@ -353,7 +353,7 @@ double EngineBuffer::getFileBpm() { return m_pBpmControl->getFileBpm(); } -void EngineBuffer::setEngineMaster(EngineMaster * pEngineMaster) { +void EngineBuffer::setEngineMaster(EngineMaster* pEngineMaster) { m_engineLock.lock(); foreach (EngineControl* pControl, m_engineControls) { pControl->setEngineMaster(pEngineMaster); @@ -399,7 +399,7 @@ void EngineBuffer::setNewPlaypos(double newpos) { m_engineLock.unlock(); } -const char * EngineBuffer::getGroup() +const char* EngineBuffer::getGroup() { return m_group; } @@ -581,7 +581,7 @@ void EngineBuffer::slotControlSlip(double v) } -void EngineBuffer::process(const CSAMPLE *, const CSAMPLE * pOut, const int iBufferSize) +void EngineBuffer::process(const CSAMPLE*, CSAMPLE* pOutput, const int iBufferSize) { Q_ASSERT(even(iBufferSize)); m_pReader->process(); @@ -595,7 +595,6 @@ void EngineBuffer::process(const CSAMPLE *, const CSAMPLE * pOut, const int iBuf // - Set last sample value (m_fLastSampleValue) so that rampOut works? Other // miscellaneous upkeep issues. - CSAMPLE * pOutput = (CSAMPLE *)pOut; // strip const attribute TODO(XXX): avoid this hack bool bCurBufferPaused = false; double rate = 0; diff --git a/src/engine/enginebuffer.h b/src/engine/enginebuffer.h index e6e8b30c4e4..5c01b8b9f28 100644 --- a/src/engine/enginebuffer.h +++ b/src/engine/enginebuffer.h @@ -92,8 +92,8 @@ const int ENGINE_RAMP_UP = 1; class EngineBuffer : public EngineObject { Q_OBJECT -public: - EngineBuffer(const char *_group, ConfigObject *_config, + public: + EngineBuffer(const char* _group, ConfigObject* _config, EngineChannel* pChannel, EngineMaster* pMixingEngine); virtual ~EngineBuffer(); bool getPitchIndpTimeStretch(void); @@ -118,7 +118,7 @@ class EngineBuffer : public EngineObject { // while holding the pause mutex void setNewPlaypos(double playpos); - void process(const CSAMPLE *pIn, const CSAMPLE *pOut, const int iBufferSize); + void process(const CSAMPLE* pIn, CSAMPLE* pOut, const int iBufferSize); void processSlip(int iBufferSize); diff --git a/src/engine/enginebufferscale.h b/src/engine/enginebufferscale.h index c9b5d43b8a3..b26087072b0 100644 --- a/src/engine/enginebufferscale.h +++ b/src/engine/enginebufferscale.h @@ -70,7 +70,7 @@ class EngineBufferScale : public QObject { /** Called from EngineBuffer when seeking, to ensure the buffers are flushed */ virtual void clear() = 0; /** Scale buffer */ - virtual CSAMPLE *getScaled(unsigned long buf_size) = 0; + virtual CSAMPLE* getScaled(unsigned long buf_size) = 0; protected: int m_iSampleRate; @@ -78,7 +78,7 @@ class EngineBufferScale : public QObject { double m_dTempoAdjust; double m_dPitchAdjust; /** Pointer to internal buffer */ - CSAMPLE *m_buffer; + CSAMPLE* m_buffer; /** New playpos after call to scale */ double m_samplesRead; }; diff --git a/src/engine/enginebufferscaledummy.cpp b/src/engine/enginebufferscaledummy.cpp index efd2fa3cb8f..6f5cf772927 100644 --- a/src/engine/enginebufferscaledummy.cpp +++ b/src/engine/enginebufferscaledummy.cpp @@ -26,7 +26,7 @@ void EngineBufferScaleDummy::clear() } -CSAMPLE *EngineBufferScaleDummy::getScaled(unsigned long buf_size) { +CSAMPLE* EngineBufferScaleDummy::getScaled(unsigned long buf_size) { m_samplesRead = 0.0; double rate = m_dRateAdjust * m_dTempoAdjust * m_dPitchAdjust; if (rate == 0.0f) { diff --git a/src/engine/enginebufferscaledummy.h b/src/engine/enginebufferscaledummy.h index 892b0404952..d0dffa57f5d 100644 --- a/src/engine/enginebufferscaledummy.h +++ b/src/engine/enginebufferscaledummy.h @@ -18,17 +18,17 @@ #ifndef ENGINEBUFFERSCALEDUMMY_H #define ENGINEBUFFERSCALEDUMMY_H -#include "defs.h" #include + +#include "defs.h" #include "engine/enginebufferscale.h" class ReadAheadManager; -class EngineBufferScaleDummy : public EngineBufferScale -{ -public: +class EngineBufferScaleDummy : public EngineBufferScale { + public: EngineBufferScaleDummy(ReadAheadManager* pReadAheadManager); - ~EngineBufferScaleDummy(); + virtual ~EngineBufferScaleDummy(); /** Get new playpos after call to scale() */ double getNewPlaypos(); diff --git a/src/engine/enginebufferscalelinear.cpp b/src/engine/enginebufferscalelinear.cpp index 0064a75115b..4da9e3f1de3 100644 --- a/src/engine/enginebufferscalelinear.cpp +++ b/src/engine/enginebufferscalelinear.cpp @@ -93,7 +93,7 @@ inline float hermite4(float frac_pos, float xm1, float x0, float x1, float x2) /** Determine if we're changing directions (scratching) and then perform a stretch */ -CSAMPLE * EngineBufferScaleLinear::getScaled(unsigned long buf_size) { +CSAMPLE* EngineBufferScaleLinear::getScaled(unsigned long buf_size) { if (m_bClear) { m_dOldRate = m_dRate; // If cleared, don't interpolate rate. m_bClear = false; @@ -159,8 +159,8 @@ CSAMPLE * EngineBufferScaleLinear::getScaled(unsigned long buf_size) { } /** Stretch a specified buffer worth of audio using linear interpolation */ -CSAMPLE * EngineBufferScaleLinear::do_scale(CSAMPLE* buf, - unsigned long buf_size, int* samples_read) { +CSAMPLE* EngineBufferScaleLinear::do_scale(CSAMPLE* buf, + unsigned long buf_size, int* samples_read) { float rate_add_old = m_dOldRate; float rate_add_new = m_dRate; float rate_add_diff = rate_add_new - rate_add_old; diff --git a/src/engine/enginebufferscalelinear.h b/src/engine/enginebufferscalelinear.h index d54b2855be4..014a762182e 100644 --- a/src/engine/enginebufferscalelinear.h +++ b/src/engine/enginebufferscalelinear.h @@ -18,8 +18,8 @@ #ifndef ENGINEBUFFERSCALELINEAR_H #define ENGINEBUFFERSCALELINEAR_H -#include "enginebufferscale.h" -#include "readaheadmanager.h" +#include "engine/enginebufferscale.h" +#include "engine/readaheadmanager.h" /** *@author Tue & Ken Haste Andersen @@ -31,10 +31,11 @@ const int kiLinearScaleReadAheadLength = 10240; class EngineBufferScaleLinear : public EngineBufferScale { -public: + public: EngineBufferScaleLinear(ReadAheadManager *pReadAheadManager); - ~EngineBufferScaleLinear(); - CSAMPLE *getScaled(unsigned long buf_size); + virtual ~EngineBufferScaleLinear(); + + CSAMPLE* getScaled(unsigned long buf_size); void clear(); void setScaleParameters(int iSampleRate, @@ -43,7 +44,7 @@ class EngineBufferScaleLinear : public EngineBufferScale { double* pitch_adjust); private: - CSAMPLE *do_scale(CSAMPLE* buf, unsigned long buf_size, + CSAMPLE* do_scale(CSAMPLE* buf, unsigned long buf_size, int *samples_read); /** Holds playback direction */ @@ -53,7 +54,7 @@ class EngineBufferScaleLinear : public EngineBufferScale { double m_dOldRate; /** Buffer for handling calls to ReadAheadManager */ - CSAMPLE *buffer_int; + CSAMPLE* buffer_int; int buffer_int_size; CSAMPLE m_fPrevSample[2]; // The read-ahead manager that we use to fetch samples diff --git a/src/engine/enginebufferscalest.cpp b/src/engine/enginebufferscalest.cpp index c3a4e2220c0..6555d9f71ac 100644 --- a/src/engine/enginebufferscalest.cpp +++ b/src/engine/enginebufferscalest.cpp @@ -15,7 +15,7 @@ * * ***************************************************************************/ -#include "enginebufferscalest.h" +#include "engine/enginebufferscalest.h" // Fixes redefinition warnings from SoundTouch. #undef TRUE diff --git a/src/engine/enginebufferscalest.h b/src/engine/enginebufferscalest.h index cbd2e1d21aa..ccafb6ca0e7 100644 --- a/src/engine/enginebufferscalest.h +++ b/src/engine/enginebufferscalest.h @@ -59,7 +59,7 @@ class EngineBufferScaleST : public EngineBufferScale { bool m_bBackwards; // Temporary buffer for reading from the RAMAN. - CSAMPLE *buffer_back; + CSAMPLE* buffer_back; // SoundTouch time/pitch scaling lib soundtouch::SoundTouch* m_pSoundTouch; diff --git a/src/engine/enginechannel.h b/src/engine/enginechannel.h index 6e815108445..599fc7347b1 100644 --- a/src/engine/enginechannel.h +++ b/src/engine/enginechannel.h @@ -18,7 +18,7 @@ #ifndef ENGINECHANNEL_H #define ENGINECHANNEL_H -#include "engineobject.h" +#include "engine/engineobject.h" #include "configobject.h" class ControlObject; @@ -41,7 +41,7 @@ class EngineChannel : public EngineObject { RIGHT, }; - EngineChannel(const char *pGroup, ChannelOrientation defaultOrientation = CENTER); + EngineChannel(const char* pGroup, ChannelOrientation defaultOrientation = CENTER); virtual ~EngineChannel(); virtual ChannelOrientation getOrientation() const; @@ -51,7 +51,7 @@ class EngineChannel : public EngineObject { virtual bool isPFL(); virtual bool isMaster(); - virtual void process(const CSAMPLE *pIn, const CSAMPLE *pOut, const int iBufferSize) = 0; + virtual void process(const CSAMPLE* pIn, CSAMPLE* pOut, const int iBufferSize) = 0; // TODO(XXX) This hack needs to be removed. virtual EngineBuffer* getEngineBuffer() { diff --git a/src/engine/engineclipping.cpp b/src/engine/engineclipping.cpp index 06bf5faa87a..0f163fcd76b 100644 --- a/src/engine/engineclipping.cpp +++ b/src/engine/engineclipping.cpp @@ -18,7 +18,7 @@ #include "controlpotmeter.h" #include "sampleutil.h" -EngineClipping::EngineClipping(const char * group) +EngineClipping::EngineClipping(const char* group) { //Used controlpotmeter as the example used it :/ perhaps someone with more knowledge could use something more suitable... m_ctrlClipping = new ControlPotmeter(ConfigKey(group, "PeakIndicator"), 0., 1.); @@ -31,12 +31,11 @@ EngineClipping::~EngineClipping() delete m_ctrlClipping; } -void EngineClipping::process(const CSAMPLE * pIn, const CSAMPLE * pOut, const int iBufferSize) +void EngineClipping::process(const CSAMPLE* pIn, CSAMPLE* pOutput, const int iBufferSize) { static const FLOAT_TYPE kfMaxAmp = 32767.; // static const FLOAT_TYPE kfClip = 0.8*kfMaxAmp; - CSAMPLE * pOutput = (CSAMPLE *)pOut; // SampleUtil clamps the buffer and if pIn and pOut are aliased will not copy. clipped = SampleUtil::copyClampBuffer(kfMaxAmp, -kfMaxAmp, pOutput, pIn, iBufferSize); diff --git a/src/engine/engineclipping.h b/src/engine/engineclipping.h index 421e218c232..273e2991c63 100644 --- a/src/engine/engineclipping.h +++ b/src/engine/engineclipping.h @@ -17,38 +17,22 @@ #ifndef ENGINECLIPPING_H #define ENGINECLIPPING_H -#include "engineobject.h" +#include "engine/engineobject.h" #include "controlpotmeter.h" -class EngineClipping : public EngineObject -{ -private: +class EngineClipping : public EngineObject { + Q_OBJECT + public: + EngineClipping(const char* group); + virtual ~EngineClipping(); + + void process(const CSAMPLE* pIn, CSAMPLE* pOut, const int iBufferSize); + bool hasClipped(); + + private: bool clipped; ControlPotmeter *m_ctrlClipping; int m_duration; -public: - EngineClipping(const char *group); - ~EngineClipping(); - void process(const CSAMPLE *pIn, const CSAMPLE *pOut, const int iBufferSize); - bool hasClipped(); }; #endif // ENGINECLIPPING_H - - - - - - - - - - - - - - - - - - diff --git a/src/engine/enginecontrol.cpp b/src/engine/enginecontrol.cpp index 859690606ba..6be7c8c315f 100644 --- a/src/engine/enginecontrol.cpp +++ b/src/engine/enginecontrol.cpp @@ -6,8 +6,8 @@ #include "engine/enginebuffer.h" #include "playermanager.h" -EngineControl::EngineControl(const char * _group, - ConfigObject * _config) +EngineControl::EngineControl(const char* _group, + ConfigObject* _config) : m_pGroup(_group), m_pConfig(_config), m_dTotalSamples(0), @@ -21,9 +21,9 @@ EngineControl::~EngineControl() { } double EngineControl::process(const double, - const double, - const double, - const int) { + const double, + const double, + const int) { return kNoTrigger; } diff --git a/src/engine/enginecontrol.h b/src/engine/enginecontrol.h index ca4ef018cdc..6f43698200c 100644 --- a/src/engine/enginecontrol.h +++ b/src/engine/enginecontrol.h @@ -34,8 +34,8 @@ const double kNoTrigger = -1; class EngineControl : public QObject { Q_OBJECT public: - EngineControl(const char * _group, - ConfigObject * _config); + EngineControl(const char* _group, + ConfigObject* _config); virtual ~EngineControl(); // Called by EngineBuffer::process every latency period. See the above diff --git a/src/engine/enginedeck.cpp b/src/engine/enginedeck.cpp index 878b4adb2fe..41d93e56b5d 100644 --- a/src/engine/enginedeck.cpp +++ b/src/engine/enginedeck.cpp @@ -16,16 +16,16 @@ ***************************************************************************/ #include "controlpushbutton.h" -#include "enginebuffer.h" -#include "enginevinylsoundemu.h" -#include "enginedeck.h" -#include "engineclipping.h" -#include "enginepregain.h" -#include "engineflanger.h" -#include "enginefiltereffect.h" -#include "enginefilterblock.h" -#include "enginevumeter.h" -#include "enginefilteriir.h" +#include "engine/enginebuffer.h" +#include "engine/enginevinylsoundemu.h" +#include "engine/enginedeck.h" +#include "engine/engineclipping.h" +#include "engine/enginepregain.h" +#include "engine/engineflanger.h" +#include "engine/enginefiltereffect.h" +#include "engine/enginefilterblock.h" +#include "engine/enginevumeter.h" +#include "engine/enginefilteriir.h" #include "sampleutil.h" @@ -76,9 +76,7 @@ EngineDeck::~EngineDeck() { delete m_pVUMeter; } -void EngineDeck::process(const CSAMPLE*, const CSAMPLE * pOutput, const int iBufferSize) { - CSAMPLE* pOut = const_cast(pOutput); - +void EngineDeck::process(const CSAMPLE*, CSAMPLE* pOut, const int iBufferSize) { // Feed the incoming audio through if passthrough is active if (isPassthroughActive()) { int samplesRead = m_sampleBuffer.read(pOut, iBufferSize); diff --git a/src/engine/enginedeck.h b/src/engine/enginedeck.h index 44a6c5c358b..5f2f84c712e 100644 --- a/src/engine/enginedeck.h +++ b/src/engine/enginedeck.h @@ -41,11 +41,11 @@ class ControlPushButton; class EngineDeck : public EngineChannel, public AudioDestination { Q_OBJECT public: - EngineDeck(const char *group, ConfigObject* pConfig, EngineMaster* pMixingEngine, + EngineDeck(const char* group, ConfigObject* pConfig, EngineMaster* pMixingEngine, EngineChannel::ChannelOrientation defaultOrientation = CENTER); virtual ~EngineDeck(); - virtual void process(const CSAMPLE *pInput, const CSAMPLE *pOutput, const int iBufferSize); + virtual void process(const CSAMPLE* pInput, CSAMPLE* pOutput, const int iBufferSize); // TODO(XXX) This hack needs to be removed. virtual EngineBuffer* getEngineBuffer(); diff --git a/src/engine/enginedelay.cpp b/src/engine/enginedelay.cpp index 46cd67434a3..8098e15b651 100644 --- a/src/engine/enginedelay.cpp +++ b/src/engine/enginedelay.cpp @@ -20,7 +20,7 @@ /*---------------------------------------------------------------- ----------------------------------------------------------------*/ -EngineDelay::EngineDelay(const char * group) +EngineDelay::EngineDelay(const char* group) { m_pDelayBuffer = new CSAMPLE[kiMaxDelay]; m_iDelayPos = 0; @@ -35,10 +35,9 @@ EngineDelay::~EngineDelay() delete m_pPotmeter; } -void EngineDelay::process(const CSAMPLE * pIn, const CSAMPLE * pOut, const int iBufferSize) +void EngineDelay::process(const CSAMPLE* pIn, CSAMPLE* pOutput, const int iBufferSize) { int iDelaySourcePos = (m_iDelayPos+kiMaxDelay-m_iDelay)%kiMaxDelay; - CSAMPLE * pOutput = (CSAMPLE *)pOut; Q_ASSERT(iDelaySourcePos>=0); Q_ASSERT(iDelaySourcePos<=kiMaxDelay); diff --git a/src/engine/enginedelay.h b/src/engine/enginedelay.h index 37b2f1029ca..1f385b9584d 100644 --- a/src/engine/enginedelay.h +++ b/src/engine/enginedelay.h @@ -17,21 +17,23 @@ #ifndef ENGINEDELAY_H #define ENGINEDELAY_H -#include "engineobject.h" +#include "engine/engineobject.h" class ControlPotmeter; -const int kiMaxDelay = 20000; - -class EngineDelay : public EngineObject -{ -public: - EngineDelay(const char *group); - ~EngineDelay(); - void process(const CSAMPLE *pIn, const CSAMPLE *pOut, const int iBufferSize); -private: - ControlPotmeter *m_pPotmeter; - CSAMPLE *m_pDelayBuffer; +const int kiMaxDelay = 20000; + +class EngineDelay : public EngineObject { + Q_OBJECT + public: + EngineDelay(const char* group); + virtual ~EngineDelay(); + + void process(const CSAMPLE* pIn, CSAMPLE* pOut, const int iBufferSize); + + private: + ControlPotmeter* m_pPotmeter; + CSAMPLE* m_pDelayBuffer; int m_iDelay, m_iDelayPos; }; diff --git a/src/engine/enginefilter.cpp b/src/engine/enginefilter.cpp index 207568c7841..c0f475accab 100644 --- a/src/engine/enginefilter.cpp +++ b/src/engine/enginefilter.cpp @@ -64,10 +64,8 @@ EngineFilter::~EngineFilter() -void EngineFilter::process(const CSAMPLE * pIn, const CSAMPLE * ppOut, const int iBufferSize) +void EngineFilter::process(const CSAMPLE* pIn, CSAMPLE* pOut, const int iBufferSize) { - CSAMPLE * pOut = (CSAMPLE *) ppOut; //overrides the const, I don't like it but the parent class - //forced this on us int i; for(i=0; i < iBufferSize; i+=2) { diff --git a/src/engine/enginefilter.h b/src/engine/enginefilter.h index 5cd7e9a5a7b..807f52bc9fe 100644 --- a/src/engine/enginefilter.h +++ b/src/engine/enginefilter.h @@ -27,13 +27,15 @@ #define PREDEF_BP 2 #define PREDEF_LP 3 -class EngineFilter : public EngineObject -{ -public: - EngineFilter( char *conf, int predefinedType = 0); - ~EngineFilter(); - void process(const CSAMPLE *pIn, const CSAMPLE *ppOut, const int iBufferSize); -protected: +class EngineFilter : public EngineObject { + Q_OBJECT + public: + EngineFilter(char* conf, int predefinedType = 0); + virtual ~EngineFilter(); + + void process(const CSAMPLE* pIn, CSAMPLE* pOut, const int iBufferSize); + + protected: const double *coefs; double iir; double fir; @@ -41,7 +43,8 @@ class EngineFilter : public EngineObject #define FILTER_BUF_SIZE 16 double buf1[FILTER_BUF_SIZE]; double buf2[FILTER_BUF_SIZE]; -private: + + private: double (*processSample)(void *buf, const double sample); FidFilter *ff; diff --git a/src/engine/enginefilterblock.cpp b/src/engine/enginefilterblock.cpp index 172ba7b5b3e..aead357d21a 100644 --- a/src/engine/enginefilterblock.cpp +++ b/src/engine/enginefilterblock.cpp @@ -29,7 +29,7 @@ ControlPotmeter* EngineFilterBlock::s_loEqFreq = NULL; ControlPotmeter* EngineFilterBlock::s_hiEqFreq = NULL; ControlPushButton* EngineFilterBlock::s_lofiEq = NULL; -EngineFilterBlock::EngineFilterBlock(const char * group) +EngineFilterBlock::EngineFilterBlock(const char* group) { ilowFreq = 0; ihighFreq = 0; @@ -149,12 +149,8 @@ void EngineFilterBlock::setFilters(bool forceSetting) } } -void EngineFilterBlock::process(const CSAMPLE * pIn, const CSAMPLE * pOut, const int iBufferSize) -{ - CSAMPLE * pOutput = (CSAMPLE *)pOut; +void EngineFilterBlock::process(const CSAMPLE* pIn, CSAMPLE* pOutput, const int iBufferSize) { float fLow=0.f, fMid=0.f, fHigh=0.f; - - if (filterKillLow->get()==0.) fLow = filterpotLow->get(); //*0.7; if (filterKillMid->get()==0.) diff --git a/src/engine/enginefilterblock.h b/src/engine/enginefilterblock.h index 1b0aa018981..a6c772d5f5c 100644 --- a/src/engine/enginefilterblock.h +++ b/src/engine/enginefilterblock.h @@ -35,13 +35,15 @@ class ControlPushButton; *@author Tue and Ken Haste Andersen */ -class EngineFilterBlock : public EngineObject -{ -public: - EngineFilterBlock(const char *group); - ~EngineFilterBlock(); - void process(const CSAMPLE *pIn, const CSAMPLE *pOut, const int iBufferSize); -private: +class EngineFilterBlock : public EngineObject { + Q_OBJECT + public: + EngineFilterBlock(const char* group); + virtual ~EngineFilterBlock(); + + void process(const CSAMPLE* pIn, CSAMPLE* pOut, const int iBufferSize); + + private: void setFilters(bool forceSetting = false); CSAMPLE *m_pTemp1, *m_pTemp2, *m_pTemp3; diff --git a/src/engine/enginefilterbutterworth8.cpp b/src/engine/enginefilterbutterworth8.cpp index d91b713842a..8f6d78b49ad 100644 --- a/src/engine/enginefilterbutterworth8.cpp +++ b/src/engine/enginefilterbutterworth8.cpp @@ -158,10 +158,9 @@ void EngineFilterButterworth8Low::setFrequencyCorners(double freqCorner1) { initBuffers(); } -void EngineFilterButterworth8Low::process(const CSAMPLE *pIn, - const CSAMPLE *ppOut, const int iBufferSize) { - CSAMPLE *pOutput = (CSAMPLE *)ppOut; - +void EngineFilterButterworth8Low::process(const CSAMPLE* pIn, + CSAMPLE* pOutput, + const int iBufferSize) { for (int i=0; i < iBufferSize; i += 2) { pOutput[i] = _processLowpass(m_coef, m_buf1, pIn[i]); pOutput[i+1] = _processLowpass(m_coef, m_buf2, pIn[i+1]); @@ -186,10 +185,9 @@ void EngineFilterButterworth8Band::setFrequencyCorners(double freqCorner1, initBuffers(); } -void EngineFilterButterworth8Band::process(const CSAMPLE *pIn, - const CSAMPLE *ppOut, const int iBufferSize) { - CSAMPLE *pOutput = (CSAMPLE *)ppOut; - +void EngineFilterButterworth8Band::process(const CSAMPLE* pIn, + CSAMPLE* pOutput, + const int iBufferSize) { for (int i=0; i < iBufferSize; i += 2) { pOutput[i] = _processBandpass(m_coef, m_buf1, pIn[i]); pOutput[i+1] = _processBandpass(m_coef, m_buf2, pIn[i+1]); @@ -216,11 +214,9 @@ void EngineFilterButterworth8High::setFrequencyCorners(double freqCorner1) { initBuffers(); } -void EngineFilterButterworth8High::process(const CSAMPLE *pIn, - const CSAMPLE *ppOut, +void EngineFilterButterworth8High::process(const CSAMPLE* pIn, + CSAMPLE* pOutput, const int iBufferSize) { - CSAMPLE *pOutput = (CSAMPLE *)ppOut; - for (int i=0; i < iBufferSize; i += 2) { pOutput[i] = _processHighpass(m_coef, m_buf1, pIn[i]); pOutput[i+1] = _processHighpass(m_coef, m_buf2, pIn[i+1]); diff --git a/src/engine/enginefilterbutterworth8.h b/src/engine/enginefilterbutterworth8.h index 25e96cdfe22..ffd34497f9c 100644 --- a/src/engine/enginefilterbutterworth8.h +++ b/src/engine/enginefilterbutterworth8.h @@ -4,13 +4,14 @@ #include "engine/enginefilter.h" class EngineFilterButterworth8 : public EngineObject { + Q_OBJECT public: EngineFilterButterworth8(int sampleRate, int bufSize); virtual ~EngineFilterButterworth8(); // Update filter without recreating it void initBuffers(); - virtual void process(const CSAMPLE *pIn, const CSAMPLE *ppOut, + virtual void process(const CSAMPLE* pIn, CSAMPLE* pOut, const int iBufferSize) = 0; protected: @@ -27,26 +28,29 @@ class EngineFilterButterworth8 : public EngineObject { }; class EngineFilterButterworth8Low : public EngineFilterButterworth8 { + Q_OBJECT public: EngineFilterButterworth8Low(int sampleRate, double freqCorner1); void setFrequencyCorners(double freqCorner1); - void process(const CSAMPLE *pIn, const CSAMPLE *ppOut, const int iBufferSize); + void process(const CSAMPLE* pIn, CSAMPLE* pOut, const int iBufferSize); }; class EngineFilterButterworth8Band : public EngineFilterButterworth8 { + Q_OBJECT public: EngineFilterButterworth8Band(int sampleRate, double freqCorner1, double freqCorner2); void setFrequencyCorners(double freqCorner1, double freqCorner2 = 0); - void process(const CSAMPLE *pIn, const CSAMPLE *ppOut, const int iBufferSize); + void process(const CSAMPLE* pIn, CSAMPLE* pOut, const int iBufferSize); }; class EngineFilterButterworth8High : public EngineFilterButterworth8 { + Q_OBJECT public: EngineFilterButterworth8High(int sampleRate, double freqCorner1); void setFrequencyCorners(double freqCorner1); - void process(const CSAMPLE *pIn, const CSAMPLE *ppOut, const int iBufferSize); + void process(const CSAMPLE* pIn, CSAMPLE* pOut, const int iBufferSize); }; diff --git a/src/engine/enginefiltereffect.cpp b/src/engine/enginefiltereffect.cpp index c4379a01ff5..486b51f83de 100644 --- a/src/engine/enginefiltereffect.cpp +++ b/src/engine/enginefiltereffect.cpp @@ -51,9 +51,8 @@ void EngineFilterEffect::applyFilters(const CSAMPLE* pIn, CSAMPLE* pOut, SampleUtil::addWithGain(pOut, m_pBandpass_buffer, bandpass_gain, iBufferSize); } -void EngineFilterEffect::process(const CSAMPLE* pIn, const CSAMPLE* pOut, +void EngineFilterEffect::process(const CSAMPLE* pIn, CSAMPLE* pOutput, const int iBufferSize) { - CSAMPLE* pOutput = (CSAMPLE*)pOut; double depth = m_pPotmeterDepth->get(); if (m_pFilterEnable->get() == 0.0) { diff --git a/src/engine/enginefiltereffect.h b/src/engine/enginefiltereffect.h index 74748c14839..3a1a23689ae 100644 --- a/src/engine/enginefiltereffect.h +++ b/src/engine/enginefiltereffect.h @@ -14,7 +14,7 @@ class EngineFilterEffect : public EngineObject { EngineFilterEffect(const char* group); virtual ~EngineFilterEffect(); - void process(const CSAMPLE* pIn, const CSAMPLE* pOut, const int iBufferSize); + void process(const CSAMPLE* pIn, CSAMPLE* pOut, const int iBufferSize); private: void applyFilters(const CSAMPLE* pIn, CSAMPLE* pOut, const int iBufferSize, diff --git a/src/engine/enginefilteriir.cpp b/src/engine/enginefilteriir.cpp index cb16734808c..e9ee4d9f7f9 100644 --- a/src/engine/enginefilteriir.cpp +++ b/src/engine/enginefilteriir.cpp @@ -35,9 +35,8 @@ EngineFilterIIR::~EngineFilterIIR() { } -void EngineFilterIIR::process(const CSAMPLE * pIn, const CSAMPLE * pOut, const int iBufferSize) +void EngineFilterIIR::process(const CSAMPLE* pIn, CSAMPLE* pOutput, const int iBufferSize) { - CSAMPLE * pOutput = (CSAMPLE *)pOut; double GAIN = coefs[0]; int i; for (i=0; i EngineFlangerControls::m_pInstance; LFOamplitude - the amplitude of the modulation of the delay length. depth - the depth of the flanger, controlled by a ControlPotmeter. ----------------------------------------------------------------*/ -EngineFlanger::EngineFlanger(const char * group) { +EngineFlanger::EngineFlanger(const char* group) { // Init. buffers: m_pDelay_buffer = SampleUtil::alloc(max_delay + 1); SampleUtil::applyGain(m_pDelay_buffer, 0.0f, max_delay+1); @@ -104,9 +104,8 @@ EngineFlanger::~EngineFlanger() { SampleUtil::free(m_pDelay_buffer); } -void EngineFlanger::process(const CSAMPLE * pIn, - const CSAMPLE * pOut, const int iBufferSize) { - CSAMPLE * pOutput = (CSAMPLE *)pOut; +void EngineFlanger::process(const CSAMPLE* pIn, + CSAMPLE* pOutput, const int iBufferSize) { CSAMPLE delayed_sample,prev,next; FLOAT_TYPE frac; diff --git a/src/engine/engineflanger.h b/src/engine/engineflanger.h index 5ef8d23fdca..2129358fa66 100644 --- a/src/engine/engineflanger.h +++ b/src/engine/engineflanger.h @@ -20,7 +20,7 @@ #include #include -#include "engineobject.h" +#include "engine/engineobject.h" class ControlPotmeter; class ControlPushButton; @@ -29,13 +29,16 @@ class EngineFlangerControls; const int max_delay = 5000; class EngineFlanger : public EngineObject { + Q_OBJECT public: - EngineFlanger(const char *group); - ~EngineFlanger(); - void process(const CSAMPLE *pIn, const CSAMPLE *pOut, const int iBufferSize); + EngineFlanger(const char* group); + virtual ~EngineFlanger(); + + void process(const CSAMPLE* pIn, CSAMPLE* pOut, const int iBufferSize); + private: ControlPushButton* m_pFlangerEnable; - CSAMPLE *m_pDelay_buffer; + CSAMPLE* m_pDelay_buffer; int m_LFOamplitude; int m_average_delay_length; int m_time; diff --git a/src/engine/engineladspa.cpp b/src/engine/engineladspa.cpp index 0ce973d54b2..9e540a07b2c 100644 --- a/src/engine/engineladspa.cpp +++ b/src/engine/engineladspa.cpp @@ -7,7 +7,7 @@ * * ***************************************************************************/ -#include "engineladspa.h" +#include "engine/engineladspa.h" #include "controlpotmeter.h" #include "ladspa/ladspacontrol.h" @@ -27,7 +27,7 @@ EngineLADSPA::~EngineLADSPA() { } -void EngineLADSPA::process(const CSAMPLE * pIn, const CSAMPLE * pOut, const int iBufferSize) +void EngineLADSPA::process(const CSAMPLE* pIn, CSAMPLE* pOutput, const int iBufferSize) { if (iBufferSize != m_bufferSize) { @@ -104,7 +104,6 @@ void EngineLADSPA::process(const CSAMPLE * pIn, const CSAMPLE * pOut, const int } } - CSAMPLE * pOutput = (CSAMPLE *)pOut; SampleUtil::interleaveBuffer(pOutput, m_pBufferLeft[0], m_pBufferRight[0], m_monoBufferSize); @@ -115,9 +114,9 @@ void EngineLADSPA::addInstance(LADSPAInstance * instance) m_Instances.append(instance); } -EngineLADSPAControlConnection * EngineLADSPA::addControl(ControlObject * potmeter, LADSPAControl * control) +EngineLADSPAControlConnection* EngineLADSPA::addControl(ControlObject* potmeter, LADSPAControl* control) { - EngineLADSPAControlConnection * connection = new EngineLADSPAControlConnection; + EngineLADSPAControlConnection* connection = new EngineLADSPAControlConnection; connection->potmeter = potmeter; connection->control = control; connection->remove = 0; @@ -125,7 +124,7 @@ EngineLADSPAControlConnection * EngineLADSPA::addControl(ControlObject * potmete return connection; } -EngineLADSPA * EngineLADSPA::getEngine() +EngineLADSPA* EngineLADSPA::getEngine() { return m_pEngine; } diff --git a/src/engine/engineladspa.h b/src/engine/engineladspa.h index 476bdcd2d31..54d9a33ec7a 100644 --- a/src/engine/engineladspa.h +++ b/src/engine/engineladspa.h @@ -10,7 +10,7 @@ #ifndef ENGINELADSPA_H #define ENGINELADSPA_H -#include "engineobject.h" +#include "engine/engineobject.h" #include "ladspa/ladspainstance.h" #include "ladspa/ladspaplugin.h" @@ -19,37 +19,36 @@ class ControlPotmeter; class LADSPAControl; class EngineLADSPA; -struct EngineLADSPAControlConnection -{ - ControlObject * potmeter; - LADSPAControl * control; +struct EngineLADSPAControlConnection { + ControlObject* potmeter; + LADSPAControl* control; bool remove; }; -typedef QLinkedList EngineLADSPAControlConnectionLinkedList; -typedef QVector EngineLADSPAControlConnectionVector; +typedef QLinkedList EngineLADSPAControlConnectionLinkedList; +typedef QVector EngineLADSPAControlConnectionVector; -class EngineLADSPA : public EngineObject -{ -public: +class EngineLADSPA : public EngineObject { + Q_OBJECT + public: EngineLADSPA(); - ~EngineLADSPA(); + virtual ~EngineLADSPA(); - void process(const CSAMPLE *pIn, const CSAMPLE *pOut, const int iBufferSize); - void addInstance(LADSPAInstance * instance); - EngineLADSPAControlConnection * addControl(ControlObject * potmeter, LADSPAControl * control); + void process(const CSAMPLE* pIn, CSAMPLE* pOut, const int iBufferSize); + void addInstance(LADSPAInstance* instance); + EngineLADSPAControlConnection* addControl(ControlObject* potmeter, LADSPAControl* control); - static EngineLADSPA * getEngine(); + static EngineLADSPA* getEngine(); -private: + private: LADSPAInstanceLinkedList m_Instances; EngineLADSPAControlConnectionLinkedList m_Connections; int m_bufferSize; int m_monoBufferSize; - CSAMPLE * m_pBufferLeft[2]; - CSAMPLE * m_pBufferRight[2]; + CSAMPLE* m_pBufferLeft[2]; + CSAMPLE* m_pBufferRight[2]; - static EngineLADSPA * m_pEngine; + static EngineLADSPA* m_pEngine; }; #endif diff --git a/src/engine/enginemaster.cpp b/src/engine/enginemaster.cpp index cead725c618..96a88caa59b 100644 --- a/src/engine/enginemaster.cpp +++ b/src/engine/enginemaster.cpp @@ -23,14 +23,14 @@ #include "configobject.h" #include "controllogpotmeter.h" #include "controlpotmeter.h" -#include "enginebuffer.h" -#include "enginemaster.h" +#include "engine/enginebuffer.h" +#include "engine/enginemaster.h" #include "engine/engineworkerscheduler.h" -#include "enginebuffer.h" -#include "enginechannel.h" -#include "engineclipping.h" -#include "enginevumeter.h" -#include "enginexfader.h" +#include "engine/enginebuffer.h" +#include "engine/enginechannel.h" +#include "engine/engineclipping.h" +#include "engine/enginevumeter.h" +#include "engine/enginexfader.h" #include "engine/sidechain/enginesidechain.h" #include "engine/sync/enginesync.h" #include "sampleutil.h" @@ -39,11 +39,11 @@ #include "engine/channelmixer.h" #ifdef __LADSPA__ -#include "engineladspa.h" +#include "engine/engineladspa.h" #endif -EngineMaster::EngineMaster(ConfigObject * _config, - const char * group, +EngineMaster::EngineMaster(ConfigObject* _config, + const char* group, bool bEnableSidechain, bool bRampingGain) : m_bRampingGain(bRampingGain), @@ -268,7 +268,7 @@ void EngineMaster::processChannels(unsigned int* busChannelConnectionFlags, } } -void EngineMaster::process(const CSAMPLE *, const CSAMPLE *pOut, const int iBufferSize) { +void EngineMaster::process(const int iBufferSize) { static bool haveSetName = false; if (!haveSetName) { QThread::currentThread()->setObjectName("Engine"); @@ -280,9 +280,6 @@ void EngineMaster::process(const CSAMPLE *, const CSAMPLE *pOut, const int iBuff // Update internal master sync. m_pMasterSync->onCallbackStart(iSampleRate, iBufferSize); - CSAMPLE **pOutput = (CSAMPLE**)pOut; - Q_UNUSED(pOutput); - // Bitvector of enabled channels const unsigned int maxChannels = 32; unsigned int busChannelConnectionFlags[3] = { 0, 0, 0 }; diff --git a/src/engine/enginemaster.h b/src/engine/enginemaster.h index 59b71376a09..386780d5b74 100644 --- a/src/engine/enginemaster.h +++ b/src/engine/enginemaster.h @@ -18,6 +18,8 @@ #ifndef ENGINEMASTER_H #define ENGINEMASTER_H +#include + #include "controlobject.h" #include "engine/engineobject.h" #include "engine/enginechannel.h" @@ -40,7 +42,7 @@ class EngineSideChain; class SyncWorker; class EngineSync; -class EngineMaster : public EngineObject, public AudioSource { +class EngineMaster : public QObject, public AudioSource { Q_OBJECT public: EngineMaster(ConfigObject* pConfig, @@ -53,7 +55,7 @@ class EngineMaster : public EngineObject, public AudioSource { // be called by SoundManager. const CSAMPLE* buffer(AudioOutput output) const; - void process(const CSAMPLE *, const CSAMPLE *pOut, const int iBufferSize); + void process(const int iBufferSize); // Add an EngineChannel to the mixing engine. This is not thread safe -- // only call it before the engine has started mixing. diff --git a/src/engine/enginemicrophone.cpp b/src/engine/enginemicrophone.cpp index 4ddb21d16f9..8a9c7997890 100644 --- a/src/engine/enginemicrophone.cpp +++ b/src/engine/enginemicrophone.cpp @@ -104,9 +104,8 @@ void EngineMicrophone::receiveBuffer(AudioInput input, const short* pBuffer, uns } } -void EngineMicrophone::process(const CSAMPLE* pInput, const CSAMPLE* pOutput, const int iBufferSize) { +void EngineMicrophone::process(const CSAMPLE* pInput, CSAMPLE* pOut, const int iBufferSize) { Q_UNUSED(pInput); - CSAMPLE* pOut = const_cast(pOutput); // If talkover is enabled, then read into the output buffer. Otherwise, skip // the appropriate number of samples to throw them away. diff --git a/src/engine/enginemicrophone.h b/src/engine/enginemicrophone.h index cd4e81ed256..07feb4ba197 100644 --- a/src/engine/enginemicrophone.h +++ b/src/engine/enginemicrophone.h @@ -24,7 +24,7 @@ class EngineMicrophone : public EngineChannel, public AudioDestination { bool isMaster(); // Called by EngineMaster whenever is requesting a new buffer of audio. - virtual void process(const CSAMPLE* pInput, const CSAMPLE* pOutput, const int iBufferSize); + virtual void process(const CSAMPLE* pInput, CSAMPLE* pOutput, const int iBufferSize); // This is called by SoundManager whenever there are new samples from the // microphone to be processed diff --git a/src/engine/engineobject.h b/src/engine/engineobject.h index 4c3a8ff97e4..54c14fb80df 100644 --- a/src/engine/engineobject.h +++ b/src/engine/engineobject.h @@ -28,18 +28,12 @@ class EngineObject : public QObject { Q_OBJECT -public: + public: EngineObject(); virtual ~EngineObject(); - virtual void process(const CSAMPLE *pIn, const CSAMPLE *pOut, const int iLen) = 0; -// static int getPlaySrate(); -//protected: -// void setPlaySrate(int srate); - -//private: -// static int PLAY_SRATE; + virtual void process(const CSAMPLE* pIn, CSAMPLE* pOut, + const int iLen) = 0; }; - #endif diff --git a/src/engine/enginepassthrough.cpp b/src/engine/enginepassthrough.cpp index 2d61070f4b8..d4e7889d948 100644 --- a/src/engine/enginepassthrough.cpp +++ b/src/engine/enginepassthrough.cpp @@ -93,8 +93,7 @@ void EnginePassthrough::receiveBuffer(AudioInput input, const short* pBuffer, un } } -void EnginePassthrough::process(const CSAMPLE* pInput, const CSAMPLE* pOutput, const int iBufferSize) { - CSAMPLE* pOut = const_cast(pOutput); +void EnginePassthrough::process(const CSAMPLE* pInput, CSAMPLE* pOut, const int iBufferSize) { Q_UNUSED(pInput); // If passthrough is enabled, then read into the output buffer. Otherwise, diff --git a/src/engine/enginepassthrough.h b/src/engine/enginepassthrough.h index 74f9ebe5e71..9fd81cf2977 100644 --- a/src/engine/enginepassthrough.h +++ b/src/engine/enginepassthrough.h @@ -17,7 +17,7 @@ class EnginePassthrough : public EngineChannel, public AudioDestination { Q_OBJECT public: - EnginePassthrough(const char *pGroup); + EnginePassthrough(const char* pGroup); virtual ~EnginePassthrough(); bool isActive(); @@ -25,7 +25,7 @@ class EnginePassthrough : public EngineChannel, public AudioDestination { bool isMaster(); // Called by EngineMaster whenever is requesting a new buffer of audio. - virtual void process(const CSAMPLE *pInput, const CSAMPLE *pOutput, const int iBufferSize); + virtual void process(const CSAMPLE* pInput, CSAMPLE* pOutput, const int iBufferSize); // This is called by SoundManager whenever there are new samples from the // deck to be processed @@ -42,9 +42,9 @@ class EnginePassthrough : public EngineChannel, public AudioDestination { private: EngineClipping m_clipping; EngineVuMeter m_vuMeter; - ControlObject *m_pEnabled; - ControlPushButton *m_pPassing; - CSAMPLE *m_pConversionBuffer; + ControlObject* m_pEnabled; + ControlPushButton* m_pPassing; + CSAMPLE* m_pConversionBuffer; CircularBuffer m_sampleBuffer; }; diff --git a/src/engine/enginepregain.cpp b/src/engine/enginepregain.cpp index 7b181747219..7accf7ca91c 100644 --- a/src/engine/enginepregain.cpp +++ b/src/engine/enginepregain.cpp @@ -31,7 +31,7 @@ ControlObject* EnginePregain::s_pEnableReplayGain = NULL; /*---------------------------------------------------------------- A pregaincontrol is ... a pregain. ----------------------------------------------------------------*/ -EnginePregain::EnginePregain(const char * group) +EnginePregain::EnginePregain(const char* group) { potmeterPregain = new ControlLogpotmeter(ConfigKey(group, "pregain"), 4.); //Replay Gain things @@ -60,11 +60,10 @@ EnginePregain::~EnginePregain() s_pReplayGainBoost = NULL; } -void EnginePregain::process(const CSAMPLE * pIn, const CSAMPLE * pOut, const int iBufferSize) { +void EnginePregain::process(const CSAMPLE* pIn, CSAMPLE* pOutput, const int iBufferSize) { float fEnableReplayGain = s_pEnableReplayGain->get(); float fReplayGainBoost = s_pReplayGainBoost->get(); - CSAMPLE * pOutput = (CSAMPLE *)pOut; float fGain = potmeterPregain->get(); float fReplayGain = m_pControlReplayGain->get(); float fReplayGainCorrection=1; diff --git a/src/engine/enginepregain.h b/src/engine/enginepregain.h index 5f3b0ded9ce..c0d06088840 100644 --- a/src/engine/enginepregain.h +++ b/src/engine/enginepregain.h @@ -24,22 +24,22 @@ class ControlLogpotmeter; class ControlPotmeter; class ControlObject; -class EnginePregain : public EngineObject -{ -public: - EnginePregain( const char *group); - ~EnginePregain(); - void process(const CSAMPLE *pIn, const CSAMPLE *pOut, const int iBufferSize); +class EnginePregain : public EngineObject { + public: + EnginePregain(const char* group); + virtual ~EnginePregain(); -private: + void process(const CSAMPLE* pIn, CSAMPLE* pOut, const int iBufferSize); + + private: float m_fPrevGain; - ControlLogpotmeter *potmeterPregain; - ControlObject *m_pTotalGain; - ControlObject *m_pControlReplayGain; - ControlObject *m_pPassthroughEnabled; - static ControlPotmeter *s_pReplayGainBoost; - static ControlObject *s_pEnableReplayGain; + ControlLogpotmeter* potmeterPregain; + ControlObject* m_pTotalGain; + ControlObject* m_pControlReplayGain; + ControlObject* m_pPassthroughEnabled; + static ControlPotmeter* s_pReplayGainBoost; + static ControlObject* s_pEnableReplayGain; bool m_bSmoothFade; PerformanceTimer m_timer; }; diff --git a/src/engine/enginevinylsoundemu.cpp b/src/engine/enginevinylsoundemu.cpp index 21a8d5aedb1..16d00037243 100644 --- a/src/engine/enginevinylsoundemu.cpp +++ b/src/engine/enginevinylsoundemu.cpp @@ -18,7 +18,7 @@ #include "configobject.h" #include "controlobject.h" -#include "enginevinylsoundemu.h" +#include "engine/enginevinylsoundemu.h" #include "sampleutil.h" /** This class emulates the response of a vinyl record's audio to changes @@ -27,7 +27,7 @@ * these slow speeds. */ -EngineVinylSoundEmu::EngineVinylSoundEmu(ConfigObject * pConfig, const char * group) +EngineVinylSoundEmu::EngineVinylSoundEmu(ConfigObject* pConfig, const char* group) { m_pConfig = pConfig; m_pRateEngine = ControlObject::getControl(ConfigKey(group, "rateEngine")); @@ -46,9 +46,7 @@ EngineVinylSoundEmu::~EngineVinylSoundEmu() } -void EngineVinylSoundEmu::process(const CSAMPLE * pIn, const CSAMPLE * pOut, const int iBufferSize) -{ - CSAMPLE * pOutput = (CSAMPLE *)pOut; +void EngineVinylSoundEmu::process(const CSAMPLE* pIn, CSAMPLE* pOutput, const int iBufferSize) { m_fSpeed = (float)m_pRateEngine->get(); float rateFrac = 2 * (m_fSpeed - m_fOldSpeed) / (float)iBufferSize; float curRate = m_fOldSpeed; diff --git a/src/engine/enginevinylsoundemu.h b/src/engine/enginevinylsoundemu.h index 05bf5c4f0e8..3da6b33d6f6 100644 --- a/src/engine/enginevinylsoundemu.h +++ b/src/engine/enginevinylsoundemu.h @@ -17,21 +17,27 @@ #ifndef ENGINEVINYLSOUNDEMU_H #define ENGINEVINYLSOUNDEMU_H -#include "engineobject.h" +#include "configobject.h" +#include "engine/engineobject.h" + +class ControlObject; #define NOISE_BUFFER_SIZE 1000 -class EngineVinylSoundEmu : public EngineObject -{ -public: - EngineVinylSoundEmu(ConfigObject *pConfig, const char *group); - ~EngineVinylSoundEmu(); - void process(const CSAMPLE *pIn, const CSAMPLE *pOut, const int iBufferSize); -private: - ConfigObject *m_pConfig; - ControlObject *m_pRateEngine; + +class EngineVinylSoundEmu : public EngineObject { + Q_OBJECT + public: + EngineVinylSoundEmu(ConfigObject* pConfig, const char* group); + virtual ~EngineVinylSoundEmu(); + + void process(const CSAMPLE* pIn, CSAMPLE* pOut, const int iBufferSize); + + private: + ConfigObject* m_pConfig; + ControlObject* m_pRateEngine; float m_fSpeed, m_fOldSpeed; float m_fGainFactor; - + float m_fNoise[NOISE_BUFFER_SIZE]; int m_iNoisePos; }; diff --git a/src/engine/enginevumeter.cpp b/src/engine/enginevumeter.cpp index 017a0baf9f2..eade65f06f0 100644 --- a/src/engine/enginevumeter.cpp +++ b/src/engine/enginevumeter.cpp @@ -22,7 +22,7 @@ #include "controlpotmeter.h" #include "sampleutil.h" -EngineVuMeter::EngineVuMeter(const char * group) { +EngineVuMeter::EngineVuMeter(const char* group) { // The VUmeter widget is controlled via a controlpotmeter, which means // that it should react on the setValue(int) signal. m_ctrlVuMeter = new ControlPotmeter(ConfigKey(group, "VuMeter"), 0., 1.); @@ -49,9 +49,7 @@ EngineVuMeter::~EngineVuMeter() delete m_ctrlVuMeterR; } -void EngineVuMeter::process(const CSAMPLE * pIn, const CSAMPLE *, const int iBufferSize) -{ - +void EngineVuMeter::process(const CSAMPLE* pIn, CSAMPLE*, const int iBufferSize) { CSAMPLE fVolSumL, fVolSumR; SampleUtil::sumAbsPerChannel(&fVolSumL, &fVolSumR, pIn, iBufferSize); m_fRMSvolumeSumL += fVolSumL; diff --git a/src/engine/enginevumeter.h b/src/engine/enginevumeter.h index bdc3dd08f55..1c4addfdabe 100644 --- a/src/engine/enginevumeter.h +++ b/src/engine/enginevumeter.h @@ -30,15 +30,17 @@ class ControlPotmeter; class EngineVuMeter : public EngineObject { -public: - EngineVuMeter(const char *); - ~EngineVuMeter(); - void process(const CSAMPLE *pIn, const CSAMPLE *pOut, const int iBufferSize); - -private: - ControlPotmeter *m_ctrlVuMeter; - ControlPotmeter *m_ctrlVuMeterL; - ControlPotmeter *m_ctrlVuMeterR; + Q_OBJECT + public: + EngineVuMeter(const char* ); + virtual ~EngineVuMeter(); + + void process(const CSAMPLE* pIn, CSAMPLE* pOut, const int iBufferSize); + + private: + ControlPotmeter* m_ctrlVuMeter; + ControlPotmeter* m_ctrlVuMeterL; + ControlPotmeter* m_ctrlVuMeterR; FLOAT_TYPE m_fRMSvolumeL; FLOAT_TYPE m_fRMSvolumeSumL; FLOAT_TYPE m_fRMSvolumeR; diff --git a/src/engine/loopingcontrol.cpp b/src/engine/loopingcontrol.cpp index 96ed2f797f1..891a29136e3 100644 --- a/src/engine/loopingcontrol.cpp +++ b/src/engine/loopingcontrol.cpp @@ -17,8 +17,8 @@ double LoopingControl::s_dBeatSizes[] = { 0.03125, 0.0625, 0.125, 0.25, 0.5, 1, 2, 4, 8, 16, 32, 64, }; -LoopingControl::LoopingControl(const char * _group, - ConfigObject * _config) +LoopingControl::LoopingControl(const char* _group, + ConfigObject* _config) : EngineControl(_group, _config) { m_bLoopingEnabled = false; m_iLoopStartSample = kNoTrigger; diff --git a/src/engine/loopingcontrol.h b/src/engine/loopingcontrol.h index d5bbc9239ff..b9d9c060345 100644 --- a/src/engine/loopingcontrol.h +++ b/src/engine/loopingcontrol.h @@ -22,7 +22,7 @@ class BeatLoopingControl; class LoopingControl : public EngineControl { Q_OBJECT public: - LoopingControl(const char * _group, ConfigObject * _config); + LoopingControl(const char* _group, ConfigObject* _config); virtual ~LoopingControl(); // process() updates the internal state of the LoopingControl to reflect the @@ -141,7 +141,7 @@ class BeatLoopingControl : public QObject { private: // Used simply to generate the beatloop_%SIZE and beatseek_%SIZE CO // ConfigKeys. - ConfigKey keyForControl(const char * _group, QString ctrlName, double num); + ConfigKey keyForControl(const char* _group, QString ctrlName, double num); double m_dBeatLoopSize; bool m_bActive; ControlPushButton* m_pLegacy; diff --git a/src/engine/positionscratchcontroller.h b/src/engine/positionscratchcontroller.h index a6381d39e09..fcb4be61bb6 100644 --- a/src/engine/positionscratchcontroller.h +++ b/src/engine/positionscratchcontroller.h @@ -15,7 +15,7 @@ class PositionScratchController : public QObject { virtual ~PositionScratchController(); void process(double currentSample, double releaseRate, - int iBufferSize, double baserate); + int iBufferSize, double baserate); bool isEnabled(); double getRate(); void notifySeek(double currentSample); diff --git a/src/engine/ratecontrol.h b/src/engine/ratecontrol.h index 9f1bf8cf163..f716e8b0523 100644 --- a/src/engine/ratecontrol.h +++ b/src/engine/ratecontrol.h @@ -119,7 +119,7 @@ class RateControl : public EngineControl { ControlObject* m_pVCScratching; Rotary* m_pJogFilter; - ControlObject *m_pSampleRate; + ControlObject* m_pSampleRate; TrackPointer m_pTrack; diff --git a/src/engine/readaheadmanager.h b/src/engine/readaheadmanager.h index 356749f43a7..3f6f4f8cccb 100644 --- a/src/engine/readaheadmanager.h +++ b/src/engine/readaheadmanager.h @@ -122,7 +122,7 @@ class ReadAheadManager { QLinkedList m_readAheadLog; int m_iCurrentPosition; CachingReader* m_pReader; - CSAMPLE *m_pCrossFadeBuffer; + CSAMPLE* m_pCrossFadeBuffer; }; #endif // READAHEADMANGER_H diff --git a/src/engine/sidechain/engineshoutcast.cpp b/src/engine/sidechain/engineshoutcast.cpp index 68a71282d6a..9b85d41ead4 100644 --- a/src/engine/sidechain/engineshoutcast.cpp +++ b/src/engine/sidechain/engineshoutcast.cpp @@ -39,7 +39,7 @@ #define TIMEOUT 10 -EngineShoutcast::EngineShoutcast(ConfigObject *_config) +EngineShoutcast::EngineShoutcast(ConfigObject* _config) : m_pTextCodec(NULL), m_pMetaData(), m_pShout(NULL), diff --git a/src/engine/sidechain/engineshoutcast.h b/src/engine/sidechain/engineshoutcast.h index 0cea0d805b2..c5190368b15 100644 --- a/src/engine/sidechain/engineshoutcast.h +++ b/src/engine/sidechain/engineshoutcast.h @@ -41,7 +41,7 @@ class Encoder; class EngineShoutcast : public QObject, public EncoderCallback, public SideChainWorker { Q_OBJECT public: - EngineShoutcast(ConfigObject *_config); + EngineShoutcast(ConfigObject* _config); virtual ~EngineShoutcast(); // This is called by the Engine implementation for each sample. Encode and @@ -89,7 +89,7 @@ class EngineShoutcast : public QObject, public EncoderCallback, public SideChain int m_iMetaDataLife; long m_iShoutStatus; long m_iShoutFailures; - ConfigObject *m_pConfig; + ConfigObject* m_pConfig; Encoder *m_encoder; ControlObject* m_pShoutcastNeedUpdateFromPrefs; ControlObjectThread* m_pUpdateShoutcastFromPrefs; diff --git a/src/engine/sidechain/enginesidechain.cpp b/src/engine/sidechain/enginesidechain.cpp index 4b12523dc7c..865b3129969 100644 --- a/src/engine/sidechain/enginesidechain.cpp +++ b/src/engine/sidechain/enginesidechain.cpp @@ -33,7 +33,7 @@ #define SIDECHAIN_BUFFER_SIZE 65536 -EngineSideChain::EngineSideChain(ConfigObject * pConfig) +EngineSideChain::EngineSideChain(ConfigObject* pConfig) : m_pConfig(pConfig), m_bStopThread(false), m_sampleFifo(SIDECHAIN_BUFFER_SIZE), diff --git a/src/engine/sidechain/enginesidechain.h b/src/engine/sidechain/enginesidechain.h index ac71117b997..f0171bb9210 100644 --- a/src/engine/sidechain/enginesidechain.h +++ b/src/engine/sidechain/enginesidechain.h @@ -30,7 +30,7 @@ class EngineSideChain : public QThread { Q_OBJECT public: - EngineSideChain(ConfigObject * pConfig); + EngineSideChain(ConfigObject* pConfig); virtual ~EngineSideChain(); // Not thread-safe, wait-free. Submit buffer of samples to the sidechain for diff --git a/src/soundmanager.cpp b/src/soundmanager.cpp index 4183170d547..2e597836108 100644 --- a/src/soundmanager.cpp +++ b/src/soundmanager.cpp @@ -434,7 +434,7 @@ void SoundManager::requestBuffer( // Produce a block of samples for output. EngineMaster expects stereo // samples so multiply iFramesPerBuffer by 2. - m_pMaster->process(0, 0, iFramesPerBuffer*2); + m_pMaster->process(iFramesPerBuffer*2); m_requestBufferMutex.unlock(); } diff --git a/src/test/enginemastertest.cpp b/src/test/enginemastertest.cpp index 12bbf8b2e07..fa3e2b408ae 100644 --- a/src/test/enginemastertest.cpp +++ b/src/test/enginemastertest.cpp @@ -27,7 +27,7 @@ class EngineChannelMock : public EngineChannel { MOCK_METHOD0(isActive, bool()); MOCK_METHOD0(isMaster, bool()); MOCK_METHOD0(isPFL, bool()); - MOCK_METHOD3(process, void(const CSAMPLE* pIn, const CSAMPLE* pOut, const int iBufferSize)); + MOCK_METHOD3(process, void(const CSAMPLE* pIn, CSAMPLE* pOut, const int iBufferSize)); }; class EngineMasterTest : public MixxxTest { @@ -90,7 +90,7 @@ TEST_F(EngineMasterTest, SingleChannelOutputWorks) { .Times(1) .WillOnce(Return()); - m_pMaster->process(NULL, NULL, MAX_BUFFER_LEN); + m_pMaster->process(MAX_BUFFER_LEN); // Check that the master output contains the channel data. const CSAMPLE* pMasterBuffer = m_pMaster->getMasterBuffer(); @@ -145,7 +145,7 @@ TEST_F(EngineMasterTest, TwoChannelOutputWorks) { .Times(1) .WillOnce(Return()); - m_pMaster->process(NULL, NULL, MAX_BUFFER_LEN); + m_pMaster->process(MAX_BUFFER_LEN); // Check that the master output contains the sum of the channel data. const CSAMPLE* pMasterBuffer = m_pMaster->getMasterBuffer(); @@ -200,7 +200,7 @@ TEST_F(EngineMasterTest, TwoChannelPFLOutputWorks) { .Times(1) .WillOnce(Return()); - m_pMaster->process(NULL, NULL, MAX_BUFFER_LEN); + m_pMaster->process(MAX_BUFFER_LEN); // Check that the master output contains the sum of the channel data. const CSAMPLE* pMasterBuffer = m_pMaster->getMasterBuffer(); @@ -273,7 +273,7 @@ TEST_F(EngineMasterTest, ThreeChannelOutputWorks) { .Times(1) .WillOnce(Return()); - m_pMaster->process(NULL, NULL, MAX_BUFFER_LEN); + m_pMaster->process(MAX_BUFFER_LEN); // Check that the master output contains the sum of the channel data. const CSAMPLE* pMasterBuffer = m_pMaster->getMasterBuffer(); @@ -346,7 +346,7 @@ TEST_F(EngineMasterTest, ThreeChannelPFLOutputWorks) { .Times(1) .WillOnce(Return()); - m_pMaster->process(NULL, NULL, MAX_BUFFER_LEN); + m_pMaster->process(MAX_BUFFER_LEN); // Check that the master output contains the sum of the channel data. const CSAMPLE* pMasterBuffer = m_pMaster->getMasterBuffer(); @@ -382,7 +382,7 @@ TEST_F(EngineMasterTest, SingleChannelPFLOutputWorks) { .Times(1) .WillOnce(Return()); - m_pMaster->process(NULL, NULL, MAX_BUFFER_LEN); + m_pMaster->process(MAX_BUFFER_LEN); // Check that the master output is empty. const CSAMPLE* pMasterBuffer = m_pMaster->getMasterBuffer(); diff --git a/src/test/mockedenginebackendtest.h b/src/test/mockedenginebackendtest.h index ee42ef156d4..7a30c9aa74c 100644 --- a/src/test/mockedenginebackendtest.h +++ b/src/test/mockedenginebackendtest.h @@ -49,7 +49,6 @@ class MockScaler : public EngineBufferScale { class MockedEngineBackendTest : public MixxxTest { protected: virtual void SetUp() { - m_pBuffer = SampleUtil::alloc(MAX_BUFFER_LEN); m_pNumDecks = new ControlObject(ConfigKey("[Master]", "num_decks")); m_pEngineMaster = new EngineMaster(m_pConfig.data(), "[Master]", false, false); @@ -93,7 +92,6 @@ class MockedEngineBackendTest : public MixxxTest { m_pChannel2 = NULL; m_pChannel3 = NULL; m_pEngineSync = NULL; - SampleUtil::free(m_pBuffer); // Deletes all EngineChannels added to it. delete m_pEngineMaster; @@ -108,7 +106,7 @@ class MockedEngineBackendTest : public MixxxTest { } void ProcessBuffer() { - m_pEngineMaster->process(NULL, m_pBuffer, 1024); + m_pEngineMaster->process(1024); } ControlObject* m_pNumDecks; @@ -118,8 +116,6 @@ class MockedEngineBackendTest : public MixxxTest { EngineDeck *m_pChannel1, *m_pChannel2, *m_pChannel3; MockScaler *m_pMockScaler1, *m_pMockScaler2, *m_pMockScaler3; - CSAMPLE *m_pBuffer; - static const char* m_sGroup1; static const char* m_sGroup2; static const char* m_sGroup3;