Skip to content
Open
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
31 changes: 23 additions & 8 deletions NeuralAmpModeler/NeuralAmpModeler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ NeuralAmpModeler::NeuralAmpModeler(const InstanceInfo& info)
GetParam(kOutputLevel)->InitGain("Output", 0.0, -40.0, 40.0, 0.1);
GetParam(kNoiseGateThreshold)->InitGain("Threshold", -80.0, -100.0, 0.0, 0.1);
GetParam(kNoiseGateActive)->InitBool("NoiseGateActive", true);
GetParam(kEQActive)->InitBool("ToneStack", true);
GetParam(kEQMode)->InitEnum("EQ", kEQModePost, {"Pre", "Off", "Post"});
GetParam(kOutputMode)->InitEnum("OutputMode", 1, {"Raw", "Normalized", "Calibrated"}); // TODO DRY w/ control
GetParam(kIRToggle)->InitBool("IRToggle", true);
GetParam(kCalibrateInput)->InitBool(kCalibrateInputParamName.c_str(), kDefaultCalibrateInput);
Expand Down Expand Up @@ -266,7 +266,13 @@ NeuralAmpModeler::NeuralAmpModeler(const InstanceInfo& info)
kCtrlTagIRFileBrowser);
pGraphics->AttachControl(
new NAMSwitchControl(ngToggleArea, kNoiseGateActive, "Noise Gate", style, switchHandleBitmap));
pGraphics->AttachControl(new NAMSwitchControl(eqToggleArea, kEQActive, "EQ", style, switchHandleBitmap));
// Buttons-only switch (label drawn separately so it aligns with the Noise Gate label)
const auto eqButtonsArea = eqToggleArea.GetReducedFromTop(6.0f).GetReducedFromBottom(24.0f);
pGraphics->AttachControl(
new IVTabSwitchControl(eqButtonsArea, kEQMode, {"Pre", "Off", "Post"}, "",
radioButtonStyle.WithShowLabel(false).WithShowValue(false).WithDrawFrame(false),
EVShape::Rectangle));
pGraphics->AttachControl(new IVLabelControl(eqToggleArea, "EQ", style.WithDrawFrame(false)));

// The knobs
pGraphics->AttachControl(new NAMKnobControl(inputKnobArea, kInputLevel, "", style, knobBackgroundBitmap));
Expand Down Expand Up @@ -337,7 +343,9 @@ void NeuralAmpModeler::ProcessBlock(iplug::sample** inputs, iplug::sample** outp
_ProcessInput(inputs, numFrames, numChannelsExternalIn, numChannelsInternal);
_ApplyDSPStaging();
const bool noiseGateActive = GetParam(kNoiseGateActive)->Value();
const bool toneStackActive = GetParam(kEQActive)->Value();
const int eqMode = GetParam(kEQMode)->Int();
const bool toneStackUsable = eqMode != kEQModeOff && mToneStack != nullptr;
const bool eqPre = eqMode == kEQModePre;

// Noise gate trigger
sample** triggerOutput = mInputPointers;
Expand All @@ -355,19 +363,23 @@ void NeuralAmpModeler::ProcessBlock(iplug::sample** inputs, iplug::sample** outp
triggerOutput = mNoiseGateTrigger.Process(mInputPointers, numChannelsInternal, numFrames);
}

// EQ before the model when in pre mode (gate detection stays on the raw input)
sample** modelInput =
(toneStackUsable && eqPre) ? mToneStack->Process(triggerOutput, numChannelsInternal, nFrames) : triggerOutput;

if (mModel != nullptr)
{
mModel->process(triggerOutput, mOutputPointers, nFrames);
mModel->process(modelInput, mOutputPointers, nFrames);
}
else
{
_FallbackDSP(triggerOutput, mOutputPointers, numChannelsInternal, numFrames);
_FallbackDSP(modelInput, mOutputPointers, numChannelsInternal, numFrames);
}
// Apply the noise gate after the NAM
sample** gateGainOutput =
noiseGateActive ? mNoiseGateGain.Process(mOutputPointers, numChannelsInternal, numFrames) : mOutputPointers;

sample** toneStackOutPointers = (toneStackActive && mToneStack != nullptr)
sample** toneStackOutPointers = (toneStackUsable && !eqPre)
? mToneStack->Process(gateGainOutput, numChannelsInternal, nFrames)
: gateGainOutput;

Expand Down Expand Up @@ -535,9 +547,12 @@ void NeuralAmpModeler::OnParamChangeUI(int paramIdx, EParamSource source)
switch (paramIdx)
{
case kNoiseGateActive: pGraphics->GetControlWithParamIdx(kNoiseGateThreshold)->SetDisabled(!active); break;
case kEQActive:
pGraphics->ForControlInGroup("EQ_KNOBS", [active](IControl* pControl) { pControl->SetDisabled(!active); });
case kEQMode:
{
const bool eqOn = GetParam(kEQMode)->Int() != kEQModeOff;
pGraphics->ForControlInGroup("EQ_KNOBS", [eqOn](IControl* pControl) { pControl->SetDisabled(!eqOn); });
break;
}
case kIRToggle: pGraphics->GetControlWithTag(kCtrlTagIRFileBrowser)->SetDisabled(!active); break;
default: break;
}
Expand Down
9 changes: 8 additions & 1 deletion NeuralAmpModeler/NeuralAmpModeler.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ enum EParams
kOutputLevel,
// The rest is fine though.
kNoiseGateActive,
kEQActive,
kEQMode,
kIRToggle,
// Input calibration
kCalibrateInput,
Expand All @@ -50,6 +50,13 @@ enum EParams
kNumParams
};

