Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/effects/effect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -210,3 +210,7 @@ EffectPointer Effect::createFromXml(EffectsManager* pEffectsManager,
EffectPointer pEffect = pEffectsManager->instantiateEffect(effectId);
return pEffect;
}

double Effect::getMetaknobDefault() {
return m_manifest.metaknobDefault();
}
2 changes: 2 additions & 0 deletions src/effects/effect.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ class Effect : public QObject {
static EffectPointer createFromXml(EffectsManager* pEffectsManager,
const QDomElement& element);

double getMetaknobDefault();

signals:
void enabledChanged(bool enabled);

Expand Down
4 changes: 4 additions & 0 deletions src/effects/effectchainmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -217,3 +217,7 @@ void EffectChainManager::loadEffectChains() {
}
}
}

bool EffectChainManager::isAdoptMetaknobValueEnabled() const {
return m_pConfig->getValue(ConfigKey("[Effects]", "AdoptMetaknobValue"), true);
}
2 changes: 2 additions & 0 deletions src/effects/effectchainmanager.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ class EffectChainManager : public QObject {

static const int kNumStandardEffectChains = 4;

bool isAdoptMetaknobValueEnabled() const;

private:
QString debugString() const {
return "EffectChainManager";
Expand Down
2 changes: 1 addition & 1 deletion src/effects/effectchainslot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ void EffectChainSlot::slotChainEffectChanged(unsigned int effectSlotNumber,
pEffect = effects.at(effectSlotNumber);
}
if (pSlot != nullptr) {
pSlot->loadEffect(pEffect);
pSlot->loadEffect(pEffect, m_pEffectRack->isAdoptMetaknobValueEnabled());
}

m_pControlNumEffects->forceSet(math_min(
Expand Down
55 changes: 32 additions & 23 deletions src/effects/effectmanifest.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,96 +24,104 @@ class EffectManifest final {
EffectManifest()
: m_isMixingEQ(false),
m_isMasterEQ(false),
m_effectRampsFromDry(false) {
m_effectRampsFromDry(false),
m_metaknobDefault(0.5) {
}

virtual const QString& id() const {
const QString& id() const {
return m_id;
}
virtual void setId(const QString& id) {
void setId(const QString& id) {
m_id = id;
}

virtual const QString& name() const {
const QString& name() const {
return m_name;
}
virtual void setName(const QString& name) {
void setName(const QString& name) {
m_name = name;
}

virtual const QString& shortName() const {
const QString& shortName() const {
return m_shortName;
}
virtual void setShortName(const QString& shortName) {
void setShortName(const QString& shortName) {
m_shortName = shortName;
}

virtual const QString& displayName() const {
const QString& displayName() const {
if (!m_shortName.isEmpty()) {
return m_shortName;
} else {
return m_name;
}
}

virtual const QString& author() const {
const QString& author() const {
return m_author;
}
virtual void setAuthor(const QString& author) {
void setAuthor(const QString& author) {
m_author = author;
}

virtual const QString& version() const {
const QString& version() const {
return m_version;
}
virtual void setVersion(const QString& version) {
void setVersion(const QString& version) {
m_version = version;
}

virtual const QString& description() const {
const QString& description() const {
return m_description;
}

virtual const bool& isMixingEQ() const {
const bool& isMixingEQ() const {
return m_isMixingEQ;
}

virtual void setIsMixingEQ(const bool value) {
void setIsMixingEQ(const bool value) {
m_isMixingEQ = value;
}

virtual const bool& isMasterEQ() const {
const bool& isMasterEQ() const {
return m_isMasterEQ;
}

virtual void setIsMasterEQ(const bool value) {
void setIsMasterEQ(const bool value) {
m_isMasterEQ = value;
}

virtual void setDescription(const QString& description) {
void setDescription(const QString& description) {
m_description = description;
}

virtual const QList<EffectManifestParameter>& parameters() const {
const QList<EffectManifestParameter>& parameters() const {
return m_parameters;
}

virtual QList<EffectManifestParameter>& parameters() {
QList<EffectManifestParameter>& parameters() {
return m_parameters;
}

virtual EffectManifestParameter* addParameter() {
EffectManifestParameter* addParameter() {
m_parameters.append(EffectManifestParameter());
return &m_parameters.last();
}

virtual bool effectRampsFromDry() const {
bool effectRampsFromDry() const {
return m_effectRampsFromDry;
}
virtual void setEffectRampsFromDry(bool effectFadesFromDry) {
void setEffectRampsFromDry(bool effectFadesFromDry) {
m_effectRampsFromDry = effectFadesFromDry;
}

double metaknobDefault() const {
return m_metaknobDefault;
}
void setMetaknobDefault(double metaknobDefault) {
m_metaknobDefault = metaknobDefault;
}

private:
QString debugString() const {
return QString("EffectManifest(%1)").arg(m_id);
Expand All @@ -130,6 +138,7 @@ class EffectManifest final {
bool m_isMasterEQ;
QList<EffectManifestParameter> m_parameters;
bool m_effectRampsFromDry;
double m_metaknobDefault;
};

#endif /* EFFECTMANIFEST_H */
8 changes: 6 additions & 2 deletions src/effects/effectrack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,10 @@ QDomElement EffectRack::toXml(QDomDocument* doc) const {
return rackElement;
}

bool EffectRack::isAdoptMetaknobValueEnabled() const {
return m_pEffectChainManager->isAdoptMetaknobValueEnabled();
}

StandardEffectRack::StandardEffectRack(EffectsManager* pEffectsManager,
EffectChainManager* pChainManager,
const unsigned int iRackNumber)
Expand Down Expand Up @@ -283,7 +287,7 @@ OutputEffectRack::OutputEffectRack(EffectsManager* pEffectsManager,
this, SLOT(loadPrevEffect(unsigned int, unsigned int, EffectPointer)));

// Register the master channel.
const ChannelHandleAndGroup* masterHandleAndGroup;
const ChannelHandleAndGroup* masterHandleAndGroup = nullptr;

// TODO(Be): Remove this hideous hack to get the ChannelHandleAndGroup
const QSet<ChannelHandleAndGroup>& registeredChannels =
Expand Down Expand Up @@ -336,7 +340,7 @@ void PerGroupRack::setupForGroup(const QString& groupName) {
pChain->updateEngineState();

// TODO(rryan): remove.
const ChannelHandleAndGroup* handleAndGroup;
const ChannelHandleAndGroup* handleAndGroup = nullptr;
for (const ChannelHandleAndGroup& handle_group :
m_pEffectChainManager->registeredInputChannels()) {
if (handle_group.name() == groupName) {
Expand Down
12 changes: 12 additions & 0 deletions src/effects/effectrack.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ class EffectRack : public QObject {

QDomElement toXml(QDomDocument* doc) const;

virtual bool isAdoptMetaknobValueEnabled() const;

public slots:
void slotClearRack(double v);

Expand Down Expand Up @@ -197,6 +199,11 @@ class QuickEffectRack : public PerGroupRack {
group);
}

bool isAdoptMetaknobValueEnabled() const override {
// No visible Metaknobs to adopt
return false;
}

protected:
void configureEffectChainSlotForGroup(EffectChainSlotPointer pSlot,
const QString& group) override;
Expand Down Expand Up @@ -244,6 +251,11 @@ class EqualizerRack : public PerGroupRack {
group);
}

bool isAdoptMetaknobValueEnabled() const override {
// No visible Metaknobs to adopt
return false;
}

protected:
void configureEffectChainSlotForGroup(EffectChainSlotPointer pSlot,
const QString& group) override;
Expand Down
10 changes: 8 additions & 2 deletions src/effects/effectslot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ EffectButtonParameterSlotPointer EffectSlot::getEffectButtonParameterSlot(unsign
return m_buttonParameters[slotNumber];
}

void EffectSlot::loadEffect(EffectPointer pEffect) {
void EffectSlot::loadEffect(EffectPointer pEffect, bool adoptMetaknobPosition) {
//qDebug() << debugString() << "loadEffect"
// << (pEffect ? pEffect->getManifest().name() : "(null)");
if (pEffect) {
Expand Down Expand Up @@ -183,7 +183,13 @@ void EffectSlot::loadEffect(EffectPointer pEffect) {
pParameter->loadEffect(pEffect);
}

slotEffectMetaParameter(m_pControlMetaParameter->get(), true);

if (adoptMetaknobPosition) {
slotEffectMetaParameter(m_pControlMetaParameter->get(), true);
} else {
m_pControlMetaParameter->set(pEffect->getMetaknobDefault());
slotEffectMetaParameter(pEffect->getMetaknobDefault(), true);
}

emit(effectLoaded(pEffect, m_iEffectNumber));
} else {
Expand Down
3 changes: 2 additions & 1 deletion src/effects/effectslot.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class EffectSlot : public QObject {

public slots:
// Request that this EffectSlot load the given Effect
void loadEffect(EffectPointer pEffect);
void loadEffect(EffectPointer pEffect, bool adoptMetaknobPosition);
void setMetaParameter(double v, bool force = false);

void slotEnabled(double v);
Expand Down Expand Up @@ -113,6 +113,7 @@ class EffectSlot : public QObject {
const unsigned int m_iChainNumber;
const unsigned int m_iEffectNumber;
const QString m_group;
UserSettingsPointer m_pConfig;
EffectPointer m_pEffect;

ControlObject* m_pControlLoaded;
Expand Down
1 change: 1 addition & 0 deletions src/effects/native/bitcrushereffect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ EffectManifest BitCrusherEffect::getManifest() {
manifest.setDescription(QObject::tr(
"Adds noise by the reducing the bit depth and sample rate"));
manifest.setEffectRampsFromDry(true);
manifest.setMetaknobDefault(0.0);

EffectManifestParameter* depth = manifest.addParameter();
depth->setId("bit_depth");
Expand Down
1 change: 1 addition & 0 deletions src/effects/native/echoeffect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ EffectManifest EchoEffect::getManifest() {
manifest.setVersion("1.0");
manifest.setDescription(QObject::tr(
"Stores the input signal in a temporary buffer and outputs it after a short time"));
manifest.setMetaknobDefault(db2ratio(-3.0));

EffectManifestParameter* delay = manifest.addParameter();
delay->setId("delay_time");
Expand Down
1 change: 1 addition & 0 deletions src/effects/native/flangereffect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ EffectManifest FlangerEffect::getManifest() {
manifest.setVersion("1.0");
manifest.setDescription(QObject::tr(
"Mixes the input with a delayed, pitch modulated copy of itself to create comb filtering"));
manifest.setMetaknobDefault(1.0);

EffectManifestParameter* speed = manifest.addParameter();
speed->setId("speed");
Expand Down
1 change: 1 addition & 0 deletions src/effects/native/loudnesscontoureffect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ EffectManifest LoudnessContourEffect::getManifest() {
manifest.setDescription(QObject::tr(
"Amplifies low and high frequencies at low volumes to compensate for reduced sensitivity of the human ear."));
manifest.setEffectRampsFromDry(true);
manifest.setMetaknobDefault(-kMaxLoGain / 2);

EffectManifestParameter* loudness = manifest.addParameter();
loudness->setId("loudness");
Expand Down
1 change: 1 addition & 0 deletions src/effects/native/tremoloeffect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ EffectManifest TremoloEffect::getManifest() {
manifest.setVersion("1.0");
manifest.setDescription(QObject::tr(
"Cycles the volume up and down"));
manifest.setMetaknobDefault(1.0);

EffectManifestParameter* depth = manifest.addParameter();
depth->setId("depth");
Expand Down
10 changes: 10 additions & 0 deletions src/preferences/dialog/dlgprefinterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,11 @@ void DlgPrefInterface::slotUpdate() {

int inhibitsettings = static_cast<int>(m_mixxx->getInhibitScreensaver());
comboBoxScreensaver->setCurrentIndex(comboBoxScreensaver->findData(inhibitsettings));

bool effectAdoptMetaknobValue = m_pConfig->getValue(
ConfigKey("[Effects]", "AdoptMetaknobValue"), true);
radioButtonKeepMetaknobPosition->setChecked(effectAdoptMetaknobValue);
radioButtonMetaknobLoadDefault->setChecked(!effectAdoptMetaknobValue);
}

void DlgPrefInterface::slotResetToDefaults() {
Expand All @@ -280,6 +285,8 @@ void DlgPrefInterface::slotResetToDefaults() {

// Tooltips on everywhere.
radioButtonTooltipsLibraryAndSkin->setChecked(true);

radioButtonKeepMetaknobPosition->setChecked(true);
}

void DlgPrefInterface::slotSetLocale(int pos) {
Expand Down Expand Up @@ -360,6 +367,9 @@ void DlgPrefInterface::slotApply() {
m_pConfig->set(ConfigKey("[Config]", "StartInFullscreen"),
ConfigValue(checkBoxStartFullScreen->isChecked()));

m_pConfig->set(ConfigKey("[Effects]", "AdoptMetaknobValue"),
ConfigValue(radioButtonKeepMetaknobPosition->isChecked()));

m_mixxx->setToolTipsCfg(m_tooltipMode);

// screensaver mode update
Expand Down
Loading