other algorithm

This commit is contained in:
Kizarm 2023-12-10 15:12:47 +01:00
parent b02468867a
commit a5511076aa

View file

@ -16,9 +16,10 @@ static constexpr int OFS = 20;
static CFFT fft (ORDER);
static vector<double> mono;
static bool sign = false;
static bool odd = false;
void cputs (const char * s) {
odd = ! odd;
const complex plus (0.0, 256.0), minus (0.0, -256.0);
complex data [TAPS];
memset (&data,0, TAPS * sizeof(complex));
@ -27,12 +28,12 @@ void cputs (const char * s) {
const char c = s [n];
if (c == '\0') break;
if (c == '#' ) {
const bool sign = (n & 1) xor odd;
// Střídání fáze 0/180 dost potlačí rozmazání spektra.
const complex fill = sign ? plus : minus;
const int k = n + OFS;
data[k] = fill;
data[TAPS - k] = fill;
sign = ! sign;
}
putchar(c);
n += 1;