Skip to content

Commit c133360

Browse files
[BUGFIX] Fix resampler bugs (#408)
* Update iPlug2 submodule * Update for IDirBrowseControlBase change * Update NonIntegerResampler -> RealtimeResampler changes * Prevent crash with NAMFileBrowserControl if menu has submenus * Retrack official iPlug2 fork --------- Co-authored-by: Oli Larkin <[email protected]>
1 parent 0b11d65 commit c133360

File tree

4 files changed

+19
-16
lines changed

4 files changed

+19
-16
lines changed

.gitmodules

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[submodule "iPlug2"]
22
path = iPlug2
3-
# url = https://github.com/iPlug2/iPlug2
4-
url = https://github.com/sdatkinson/iPlug2.git
3+
url = https://github.com/iPlug2/iPlug2
4+
# url = https://github.com/sdatkinson/iPlug2.git
55
[submodule "eigen"]
66
path = eigen
77
url = https://gitlab.com/libeigen/eigen.git

NeuralAmpModeler/NeuralAmpModeler.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@
99

1010
#include "IPlug_include_in_plug_hdr.h"
1111
#include "ISender.h"
12-
#define M_PI 3.141592653589793238462643383279 // Needed by NonIntegerResampler.h
13-
#include "NonIntegerResampler.h"
12+
#include "RealtimeResampler.h"
1413

1514
const int kNumPresets = 1;
1615
// The plugin is mono inside
@@ -189,7 +188,7 @@ class ResamplingNAM : public nam::DSP
189188
bool mFinalized = true;
190189

191190
// The resampling wrapper
192-
iplug::NonIntegerResampler<NAM_SAMPLE, 1> mResampler;
191+
iplug::RealtimeResampler<NAM_SAMPLE, 1, 12> mResampler;
193192

194193
// Used to check that we don't get too large a block to process.
195194
int mMaxExternalBlockSize = 0;

NeuralAmpModeler/NeuralAmpModelerControls.h

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ class NAMFileBrowserControl : public IDirBrowseControlBase
228228

229229
if (pItem)
230230
{
231-
mSelectedIndex = mItems.Find(pItem);
231+
mSelectedItemIndex = mItems.Find(pItem);
232232
LoadFileAtCurrentIndex();
233233
}
234234
}
@@ -240,10 +240,10 @@ class NAMFileBrowserControl : public IDirBrowseControlBase
240240
const auto nItems = NItems();
241241
if (nItems == 0)
242242
return;
243-
mSelectedIndex--;
243+
mSelectedItemIndex--;
244244

245-
if (mSelectedIndex < 0)
246-
mSelectedIndex = nItems - 1;
245+
if (mSelectedItemIndex < 0)
246+
mSelectedItemIndex = nItems - 1;
247247

248248
LoadFileAtCurrentIndex();
249249
};
@@ -252,10 +252,10 @@ class NAMFileBrowserControl : public IDirBrowseControlBase
252252
const auto nItems = NItems();
253253
if (nItems == 0)
254254
return;
255-
mSelectedIndex++;
255+
mSelectedItemIndex++;
256256

257-
if (mSelectedIndex >= nItems)
258-
mSelectedIndex = 0;
257+
if (mSelectedItemIndex >= nItems)
258+
mSelectedItemIndex = 0;
259259

260260
LoadFileAtCurrentIndex();
261261
};
@@ -304,7 +304,11 @@ class NAMFileBrowserControl : public IDirBrowseControlBase
304304
else
305305
{
306306
CheckSelectedItem();
307-
mMainMenu.SetChosenItemIdx(mSelectedIndex);
307+
308+
if (!mMainMenu.HasSubMenus())
309+
{
310+
mMainMenu.SetChosenItemIdx(mSelectedItemIndex);
311+
}
308312
pCaller->GetUI()->CreatePopupMenu(*this, mMainMenu, pCaller->GetRECT());
309313
}
310314
};
@@ -333,7 +337,7 @@ class NAMFileBrowserControl : public IDirBrowseControlBase
333337

334338
void LoadFileAtCurrentIndex()
335339
{
336-
if (mSelectedIndex > -1 && mSelectedIndex < NItems())
340+
if (mSelectedItemIndex > -1 && mSelectedItemIndex < NItems())
337341
{
338342
WDL_String fileName, path;
339343
GetSelectedFile(fileName);
@@ -373,7 +377,7 @@ class NAMFileBrowserControl : public IDirBrowseControlBase
373377
}
374378

375379
private:
376-
void SelectFirstFile() { mSelectedIndex = mFiles.GetSize() ? 0 : -1; }
380+
void SelectFirstFile() { mSelectedItemIndex = mFiles.GetSize() ? 0 : -1; }
377381

378382
void GetSelectedFileDirectory(WDL_String& path)
379383
{

0 commit comments

Comments
 (0)