fix a few warnings
This commit is contained in:
1 parent
e9685ef3e8
commit
986a131a36
2 files changed
+28
-26
No files matched your search
+1
-1
@@ -455,7 +455,7 @@ static void Impl_HandleWindowEvent(SDL_WindowEvent evt)
|
||||
static bool kbfocus = true;
|
||||
static bool windowmoved = false;
|
||||
|
||||
const unsigned int oldfocus = FOCUSUNION;
|
||||
const int oldfocus = FOCUSUNION;
|
||||
|
||||
switch (evt.type)
|
||||
{
|
||||
|
||||
+27
-25
@@ -75,10 +75,10 @@ typedef struct sndlump_s
|
||||
|
||||
UINT8 sound_started = false;
|
||||
|
||||
static UINT32 stutter_threshold;
|
||||
/*static UINT32 stutter_threshold;
|
||||
static UINT32 music_end_bytes;
|
||||
static UINT32 music_bytes;
|
||||
static UINT32 music_stutter_bytes;
|
||||
static UINT32 music_stutter_bytes;*/
|
||||
|
||||
static SDL_AudioDeviceID audio_device;
|
||||
static SDL_AudioStream *audio_stream;
|
||||
@@ -136,6 +136,10 @@ static void MidiSoundfontPath_Onchange(void)
|
||||
consvar_t cv_midisoundfontpath = CVAR_INIT ("midisoundfont", "sf2/GeneralUser-GS.sf2", "Which MIDI soundfont to use", CV_CALL|CV_NOINIT|CV_SAVE, NULL, MidiSoundfontPath_Onchange);
|
||||
#endif
|
||||
|
||||
//FIXME: this is not how it should be lol
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wfloat-equal"
|
||||
|
||||
/// ------------------------
|
||||
/// Audio System
|
||||
/// ------------------------
|
||||
@@ -211,7 +215,8 @@ static void MusicCallback(void *userdata, SDL_AudioStream *stream, int additiona
|
||||
(void)userdata;
|
||||
(void)total_amount;
|
||||
|
||||
int amount = additional_amount / 4 * music_speed;
|
||||
int amount = additional_amount / 4.0f * music_speed;
|
||||
|
||||
if (music_info.channels == 2 && (amount & 1))
|
||||
amount++;
|
||||
float *needed = malloc(amount * 4);
|
||||
@@ -280,6 +285,7 @@ static void StreamCallback(void *userdata, SDL_AudioStream *stream, int addition
|
||||
else if (gme != NULL && !gme_track_ended(gme) && !song_paused)
|
||||
{
|
||||
INT16 *buf = malloc(additional_amount * 2);
|
||||
|
||||
if (buf != NULL)
|
||||
{
|
||||
gme_play(gme, additional_amount, buf);
|
||||
@@ -527,9 +533,9 @@ static sample_t *CreateSample(float *data, size_t len)
|
||||
return sample;
|
||||
}
|
||||
|
||||
static sample_t *ConvertDOOMSample(void *stream)
|
||||
static sample_t *ConvertDOOMSample(const void *stream)
|
||||
{
|
||||
UINT16 ver,freq;
|
||||
UINT16 ver, freq;
|
||||
UINT32 samples;
|
||||
|
||||
// lump header
|
||||
@@ -537,6 +543,11 @@ static sample_t *ConvertDOOMSample(void *stream)
|
||||
if (ver != 3) // It should be 3 if it's a doomsound...
|
||||
return NULL; // onos! it's not a doomsound!
|
||||
freq = READUINT16(stream);
|
||||
|
||||
// dont divide by 0!
|
||||
if (freq == 0)
|
||||
return NULL;
|
||||
|
||||
samples = READUINT32(stream);
|
||||
|
||||
SDL_AudioSpec srcspec = {
|
||||
@@ -547,7 +558,7 @@ static sample_t *ConvertDOOMSample(void *stream)
|
||||
|
||||
float *data;
|
||||
int len;
|
||||
if (!SDL_ConvertAudioSamples(&srcspec, (void *)(((char *)stream)+16), samples-32, &virtual_spec, (void *)&data, &len))
|
||||
if (!SDL_ConvertAudioSamples(&srcspec, (const void *)(((const char *)stream)+16), samples-32, &virtual_spec, (void *)&data, &len))
|
||||
{
|
||||
CONS_Alert(CONS_ERROR, "Failed to convert audio: %s\n", SDL_GetError());
|
||||
return NULL;
|
||||
@@ -641,6 +652,7 @@ void *I_GetSfx(sfxinfo_t *sfx)
|
||||
int zErr; // Somewhere to handle any error messages zlib tosses out
|
||||
|
||||
memset(&stream, 0x00, sizeof (z_stream)); // Init zlib stream
|
||||
|
||||
// Begin the inflation process
|
||||
inflatedLen = *(UINT32 *)lump + (sfx->length-4); // Last 4 bytes are the decompressed size, typically
|
||||
inflatedData = (UINT8 *)malloc(inflatedLen); // Make room for the decompressed data
|
||||
@@ -653,7 +665,8 @@ void *I_GetSfx(sfxinfo_t *sfx)
|
||||
if (zErr == Z_OK) // We're good to go
|
||||
{
|
||||
zErr = inflate(&stream, Z_FINISH);
|
||||
if (zErr == Z_STREAM_END) {
|
||||
if (zErr == Z_STREAM_END)
|
||||
{
|
||||
// Run GME on new data
|
||||
if (!gme_open_data(inflatedData, inflatedLen, &emu, virtual_spec.freq))
|
||||
{
|
||||
@@ -934,11 +947,13 @@ void I_ShutdownMusic(void)
|
||||
I_UnloadSong();
|
||||
}
|
||||
|
||||
//FIXME: implement this crap
|
||||
#if 0
|
||||
static void Countstutter(int len)
|
||||
{
|
||||
UINT32 bytes;
|
||||
|
||||
music_bytes += len;
|
||||
|
||||
if (gamestate != GS_LEVEL)
|
||||
return;
|
||||
|
||||
@@ -966,22 +981,7 @@ static void Countstutter(int len)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void count_music_bytes(int chan, void *stream, int len, void *udata)
|
||||
{
|
||||
(void)chan;
|
||||
(void)stream;
|
||||
(void)udata;
|
||||
|
||||
const musictype_t mustype = I_SongType();
|
||||
|
||||
if (I_SongType() == MU_NONE || mustype == MU_GME || mustype == MU_MOD || mustype == MU_MID)
|
||||
return;
|
||||
|
||||
music_bytes += len;
|
||||
|
||||
Countstutter(len);
|
||||
}
|
||||
#endif
|
||||
|
||||
/// ------------------------
|
||||
/// Music Properties
|
||||
@@ -1290,7 +1290,7 @@ static void ResetMusic(void)
|
||||
|
||||
void I_UpdateSongLagThreshold(void)
|
||||
{
|
||||
stutter_threshold = cv_music_resync_powerups_only.value ? 0 : (cv_music_resync_threshold.value/1000.0*(4*44100));
|
||||
//stutter_threshold = cv_music_resync_powerups_only.value ? 0 : (cv_music_resync_threshold.value/1000.0*(4*44100));
|
||||
}
|
||||
|
||||
boolean I_LoadSong(char *data, size_t len)
|
||||
@@ -1733,5 +1733,7 @@ boolean I_FadeInPlaySong(UINT32 ms, boolean looping)
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
||||
Reference in new issue
Block a user