Skip to content

Commit 6b35b75

Browse files
authored
Merge pull request #191 from theAeon/dspsys_typedef
port to gcc 14
2 parents dd5ae3c + 4a53af2 commit 6b35b75

File tree

8 files changed

+50
-23
lines changed

8 files changed

+50
-23
lines changed

libjamesdsp/JdspImpResToolbox.c

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -252,10 +252,26 @@ static void decompressResamplerMQ(const double y[701], float *yi)
252252
yi[k] = xloc * (xloc * (xloc * coefs[low_i] + coefs[low_i + 700]) + coefs[low_i + 1400]) + coefs[low_i + 2100];
253253
}
254254
}
255-
255+
void jds_reverse(float *arr, int32_t start, int32_t end) {
256+
while (start < end)
257+
{
258+
float tmp = arr[start];
259+
arr[start] = arr[end];
260+
arr[end] = tmp;
261+
start++;
262+
end--;
263+
}
264+
}
265+
void jds_shift(float *arr, int32_t k, int32_t n)
266+
{
267+
k = k % n;
268+
jds_reverse(arr, 0, n - 1);
269+
jds_reverse(arr, 0, n - k - 1);
270+
jds_reverse(arr, n - k, n - 1);
271+
}
256272
void circshift(float *x, int n, int k)
257273
{
258-
k < 0 ? shift(x, -k, n) : shift(x, n - k, n);
274+
k < 0 ? jds_shift(x, -k, n) : jds_shift(x, n - k, n);
259275
}
260276
#define NUMPTS 15
261277
#define NUMPTS_DRS (7)
@@ -303,10 +319,11 @@ float* loadAudioFile(const char *filename, double targetFs, unsigned int *channe
303319
unsigned int fs = 1;
304320
const char *ext = get_filename_ext(filename);
305321
float *pSampleData = 0;
322+
drflac_uintptr *totalPCMFrameFlac = (drflac_uintptr *) totalPCMFrameCount;
306323
if (!strncmp(ext, "wav", 5) || !strncmp(ext, "irs", 5))
307324
pSampleData = drwav_open_file_and_read_pcm_frames_f32(filename, channels, &fs, totalPCMFrameCount, 0);
308325
if (!strncmp(ext, "flac", 5))
309-
pSampleData = drflac_open_file_and_read_pcm_frames_f32(filename, channels, &fs, totalPCMFrameCount, 0);
326+
pSampleData = drflac_open_file_and_read_pcm_frames_f32(filename, channels, &fs, totalPCMFrameFlac, 0);
310327
/*if (!strncmp(ext, "mp3", 5))
311328
{
312329
drmp3_config mp3Conf;

libjamesdsp/JdspImpResToolbox.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#ifndef JDSPIMPRESTOOLBOX_H
22
#define JDSPIMPRESTOOLBOX_H
3-
43
extern float* ReadImpulseResponseToFloat(const char* mIRFileName, int targetSampleRate, int* jImpInfo, int convMode, int* javaAdvSetPtr);
54
extern int ComputeEqResponse(const double* jfreq, double* jgain, int interpolationMode, int queryPts, double* dispFreq, float* response);
65
extern int ComputeCompResponse(int n, const double* jfreq, const double* jgain, int queryPts, const double* dispFreq, float* response);

libjamesdsp/PrintfStdOutExtension.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#include "PrintfStdOutExtension.h"
22
#include <stdarg.h>
3+
#include <stdio.h>
4+
#include <stdlib.h>
35

46
static stdOutHandler _printfStdOutHandlerPtr = 0;
57
static void* _printfStdOutHandlerUserPtr = 0;
@@ -23,7 +25,7 @@ int redirected_printf(const char * format, ...) {
2325
return result;
2426
}
2527

26-
void __android_log_print(int severity, const char* tag, const char* msg) {
28+
void __android_log_print(int severity, const char* tag, const char* msg, ...) {
2729
char *s;
2830
if (asprintf(&s, "%s: %s", tag, msg) > 0 && s != 0)
2931
{

libjamesdsp/PrintfStdOutExtension.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,10 @@ typedef void (*stdOutHandler)(const char*, void*);
66

77
extern void setPrintfStdOutHandler(stdOutHandler funcPtr, void* userData);
88
extern int isPrintfStdOutHandlerSet();
9+
extern void __android_log_print(int severity, const char* tag, const char* msg, ...)
10+
#if defined(__GNUC__)
11+
__attribute__ ((format(printf, 3, 4)))
12+
#endif
13+
;
914

1015
#endif // EELSTDOUTEXTENSION_H

libjamesdsp/subtree/Main/libjamesdsp/jni/jamesdsp/jdsp/Effects/eel2/nseel-compiler.c

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1378,21 +1378,21 @@ static float NSEEL_CGEN_CALL arburgPredictForward(float *blocks, float *start)
13781378
}
13791379
void reverse(float *arr, int32_t start, int32_t end)
13801380
{
1381-
while (start < end)
1382-
{
1383-
float tmp = arr[start];
1384-
arr[start] = arr[end];
1385-
arr[end] = tmp;
1386-
start++;
1387-
end--;
1388-
}
1381+
while (start < end)
1382+
{
1383+
float tmp = arr[start];
1384+
arr[start] = arr[end];
1385+
arr[end] = tmp;
1386+
start++;
1387+
end--;
1388+
}
13891389
}
13901390
void shift(float *arr, int32_t k, int32_t n)
13911391
{
1392-
k = k % n;
1393-
reverse(arr, 0, n - 1);
1394-
reverse(arr, 0, n - k - 1);
1395-
reverse(arr, n - k, n - 1);
1392+
k = k % n;
1393+
reverse(arr, 0, n - 1);
1394+
reverse(arr, 0, n - k - 1);
1395+
reverse(arr, n - k, n - 1);
13961396
}
13971397
float * NSEEL_CGEN_CALL __NSEEL_circshift(float *blocks, float *offptr, float *shiftptr, float *lenptr)
13981398
{
@@ -1646,7 +1646,7 @@ static float NSEEL_CGEN_CALL eel_mean(float *blocks, float *start, float *lengt
16461646
---------------------------------------------------------------------------*/
16471647
float kth_smallest(float a[], int n, int k)
16481648
{
1649-
register i, j, l, m;
1649+
register int i, j, l, m;
16501650
register float x;
16511651

16521652
l = 0; m = n - 1;
@@ -3855,7 +3855,7 @@ static float NSEEL_CGEN_CALL _eel_flacDecodeFile(void *opaque, INT_PTR num_param
38553855
float *blocks = c->ram_state;
38563856
const char *filename = (const char*)GetStringForIndex(c->region_context, *parms[0], 0);
38573857
uint32_t channels, fs;
3858-
uint64_t frameCount;
3858+
drflac_uintptr frameCount;
38593859
float *signal = drflac_open_file_and_read_pcm_frames_f32(filename, &channels, &fs, &frameCount, 0);
38603860
float targetFs = *parms[2];
38613861
if (targetFs > FLT_EPSILON)
@@ -3917,7 +3917,7 @@ static float NSEEL_CGEN_CALL _eel_flacDecodeMemory(void *opaque, INT_PTR num_par
39173917
size_t actualSize;
39183918
unsigned char *memoryBlk = base64_decode((const unsigned char*)base64String, strlen(base64String), &actualSize);
39193919
uint32_t channels, fs;
3920-
uint64_t frameCount;
3920+
drflac_uintptr frameCount;
39213921
float *signal = drflac_open_memory_and_read_pcm_frames_f32(memoryBlk, actualSize, &channels, &fs, &frameCount, 0);
39223922
float targetFs = *parms[2];
39233923
if (targetFs > FLT_EPSILON)
@@ -8185,4 +8185,4 @@ opcodeRec *nseel_translate(compileContext *ctx, const char *tmp, size_t tmplen)
81858185
return nseel_createCompiledValue(ctx, (float)rv);
81868186
}
81878187
return nseel_createCompiledValue(ctx, (float)atof(tmp));
8188-
}
8188+
}

libjamesdsp/subtree/Main/libjamesdsp/jni/jamesdsp/jdsp/Effects/liveprogWrapper.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
void NSEEL_HOSTSTUB_EnterMutex() { }
22
void NSEEL_HOSTSTUB_LeaveMutex() { }
3+
#include <math.h>
34
#include "../jdsp_header.h"
45
void LiveProgConstructor(JamesDSPLib *jdsp)
56
{

libjamesdsp/subtree/Main/libjamesdsp/jni/jamesdsp/jdsp/jdspController.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,14 @@
33
#include <string.h>
44
#include <math.h>
55
#include <time.h>
6+
#include <sys/time.h>
67
#include <float.h>
8+
#include <unistd.h>
79
#include "Effects/eel2/dr_flac.h"
810
#include "Effects/eel2/ns-eel.h"
911
#include "jdsp_header.h"
1012
#define TAG "EffectDSPMain"
13+
#include "PrintfStdOutExtension.h"
1114

1215
#ifdef __ANDROID_API__
1316
#if __ANDROID_API__ < __ANDROID_API_J_MR2__
@@ -1259,4 +1262,4 @@ void JamesDSPFree(JamesDSPLib *jdsp)
12591262
FreeIntegerASRCHandler(&jdsp->asrc[1]);
12601263
}
12611264
jdsp_unlock(jdsp);
1262-
}
1265+
}

libjamesdsp/subtree/Main/libjamesdsp/jni/jamesdsp/jdsp/jdsp_header.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -440,6 +440,7 @@ int BS2BCalculateflevel(unsigned int fcut, unsigned int gain);
440440
void BS2BInit(t_bs2bdp *bs2bdp, unsigned int samplerate, int flevel);
441441
/* sample poits to double floats native endians */
442442
void BS2BProcess(t_bs2bdp *bs2bdp, double *sampleL, double *sampleR);
443+
typedef struct dspsys dspsys;
443444
typedef struct
444445
{
445446
int mode; // 0: BS2B Lv 1, 1: BS2B Lv 2, 2: HRTF crossfeed, 2: HRTF surround 1, 2: HRTF surround 2, 2: HRTF surround 3
@@ -449,7 +450,6 @@ typedef struct
449450
FFTConvolver2x4x2 *convLong_S_S;
450451
void(*process)(struct dspsys *, size_t);
451452
} Crossfeed;
452-
typedef struct dspsys dspsys;
453453
typedef struct
454454
{
455455
FFTConvolver2x2 *conv1d2x2_S_S;

0 commit comments

Comments
 (0)