1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-06-17 08:30:06 +02:00

Fix compilation on MSVC2013 Express.

MSVC2013 Express does not support some initialisation syntax for structs and instead gives error C2905.
This workaround to get us compiling again may need revisiting.
This commit is contained in:
James Crook 2017-03-18 16:05:12 +00:00
parent 864d0b2418
commit e94fa1d65e
3 changed files with 65 additions and 0 deletions

View File

@ -1,5 +1,10 @@
#ifndef __BIQUAD_H__
#define __BIQUAD_H__
#if 0
//initialisations not supported in MSVC 2013.
//Gives error C2905
// Do not make conditional on compiler.
typedef struct {
float* pfIn {};
float* pfOut {};
@ -10,6 +15,22 @@ typedef struct {
float fPrevOut {};
float fPrevPrevOut {};
} BiquadStruct;
#else
// WARNING: This structure may need initialisation.
typedef struct {
float* pfIn;
float* pfOut;
float fNumerCoeffs [3]; // B0 B1 B2
float fDenomCoeffs [2]; // A1 A2
float fPrevIn;
float fPrevPrevIn;
float fPrevOut;
float fPrevPrevOut;
} BiquadStruct;
#endif
void Biquad_Process (BiquadStruct* pBQ, int iNumSamples);
void ComplexDiv (float fNumerR, float fNumerI, float fDenomR, float fDenomI, float* pfQuotientR, float* pfQuotientI);
bool BilinTransform (float fSX, float fSY, float* pfZX, float* pfZY);

View File

@ -75,12 +75,25 @@ FactoryPresets[] =
{ XO("Cathedral"), { 90, 16, 90, 50, 100, 0, 0, -20, 100, false } },
};
#if 0
//initialisations not supported in MSVC 2013.
//Gives error C2905
// Do not make conditional on compiler.
struct Reverb_priv_t
{
reverb_t reverb;
float *dry {};
float *wet[2] { {}, {} };
};
#else
// WARNING: This structure may need initialisation.
struct Reverb_priv_t
{
reverb_t reverb;
float *dry;
float *wet[2];
};
#endif
//
// EffectReverb

View File

@ -32,6 +32,10 @@ using std::max;
#define lsx_zalloc(var, n) (var.reinit(n, true), var.get())
#define filter_advance(p) if (--(p)->ptr < (p)->buffer.get()) (p)->ptr += (p)->size
#if 0
//initialisations not supported in MSVC 2013.
//Gives error C2905
// Do not make conditional on compiler.
typedef struct {
ArrayOf<char> data;
size_t allocation {}; /* Number of bytes allocated for data. */
@ -39,12 +43,24 @@ typedef struct {
size_t begin {}; /* Offset of the first byte to read. */
size_t end {}; /* 1 + Offset of the last byte byte to read. */
} fifo_t;
#else
// WARNING: This structure may need initialisation.
typedef struct {
ArrayOf<char> data;
size_t allocation; /* Number of bytes allocated for data. */
size_t item_size; /* Size of each item in data */
size_t begin; /* Offset of the first byte to read. */
size_t end; /* 1 + Offset of the last byte byte to read. */
} fifo_t;
#endif
static void fifo_clear(fifo_t * f)
{
f->end = f->begin = 0;
}
static void * fifo_reserve(fifo_t * f, FIFO_SIZE_T n)
{
n *= f->item_size;
@ -194,6 +210,10 @@ static void filter_array_process(filter_array_t * p,
}
}
#if 0
//initialisations not supported in MSVC 2013.
//Gives error C2905
// Do not make conditional on compiler.
typedef struct {
float feedback {};
float hf_damping {};
@ -202,6 +222,17 @@ typedef struct {
filter_array_t chan[2];
ArrayOf<float> out[2];
} reverb_t;
#else
// WARNING: This structure may need initialisation.
typedef struct {
float feedback;
float hf_damping;
float gain;
fifo_t input_fifo;
filter_array_t chan[2];
ArrayOf<float> out[2];
} reverb_t;
#endif
static void reverb_create(reverb_t * p, double sample_rate_Hz,
double wet_gain_dB,