Skip to content

Commit 3f5872c

Browse files
committed
CMake options for forcing use of NAM Core for LSTM or WaveNet
1 parent 5dd0376 commit 3f5872c

File tree

3 files changed

+23
-2
lines changed

3 files changed

+23
-2
lines changed

src/CMakeLists.txt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,19 @@ if (DISABLE_DENORMALS)
2323
add_definitions(-DDISABLE_DENORMALS)
2424
endif (DISABLE_DENORMALS)
2525

26+
option(LSTM_PREFER_NAM "Always use NAM Core for NAM LSTM models" OFF)
27+
28+
if (LSTM_PREFER_NAM)
29+
add_definitions(-DLSTM_PREFER_NAM)
30+
endif (LSTM_PREFER_NAM)
31+
32+
option(WAVENET_PREFER_NAM "Always use NAM Core for NAM WaveNet models" OFF)
33+
34+
if (WAVENET_PREFER_NAM)
35+
add_definitions(-DWAVENET_PREFER_NAM)
36+
endif (WAVENET_PREFER_NAM)
37+
38+
2639
if (CMAKE_SYSTEM_PROCESSOR MATCHES "(amd64)|(AMD64)|(x86_64)")
2740
option(USE_NATIVE_ARCH "Enable architecture-specific optimizations" OFF)
2841

src/nam_lv2.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
#include "nam_plugin.h"
1515

1616
// LV2 Functions
17-
static LV2_Handle instantiate(const LV2_Descriptor*, double rate, const char*, const LV2_Feature* const* features
18-
) {
17+
static LV2_Handle instantiate(const LV2_Descriptor*, double rate, const char*, const LV2_Feature* const* features)
18+
{
1919
try
2020
{
2121
auto nam = std::make_unique<NAM::Plugin>();

src/nam_plugin.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,14 @@ namespace NAM {
1212
{
1313
// prevent allocations on the audio thread
1414
currentModelPath.reserve(MAX_FILE_NAME+1);
15+
16+
#ifdef LSTM_PREFER_NAM // Use NAM Core for NAM LSTM models
17+
NeuralAudio::NeuralModel::SetLSTMLoadMode(NeuralAudio::PreferNAMCore);
18+
#endif
19+
20+
#ifdef WAVENET_PREFER_NAM // Use NAM Core for NAM WaveNet models
21+
NeuralAudio::NeuralModel::SetWaveNetLoadMode(NeuralAudio::PreferNAMCore);
22+
#endif
1523
}
1624

1725
Plugin::~Plugin()

0 commit comments

Comments
 (0)