enum EEQMode
{
kEQModePre = 0,
kEQModeOff,
kEQModePost
};

const int numKnobs = 6;

enum ECtrlTags
Expand Down
44 changes: 42 additions & 2 deletions NeuralAmpModeler/Unserialization.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,47 @@ void _RenameKeys(nlohmann::json& j, std::unordered_map<std::string, std::string>
}
}

// v0.7.16

void _UpdateConfigFrom_0_7_16(nlohmann::json& config)
{
// Fill me in once something changes!
}

int _GetConfigFrom_0_7_16(const iplug::IByteChunk& chunk, int startPos, nlohmann::json& config)
{
std::vector<std::string> paramNames{"Input",
"Threshold",
"Bass",
"Middle",
"Treble",
"Output",
"NoiseGateActive",
"EQ",
"IRToggle",
"CalibrateInput",
"InputCalibrationLevel",
"OutputMode",
"Slim"};

int pos = _UnserializePathsAndExpectedKeys(chunk, startPos, config, paramNames);
_UpdateConfigFrom_0_7_16(config);
return pos;
}

// v0.7.14

void _UpdateConfigFrom_0_7_14(nlohmann::json& config)
{
// Fill me in once something changes!
// "ToneStack" (Bool: off/on) became "EQ" (Enum: 0=Pre, 1=Off, 2=Post).
// Legacy "on" was always post-model, so map on->Post, off->Off.
if (config.find("ToneStack") != config.end())
{
const bool on = config["ToneStack"].get<double>() > 0.5;
config["EQ"] = static_cast<double>(on ? kEQModePost : kEQModeOff);
config.erase("ToneStack");
}
_UpdateConfigFrom_0_7_16(config);
}

