Prefer uint32_t over unsigned int

git-svn-id: https://svn.eduke32.com/eduke32@8225 1a8010ca-5511-0410-912e-c29ae57300e0

# Conflicts:
#	source/audiolib/src/_al_midi.h
This commit is contained in:
terminx 2019-10-19 23:48:51 +00:00 committed by Christoph Oelckers
parent 4ff4fddf62
commit 5853fe1cc6
8 changed files with 56 additions and 62 deletions

View file

@ -54,7 +54,7 @@ enum FX_LOOP_HOW
#define FX_MUSIC_PRIORITY INT_MAX
const char *FX_ErrorString(int ErrorNumber);
int FX_Init(int numvoices, int numchannels, unsigned mixrate, void *initdata);
int FX_Init(int numvoices, int numchannels, int mixrate, void *initdata);
int FX_Shutdown(void);

View file

@ -175,7 +175,7 @@ typedef struct VoiceNode
float volume;
unsigned LoopCount;
int LoopCount;
uint32_t LoopSize;
uint32_t BlockLength;

View file

@ -117,12 +117,12 @@ static opl3_chip chip;
opl3_chip *AL_GetChip(void) { return &chip; }
static constexpr unsigned int OctavePitch[MAX_OCTAVE+1] = {
static constexpr uint32_t OctavePitch[MAX_OCTAVE+1] = {
OCTAVE_0, OCTAVE_1, OCTAVE_2, OCTAVE_3, OCTAVE_4, OCTAVE_5, OCTAVE_6, OCTAVE_7,
};
static unsigned int NoteMod12[MAX_NOTE+1];
static unsigned int NoteDiv12[MAX_NOTE+1];
static uint32_t NoteMod12[MAX_NOTE+1];
static uint32_t NoteDiv12[MAX_NOTE+1];
// Pitch table
@ -131,7 +131,7 @@ static unsigned int NoteDiv12[MAX_NOTE+1];
// { C, C_SHARP, D, D_SHARP, E, F, F_SHARP, G, G_SHARP, A, A_SHARP, B },
// };
static constexpr unsigned int NotePitch[FINETUNE_MAX+1][12] = {
static constexpr uint32_t NotePitch[FINETUNE_MAX+1][12] = {
{ 0x157, 0x16b, 0x181, 0x198, 0x1b0, 0x1ca, 0x1e5, 0x202, 0x220, 0x241, 0x263, 0x287 },
{ 0x157, 0x16b, 0x181, 0x198, 0x1b0, 0x1ca, 0x1e5, 0x202, 0x220, 0x242, 0x264, 0x288 },
{ 0x158, 0x16c, 0x182, 0x199, 0x1b1, 0x1cb, 0x1e6, 0x203, 0x221, 0x243, 0x265, 0x289 },
@ -334,13 +334,13 @@ static void AL_SetVoiceVolume(int const voice)
int const port = Voice[voice].port;
// amplitude
uint32_t t1 = (unsigned int)VoiceLevel[slot][port] * (velocity + 0x80);
auto t1 = (uint32_t)VoiceLevel[slot][port] * (velocity + 0x80);
t1 = (Channel[channel].Volume * t1) >> 15;
if (!AL_SendStereo)
{
uint32_t volume = t1 ^ 63;
volume |= (unsigned int)VoiceKsl[slot][port];
volume |= (uint32_t)VoiceKsl[slot][port];
AL_SendOutput(port, 0x40 + offsetSlot[slot], volume);
@ -350,11 +350,11 @@ static void AL_SetVoiceVolume(int const voice)
int const slot = slotVoice[voc][0];
// amplitude
uint32_t t2 = (unsigned int)VoiceLevel[slot][port] * (velocity + 0x80);
auto t2 = (uint32_t)VoiceLevel[slot][port] * (velocity + 0x80);
t2 = (Channel[channel].Volume * t2) >> 15;
volume = t2 ^ 63;
volume |= (unsigned int)VoiceKsl[slot][port];
volume |= (uint32_t)VoiceKsl[slot][port];
AL_SendOutput(port, 0x40 + offsetSlot[slot], volume);
}
@ -371,7 +371,7 @@ static void AL_SetVoiceVolume(int const voice)
}
volume ^= 63;
volume |= (unsigned int)VoiceKsl[slot][port];
volume |= (uint32_t)VoiceKsl[slot][port];
AL_SendOutputToPort(AL_LeftPort, 0x40 + offsetSlot[slot], volume);
@ -384,7 +384,7 @@ static void AL_SetVoiceVolume(int const voice)
}
volume ^= 63;
volume |= (unsigned int)VoiceKsl[slot][port];
volume |= (uint32_t)VoiceKsl[slot][port];
AL_SendOutputToPort(AL_RightPort, 0x40 + offsetSlot[slot], volume);
@ -392,7 +392,7 @@ static void AL_SetVoiceVolume(int const voice)
if (timbre->Feedback & 0x01)
{
// amplitude
uint32_t t2 = (unsigned int)VoiceLevel[slot][port] * (velocity + 0x80);
auto t2 = (uint32_t)VoiceLevel[slot][port] * (velocity + 0x80);
t2 = (Channel[channel].Volume * t2) >> 15;
int const slot = slotVoice[voc][0];
@ -406,7 +406,7 @@ static void AL_SetVoiceVolume(int const voice)
}
volume ^= 63;
volume |= (unsigned int)VoiceKsl[slot][port];
volume |= (uint32_t)VoiceKsl[slot][port];
AL_SendOutputToPort(AL_LeftPort, 0x40 + offsetSlot[slot], volume);
@ -419,7 +419,7 @@ static void AL_SetVoiceVolume(int const voice)
}
volume ^= 63;
volume |= (unsigned int)VoiceKsl[slot][port];
volume |= (uint32_t)VoiceKsl[slot][port];
AL_SendOutputToPort(AL_RightPort, 0x40 + offsetSlot[slot], volume);
}
@ -430,7 +430,7 @@ static int AL_AllocVoice(void)
{
if (Voice_Pool.start)
{
int voice = Voice_Pool.start->num;
int const voice = Voice_Pool.start->num;
LL_Remove(AdLibVoice, &Voice_Pool, &Voice[voice]);
return voice;
}
@ -441,11 +441,11 @@ static int AL_AllocVoice(void)
static int AL_GetVoice(int const channel, int const key)
{
auto voice = Channel[channel].Voices.start;
auto const *voice = Channel[channel].Voices.start;
while (voice != nullptr)
{
if (voice->key == (unsigned int)key)
if (voice->key == (uint32_t)key)
return voice->num;
voice = voice->next;
}
@ -554,10 +554,7 @@ static void AL_ResetVoices(void)
Voice_Pool.start = nullptr;
Voice_Pool.end = nullptr;
int numvoices = NUMADLIBVOICES;
if (!AL_Stereo)
numvoices = NUMADLIBVOICES * 2;
int const numvoices = AL_Stereo ? NUMADLIBVOICES : NUMADLIBVOICES * 2;
for (int index = 0; index < numvoices; index++)
{
@ -576,15 +573,9 @@ static void AL_ResetVoices(void)
for (int index = 0; index < NUMADLIBCHANNELS; index++)
{
Channel[index].Voices.start = nullptr;
Channel[index].Voices.end = nullptr;
Channel[index].Timbre = 0;
Channel[index].Pitchbend = 0;
Channel[index].KeyOffset = 0;
Channel[index].KeyDetune = 0;
Channel[index] = {};
Channel[index].Volume = AL_DefaultChannelVolume;
Channel[index].Pan = 64;
Channel[index].RPN = 0;
Channel[index].PitchBendRange = AL_DefaultPitchBendRange;
Channel[index].PitchBendSemiTones = AL_DefaultPitchBendRange / 100;
Channel[index].PitchBendHundreds = AL_DefaultPitchBendRange % 100;
@ -618,10 +609,11 @@ static void AL_FlushCard(int const port)
{
for (int i = 0; i < NUMADLIBVOICES; i++)
{
if (VoiceReserved[i] == FALSE)
{
unsigned slot1 = offsetSlot[slotVoice[i][0]];
unsigned slot2 = offsetSlot[slotVoice[i][1]];
if (VoiceReserved[i])
continue;
auto slot1 = offsetSlot[slotVoice[i][0]];
auto slot2 = offsetSlot[slotVoice[i][1]];
AL_SendOutputToPort(port, 0xA0 + i, 0);
AL_SendOutputToPort(port, 0xB0 + i, 0);
@ -639,7 +631,6 @@ static void AL_FlushCard(int const port)
AL_SendOutputToPort(port, 0x40 + slot1, 0xff);
AL_SendOutputToPort(port, 0x40 + slot2, 0xff);
}
}
}
@ -839,7 +830,7 @@ static void AL_SetPitchBend(int const channel, int const lsb, int const msb)
Channel[channel].KeyOffset = (int)(TotalBend / FINETUNE_RANGE);
Channel[channel].KeyOffset -= Channel[channel].PitchBendSemiTones;
Channel[channel].KeyDetune = (unsigned int)(TotalBend % FINETUNE_RANGE);
Channel[channel].KeyDetune = (uint32_t)(TotalBend % FINETUNE_RANGE);
auto voice = Channel[channel].Voices.start;
while (voice != nullptr)

View file

@ -112,7 +112,7 @@ static void FillBuffer(int bufnum)
continue;
}
fail:
MV_Printf("DirectSound FillBuffer: err %x\n", (unsigned int)err);
MV_Printf("DirectSound FillBuffer: err %x\n", (uint32_t)err);
return;
}
@ -170,7 +170,7 @@ static DWORD WINAPI fillDataThread(LPVOID lpParameter)
static void TeardownDSound(HRESULT err)
{
if (FAILED(err))
MV_Printf("Dying error: %x\n", (unsigned int)err);
MV_Printf("Dying error: %x\n", (uint32_t)err);
if (lpdsnotify)
IDirectSoundNotify_Release(lpdsnotify), lpdsnotify = nullptr;

View file

@ -71,7 +71,7 @@ int NoSoundDrv_MIDI_StartPlayback(void (*service)(void))
}
void NoSoundDrv_MIDI_HaltPlayback(void) {}
unsigned int NoSoundDrv_MIDI_GetTick(void) { return 0; }
uint32_t NoSoundDrv_MIDI_GetTick(void) { return 0; }
void NoSoundDrv_MIDI_SetTempo(int tempo, int division)
{

View file

@ -20,6 +20,8 @@
#include "midifuncs.h"
#include <inttypes.h>
int NoSoundDrv_GetError(void);
const char *NoSoundDrv_ErrorString( int ErrorNumber );
@ -35,7 +37,7 @@ int NoSoundDrv_MIDI_Init(midifuncs *);
void NoSoundDrv_MIDI_Shutdown(void);
int NoSoundDrv_MIDI_StartPlayback(void (*service)(void));
void NoSoundDrv_MIDI_HaltPlayback(void);
unsigned int NoSoundDrv_MIDI_GetTick(void);
uint32_t NoSoundDrv_MIDI_GetTick(void);
void NoSoundDrv_MIDI_SetTempo(int tempo, int division);
void NoSoundDrv_MIDI_Lock(void);
void NoSoundDrv_MIDI_Unlock(void);

View file

@ -55,10 +55,10 @@ static BOOL midiInstalled;
static HMIDISTRM midiStream;
static UINT midiDeviceID = MIDI_MAPPER;
static void (*midiThreadService)(void);
static unsigned int midiThreadTimer;
static unsigned int midiLastEventTime;
static unsigned int midiThreadQueueTimer;
static unsigned int midiThreadQueueTicks;
static uint32_t midiThreadTimer;
static uint32_t midiLastEventTime;
static uint32_t midiThreadQueueTimer;
static uint32_t midiThreadQueueTicks;
static HANDLE midiThread;
static HANDLE midiThreadQuitEvent;
static HANDLE midiMutex;
@ -354,7 +354,7 @@ static void midi_setup_event(int length, unsigned char ** data)
*/
static BOOL midi_get_buffer(int length, unsigned char ** data)
{
unsigned int datalen;
uint32_t datalen;
MidiBuffer * node;
// determine the space to alloc.

View file

@ -32,7 +32,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
int FX_ErrorCode = FX_Ok;
int FX_Installed;
const char *FX_ErrorString(int ErrorNumber)
const char *FX_ErrorString(int const ErrorNumber)
{
const char *ErrorString;
@ -63,7 +63,7 @@ static int osdcmd_cvar_set_audiolib(osdcmdptr_t parm)
return r;
}
int FX_Init(int numvoices, int numchannels, unsigned mixrate, void *initdata)
int FX_Init(int numvoices, int numchannels, int mixrate, void *initdata)
{
if (FX_Installed)
FX_Shutdown();
@ -82,9 +82,11 @@ int FX_Init(int numvoices, int numchannels, unsigned mixrate, void *initdata)
OSD_RegisterCvar(&i, (i.flags & CVAR_FUNCPTR) ? osdcmd_cvar_set_audiolib : osdcmd_cvar_set);
}
}
int SoundCard = ASS_AutoDetect;
if (SoundCard == ASS_AutoDetect) {
if (SoundCard == ASS_AutoDetect)
{
#if defined RENDERTYPESDL
SoundCard = ASS_SDL;
#elif defined RENDERTYPEWIN
@ -100,7 +102,6 @@ int FX_Init(int numvoices, int numchannels, unsigned mixrate, void *initdata)
return FX_Error;
}
if (SoundDriver_IsPCMSupported(SoundCard) == 0)
{
// unsupported cards fall back to no sound