Skip to content

Commit a79323d

Browse files
committed
refactor: adapt libjamesdsp upstream updates
1 parent 43d3135 commit a79323d

File tree

3 files changed

+11
-33
lines changed

3 files changed

+11
-33
lines changed

libjamesdsp/libjamesdsp.pro

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ QMAKE_CFLAGS += -std=gnu11 -O2
1010

1111
CONFIG += warn_off # Disable warnings for library
1212

13+
DEBUG_ASAN: CONFIG += sanitizer sanitize_address
14+
1315
# Enable liveprog logging redirection
1416
DEFINES += CUSTOM_CMD
1517

src/audio/base/DspHost.cpp

Lines changed: 8 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -26,33 +26,6 @@ extern "C" {
2626
inline JamesDSPLib* cast(void* raw){
2727
return static_cast<JamesDSPLib*>(raw);
2828
}
29-
inline int32_t arySearch(int32_t *array, int32_t N, int32_t x)
30-
{
31-
for (int32_t i = 0; i < N; i++)
32-
{
33-
if (array[i] == x)
34-
return i;
35-
}
36-
return -1;
37-
}
38-
#define FLOIDX 20000
39-
inline void* GetStringForIndex(eel_string_context_state *st, float val, int32_t write)
40-
{
41-
int32_t castedValue = (int32_t)(val + 0.5f);
42-
if (castedValue < FLOIDX)
43-
return 0;
44-
int32_t idx = arySearch(st->map, st->slot, castedValue);
45-
if (idx < 0)
46-
return 0;
47-
if (!write)
48-
{
49-
s_str *tmp = &st->m_literal_strings[idx];
50-
const char *s = s_str_c_str(tmp);
51-
return (void*)s;
52-
}
53-
else
54-
return (void*)&st->m_literal_strings[idx];
55-
}
5629

5730
DspHost::DspHost(void* dspPtr, MessageHandlerFunc&& extraHandler) : _extraFunc(std::move(extraHandler))
5831
{
@@ -746,16 +719,17 @@ std::vector<EelVariable> DspHost::enumEelVariables()
746719
for (int j = 0; j < NSEEL_VARS_PER_BLOCK; j++)
747720
{
748721
EelVariable var;
749-
char *valid = (char*)GetStringForIndex(ctx->m_string_context, ctx->varTable_Values[i][j], 0);
750-
var.isString = valid;
722+
// char *valid = (char*)GetStringForIndex(ctx->region_context, ctx->varTable_Values[i][j], 0);
723+
// TODO fix string handling (broke after last libjamesdsp update)
724+
var.isString = false; // = valid;
751725

752726
if (ctx->varTable_Names[i][j])
753727
{
754728
var.name = ctx->varTable_Names[i][j];
755-
if(var.isString)
729+
/*if(var.isString)
756730
var.value = valid;
757-
else
758-
var.value = ctx->varTable_Values[i][j];
731+
else*/
732+
var.value = ctx->varTable_Values[i][j];
759733

760734
vars.push_back(var);
761735
}
@@ -777,7 +751,8 @@ bool DspHost::manipulateEelVariable(const char* name, float value)
777751
continue;
778752
}
779753

780-
char *validString = (char*)GetStringForIndex(ctx->m_string_context, ctx->varTable_Values[i][j], 0);
754+
// TODO fix string handling & detection
755+
char *validString = nullptr;//(char*)GetStringForIndex(ctx->region_context, ctx->varTable_Values[i][j], 1);
781756
if(validString)
782757
{
783758
Log::error(QString("variable '%1' is a string; currently only numerical variables can be manipulated").arg(name));

src/src.pro

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ TEMPLATE = app
1313

1414
UI_DEBUG: DEFINES += UI_DEBUG
1515
DEBUG_FPE: DEFINES += DEBUG_FPE
16+
DEBUG_ASAN: CONFIG += sanitizer sanitize_address
1617
USE_PULSEAUDIO: DEFINES += USE_PULSEAUDIO
1718
USE_PORTALS: DEFINES += USE_PORTALS
1819
NO_CRASH_HANDLER: DEFINES += NO_CRASH_HANDLER

0 commit comments

Comments
 (0)