Browse Source

Fix MSVC build #20

tags/v1.8.0
Xerbo 2 years ago
parent
commit
3e8297a912
No known key found for this signature in database GPG Key ID: 34103F6D8F11CEB0
3 changed files with 20 additions and 11 deletions
  1. +6
    -7
      src/dsp.c
  2. +5
    -1
      src/filter.c
  3. +9
    -3
      src/filter.h

+ 6
- 7
src/dsp.c View File

@@ -26,12 +26,6 @@
#include "taps.h"
#include "util.h"

#ifdef _MSC_VER
typedef _Fcomplex complexf_t;
#else
typedef complex float complexf_t;
#endif

// Block sizes
#define BLKAMP 32768
#define BLKIN 32768
@@ -69,8 +63,13 @@ static float pll(complexf_t in) {
static float oscillator_phase = 0.0;

// Internal oscillator
#ifdef _MSC_VER
complexf_t osc = _FCbuild(cos(oscillator_phase), -sin(oscillator_phase));
in = _FCmulcc(in, osc);
#else
complexf_t osc = cos(oscillator_phase) + -sin(oscillator_phase)*I;
in *= osc;
in *= osc;
#endif

// Error detector
float error = cargf(in);


+ 5
- 1
src/filter.c View File

@@ -29,7 +29,7 @@ float convolve(const float *in, const float *taps, size_t len) {
return sum;
}

float complex hilbert_transform(const float *in, const float *taps, size_t len) {
complexf_t hilbert_transform(const float *in, const float *taps, size_t len) {
float i = 0.0;
float q = 0.0;

@@ -39,7 +39,11 @@ float complex hilbert_transform(const float *in, const float *taps, size_t len)
}

i = in[len-1] - (i / len);
#ifdef _MSC_VER
return _FCbuild(i, q);
#else
return i + q*I;
#endif
}

float interpolating_convolve(const float *in, const float *taps, size_t len, float offset, float delta) {


+ 9
- 3
src/filter.h View File

@@ -19,6 +19,12 @@
#include <stddef.h>
#include <complex.h>
float convolve(const float *in, const float *taps, size_t len);
float complex hilbert_transform(const float *in, const float *taps, size_t len);
float interpolating_convolve(const float *in, const float *taps, size_t len, float offset, float delta);
#ifdef _MSC_VER
typedef _Fcomplex complexf_t;
#else
typedef complex float complexf_t;
#endif
float convolve(const float *in, const float *taps, size_t len);
complexf_t hilbert_transform(const float *in, const float *taps, size_t len);
float interpolating_convolve(const float *in, const float *taps, size_t len, float offset, float delta);

Loading…
Cancel
Save