Some minor fixes in siggen and ln to also work with (untested) 32-bit floats
This commit is contained in:
parent
09c6b2680b
commit
6acf45a909
@ -35,6 +35,7 @@
|
|||||||
#define d_cos cos
|
#define d_cos cos
|
||||||
#define d_pow pow
|
#define d_pow pow
|
||||||
#define d_log10 log10
|
#define d_log10 log10
|
||||||
|
#define d_ln log
|
||||||
#define d_epsilon (DBL_EPSILON)
|
#define d_epsilon (DBL_EPSILON)
|
||||||
|
|
||||||
#else // LASP_DOUBLE_PRECISION not defined
|
#else // LASP_DOUBLE_PRECISION not defined
|
||||||
@ -51,6 +52,7 @@
|
|||||||
#define d_cos cosf
|
#define d_cos cosf
|
||||||
#define d_pow powf
|
#define d_pow powf
|
||||||
#define d_log10 log10f
|
#define d_log10 log10f
|
||||||
|
#define d_ln logf
|
||||||
#define d_epsilon (FLT_EPSILON)
|
#define d_epsilon (FLT_EPSILON)
|
||||||
#endif // LASP_DOUBLE_PRECISION
|
#endif // LASP_DOUBLE_PRECISION
|
||||||
|
|
||||||
|
@ -83,7 +83,7 @@ Siggen* Siggen_Noise_create(const d fs, const d level_dB, Sosfilterbank* colorfi
|
|||||||
fsTRACE(15);
|
fsTRACE(15);
|
||||||
|
|
||||||
Siggen* noise = Siggen_create(NOISE, fs, level_dB);
|
Siggen* noise = Siggen_create(NOISE, fs, level_dB);
|
||||||
dbgassert(sizeof(noiseSpecific) <= sizeof(noise->private_data),
|
dbgassert(sizeof(NoiseSpecific) <= sizeof(noise->private_data),
|
||||||
"Allocated memory too small");
|
"Allocated memory too small");
|
||||||
NoiseSpecific* wn = (NoiseSpecific*) noise->private_data;
|
NoiseSpecific* wn = (NoiseSpecific*) noise->private_data;
|
||||||
wn->phase = 0;
|
wn->phase = 0;
|
||||||
@ -264,9 +264,9 @@ static void noise_genSignal(Siggen* siggen, NoiseSpecific* wn, vd* samples) {
|
|||||||
S = V1 * V1 + V2 * V2;
|
S = V1 * V1 + V2 * V2;
|
||||||
} while(S >= 1 || S == 0);
|
} while(S >= 1 || S == 0);
|
||||||
|
|
||||||
X = V1 * sqrt(-2 * d_log(S) / S);
|
X = V1 * sqrt(-2 * d_ln(S) / S);
|
||||||
} else
|
} else
|
||||||
X = V2 * sqrt(-2 * d_log(S) / S);
|
X = V2 * sqrt(-2 * d_ln(S) / S);
|
||||||
|
|
||||||
phase = 1 - phase;
|
phase = 1 - phase;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user