int _GetConfigFrom_0_7_14(const iplug::IByteChunk& chunk, int startPos, nlohmann::json& config)
Expand Down Expand Up @@ -277,7 +313,11 @@ int NeuralAmpModeler::_UnserializeStateWithKnownVersion(const iplug::IByteChunk&
_Version version(versionStr);
// Act accordingly
nlohmann::json config;
if (version >= _Version(0, 7, 14))
if (version >= _Version(0, 7, 16))
{
pos = _GetConfigFrom_0_7_16(chunk, pos, config);
}
else if (version >= _Version(0, 7, 14))
{
pos = _GetConfigFrom_0_7_14(chunk, pos, config);
}
Expand Down
4 changes: 2 additions & 2 deletions NeuralAmpModeler/config.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#define PLUG_NAME "NeuralAmpModeler"
#define PLUG_MFR "Steven Atkinson"
#define PLUG_VERSION_HEX 0x0000070f
#define PLUG_VERSION_STR "0.7.15"
#define PLUG_VERSION_HEX 0x00000710
#define PLUG_VERSION_STR "0.7.16"
#define PLUG_UNIQUE_ID '1YEo'
#define PLUG_MFR_ID 'SDAa'
#define PLUG_URL_STR "https://github.com/sdatkinson/NeuralAmpModelerPlugin"
Expand Down
6 changes: 3 additions & 3 deletions NeuralAmpModeler/resources/NeuralAmpModeler-AAX-Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<key>CFBundleExecutable</key>
<string>NeuralAmpModeler</string>
<key>CFBundleGetInfoString</key>
<string>NeuralAmpModeler v0.7.15 Copyright 2022 Steven Atkinson</string>
<string>NeuralAmpModeler v0.7.16 Copyright 2022 Steven Atkinson</string>
<key>CFBundleIdentifier</key>
<string>com.StevenAtkinson.aax.NeuralAmpModeler</string>
<key>CFBundleInfoDictionaryVersion</key>
Expand All @@ -17,11 +17,11 @@
<key>CFBundlePackageType</key>
<string>TDMw</string>
<key>CFBundleShortVersionString</key>
<string>0.7.15</string>
<string>0.7.16</string>
<key>CFBundleSignature</key>
<string>PTul</string>
<key>CFBundleVersion</key>
<string>0.7.15</string>
<string>0.7.16</string>
<key>CSResourcesFileMapped</key>
<true/>
<key>LSMinimumSystemVersion</key>
Expand Down
10 changes: 5 additions & 5 deletions NeuralAmpModeler/resources/NeuralAmpModeler-AU-Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,17 @@
<key>type</key>
<string>aufx</string>
<key>version</key>
<integer>1807</integer>
<integer>1808</integer>
</dict>
</array>
<key>AudioUnit Version</key>
<string>0x0000070f</string>
<string>0x00000710</string>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<string>NeuralAmpModeler</string>
<key>CFBundleGetInfoString</key>
<string>NeuralAmpModeler v0.7.15 Copyright 2022 Steven Atkinson</string>
<string>NeuralAmpModeler v0.7.16 Copyright 2022 Steven Atkinson</string>
<key>CFBundleIdentifier</key>
<string>com.StevenAtkinson.audiounit.NeuralAmpModeler</string>
<key>CFBundleInfoDictionaryVersion</key>
Expand All @@ -40,11 +40,11 @@
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>0.7.15</string>
<string>0.7.16</string>
<key>CFBundleSignature</key>
<string>1YEo</string>
<key>CFBundleVersion</key>
<string>0.7.15</string>
<string>0.7.16</string>
<key>CSResourcesFileMapped</key>
<true/>
<key>LSMinimumSystemVersion</key>
Expand Down
6 changes: 3 additions & 3 deletions NeuralAmpModeler/resources/NeuralAmpModeler-VST3-Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<key>CFBundleExecutable</key>
<string>NeuralAmpModeler</string>
<key>CFBundleGetInfoString</key>
<string>NeuralAmpModeler v0.7.15 Copyright 2022 Steven Atkinson</string>
<string>NeuralAmpModeler v0.7.16 Copyright 2022 Steven Atkinson</string>
<key>CFBundleIdentifier</key>
<string>com.StevenAtkinson.vst3.NeuralAmpModeler</string>
<key>CFBundleInfoDictionaryVersion</key>
Expand All @@ -17,11 +17,11 @@
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>0.7.15</string>
<string>0.7.16</string>
<key>CFBundleSignature</key>
<string>1YEo</string>
<key>CFBundleVersion</key>
<string>0.7.15</string>
<string>0.7.16</string>
<key>CSResourcesFileMapped</key>
<true/>
<key>LSMinimumSystemVersion</key>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<key>CFBundleExecutable</key>
<string>NeuralAmpModeler</string>
<key>CFBundleGetInfoString</key>
<string>NeuralAmpModeler v0.7.15 Copyright 2022 Steven Atkinson</string>
<string>NeuralAmpModeler v0.7.16 Copyright 2022 Steven Atkinson</string>
<key>CFBundleIdentifier</key>
<string>com.StevenAtkinson.app.NeuralAmpModeler.AUv3</string>
<key>CFBundleInfoDictionaryVersion</key>
Expand All @@ -17,9 +17,9 @@
<key>CFBundlePackageType</key>
<string>XPC!</string>
<key>CFBundleShortVersionString</key>
<string>0.7.15</string>
<string>0.7.16</string>
<key>CFBundleVersion</key>
<string>0.7.15</string>
<string>0.7.16</string>
<key>LSMinimumSystemVersion</key>
<string>10.12.0</string>
<key>NSExtension</key>
Expand Down Expand Up @@ -48,7 +48,7 @@
<key>type</key>
<string>aufx</string>
<key>version</key>
<integer>1807</integer>
<integer>1808</integer>
</dict>
</array>
</dict>
Expand Down
6 changes: 3 additions & 3 deletions NeuralAmpModeler/resources/NeuralAmpModeler-macOS-Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<key>CFBundleExecutable</key>
<string>NeuralAmpModeler</string>
<key>CFBundleGetInfoString</key>
<string>NeuralAmpModeler v0.7.15 Copyright 2022 Steven Atkinson</string>
<string>NeuralAmpModeler v0.7.16 Copyright 2022 Steven Atkinson</string>
<key>CFBundleIconFile</key>
<string>NeuralAmpModeler.icns</string>
<key>CFBundleIdentifier</key>
Expand All @@ -19,11 +19,11 @@
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>0.7.15</string>
<string>0.7.16</string>
<key>CFBundleSignature</key>
<string>1YEo</string>
<key>CFBundleVersion</key>
<string>0.7.15</string>
<string>0.7.16</string>
<key>CSResourcesFileMapped</key>
<true/>
<key>LSApplicationCategoryType</key>
Expand Down