Skip to content

Commit

Permalink
Implement resampling
Browse files Browse the repository at this point in the history
  • Loading branch information
olilarkin committed Oct 16, 2023
1 parent e9a6512 commit 638f39e
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 4 deletions.
1 change: 1 addition & 0 deletions NeuralAmpModeler/NeuralAmpModeler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,7 @@ void NeuralAmpModeler::OnReset()
mInputSender.Reset(sampleRate);
mOutputSender.Reset(sampleRate);
mCheckSampleRateWarning = true;
mNonIntegerSRC.Reset(sampleRate);

// Setup noise gate
const auto time = 0.01;
Expand Down
2 changes: 2 additions & 0 deletions NeuralAmpModeler/NeuralAmpModeler.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include "ISender.h"

#include "NeuralAmpModelerFileManager.h"
#include "NonIntegerResampler.h"

const int kNumPresets = 1;

Expand Down Expand Up @@ -148,4 +149,5 @@ class NeuralAmpModeler final : public iplug::Plugin

NAMSender mInputSender, mOutputSender;
FileManager mModelFileManager {"nam"}, mIRFileManager {"wav"};
iplug::NonIntegerResampler<iplug::sample, 1> mNonIntegerSRC {48000.0f, iplug::ESRCMode::kLancsoz};
};
4 changes: 2 additions & 2 deletions NeuralAmpModeler/NeuralAmpModelerControls.h
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ class NAMMeterControl : public IVPeakAvgMeterControl<>, public IBitmapBase
}
};

const IText _WARNING_TEXT(DEFAULT_TEXT_SIZE + 3.f, COLOR_RED, "Roboto-Regular", EAlign::Near);
const IText _WARNING_TEXT(DEFAULT_TEXT_SIZE, COLOR_RED, "Roboto-Regular", EAlign::Near);

class NAMSampleRateWarningControl : public ITextControl
{
Expand All @@ -439,7 +439,7 @@ class NAMSampleRateWarningControl : public ITextControl
void SetSampleRate(const double sampleRate)
{
std::stringstream ss;
ss << "WARNING: NAM model expects sample rate " << static_cast<long>(std::round(sampleRate));
ss << "!Resampling to: " << static_cast<long>(std::round(sampleRate));
SetStr(ss.str().c_str());
}

Expand Down
2 changes: 1 addition & 1 deletion NeuralAmpModeler/config/NeuralAmpModeler-mac.xcconfig
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ EXTRA_LNK_FLAGS = -framework Accelerate -framework Metal -framework MetalKit //

//------------------------------
// PREPROCESSOR MACROS
EXTRA_ALL_DEFS = OBJC_PREFIX=vNeuralAmpModeler SWELL_APP_PREFIX=Swell_vNeuralAmpModeler IGRAPHICS_NANOVG IGRAPHICS_METAL GRAYED_ALPHA=0.5f NAM_SAMPLE_FLOAT SAMPLE_TYPE_FLOAT
EXTRA_ALL_DEFS = OBJC_PREFIX=vNeuralAmpModeler SWELL_APP_PREFIX=Swell_vNeuralAmpModeler IGRAPHICS_NANOVG IGRAPHICS_METAL GRAYED_ALPHA=0.5f NAM_SAMPLE_FLOAT SAMPLE_TYPE_FLOAT IPLUG_SIMDE
//EXTRA_DEBUG_DEFS =
//EXTRA_RELEASE_DEFS =
//EXTRA_TRACER_DEFS =
Expand Down
2 changes: 1 addition & 1 deletion iPlug2
Submodule iPlug2 updated 56 files
+89 −2 IGraphics/Controls/IControls.cpp
+58 −4 IGraphics/Controls/IControls.h
+3 −0 IGraphics/IGraphicsConstants.h
+17 −3 IGraphics/Platforms/IGraphicsIOS_view.mm
+2 −0 IPlug/AUv3/IPlugAUAudioUnit.h
+24 −0 IPlug/AUv3/IPlugAUAudioUnit.mm
+163 −0 IPlug/AUv3/IPlugAUViewController.mm
+3 −0 IPlug/AUv3/IPlugAUv3.h
+12 −0 IPlug/AUv3/IPlugAUv3.mm
+271 −0 IPlug/Extras/LanczosResampler.h
+204 −0 IPlug/Extras/NonIntegerResampler.h
+13 −13 IPlug/Extras/Oversampler.h
+73 −29 WDL/assocarray.h
+1 −1 WDL/audiobuffercontainer.h
+1 −1 WDL/denormal.h
+10 −10 WDL/eel2/asm-nseel-aarch64-gcc.c
+1,418 −0 WDL/eel2/asm-nseel-aarch64-msvc.asm
+123 −26 WDL/eel2/eel_lice.h
+76 −11 WDL/eel2/eel_pproc.h
+14 −1 WDL/eel2/eelscript.h
+37 −18 WDL/eel2/glue_aarch64.h
+5 −4 WDL/eel2/glue_port.h
+1 −1 WDL/eel2/glue_x86_64_sse.h
+9 −0 WDL/eel2/makefile.vc
+2 −0 WDL/eel2/nseel-cfunc.c
+11 −6 WDL/eel2/nseel-compiler.c
+94 −69 WDL/has_strings.h
+23 −3 WDL/lice/lice_combine.h
+10 −10 WDL/lice/lice_text.h
+18 −9 WDL/lice/lice_textnew.cpp
+30 −11 WDL/lineparse.h
+1 −1 WDL/localize/langpack_edit/LangPackEdit-Info.plist
+2 −2 WDL/localize/langpack_edit/res.rc
+3 −0 WDL/localize/localize.cpp
+117 −11 WDL/metadata.h
+27 −2 WDL/ptrlist_indexed.h
+20 −36 WDL/queue.h
+1 −1 WDL/resample.cpp
+5 −6 WDL/shm_msgreply.cpp
+120 −150 WDL/swell/swell-dlg.mm
+2 −4 WDL/swell/swell-internal.h
+131 −18 WDL/swell/swell-menu.mm
+1 −1 WDL/swell/swell-miscdlg.mm
+6 −0 WDL/swell/swell-types.h
+10 −10 WDL/swell/swell-wnd.mm
+18 −0 WDL/swell/swell_resgen.pl
+2 −1 WDL/wdl_base64.h
+36 −0 WDL/wdltypes.h
+19 −3 WDL/win32_utf8.c
+82 −57 WDL/wingui/scrollbar/coolscroll.cpp
+2 −0 WDL/wingui/virtwnd-controls.h
+7 −0 WDL/wingui/virtwnd-iconbutton.cpp
+4 −8 WDL/wingui/virtwnd-listbox.cpp
+33 −55 WDL/wingui/virtwnd-slider.cpp
+1 −1 WDL/wingui/virtwnd.cpp
+1 −0 WDL/wingui/virtwnd.h

0 comments on commit 638f39e

Please sign in to comment.