forked from mixxxdj/mixxx
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
I came up with an interesting formula having no idea what it would sound like. It turned out to make some gnarly noise. :)
- Loading branch information
Showing
4 changed files
with
113 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
#include "effects/backends/builtin/noiseeffect.h" | ||
|
||
#include "effects/backends/effectmanifest.h" | ||
|
||
// static | ||
QString NoiseEffect::getId() { | ||
return "org.mixxx.effects.noise"; | ||
} | ||
|
||
// static | ||
EffectManifestPointer NoiseEffect::getManifest() { | ||
EffectManifestPointer pManifest(new EffectManifest()); | ||
pManifest->setId(getId()); | ||
pManifest->setName(QObject::tr("Noise")); | ||
pManifest->setShortName(QObject::tr("Noise")); | ||
pManifest->setAuthor("The Mixxx Team"); | ||
pManifest->setVersion("1.0"); | ||
pManifest->setDescription(QObject::tr( | ||
"Adds noise")); | ||
pManifest->setEffectRampsFromDry(true); | ||
pManifest->setMetaknobDefault(0.0); | ||
|
||
EffectManifestParameterPointer depth = pManifest->addParameter(); | ||
depth->setId("depth"); | ||
depth->setName(QObject::tr("Depth")); | ||
depth->setShortName(QObject::tr("Depth")); | ||
depth->setDescription(QObject::tr( | ||
"Depth")); | ||
depth->setValueScaler(EffectManifestParameter::ValueScaler::LOGARITHMIC); | ||
depth->setSemanticHint(EffectManifestParameter::SemanticHint::UNKNOWN); | ||
depth->setUnitsHint(EffectManifestParameter::UnitsHint::UNKNOWN); | ||
depth->setDefaultLinkType(EffectManifestParameter::LinkType::LINKED); | ||
depth->setRange(0, 0, 1); | ||
|
||
return pManifest; | ||
} | ||
|
||
void NoiseEffect::loadEngineEffectParameters( | ||
const QMap<QString, EngineEffectParameterPointer>& parameters) { | ||
m_pDepthParameter = parameters.value("depth"); | ||
} | ||
|
||
void NoiseEffect::processChannel( | ||
NoiseGroupState* pState, | ||
const CSAMPLE* pInput, | ||
CSAMPLE* pOutput, | ||
const mixxx::EngineParameters& bufferParameters, | ||
const EffectEnableState enableState, | ||
const GroupFeatureState& groupFeatures) { | ||
Q_UNUSED(pState); | ||
Q_UNUSED(groupFeatures); | ||
Q_UNUSED(enableState); | ||
|
||
const CSAMPLE depth = m_pDepthParameter->value(); | ||
|
||
for (unsigned int i = 0; i < bufferParameters.samplesPerBuffer(); i++) { | ||
int sign = (pInput[i] >= 0) ? 1 : -1; | ||
pOutput[i] = sign * depth - pInput[i]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#pragma once | ||
|
||
#include "effects/backends/effectprocessor.h" | ||
#include "engine/effects/engineeffectparameter.h" | ||
#include "util/types.h" | ||
|
||
// This effect requires no state. | ||
struct NoiseGroupState : public EffectState { | ||
NoiseGroupState(const mixxx::EngineParameters& bufferParameters) | ||
: EffectState(bufferParameters) { | ||
} | ||
}; | ||
|
||
class NoiseEffect : public EffectProcessorImpl<NoiseGroupState> { | ||
public: | ||
NoiseEffect(){}; | ||
~NoiseEffect(){}; | ||
|
||
static QString getId(); | ||
static EffectManifestPointer getManifest(); | ||
|
||
void loadEngineEffectParameters( | ||
const QMap<QString, EngineEffectParameterPointer>& parameters) override; | ||
|
||
void processChannel( | ||
NoiseGroupState* pState, | ||
const CSAMPLE* pInput, | ||
CSAMPLE* pOutput, | ||
const mixxx::EngineParameters& bufferParameters, | ||
const EffectEnableState enableState, | ||
const GroupFeatureState& groupFeatureState) override; | ||
|
||
private: | ||
QString debugString() const { | ||
return getId(); | ||
} | ||
|
||
EngineEffectParameterPointer m_pDepthParameter; | ||
|
||
DISALLOW_COPY_AND_ASSIGN(NoiseEffect); | ||
}; |