Skip to content

Commit 2edc449

Browse files
committed
feat: implement new libjamesdsp features & fix bugs
1. Compander: support for time-frequency transforms parameter 2. Stereo widener: fixed broken audio when enaling without setting strength 3. Convolver benchmarking: Add setting to disable benchmarks on boot (Pipewire only)
1 parent 8c3169a commit 2edc449

File tree

10 files changed

+136
-15
lines changed

10 files changed

+136
-15
lines changed

libjamesdsp/libjamesdsp.pro

Lines changed: 57 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,21 @@ HEADERS += \
5757
$$BASEPATH/jdsp_header.h \
5858
EELStdOutExtension.h \
5959
PrintfStdOutExtension.h \
60-
JdspImpResToolbox.h
60+
JdspImpResToolbox.h \
61+
subtree/Main/libjamesdsp/jni/jamesdsp/jdsp/Effects/eel2/numericSys/HPFloat/cxpre.h \
62+
subtree/Main/libjamesdsp/jni/jamesdsp/jdsp/Effects/eel2/numericSys/HPFloat/cxxsrc/xcomplex.h \
63+
subtree/Main/libjamesdsp/jni/jamesdsp/jdsp/Effects/eel2/numericSys/HPFloat/cxxsrc/xreal.h \
64+
subtree/Main/libjamesdsp/jni/jamesdsp/jdsp/Effects/eel2/numericSys/HPFloat/doc/xcomplex.h \
65+
subtree/Main/libjamesdsp/jni/jamesdsp/jdsp/Effects/eel2/numericSys/HPFloat/doc/xreal.h \
66+
subtree/Main/libjamesdsp/jni/jamesdsp/jdsp/Effects/eel2/numericSys/HPFloat/hpaconf.h \
67+
subtree/Main/libjamesdsp/jni/jamesdsp/jdsp/Effects/eel2/numericSys/HPFloat/mp/const07.h \
68+
subtree/Main/libjamesdsp/jni/jamesdsp/jdsp/Effects/eel2/numericSys/HPFloat/mp/const11.h \
69+
subtree/Main/libjamesdsp/jni/jamesdsp/jdsp/Effects/eel2/numericSys/HPFloat/mp/const15.h \
70+
subtree/Main/libjamesdsp/jni/jamesdsp/jdsp/Effects/eel2/numericSys/HPFloat/mp/const19.h \
71+
subtree/Main/libjamesdsp/jni/jamesdsp/jdsp/Effects/eel2/numericSys/HPFloat/mp/const23.h \
72+
subtree/Main/libjamesdsp/jni/jamesdsp/jdsp/Effects/eel2/numericSys/HPFloat/mp/const27.h \
73+
subtree/Main/libjamesdsp/jni/jamesdsp/jdsp/Effects/eel2/numericSys/HPFloat/mp/const31.h \
74+
subtree/Main/libjamesdsp/jni/jamesdsp/jdsp/Effects/eel2/numericSys/HPFloat/xpre.h
6175

