Fix some types to make MSVC happy

This commit is contained in:
Chris Robinson 2017-12-17 15:56:30 -08:00
parent 57e516720e
commit 8253014fe9
3 changed files with 13 additions and 12 deletions

View File

@ -26,7 +26,7 @@ SampleConverter *CreateSampleConverter(enum DevFmtType srcType, enum DevFmtType
/* Have to set the mixer FPU mode since that's what the resampler code expects. */
START_MIXER_MODE();
step = fastf2i(minf((ALdouble)srcRate / dstRate, MAX_PITCH)*FRACTIONONE + 0.5f);
step = fastf2i((ALfloat)mind((ALdouble)srcRate / dstRate, MAX_PITCH)*FRACTIONONE + 0.5f);
converter->mIncrement = maxi(step, 1);
if(converter->mIncrement == FRACTIONONE)
converter->mResample = Resample_copy_C;

View File

@ -1057,7 +1057,7 @@ static void AddFileEntry(vector_EnumeratedHrtf *list, const_al_string filename)
/* Unfortunate that we have to duplicate AddFileEntry to take a memory buffer
* for input instead of opening the given filename.
*/
static void AddBuiltInEntry(vector_EnumeratedHrtf *list, const_al_string filename, size_t residx)
static void AddBuiltInEntry(vector_EnumeratedHrtf *list, const_al_string filename, ALuint residx)
{
EnumeratedHrtf entry = { AL_STRING_INIT_STATIC(), NULL };
struct HrtfEntry *loaded_entry;
@ -1097,7 +1097,7 @@ static void AddBuiltInEntry(vector_EnumeratedHrtf *list, const_al_string filenam
);
loaded_entry->next = LoadedHrtfs;
loaded_entry->handle = hrtf;
snprintf(loaded_entry->filename, namelen, "!"SZFMT"_%s",
snprintf(loaded_entry->filename, namelen, "!%u_%s",
residx, alstr_get_cstr(filename));
LoadedHrtfs = loaded_entry;
}
@ -1285,7 +1285,7 @@ struct Hrtf *GetLoadedHrtf(struct HrtfEntry *entry)
struct FileMapping fmap;
const ALubyte *rdata;
const char *name;
size_t residx;
ALuint residx;
size_t rsize;
char ch;
@ -1301,7 +1301,7 @@ struct Hrtf *GetLoadedHrtf(struct HrtfEntry *entry)
fmap.ptr = NULL;
fmap.len = 0;
if(sscanf(entry->filename, "!"SZFMT"%c", &residx, &ch) == 2 && ch == '_')
if(sscanf(entry->filename, "!%u%c", &residx, &ch) == 2 && ch == '_')
{
name = strchr(entry->filename, ch)+1;
@ -1309,7 +1309,7 @@ struct Hrtf *GetLoadedHrtf(struct HrtfEntry *entry)
rdata = GetResource(residx, &rsize);
if(rdata == NULL || rsize == 0)
{
ERR("Could not get resource "SZFMT", %s\n", residx, name);
ERR("Could not get resource %u, %s\n", residx, name);
goto done;
}
}

View File

@ -63,13 +63,13 @@ typedef struct Recorder {
FILE *mFile;
long mDataSizeOffset;
size_t mDataSize;
ALuint mDataSize;
float mRecTime;
int mChannels;
int mBits;
int mSampleRate;
size_t mFrameSize;
ALuint mFrameSize;
ALbyte *mBuffer;
ALsizei mBufferSize;
} Recorder;
@ -184,7 +184,7 @@ int main(int argc, char **argv)
return 1;
}
recorder.mRecTime = strtod(argv[1], &end);
recorder.mRecTime = strtof(argv[1], &end);
if(!(recorder.mRecTime >= 1.0f && recorder.mRecTime <= 10.0f) || (end && *end != '\0'))
{
fprintf(stderr, "Invalid record time: %s\n", argv[1]);
@ -314,7 +314,7 @@ int main(int argc, char **argv)
(err=alcGetError(recorder.mDevice)) == ALC_NO_ERROR && !ferror(recorder.mFile))
{
ALCint count = 0;
fprintf(stderr, "\rCaptured "SZFMT" samples", recorder.mDataSize);
fprintf(stderr, "\rCaptured %u samples", recorder.mDataSize);
alcGetIntegerv(recorder.mDevice, ALC_CAPTURE_SAMPLES, 1, &count);
if(count < 1)
{
@ -357,10 +357,11 @@ int main(int argc, char **argv)
}
}
#endif
recorder.mDataSize += fwrite(recorder.mBuffer, recorder.mFrameSize, count, recorder.mFile);
recorder.mDataSize += (ALuint)fwrite(recorder.mBuffer, recorder.mFrameSize, count,
recorder.mFile);
}
alcCaptureStop(recorder.mDevice);
fprintf(stderr, "\rCaptured "SZFMT" samples\n", recorder.mDataSize);
fprintf(stderr, "\rCaptured %u samples\n", recorder.mDataSize);
if(err != ALC_NO_ERROR)
fprintf(stderr, "Got device error 0x%04x: %s\n", err, alcGetString(recorder.mDevice, err));