Skip to content

Commit

Permalink
Update to latest NeuralAmpModelerCore 0.2.0 release
Browse files Browse the repository at this point in the history
  • Loading branch information
brummer10 committed Oct 28, 2024
1 parent f202044 commit cac09b5
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 15 deletions.
1 change: 1 addition & 0 deletions Ratatouille/ModelerSelector.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include <condition_variable>

#include "dsp.h"
#include "get_dsp.h"
#include "activations.h"

#include "RTNeural.h"
Expand Down
4 changes: 1 addition & 3 deletions Ratatouille/NeuralModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,14 @@ inline void NeuralModel::compute(int count, float *input0, float *output0)
memcpy(buf1, buf, ReCounta * sizeof(float));
}
model->process(buf1, buf1, ReCounta);
model->finalize_(ReCounta);

if (needResample == 1) {
smp.down(buf1, buf);
} else if (needResample == 2) {
smp.up(ReCounta, buf1, buf);
}
} else {
model->process(buf, buf, count);
model->finalize_(count);
}
memcpy(output0, buf, count*sizeof(float));
}
Expand Down Expand Up @@ -121,7 +120,6 @@ bool NeuralModel::loadModel() {
memset(buffer, 0, warmUpSize * sizeof(float));

model->process(buffer, buffer, warmUpSize);
model->finalize_(warmUpSize);

delete[] buffer;
//fprintf(stderr, "sample rate = %i file = %i l = %f\n",fSampleRate, modelSampleRate, loudness);
Expand Down
10 changes: 3 additions & 7 deletions Ratatouille/ParallelThread.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@ class ProcessPtr
void process() const {
return memberFunc[i](instPtr[i]);
}

void dummyFunc() {}

private:
typedef void* InstancePtr;
Expand All @@ -118,8 +120,6 @@ class ProcessPtr
return (static_cast<C*>(instance)->*Function)();
}

void dummyFunc() {}

InstancePtr instPtr[2];
MemberFunc memberFunc[2];
uint32_t i;
Expand Down Expand Up @@ -185,9 +185,7 @@ class ParallelThread: public ProcessPtr
if (pthread_cond_timedwait(&pProcCond, &pWaitProc, getTimeOut()) == ETIMEDOUT) {
pthread_mutex_unlock(&pWaitProc);
maxDuration +=1;
//fprintf(stderr, "%s wait for process %i\n", threadName.c_str(), maxDuration);
if (maxDuration > 2) {
//fprintf(stderr, "%s break waitForProcess\n", threadName.c_str());
break;
}
} else {
Expand Down Expand Up @@ -219,16 +217,13 @@ class ParallelThread: public ProcessPtr
if (pthread_cond_timedwait(&pProcCond, &pWaitProc, getTimeOut()) == ETIMEDOUT) {
pthread_mutex_unlock(&pWaitProc);
maxDuration +=1;
//fprintf(stderr, "%s wait for data %i\n", threadName.c_str(), maxDuration);
if (maxDuration > 5) {
pWait.store(false, std::memory_order_release);
//fprintf(stderr, "%s break processWait\n", threadName.c_str());
}
} else {
pthread_mutex_unlock(&pWaitProc);;
}
}
//fprintf(stderr, "%s processed data %i\n", threadName.c_str(), maxDuration);
}
}

Expand All @@ -237,6 +232,7 @@ class ParallelThread: public ProcessPtr
if (isRunning()) {
pRun.store(false, std::memory_order_release);
if (pThd.joinable()) {
set<ProcessPtr, &ProcessPtr::dummyFunc>(this);
#if __cplusplus > 201703L
pWorkCond.store(true);
#endif
Expand Down
6 changes: 3 additions & 3 deletions Ratatouille/makefile
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,13 @@ endif
# check for sse optimisation level only on x86_64 architecture
ifeq ($(TARGET_ARCH), x86_64)
ifneq ($$(filter $(CPU_INFO) | grep sse3 ) , )
SSE_CFLAGS = -msse3 -mfpmath=sse -mfxsr -DUSE_SSE
SSE_CFLAGS = -msse3 -mfpmath=sse -mfxsr -DUSE_SSE=1
FFT_FLAG = -DFFTCONVOLVER_USE_SSE=1
else ifneq ($$(filter $(CPU_INFO) | grep sse2 ) , )
SSE_CFLAGS = -msse2 -mfpmath=sse -mfxsr -DUSE_SSE
SSE_CFLAGS = -msse2 -mfpmath=sse -mfxsr -DUSE_SSE=1
FFT_FLAG = -DFFTCONVOLVER_USE_SSE=1
else ifneq ($$(filter $(CPU_INFO) | grep sse ) , )
SSE_CFLAGS = -msse -mfpmath=sse -mfxsr -DUSE_SSE
SSE_CFLAGS = -msse -mfpmath=sse -mfxsr -DUSE_SSE=1
FFT_FLAG = -DFFTCONVOLVER_USE_SSE=1
else ifneq ($$(filter $(CPU_INFO) | grep ARM ) , )
ifneq ($$(filter $(CPU_INFO) | grep ARMv7 ) , )
Expand Down
2 changes: 1 addition & 1 deletion libxputty

0 comments on commit cac09b5

Please sign in to comment.