6276
SOURCES += \
6377
$$BASEPATH/Effects/arbEqConv.c \
@@ -107,6 +121,45 @@ SOURCES += \
107121
EELStdOutExtension.c \
108122
PrintfStdOutExtension.c \
109123
JdspImpResToolbox.c \
124+
subtree/Main/libjamesdsp/jni/jamesdsp/jdsp/Effects/eel2/loose_eel.c \
125+
subtree/Main/libjamesdsp/jni/jamesdsp/jdsp/Effects/eel2/numericSys/HPFloat/atox.c \
126+
subtree/Main/libjamesdsp/jni/jamesdsp/jdsp/Effects/eel2/numericSys/HPFloat/constant.c \
127+
subtree/Main/libjamesdsp/jni/jamesdsp/jdsp/Effects/eel2/numericSys/HPFloat/cxaop.c \
128+
subtree/Main/libjamesdsp/jni/jamesdsp/jdsp/Effects/eel2/numericSys/HPFloat/cxbasic.c \
129+
subtree/Main/libjamesdsp/jni/jamesdsp/jdsp/Effects/eel2/numericSys/HPFloat/cxconstant.c \
130+
subtree/Main/libjamesdsp/jni/jamesdsp/jdsp/Effects/eel2/numericSys/HPFloat/cxconvf.c \
131+
subtree/Main/libjamesdsp/jni/jamesdsp/jdsp/Effects/eel2/numericSys/HPFloat/cxexp.c \
132+
subtree/Main/libjamesdsp/jni/jamesdsp/jdsp/Effects/eel2/numericSys/HPFloat/cxhypb.c \
133+
subtree/Main/libjamesdsp/jni/jamesdsp/jdsp/Effects/eel2/numericSys/HPFloat/cxidiv.c \
134+
subtree/Main/libjamesdsp/jni/jamesdsp/jdsp/Effects/eel2/numericSys/HPFloat/cxpow.c \
135+
subtree/Main/libjamesdsp/jni/jamesdsp/jdsp/Effects/eel2/numericSys/HPFloat/cxprcmp.c \
136+
subtree/Main/libjamesdsp/jni/jamesdsp/jdsp/Effects/eel2/numericSys/HPFloat/cxtrig.c \
137+
subtree/Main/libjamesdsp/jni/jamesdsp/jdsp/Effects/eel2/numericSys/HPFloat/hpaconf.c \
138+
subtree/Main/libjamesdsp/jni/jamesdsp/jdsp/Effects/eel2/numericSys/HPFloat/prcxpr.c \
139+
subtree/Main/libjamesdsp/jni/jamesdsp/jdsp/Effects/eel2/numericSys/HPFloat/print.c \
140+
subtree/Main/libjamesdsp/jni/jamesdsp/jdsp/Effects/eel2/numericSys/HPFloat/prxpr.c \
141+
subtree/Main/libjamesdsp/jni/jamesdsp/jdsp/Effects/eel2/numericSys/HPFloat/sfmod.c \
142+
subtree/Main/libjamesdsp/jni/jamesdsp/jdsp/Effects/eel2/numericSys/HPFloat/shift.c \
143+
subtree/Main/libjamesdsp/jni/jamesdsp/jdsp/Effects/eel2/numericSys/HPFloat/xadd.c \
144+
subtree/Main/libjamesdsp/jni/jamesdsp/jdsp/Effects/eel2/numericSys/HPFloat/xchcof.c \
145+
subtree/Main/libjamesdsp/jni/jamesdsp/jdsp/Effects/eel2/numericSys/HPFloat/xdiv.c \
146+
subtree/Main/libjamesdsp/jni/jamesdsp/jdsp/Effects/eel2/numericSys/HPFloat/xevtch.c \
147+
subtree/Main/libjamesdsp/jni/jamesdsp/jdsp/Effects/eel2/numericSys/HPFloat/xexp.c \
148+
subtree/Main/libjamesdsp/jni/jamesdsp/jdsp/Effects/eel2/numericSys/HPFloat/xfmod.c \
149+
subtree/Main/libjamesdsp/jni/jamesdsp/jdsp/Effects/eel2/numericSys/HPFloat/xfrac.c \
150+
subtree/Main/libjamesdsp/jni/jamesdsp/jdsp/Effects/eel2/numericSys/HPFloat/xhypb.c \
151+
subtree/Main/libjamesdsp/jni/jamesdsp/jdsp/Effects/eel2/numericSys/HPFloat/xivhypb.c \
152+
subtree/Main/libjamesdsp/jni/jamesdsp/jdsp/Effects/eel2/numericSys/HPFloat/xivtrg.c \
153+
subtree/Main/libjamesdsp/jni/jamesdsp/jdsp/Effects/eel2/numericSys/HPFloat/xlog.c \
154+
subtree/Main/libjamesdsp/jni/jamesdsp/jdsp/Effects/eel2/numericSys/HPFloat/xmul.c \
155+
subtree/Main/libjamesdsp/jni/jamesdsp/jdsp/Effects/eel2/numericSys/HPFloat/xneg.c \
156+
subtree/Main/libjamesdsp/jni/jamesdsp/jdsp/Effects/eel2/numericSys/HPFloat/xprcmp.c \
157+
subtree/Main/libjamesdsp/jni/jamesdsp/jdsp/Effects/eel2/numericSys/HPFloat/xpwr.c \
158+
subtree/Main/libjamesdsp/jni/jamesdsp/jdsp/Effects/eel2/numericSys/HPFloat/xsigerr.c \
159+
subtree/Main/libjamesdsp/jni/jamesdsp/jdsp/Effects/eel2/numericSys/HPFloat/xsqrt.c \
160+
subtree/Main/libjamesdsp/jni/jamesdsp/jdsp/Effects/eel2/numericSys/HPFloat/xtodbl.c \
161+
subtree/Main/libjamesdsp/jni/jamesdsp/jdsp/Effects/eel2/numericSys/HPFloat/xtoflt.c \
162+
subtree/Main/libjamesdsp/jni/jamesdsp/jdsp/Effects/eel2/numericSys/HPFloat/xtrig.c \
110163
subtree/Main/libjamesdsp/jni/jamesdsp/jdsp/Effects/multimodalEQ.c
111164

