Skip to content

Commit 0e74768

Browse files
committed
Fix issue #26, add missing library notification for stand alone build
1 parent c90f733 commit 0e74768

File tree

4 files changed

+37
-19
lines changed

4 files changed

+37
-19
lines changed

NeuralRack/engine/engine.h

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ class Engine
138138
std::atomic<bool> bufferIsInit;
139139
std::atomic<int> _ab;
140140
std::atomic<int> _cd;
141+
std::atomic<int> _eqPos;
141142

142143
inline Engine();
143144
inline ~Engine();
@@ -231,6 +232,7 @@ inline Engine::Engine() :
231232

232233
_neuralA.store(false, std::memory_order_release);
233234
_neuralB.store(false, std::memory_order_release);
235+
_eqPos.store(1, std::memory_order_release);
234236
};
235237

236238
inline Engine::~Engine(){
@@ -305,9 +307,10 @@ void Engine::clean_up()
305307
// delete the internal DSP mem
306308
}
307309

308-
inline void Engine::setEQPos(uint32_t _eqPos) {
310+
inline void Engine::setEQPos(uint32_t eqPosition) {
309311
peq->clear_state_f();
310-
eqPos = _eqPos;
312+
eqPos = eqPosition;
313+
_eqPos.store(eqPos, std::memory_order_release);
311314
}
312315

313316
inline void Engine::setModel(NeuralModelLoader *slot,
@@ -463,7 +466,8 @@ inline void Engine::processDsp(uint32_t n_samples, float* output, float* output1
463466
ngate->compute(n_samples, output);
464467

465468
// run eq
466-
if (eqOnOff && eqPos == 0) processEQ(n_samples, output);
469+
if (eqOnOff && (_eqPos.load(std::memory_order_acquire) == 0))
470+
processEQ(n_samples, output);
467471

468472
// process input volume slot A
469473
if (_neuralA.load(std::memory_order_acquire)) {
@@ -490,7 +494,8 @@ inline void Engine::processDsp(uint32_t n_samples, float* output, float* output1
490494
}
491495

492496
// run eq
493-
if (eqOnOff && eqPos == 1) processEQ(n_samples, output);
497+
if (eqOnOff && (_eqPos.load(std::memory_order_acquire) == 1))
498+
processEQ(n_samples, output);
494499

495500
if ((buffered == 1.0) && bufferIsInit.load(std::memory_order_acquire)) {
496501
// avoid buffer overflow on frame size change
@@ -529,7 +534,8 @@ inline void Engine::processDsp(uint32_t n_samples, float* output, float* output1
529534
}
530535

531536
// run eq
532-
if (eqOnOff && eqPos == 2) processEQ(n_samples, output);
537+
if (eqOnOff && (_eqPos.load(std::memory_order_acquire) == 2))
538+
processEQ(n_samples, output);
533539

534540
// run dcblocker
535541
dcb->compute(n_samples, output, output);

NeuralRack/gui/SizeGroup.h

Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@
77
* Copyright (C) 2026 brummer <brummer@web.de>
88
*/
99

10+
/****************************************************************
11+
SizeGroup.h - a vertical animated size group
12+
with drag and drop support for libxputty
13+
****************************************************************/
14+
1015

1116
#pragma once
1217
#include "xwidgets.h"
@@ -73,16 +78,18 @@ static inline void vsg_destroy(VerticalSizeGroup* g) {
7378

7479
static inline void vsg_init(VerticalSizeGroup* g,
7580
Widget_t* parent,int sx,int sy,int spacingY,int* glowY) {
76-
memset(g,0,sizeof(*g));
77-
g->parent = parent;
78-
g->startX = sx;
79-
g->startY = sy;
80-
g->spacingY = spacingY;
81-
g->glowY = glowY;
82-
g->animateOnAdd = 1;
83-
g->newIndex = 1;
81+
memset(g,0,sizeof(*g)); // clear the SizeGroup
82+
g->parent = parent; // the parent window
83+
g->startX = sx; // the upper left corner
84+
g->startY = sy; // the upper vertical point
85+
g->spacingY = spacingY; // spacing behind elements
86+
g->glowY = glowY; // drop indicator
87+
g->animateOnAdd = 1; // switch animation on/off
88+
g->newIndex = 1; // the drop index
89+
g->wmy = sy; // the current position from a dragged window
8490
}
8591

92+
// call from a GUI timeout loop (60fps)
8693
static inline void vsg_update(VerticalSizeGroup* g,float dt) {
8794
if (!g->tweensActive) return;
8895
Display* dpy = g->parent->app->dpy;
@@ -92,7 +99,7 @@ static inline void vsg_update(VerticalSizeGroup* g,float dt) {
9299
VSTween* t = &g->tweens[i];
93100
if (t->t>=1) continue;
94101

95-
t->t += dt*12.0f;
102+
t->t += dt/0.083335f; // 60fps
96103
if (t->t>1) t->t=1;
97104

98105
float s = t->t*t->t*(3-2*t->t);
@@ -103,6 +110,7 @@ static inline void vsg_update(VerticalSizeGroup* g,float dt) {
103110
g->tweensActive = active;
104111
}
105112

113+
// prepare entries for animation/ positioning
106114
static inline void vsg_relayout(VerticalSizeGroup* g) {
107115
Display* dpy = g->parent->app->dpy;
108116
g->tweenCount = 0;
@@ -138,6 +146,7 @@ static inline void vsg_relayout(VerticalSizeGroup* g) {
138146
}
139147
}
140148

149+
// add element to the size-group
141150
static inline void vsg_add(VerticalSizeGroup* g,Widget_t* w) {
142151
if (g->entryCount+1 > g->entryCap) {
143152
g->entryCap = g->entryCap ? g->entryCap*2 : 8;
@@ -148,8 +157,8 @@ static inline void vsg_add(VerticalSizeGroup* g,Widget_t* w) {
148157
vsg_relayout(g);
149158
}
150159

160+
// find index of a element in the size-group
151161
static inline int vsg_findDragIndex(VerticalSizeGroup* g, Widget_t* w) {
152-
/* find current index */
153162
for (int i=0;i<g->entryCount;i++) {
154163
if (g->entries[i] == w) {
155164
g->oldIndex = i;
@@ -159,6 +168,7 @@ static inline int vsg_findDragIndex(VerticalSizeGroup* g, Widget_t* w) {
159168
return -1;
160169
}
161170

171+
// find new index of a moved element
162172
static inline int vsg_findDropIndex(VerticalSizeGroup* g) {
163173
int best = 0;
164174
int bestDist = 1e9;
@@ -180,12 +190,14 @@ static inline int vsg_findDropIndex(VerticalSizeGroup* g) {
180190
return best;
181191
}
182192

193+
// register a element for dragging
183194
static inline void vsg_beginDrag(VerticalSizeGroup* g,Widget_t* w,int my) {
184195
g->dragWidget = w;
185196
g->dragOffsetY = my;
186197
os_raise_widget(w);
187198
}
188199

200+
// while move the element
189201
static inline void vsg_dragMove(VerticalSizeGroup* g,int my) {
190202
if (!g->dragWidget) return;
191203

@@ -195,7 +207,7 @@ static inline void vsg_dragMove(VerticalSizeGroup* g,int my) {
195207
g->dragWidget->scale.init_x,
196208
g->wmy);
197209

198-
/* find current index */
210+
// find current index
199211
for (int i=0;i<g->entryCount;i++) {
200212
if (g->entries[i] == g->dragWidget) {
201213
g->oldIndex = i;
@@ -208,7 +220,7 @@ static inline void vsg_dragMove(VerticalSizeGroup* g,int my) {
208220
expose_widget(g->parent);
209221
}
210222

211-
223+
// insert dropped element in size-group at new index
212224
static inline void vsg_endDrag(VerticalSizeGroup* g) {
213225
if (!g->dragWidget) return;
214226

@@ -230,5 +242,4 @@ static inline void vsg_endDrag(VerticalSizeGroup* g) {
230242
g->dragWidget = NULL;
231243
*g->glowY = -1;
232244
expose_widget(g->parent);
233-
//fprintf(stderr, "newIndex %i\n", g->newIndex);
234245
}

NeuralRack/lv2/NeuralRack.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -667,6 +667,7 @@ LV2_State_Status Xneuralrack::restore_state(LV2_Handle instance,
667667
if (value) {
668668
if (*((int *)value) != self->engine.eqPos) {
669669
self->engine.eqPos = *((int *)value);
670+
self->engine.setEQPos(self->engine.eqPos);
670671
self->write_set_eqpos(&self->forge, self->xlv2_eq_pos, self->engine.eqPos);
671672
}
672673
}

NeuralRack/makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ ifeq (,$(filter vst2,$(MAKECMDGOALS)))
248248
INFOSTRING += support
249249
$(info $(yellow) INFO: $(reset)Stand-alone $(blue)$(INFOSTRING)$(reset))
250250
else
251-
$(info $(yellow) INFO: $(reset)Stand-alone $(red)not supported$(reset))
251+
$(info $(yellow) INFO: $(reset)Stand-alone $(red)skipped - libjack-dev and portaudio19-dev missing$(reset))
252252
endif
253253
endif
254254
endif

0 commit comments

Comments
 (0)