1
0
mirror of https://github.com/cookiengineer/audacity synced 2026-01-12 07:35:51 +01:00

Upgrade to libsoxr 0.0.2.

This commit is contained in:
v.audacity
2012-10-12 23:54:03 +00:00
parent 3cb679ccd8
commit 2416f94980
51 changed files with 1300 additions and 372 deletions

View File

@@ -11,7 +11,7 @@
#include <quadmath.h>
#endif
#include "../examples/util.h"
#include "../examples/examples-common.h"
#if QUAD
#define modf modfq
@@ -31,23 +31,26 @@ int main(int i, char const * argv[])
real rate = atof(argv[1]), /* Rate for this vector */
lead_in_len = atof(argv[2]), /* Lead-in length in seconds */
len = atof(argv[3]), /* Sweep length (excl. lead_in_len) */
sweep_to_freq = atof(argv[4]),
sweep_to_freq = atof(argv[4]), /* Sweep from DC to this freq. */
multiplier = atof(argv[5]), /* For headroom */
f1 = -sweep_to_freq / len * lead_in_len, f2 = sweep_to_freq,
n1 = rate * -lead_in_len, n2 = rate * len,
m = (f2 - f1) / (n2 - n1) / 2, dummy;
FILE * file = fopen(argv[5], "wb");
FILE * file = fopen(argv[6], "wb");
i = (int)n1;
if (!file || i != n1)
exit(1);
for (; i < (int)(n2 + .5); ++i) {
double d1 = sin(2 * M_PI * modf(i * m * i / rate, &dummy));
double d1 = multiplier * sin(2 * M_PI * modf(i * m * i / rate, &dummy));
double d = i < 0? d1 * (1 - cos(M_PI * (i + n1) / n1)) * .5 : d1;
#if QUAD
fwrite(&d, sizeof(d), 1, file);
size_t actual = fwrite(&d, sizeof(d), 1, file);
#else
int32_t out = rint32(d * (32768. * 65536 - 1));
fwrite(&out, sizeof(out), 1, file);
size_t actual = fwrite(&out, sizeof(out), 1, file);
#endif
if (actual != 1)
return 1;
}
return 0;
}