summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbe_ <be.0@gmx.com>2017-12-21 20:10:36 -0600
committerbe_ <be.0@gmx.com>2017-12-21 20:10:36 -0600
commite860545a0a3a8ca94b37040814fb6fcf5565d247 (patch)
tree7d234208227ffacbdd99abc330b560afc6ba47bb
parent9ca89d9c3b97aa291b37fae86ce03bcdb21f8512 (diff)
fix compilation warning about deleting forward declared EffectState
... in src/effects/effectchain.cpp EffectChain::InsertionType had to be moved to src/effects/defs.h to avoid circular #includes. Made it an enum class while I was at it.
-rw-r--r--src/effects/defs.h7
-rw-r--r--src/effects/effectchain.cpp11
-rw-r--r--src/effects/effectchain.h28
-rw-r--r--src/effects/effectchainslot.cpp17
-rw-r--r--src/effects/effectchainslot.h2
-rw-r--r--src/effects/effectsmanager.cpp2
-rw-r--r--src/engine/effects/engineeffectchain.cpp4
-rw-r--r--src/engine/effects/engineeffectchain.h2
-rw-r--r--src/engine/effects/message.h3
9 files changed, 39 insertions, 37 deletions
diff --git a/src/effects/defs.h b/src/effects/defs.h
index 0728c007b5..a3ad32f98f 100644
--- a/src/effects/defs.h
+++ b/src/effects/defs.h
@@ -18,6 +18,13 @@ inline uint qHash(SignalProcessingStage stage) {
return static_cast<uint>(stage);
};
+enum class EffectChainInsertionType {
+ Insert = 0,
+ Send,
+ // The number of insertion types. Also used to represent "unknown".
+ Num_Insertion_Types
+};
+
const int kNumEffectsPerUnit = 4;
class EffectState;
diff --git a/src/effects/effectchain.cpp b/src/effects/effectchain.cpp
index c3a6c1221d..594e225aa7 100644
--- a/src/effects/effectchain.cpp
+++ b/src/effects/effectchain.cpp
@@ -3,6 +3,7 @@
#include "engine/engine.h"
#include "effects/effectchainmanager.h"
#include "effects/effectsmanager.h"
+#include "effects/effectprocessor.h"
#include "effects/effectxmlelements.h"
#include "engine/effects/engineeffectchain.h"
#include "engine/effects/engineeffectrack.h"
@@ -19,7 +20,7 @@ EffectChain::EffectChain(EffectsManager* pEffectsManager, const QString& id,
m_bEnabled(true),
m_id(id),
m_name(""),
- m_insertionType(EffectChain::INSERT),
+ m_insertionType(EffectChainInsertionType::Insert),
m_dMix(0),
m_pEngineEffectChain(nullptr),
m_bAddedToEngine(false) {
@@ -239,11 +240,11 @@ void EffectChain::setMix(const double& dMix) {
emit(mixChanged(dMix));
}
-EffectChain::InsertionType EffectChain::insertionType() const {
+EffectChainInsertionType EffectChain::insertionType() const {
return m_insertionType;
}
-void EffectChain::setInsertionType(InsertionType insertionType) {
+void EffectChain::setInsertionType(EffectChainInsertionType insertionType) {
m_insertionType = insertionType;
sendParameterUpdate();
emit(insertionTypeChanged(insertionType));
@@ -345,8 +346,8 @@ EffectChainPointer EffectChain::createFromXml(EffectsManager* pEffectsManager,
EffectChainPointer pChain(new EffectChain(pEffectsManager, id));
pChain->setName(name);
pChain->setDescription(description);
- InsertionType insertionType = insertionTypeFromString(insertionTypeStr);
- if (insertionType != NUM_INSERTION_TYPES) {
+ EffectChainInsertionType insertionType = insertionTypeFromString(insertionTypeStr);
+ if (insertionType != EffectChainInsertionType::Num_Insertion_Types) {
pChain->setInsertionType(insertionType);
}
diff --git a/src/effects/effectchain.h b/src/effects/effectchain.h
index 916e707bf2..160ce8b113 100644
--- a/src/effects/effectchain.h
+++ b/src/effects/effectchain.h
@@ -57,34 +57,28 @@ class EffectChain : public QObject {
double mix() const;
void setMix(const double& dMix);
- enum InsertionType {
- INSERT = 0,
- SEND,
- // The number of insertion types. Also used to represent "unknown".
- NUM_INSERTION_TYPES
- };
- static QString insertionTypeToString(InsertionType type) {
+ static QString insertionTypeToString(EffectChainInsertionType type) {
switch (type) {
- case INSERT:
+ case EffectChainInsertionType::Insert:
return "INSERT";
- case SEND:
+ case EffectChainInsertionType::Send:
return "SEND";
default:
return "UNKNOWN";
}
}
- static InsertionType insertionTypeFromString(const QString& typeStr) {
+ static EffectChainInsertionType insertionTypeFromString(const QString& typeStr) {
if (typeStr == "INSERT") {
- return INSERT;
+ return EffectChainInsertionType::Insert;
} else if (typeStr == "SEND") {
- return SEND;
+ return EffectChainInsertionType::Send;
} else {
- return NUM_INSERTION_TYPES;
+ return EffectChainInsertionType::Num_Insertion_Types;
}
}
- InsertionType insertionType() const;
- void setInsertionType(InsertionType type);
+ EffectChainInsertionType insertionType() const;
+ void setInsertionType(EffectChainInsertionType type);
void addEffect(EffectPointer pEffect);
void replaceEffect(unsigned int effectSlotNumber, EffectPointer pEffect);
@@ -105,7 +99,7 @@ class EffectChain : public QObject {
void descriptionChanged(const QString& name);
void enabledChanged(bool enabled);
void mixChanged(double v);
- void insertionTypeChanged(EffectChain::InsertionType type);
+ void insertionTypeChanged(EffectChainInsertionType type);
void channelStatusChanged(const QString& group, bool enabled);
private:
@@ -122,7 +116,7 @@ class EffectChain : public QObject {
QString m_id;
QString m_name;
QString m_description;
- InsertionType m_insertionType;
+ EffectChainInsertionType m_insertionType;
double m_dMix;
QSet<ChannelHandleAndGroup> m_enabledInputChannels;
diff --git a/src/effects/effectchainslot.cpp b/src/effects/effectchainslot.cpp
index bc61905df5..d6594c0f07 100644
--- a/src/effects/effectchainslot.cpp
+++ b/src/effects/effectchainslot.cpp
@@ -49,7 +49,7 @@ EffectChainSlot::EffectChainSlot(EffectRack* pRack, const QString& group,
m_pControlChainInsertionType = new ControlPushButton(ConfigKey(m_group, "insertion_type"));
m_pControlChainInsertionType->setButtonMode(ControlPushButton::TOGGLE);
- m_pControlChainInsertionType->setStates(EffectChain::NUM_INSERTION_TYPES);
+ m_pControlChainInsertionType->setStates(static_cast<double>(EffectChainInsertionType::Num_Insertion_Types));
connect(m_pControlChainInsertionType, SIGNAL(valueChanged(double)),
this, SLOT(slotControlChainInsertionType(double)));
@@ -146,7 +146,7 @@ void EffectChainSlot::slotChainMixChanged(double mix) {
emit(updated());
}
-void EffectChainSlot::slotChainInsertionTypeChanged(EffectChain::InsertionType type) {
+void EffectChainSlot::slotChainInsertionTypeChanged(EffectChainInsertionType type) {
m_pControlChainInsertionType->set(static_cast<double>(type));
emit(updated());
}
@@ -213,7 +213,8 @@ void EffectChainSlot::loadEffectChainToSlot(EffectChainPointer pEffectChain) {
this, SLOT(slotChainChannelStatusChanged(const QString&, bool)));
m_pControlChainLoaded->forceSet(true);
- m_pControlChainInsertionType->set(m_pEffectChain->insertionType());
+ m_pControlChainInsertionType->set(
+ static_cast<double>(m_pEffectChain->insertionType()));
// Mix and enabled channels are persistent properties of the chain slot,
// not of the chain. Propagate the current settings to the chain.
@@ -275,7 +276,8 @@ void EffectChainSlot::clear() {
}
m_pControlNumEffects->forceSet(0.0);
m_pControlChainLoaded->forceSet(0.0);
- m_pControlChainInsertionType->set(EffectChain::INSERT);
+ m_pControlChainInsertionType->set(
+ static_cast<double>(EffectChainInsertionType::Insert));
emit(updated());
}
@@ -391,10 +393,9 @@ void EffectChainSlot::slotControlChainSuperParameter(double v, bool force) {
void EffectChainSlot::slotControlChainInsertionType(double v) {
// Intermediate cast to integer is needed for VC++.
- EffectChain::InsertionType type = static_cast<EffectChain::InsertionType>(int(v));
+ EffectChainInsertionType type = static_cast<EffectChainInsertionType>(int(v));
(void)v; // this avoids a false warning with g++ 4.8.1
- if (m_pEffectChain && type >= 0 &&
- type < EffectChain::NUM_INSERTION_TYPES) {
+ if (m_pEffectChain && type < EffectChainInsertionType::Num_Insertion_Types) {
m_pEffectChain->setInsertionType(type);
}
}
@@ -455,7 +456,7 @@ QDomElement EffectChainSlot::toXml(QDomDocument* doc) const {
m_pEffectChain->description());
XmlParse::addElement(*doc, chainElement, EffectXml::ChainInsertionType,
EffectChain::insertionTypeToString(
- static_cast<EffectChain::InsertionType>(
+ static_cast<EffectChainInsertionType>(
static_cast<int>(m_pControlChainInsertionType->get()))));
XmlParse::addElement(*doc, chainElement, EffectXml::ChainSuperParameter,
QString::number(m_pControlChainSuperParameter->get()));
diff --git a/src/effects/effectchainslot.h b/src/effects/effectchainslot.h
index 1897357528..68174874d8 100644
--- a/src/effects/effectchainslot.h
+++ b/src/effects/effectchainslot.h
@@ -102,7 +102,7 @@ class EffectChainSlot : public QObject {
void slotChainNameChanged(const QString& name);
void slotChainEnabledChanged(bool enabled);
void slotChainMixChanged(double mix);
- void slotChainInsertionTypeChanged(EffectChain::InsertionType type);
+ void slotChainInsertionTypeChanged(EffectChainInsertionType type);
void slotChainChannelStatusChanged(const QString& group, bool enabled);
void slotEffectLoaded(EffectPointer pEffect, unsigned int slotNumber);
diff --git a/src/effects/effectsmanager.cpp b/src/effects/effectsmanager.cpp
index 779e847018..2ec0b5550a 100644
--- a/src/effects/effectsmanager.cpp
+++ b/src/effects/effectsmanager.cpp
@@ -25,7 +25,7 @@ EffectsManager::EffectsManager(QObject* pParent, UserSettingsPointer pConfig,
m_pLoEqFreq(NULL),
m_pHiEqFreq(NULL),
m_underDestruction(false) {
- qRegisterMetaType<EffectChain::InsertionType>("EffectChain::InsertionType");
+ qRegisterMetaType<EffectChainInsertionType>("EffectChainInsertionType");
QPair<EffectsRequestPipe*, EffectsResponsePipe*> requestPipes =
TwoWayMessagePipe<EffectsRequest*, EffectsResponse>::makeTwoWayMessagePipe(
kEffectMessagPipeFifoSize, kEffectMessagPipeFifoSize, false, false);
diff --git a/src/engine/effects/engineeffectchain.cpp b/src/engine/effects/engineeffectchain.cpp
index 08dfe0c188..aa2fb3abf5 100644
--- a/src/engine/effects/engineeffectchain.cpp
+++ b/src/engine/effects/engineeffectchain.cpp
@@ -9,7 +9,7 @@ EngineEffectChain::EngineEffectChain(const QString& id,
const QSet<ChannelHandleAndGroup>& registeredOutputChannels)
: m_id(id),
m_enableState(EffectEnableState::Enabled),
- m_insertionType(EffectChain::INSERT),
+ m_insertionType(EffectChainInsertionType::Insert),
m_dMix(0),
m_buffer1(MAX_BUFFER_LEN),
m_buffer2(MAX_BUFFER_LEN) {
@@ -266,7 +266,7 @@ bool EngineEffectChain::process(const ChannelHandle& inputHandle,
if (processingOccured) {
// pIntermediateInput is the output of the last processed effect. It would be the
// intermediate input of the next effect if there was one.
- if (m_insertionType == EffectChain::INSERT) {
+ if (m_insertionType == EffectChainInsertionType::Insert) {
// INSERT mode: output = input * (1-wet) + effect(input) * wet
SampleUtil::copy2WithRampingGain(
pOut,
diff --git a/src/engine/effects/engineeffectchain.h b/src/engine/effects/engineeffectchain.h
index 18160ceb07..079b6b96b2 100644
--- a/src/engine/effects/engineeffectchain.h
+++ b/src/engine/effects/engineeffectchain.h
@@ -70,7 +70,7 @@ class EngineEffectChain : public EffectsRequestHandler {
QString m_id;
EffectEnableState m_enableState;
- EffectChain::InsertionType m_insertionType;
+ EffectChainInsertionType m_insertionType;
CSAMPLE m_dMix;
QList<EngineEffect*> m_effects;
mixxx::SampleBuffer m_buffer1;
diff --git a/src/engine/effects/message.h b/src/engine/effects/message.h
index 88ec4bab2b..12108f5f34 100644
--- a/src/engine/effects/message.h
+++ b/src/engine/effects/message.h
@@ -8,7 +8,6 @@
#include "util/fifo.h"
#include "util/memory.h"
#include "effects/defs.h"
-#include "effects/effectchain.h"
#include "engine/channelhandle.h"
// NOTE: Setting this to true will enable string manipulation and calls to
@@ -128,7 +127,7 @@ struct EffectsRequest {
} RemoveEffectFromChain;
struct {
bool enabled;
- EffectChain::InsertionType insertion_type;
+ EffectChainInsertionType insertion_type;
double mix;
} SetEffectChainParameters;
struct {