Skip to content

Commit bfaf2f2

Browse files
committed
msvc: Clean up some compiler warnings on Visual Studio.
Fixes #21.
1 parent 93b7dbb commit bfaf2f2

1 file changed

Lines changed: 20 additions & 20 deletions

File tree

mojoal.c

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1198,11 +1198,11 @@ static void pitch_fft(float *fftBuffer, int fftFrameSize, int sign)
11981198
for (k = 0, le = 2; k < endval; k++) {
11991199
le <<= 1;
12001200
le2 = le>>1;
1201-
ur = 1.0;
1202-
ui = 0.0;
1203-
arg = M_PI / (le2>>1);
1204-
wr = SDL_cos(arg);
1205-
wi = sign*SDL_sin(arg);
1201+
ur = 1.0f;
1202+
ui = 0.0f;
1203+
arg = (float) (M_PI / (le2>>1));
1204+
wr = SDL_cosf(arg);
1205+
wi = sign*SDL_sinf(arg);
12061206
for (j = 0; j < le2; j += 2) {
12071207
p1r = fftBuffer+j; p1i = p1r+1;
12081208
p2r = p1r+le2; p2i = p2r+1;
@@ -1254,8 +1254,8 @@ static void pitch_shift(ALsource *src, const ALbuffer *buffer, int numSampsToPro
12541254
/* do windowing and re,im interleave */
12551255
for (k = 0; k < pitch_framesize;k++) {
12561256
window = -.5*SDL_cos(2.*M_PI*(double)k/(double)pitch_framesize)+.5;
1257-
state->workspace[2*k] = state->infifo[k] * window;
1258-
state->workspace[2*k+1] = 0.;
1257+
state->workspace[2*k] = (ALfloat) state->infifo[k] * window;
1258+
state->workspace[2*k+1] = 0.0f;
12591259
}
12601260

12611261

@@ -1276,13 +1276,13 @@ static void pitch_shift(ALsource *src, const ALbuffer *buffer, int numSampsToPro
12761276

12771277
/* compute phase difference */
12781278
tmp = phase - state->lastphase[k];
1279-
state->lastphase[k] = phase;
1279+
state->lastphase[k] = (ALfloat) phase;
12801280

12811281
/* subtract expected phase difference */
12821282
tmp -= (double)k*expct;
12831283

12841284
/* map delta phase into +/- Pi interval */
1285-
qpd = tmp/M_PI;
1285+
qpd = (int) (tmp/M_PI);
12861286
if (qpd >= 0) qpd += qpd&1;
12871287
else qpd -= qpd&1;
12881288
tmp -= M_PI*(double)qpd;
@@ -1294,16 +1294,16 @@ static void pitch_shift(ALsource *src, const ALbuffer *buffer, int numSampsToPro
12941294
tmp = (double)k*freqPerBin + tmp*freqPerBin;
12951295

12961296
/* store magnitude and true frequency in analysis arrays */
1297-
state->workspace[2*k] = magn;
1298-
state->workspace[2*k+1] = tmp;
1297+
state->workspace[2*k] = (ALfloat) magn;
1298+
state->workspace[2*k+1] = (ALfloat) tmp;
12991299

13001300
}
13011301

13021302
/* ***************** PROCESSING ******************* */
13031303
/* this does the actual pitch shifting */
13041304
SDL_memset(state->synmagn, '\0', sizeof (state->synmagn));
13051305
for (k = 0; k <= pitch_framesize2; k++) {
1306-
index = k*pitchShift;
1306+
index = (int) (k*pitchShift);
13071307
if (index <= pitch_framesize2) {
13081308
state->synmagn[index] += state->workspace[2*k];
13091309
state->synfreq[index] = state->workspace[2*k+1] * pitchShift;
@@ -1331,12 +1331,12 @@ static void pitch_shift(ALsource *src, const ALbuffer *buffer, int numSampsToPro
13311331
tmp += (double)k*expct;
13321332

13331333
/* accumulate delta phase to get bin phase */
1334-
state->sumphase[k] += tmp;
1334+
state->sumphase[k] += (ALfloat) tmp;
13351335
phase = state->sumphase[k];
13361336

13371337
/* get real and imag part and re-interleave */
1338-
state->workspace[2*k] = magn*SDL_cos(phase);
1339-
state->workspace[2*k+1] = magn*SDL_sin(phase);
1338+
state->workspace[2*k] = (ALfloat) (magn*SDL_cos(phase));
1339+
state->workspace[2*k+1] = (ALfloat) (magn*SDL_sin(phase));
13401340
}
13411341

13421342
/* zero negative frequencies */
@@ -1348,7 +1348,7 @@ static void pitch_shift(ALsource *src, const ALbuffer *buffer, int numSampsToPro
13481348
/* do windowing and add to output accumulator */
13491349
for(k=0; k < pitch_framesize; k++) {
13501350
window = -.5*SDL_cos(2.*M_PI*(double)k/(double)pitch_framesize)+.5;
1351-
state->outputaccum[k] += 2.*window*state->workspace[2*k]/(pitch_framesize2*osamp);
1351+
state->outputaccum[k] += (ALfloat) (2.*window*state->workspace[2*k]/(pitch_framesize2*osamp));
13521352
}
13531353
for (k = 0; k < stepSize; k++) state->outfifo[k] = state->outputaccum[k];
13541354

@@ -2935,7 +2935,7 @@ static const ALchar *_alGetString(const ALenum param)
29352935

29362936
return NULL;
29372937
}
2938-
ENTRYPOINT(const ALchar *,alGetString,(const ALenum param),(param))
2938+
ENTRYPOINT(const ALchar *,alGetString,(ALenum param),(param))
29392939

29402940
static void _alGetBooleanv(const ALenum param, ALboolean *values)
29412941
{
@@ -4260,13 +4260,13 @@ static void source_set_offset(ALsource *src, ALenum param, ALfloat value)
42604260

42614261
switch (param) {
42624262
case AL_SAMPLE_OFFSET:
4263-
offset = value * framesize;
4263+
offset = ((int) value) * framesize;
42644264
break;
42654265
case AL_SEC_OFFSET:
4266-
offset = value * freq * framesize;
4266+
offset = ((int) value) * freq * framesize;
42674267
break;
42684268
case AL_BYTE_OFFSET:
4269-
offset = ((int)value / framesize) * framesize;
4269+
offset = (((int) value) / framesize) * framesize;
42704270
break;
42714271
default:
42724272
SDL_assert(!"Unexpected source offset type!");

0 commit comments

Comments
 (0)