112165
unix {
@@ -120,3 +173,6 @@ unix {
120173
else: error("Static linking only available on Linux systems")
121174

122175
!isEmpty(target.path): INSTALLS += target
176+
177+
DISTFILES += \
178+
subtree/Main/libjamesdsp/jni/jamesdsp/jdsp/Effects/eel2/numericSys/HPFloat/doc/hpa.txt

src/MainWindow.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -137,11 +137,6 @@ MainWindow::MainWindow(bool statupInTray,
137137
// GraphicEQ
138138
ui->graphicEq->setEnableSwitchVisible(true);
139139
ui->graphicEq->setAutoEqAvailable(true);
140-
141-
// Compander
142-
// TODO remove this once the option is actually implemented in libjamesdsp
143-
ui->label_5->setVisible(false);
144-
ui->comp_tf_transforms->setVisible(false);
145140
}
146141

147142
// Allocate pointers and init important variables

src/audio/base/DspHost.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -556,6 +556,7 @@ bool DspHost::update(DspConfig *config, bool ignoreCache)
556556
StereoEnhancementEnable(cast(this->_dsp));
557557
else
558558
StereoEnhancementDisable(cast(this->_dsp));
559+
StereoEnhancementSetParam(cast(this->_dsp), _cache->get<float>(DspConfig::stereowide_level) / 100.0f);
559560
break;
560561
case DspConfig::stereowide_level:
561562
StereoEnhancementDisable(cast(this->_dsp));

src/audio/pipewire/PwJamesDspPlugin.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#include "PwJamesDspPlugin.h"
22
#include <QString>
33

4+
#include "config/AppConfig.h"
5+
46
extern "C" {
57
#ifdef DEBUG_FPE
68
#include <fenv.h>
@@ -27,7 +29,7 @@ PwJamesDspPlugin::PwJamesDspPlugin(PwPipelineManager* pipe_manager, IAudioServic
2729
#ifdef DEBUG_FPE
2830
feenableexcept(FE_ALL_EXCEPT & ~FE_INEXACT & ~FE_INVALID);
2931
#endif
30-
JamesDSPGlobalMemoryAllocation();
32+
JamesDSPGlobalMemoryAllocation((int)AppConfig::instance().get<bool>(AppConfig::BenchmarkOnBoot));
3133
JamesDSPInit(this->dsp, 128, 48000);
3234
#ifdef DEBUG_FPE
3335
fedisableexcept(FE_ALL_EXCEPT & ~FE_INEXACT & ~FE_INVALID);

src/audio/pulseaudio/wrapper/gstjamesdsp.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,8 @@ gst_jamesdsp_init(Gstjamesdsp *self) {
112112
self->dsp = malloc(sizeof(JamesDSPLib));
113113
memset(self->dsp, 0, sizeof(JamesDSPLib));
114114

115-
JamesDSPGlobalMemoryAllocation();
115+
// TODO: Add benchmark toggle support to pulse version...
116+
JamesDSPGlobalMemoryAllocation(0);
116117
JamesDSPInit(self->dsp, 128, 48000);
117118

118119
self->enable = FALSE;

src/config/AppConfig.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ AppConfig::AppConfig()
4343
DEFINE_KEY(AudioAppBlocklistInvert, false);
4444
DEFINE_KEY(AudioInactivityTimeout, 10);
4545

46+
DEFINE_KEY(BenchmarkOnBoot, true);
47+
4648
DEFINE_KEY(AeqPlotDarkMode, false);
4749

4850
DEFINE_KEY(ConvolverDefaultPath, ENCLOSE_QUOTES(getPath("irs")));

src/config/AppConfig.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@ class AppConfig :
6767
AudioAppBlocklistInvert,
6868
AudioInactivityTimeout,
6969

70+
BenchmarkOnBoot,
71+
7072
AeqPlotDarkMode,
7173

7274
ConvolverDefaultPath,

src/interface/fragment/SettingsFragment.cpp

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,10 @@ SettingsFragment::SettingsFragment(TrayIcon *trayIcon,
4141
ui->setupUi(this);
4242

4343
#ifdef USE_PULSEAUDIO
44-
ui->selector->topLevelItem(2)->setHidden(true); // Hide devices
44+
ui->selector->topLevelItem(3)->setHidden(true); // Hide devices
4545
ui->devices->setVisible(false);
4646
ui->blocklistBox->setVisible(false);
47+
ui->benchmarkOnBoot->setEnabled(false);
4748
#endif
4849

4950
_paletteEditor->setFixedSize(_paletteEditor->geometry().width(), _paletteEditor->geometry().height());
@@ -54,7 +55,7 @@ SettingsFragment::SettingsFragment(TrayIcon *trayIcon,
5455
ui->selector->setCurrentItem(ui->selector->topLevelItem(0));
5556
ui->stackedWidget->setCurrentIndex(0);
5657
ui->stackedWidget->repaint();
57-
ui->selector->expandItem(ui->selector->topLevelItem(4)); // Expand tray-icon
58+
ui->selector->expandItem(ui->selector->topLevelItem(5)); // Expand tray-icon
5859
connect(ui->selector, &QTreeWidget::currentItemChanged, this, &SettingsFragment::onTreeItemSelected);
5960

6061
/*
@@ -86,14 +87,19 @@ SettingsFragment::SettingsFragment(TrayIcon *trayIcon,
8687
connect(ui->menu_edit, &QMenuEditor::resetPressed, this, &SettingsFragment::onTrayEditorReset);
8788
ui->menu_edit->setSourceMenu(trayIcon->buildAvailableActions());
8889

89-
/*
90+
/*
9091
* Interface signals
91-
*/
92+
*/
9293
connect(ui->themeSelect, qOverload<int>(&QComboBox::currentIndexChanged), this, &SettingsFragment::onThemeSelected);
9394
connect(ui->paletteSelect, qOverload<int>(&QComboBox::currentIndexChanged), this, &SettingsFragment::onPaletteSelected);
9495
connect(ui->paletteConfig, &QPushButton::clicked, _paletteEditor, &PaletteEditor::show);
9596
connect(ui->eq_alwaysdrawhandles, &QCheckBox::clicked, this, &SettingsFragment::onEqualizerHandlesToggled);
9697

98+
/*
99+
* Audio processing
100+
*/
101+
connect(ui->benchmarkOnBoot, &QCheckBox::clicked, this, &SettingsFragment::onBenchmarkOnBootToggled);
102+
97103
/*
98104
* Paths signals
99105
*/
@@ -252,6 +258,8 @@ void SettingsFragment::refreshAll()
252258

253259
ui->eq_alwaysdrawhandles->setChecked(AppConfig::instance().get<bool>(AppConfig::EqualizerShowHandles));
254260

261+
ui->benchmarkOnBoot->setChecked(AppConfig::instance().get<bool>(AppConfig::BenchmarkOnBoot));
262+
255263
ui->blocklistInvert->blockSignals(true);
256264
ui->blocklistInvert->setChecked(AppConfig::instance().get<bool>(AppConfig::AudioAppBlocklistInvert));
257265
ui->blocklistInvert->blockSignals(false);
@@ -313,9 +321,9 @@ void SettingsFragment::onTreeItemSelected(QTreeWidgetItem *cur, QTreeWidgetItem
313321
switch (topLevelIndex)
314322
{
315323
case -1:
316-
if (ui->selector->indexOfTopLevelItem(cur->parent()) == 4 /* Tray-icon */)
324+
if (ui->selector->indexOfTopLevelItem(cur->parent()) == 5 /* Tray-icon */)
317325
{
318-
ui->stackedWidget->setCurrentIndex(5); // Context menu
326+
ui->stackedWidget->setCurrentIndex(6); // Context menu
319327
}
320328
break;
321329
default:
@@ -419,6 +427,11 @@ void SettingsFragment::onEqualizerHandlesToggled()
419427
AppConfig::instance().set(AppConfig::EqualizerShowHandles, ui->eq_alwaysdrawhandles->isChecked());
420428
}
421429

430+
void SettingsFragment::onBenchmarkOnBootToggled()
431+
{
432+
AppConfig::instance().set(AppConfig::BenchmarkOnBoot, ui->benchmarkOnBoot->isChecked());
433+
}
434+
422435
void SettingsFragment::onLiveprogAutoExtractToggled()
423436
{
424437
AppConfig::instance().set(AppConfig::LiveprogAutoExtract, ui->liveprog_autoextract->isChecked());

src/interface/fragment/SettingsFragment.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ private slots:
6666
void onTrayEditorCommitted();
6767
void onTrayEditorReset();
6868
void onEqualizerHandlesToggled();
69+
void onBenchmarkOnBootToggled();
6970
void onLiveprogAutoExtractToggled();
7071
void onGithubLinkClicked();
7172
void onAeqDatabaseManageClicked();

src/interface/fragment/SettingsFragment.ui

Lines changed: 49 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,11 @@
8888
<string>Interface</string>
8989
</property>
9090
</item>
91+
<item>
92+
<property name="text">
93+
<string>Audio processing</string>
94+
</property>
95+
</item>
9196
<item>
9297
<property name="text">
9398
<string>Default paths</string>
@@ -129,7 +134,7 @@
129134
<bool>true</bool>
130135
</property>
131136
<property name="currentIndex">
132-
<number>3</number>
137+
<number>1</number>
133138
</property>
134139
<widget class="QWidget" name="interface_2">
135140
<property name="maximumSize">
@@ -286,6 +291,49 @@
286291
</item>
287292
</layout>
288293
</widget>
294+
<widget class="QWidget" name="audioProcessing">
295+
<layout class="QVBoxLayout" name="verticalLayout_12">
296+
<item>
297+
<widget class="QGroupBox" name="groupBox_7">
298+
<property name="title">
299+
<string>Convolver benchmarking</string>
300+
</property>
301+
<layout class="QVBoxLayout" name="verticalLayout_10">
302+
<item>
303+
<widget class="QCheckBox" name="benchmarkOnBoot">
304+
<property name="text">
305+
<string>Enable benchmarking on boot</string>
306+
</property>
307+
</widget>
308+
</item>
309+
<item>
310+
<widget class="QLabel" name="label_8">
311+
<property name="text">
312+
<string>Optimizes convolver performance but causes temporarily increased CPU usage for about 1 minute after launch.</string>
313+
</property>
314+
<property name="wordWrap">
315+
<bool>true</bool>
316+
</property>
317+
</widget>
318+
</item>
319+
</layout>
320+
</widget>
321+
</item>
322+
<item>
323+
<spacer name="verticalSpacer_5">
324+
<property name="orientation">
325+
<enum>Qt::Vertical</enum>
326+
</property>
327+
<property name="sizeHint" stdset="0">
328+
<size>
329+
<width>20</width>
330+
<height>40</height>
331+
</size>
332+
</property>
333+
</spacer>
334+
</item>
335+
</layout>
336+
</widget>
289337
<widget class="QWidget" name="paths">
290338
<property name="autoFillBackground">
291339
<bool>true</bool>

0 commit comments

Comments
 (0)