@@ -126,7 +126,7 @@ class ResamplingNAM : public nam::DSP
126126 // We can afford to be careful
127127 throw std::runtime_error (" More frames were provided than the max expected!" );
128128
129- if (GetExpectedSampleRate () == GetEncapsulatedSampleRate ())
129+ if (! NeedToResample ())
130130 {
131131 mEncapsulated ->process (input, output, num_frames);
132132 mEncapsulated ->finalize_ (num_frames);
@@ -156,7 +156,7 @@ class ResamplingNAM : public nam::DSP
156156 mFinalized = true ;
157157 };
158158
159- int GetLatency () const { return mResampler .GetLatency (); };
159+ int GetLatency () const { return NeedToResample () ? mResampler .GetLatency () : 0 ; };
160160
161161 void Reset (const double sampleRate, const int maxBlockSize)
162162 {
@@ -182,6 +182,7 @@ class ResamplingNAM : public nam::DSP
182182 double GetEncapsulatedSampleRate () const { return GetNAMSampleRate (mEncapsulated ); };
183183
184184private:
185+ bool NeedToResample () const { return GetExpectedSampleRate () != GetEncapsulatedSampleRate (); };
185186 // The encapsulated NAM
186187 std::unique_ptr<nam::DSP> mEncapsulated ;
187188 // The processing for NAM is a little weird--there's a call to .finalize_() that's expected.
@@ -271,6 +272,9 @@ class NeuralAmpModeler final : public iplug::Plugin
271272 int _UnserializeStateLegacy_0_7_9 (const iplug::IByteChunk& chunk, int startPos);
272273 // And other legacy unsrializations if/as needed...
273274
275+ // Make sure that the latency is reported correctly.
276+ void _UpdateLatency ();
277+
274278 // Update level meters
275279 // Called within ProcessBlock().
276280 // Assume _ProcessInput() and _ProcessOutput() were run immediately before.
0 commit comments