mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-04 13:30:12 -05:00
fix compilation some more
The math M_*f symbols are GNU extensions.
This commit is contained in:
parent
69251948ee
commit
f7d59bcea7
10 changed files with 22 additions and 21 deletions
|
|
@ -16,7 +16,7 @@
|
||||||
|
|
||||||
#define DEFAULT_DEVICE "hw:0"
|
#define DEFAULT_DEVICE "hw:0"
|
||||||
|
|
||||||
#define M_PI_M2f (M_PIf + M_PIf)
|
#define M_PI_M2f (float)(M_PI+M_PI)
|
||||||
|
|
||||||
#define BW_PERIOD (SPA_NSEC_PER_SEC * 3)
|
#define BW_PERIOD (SPA_NSEC_PER_SEC * 3)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,11 +13,12 @@ extern "C" {
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
|
|
||||||
static inline void blackman_window(float *taps, int n_taps)
|
static inline void blackman_window(float *taps, int n_taps)
|
||||||
{
|
{
|
||||||
int n;
|
int n;
|
||||||
for (n = 0; n < n_taps; n++) {
|
for (n = 0; n < n_taps; n++) {
|
||||||
float w = 2.0f * M_PIf * n / (n_taps-1);
|
float w = 2.0f * (float)M_PI * n / (n_taps-1);
|
||||||
taps[n] = 0.3635819f - 0.4891775f * cosf(w)
|
taps[n] = 0.3635819f - 0.4891775f * cosf(w)
|
||||||
+ 0.1365995f * cosf(2 * w) - 0.0106411f * cosf(3 * w);
|
+ 0.1365995f * cosf(2 * w) - 0.0106411f * cosf(3 * w);
|
||||||
}
|
}
|
||||||
|
|
@ -33,7 +34,7 @@ static inline int hilbert_generate(float *taps, int n_taps)
|
||||||
for (i = 0; i < n_taps; i++) {
|
for (i = 0; i < n_taps; i++) {
|
||||||
int k = -(n_taps / 2) + i;
|
int k = -(n_taps / 2) + i;
|
||||||
if (k & 1) {
|
if (k & 1) {
|
||||||
float pk = M_PIf * k;
|
float pk = (float)M_PI * k;
|
||||||
taps[i] *= (1.0f - cosf(pk)) / pk;
|
taps[i] *= (1.0f - cosf(pk)) / pk;
|
||||||
} else {
|
} else {
|
||||||
taps[i] = 0.0f;
|
taps[i] = 0.0f;
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
#define M_PI_M2f ( M_PIf + M_PIf )
|
#define M_PI_M2f (float)(M_PI+M_PI)
|
||||||
|
|
||||||
#define DEFINE_SINE(type,scale) \
|
#define DEFINE_SINE(type,scale) \
|
||||||
static void \
|
static void \
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@
|
||||||
#include <pipewire/pipewire.h>
|
#include <pipewire/pipewire.h>
|
||||||
#include <pipewire/filter.h>
|
#include <pipewire/filter.h>
|
||||||
|
|
||||||
#define M_PI_M2f ( M_PIf + M_PIf )
|
#define M_PI_M2f (float)(M_PI+M_PI)
|
||||||
|
|
||||||
#define DEFAULT_RATE 44100
|
#define DEFAULT_RATE 44100
|
||||||
#define DEFAULT_FREQ 440
|
#define DEFAULT_FREQ 440
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@
|
||||||
|
|
||||||
#include <pipewire/pipewire.h>
|
#include <pipewire/pipewire.h>
|
||||||
|
|
||||||
#define M_PI_M2f ( M_PIf + M_PIf )
|
#define M_PI_M2f (float)(M_PI+M_PI)
|
||||||
|
|
||||||
#define DEFAULT_RATE 44100
|
#define DEFAULT_RATE 44100
|
||||||
#define DEFAULT_CHANNELS 2
|
#define DEFAULT_CHANNELS 2
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@
|
||||||
|
|
||||||
#include "sdl.h"
|
#include "sdl.h"
|
||||||
|
|
||||||
#define M_PI_M2f ( M_PIf + M_PIf )
|
#define M_PI_M2f (float)(M_PI+M_PI)
|
||||||
|
|
||||||
#define MAX_BUFFERS 64
|
#define MAX_BUFFERS 64
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@
|
||||||
|
|
||||||
#include <pipewire/pipewire.h>
|
#include <pipewire/pipewire.h>
|
||||||
|
|
||||||
#define M_PI_M2f ( M_PIf + M_PIf )
|
#define M_PI_M2f (float)(M_PI + M_PI)
|
||||||
|
|
||||||
#define BUFFER_SAMPLES 128
|
#define BUFFER_SAMPLES 128
|
||||||
#define MAX_BUFFERS 32
|
#define MAX_BUFFERS 32
|
||||||
|
|
|
||||||
|
|
@ -752,10 +752,10 @@ static float *create_hilbert(const char *filename, float gain, int delay, int of
|
||||||
if (samples == NULL)
|
if (samples == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
gain *= 2 / M_PIf;
|
gain *= 2 / (float)M_PI;
|
||||||
h = length / 2;
|
h = length / 2;
|
||||||
for (i = 1; i < h; i += 2) {
|
for (i = 1; i < h; i += 2) {
|
||||||
v = (gain / i) * (0.43f + 0.57f * cosf(i * M_PIf / h));
|
v = (gain / i) * (0.43f + 0.57f * cosf(i * (float)M_PI / h));
|
||||||
samples[delay + h + i] = -v;
|
samples[delay + h + i] = -v;
|
||||||
samples[delay + h - i] = v;
|
samples[delay + h - i] = v;
|
||||||
}
|
}
|
||||||
|
|
@ -1453,7 +1453,7 @@ static struct fc_port exp_ports[] = {
|
||||||
{ .index = 4,
|
{ .index = 4,
|
||||||
.name = "Base",
|
.name = "Base",
|
||||||
.flags = FC_PORT_INPUT | FC_PORT_CONTROL,
|
.flags = FC_PORT_INPUT | FC_PORT_CONTROL,
|
||||||
.def = M_Ef, .min = -10.0f, .max = 10.0f
|
.def = (float)M_E, .min = -10.0f, .max = 10.0f
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -1510,7 +1510,7 @@ static struct fc_port log_ports[] = {
|
||||||
{ .index = 4,
|
{ .index = 4,
|
||||||
.name = "Base",
|
.name = "Base",
|
||||||
.flags = FC_PORT_INPUT | FC_PORT_CONTROL,
|
.flags = FC_PORT_INPUT | FC_PORT_CONTROL,
|
||||||
.def = M_Ef, .min = 2.0f, .max = 100.0f
|
.def = (float)M_E, .min = 2.0f, .max = 100.0f
|
||||||
},
|
},
|
||||||
{ .index = 5,
|
{ .index = 5,
|
||||||
.name = "M1",
|
.name = "M1",
|
||||||
|
|
@ -1611,7 +1611,7 @@ static const struct fc_descriptor mult_desc = {
|
||||||
.cleanup = builtin_cleanup,
|
.cleanup = builtin_cleanup,
|
||||||
};
|
};
|
||||||
|
|
||||||
#define M_PI_M2f ( M_PIf + M_PIf )
|
#define M_PI_M2f (float)(M_PI+M_PI)
|
||||||
|
|
||||||
/* sine */
|
/* sine */
|
||||||
static void sine_run(void * Instance, unsigned long SampleCount)
|
static void sine_run(void * Instance, unsigned long SampleCount)
|
||||||
|
|
@ -1658,7 +1658,7 @@ static struct fc_port sine_ports[] = {
|
||||||
{ .index = 4,
|
{ .index = 4,
|
||||||
.name = "Phase",
|
.name = "Phase",
|
||||||
.flags = FC_PORT_INPUT | FC_PORT_CONTROL,
|
.flags = FC_PORT_INPUT | FC_PORT_CONTROL,
|
||||||
.def = 0.0f, .min = -M_PIf, .max = M_PIf
|
.def = 0.0f, .min = (float)-M_PI, .max = (float)M_PI
|
||||||
},
|
},
|
||||||
{ .index = 5,
|
{ .index = 5,
|
||||||
.name = "Offset",
|
.name = "Offset",
|
||||||
|
|
|
||||||
|
|
@ -1273,7 +1273,7 @@ static void rffti1_ps(int n, float *wa, int *ifac)
|
||||||
int k1, j, ii;
|
int k1, j, ii;
|
||||||
|
|
||||||
int nf = decompose(n, ifac, ntryh);
|
int nf = decompose(n, ifac, ntryh);
|
||||||
float argh = (2 * M_PIf) / n;
|
float argh = (2 * (float)M_PI) / n;
|
||||||
int is = 0;
|
int is = 0;
|
||||||
int nfm1 = nf - 1;
|
int nfm1 = nf - 1;
|
||||||
int l1 = 1;
|
int l1 = 1;
|
||||||
|
|
@ -1306,7 +1306,7 @@ static void cffti1_ps(int n, float *wa, int *ifac)
|
||||||
int k1, j, ii;
|
int k1, j, ii;
|
||||||
|
|
||||||
int nf = decompose(n, ifac, ntryh);
|
int nf = decompose(n, ifac, ntryh);
|
||||||
float argh = (2 * M_PIf) / (float)n;
|
float argh = (2 * (float)M_PI) / (float)n;
|
||||||
int i = 1;
|
int i = 1;
|
||||||
int l1 = 1;
|
int l1 = 1;
|
||||||
for (k1 = 1; k1 <= nf; k1++) {
|
for (k1 = 1; k1 <= nf; k1++) {
|
||||||
|
|
@ -1440,7 +1440,7 @@ static PFFFT_Setup *new_setup_simd(int N, pffft_transform_t transform)
|
||||||
int i = k / SIMD_SZ;
|
int i = k / SIMD_SZ;
|
||||||
int j = k % SIMD_SZ;
|
int j = k % SIMD_SZ;
|
||||||
for (m = 0; m < SIMD_SZ - 1; ++m) {
|
for (m = 0; m < SIMD_SZ - 1; ++m) {
|
||||||
float A = -2 * M_PIf * (m + 1) * k / N;
|
float A = -2 * (float)M_PI * (m + 1) * k / N;
|
||||||
s->e[(2 * (i * 3 + m) + 0) * SIMD_SZ + j] =
|
s->e[(2 * (i * 3 + m) + 0) * SIMD_SZ + j] =
|
||||||
cosf(A);
|
cosf(A);
|
||||||
s->e[(2 * (i * 3 + m) + 1) * SIMD_SZ + j] =
|
s->e[(2 * (i * 3 + m) + 1) * SIMD_SZ + j] =
|
||||||
|
|
@ -1453,7 +1453,7 @@ static PFFFT_Setup *new_setup_simd(int N, pffft_transform_t transform)
|
||||||
int i = k / SIMD_SZ;
|
int i = k / SIMD_SZ;
|
||||||
int j = k % SIMD_SZ;
|
int j = k % SIMD_SZ;
|
||||||
for (m = 0; m < SIMD_SZ - 1; ++m) {
|
for (m = 0; m < SIMD_SZ - 1; ++m) {
|
||||||
float A = -2 * M_PIf * (m + 1) * k / N;
|
float A = -2 * (float)M_PI * (m + 1) * k / N;
|
||||||
s->e[(2 * (i * 3 + m) + 0) * SIMD_SZ + j] =
|
s->e[(2 * (i * 3 + m) + 0) * SIMD_SZ + j] =
|
||||||
cosf(A);
|
cosf(A);
|
||||||
s->e[(2 * (i * 3 + m) + 1) * SIMD_SZ + j] =
|
s->e[(2 * (i * 3 + m) + 1) * SIMD_SZ + j] =
|
||||||
|
|
@ -1765,7 +1765,7 @@ static NEVER_INLINE(void) pffft_real_finalize(int Ncvec, const v4sf * in,
|
||||||
v4sf_union cr, ci, *uout = (v4sf_union *) out;
|
v4sf_union cr, ci, *uout = (v4sf_union *) out;
|
||||||
v4sf save = in[7], zero = VZERO();
|
v4sf save = in[7], zero = VZERO();
|
||||||
float xr0, xi0, xr1, xi1, xr2, xi2, xr3, xi3;
|
float xr0, xi0, xr1, xi1, xr2, xi2, xr3, xi3;
|
||||||
static const float s = M_SQRT2f / 2;
|
static const float s = (float)M_SQRT2 / 2;
|
||||||
|
|
||||||
cr.v = in[0];
|
cr.v = in[0];
|
||||||
ci.v = in[Ncvec * 2 - 1];
|
ci.v = in[Ncvec * 2 - 1];
|
||||||
|
|
@ -1871,7 +1871,7 @@ static NEVER_INLINE(void) pffft_real_preprocess(int Ncvec, const v4sf * in,
|
||||||
|
|
||||||
v4sf_union Xr, Xi, *uout = (v4sf_union *) out;
|
v4sf_union Xr, Xi, *uout = (v4sf_union *) out;
|
||||||
float cr0, ci0, cr1, ci1, cr2, ci2, cr3, ci3;
|
float cr0, ci0, cr1, ci1, cr2, ci2, cr3, ci3;
|
||||||
static const float s = M_SQRT2f;
|
static const float s = (float)M_SQRT2;
|
||||||
assert(in != out);
|
assert(in != out);
|
||||||
for (k = 0; k < 4; ++k) {
|
for (k = 0; k < 4; ++k) {
|
||||||
Xr.f[k] = ((float *)in)[8 * k];
|
Xr.f[k] = ((float *)in)[8 * k];
|
||||||
|
|
|
||||||
|
|
@ -229,7 +229,7 @@ static void spatializer_reload(void * Instance)
|
||||||
);
|
);
|
||||||
|
|
||||||
// TODO: make use of delay
|
// TODO: make use of delay
|
||||||
if ((left_delay || right_delay) && (!isnan(left_delay) || !isnan(right_delay))) {
|
if ((left_delay != 0.0f || right_delay != 0.0f) && (!isnan(left_delay) || !isnan(right_delay))) {
|
||||||
pw_log_warn("delay dropped l: %f, r: %f", left_delay, right_delay);
|
pw_log_warn("delay dropped l: %f, r: %f", left_delay, right_delay);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue