- except for DWORD, all homegrown integer types are gone - a handful were left where they represent genuine Windows types.

This commit is contained in:
Christoph Oelckers 2017-03-09 19:54:41 +01:00
commit d2beacfc5f
136 changed files with 770 additions and 774 deletions

View file

@ -133,7 +133,7 @@ typedef struct _DLSID {
ULONG ulData1;
USHORT usData2;
USHORT usData3;
BYTE abData4[8];
uint8_t abData4[8];
} DLSID, FAR *LPDLSID;
typedef struct _DLSVERSION {

View file

@ -26,13 +26,13 @@ struct GF1PatchHeader
char Header[HEADER_SIZE];
char GravisID[ID_SIZE]; /* Id = "ID#000002" */
char Description[DESC_SIZE];
BYTE Instruments;
BYTE Voices;
BYTE Channels;
uint8_t Instruments;
uint8_t Voices;
uint8_t Channels;
uint16_t WaveForms;
uint16_t MasterVolume;
DWORD DataSize;
BYTE Reserved[PATCH_HEADER_RESERVED_SIZE];
uint8_t Reserved[PATCH_HEADER_RESERVED_SIZE];
} GCC_PACKED;
struct GF1InstrumentData
@ -40,23 +40,23 @@ struct GF1InstrumentData
uint16_t Instrument;
char InstrumentName[INST_NAME_SIZE];
int InstrumentSize;
BYTE Layers;
BYTE Reserved[RESERVED_SIZE];
uint8_t Layers;
uint8_t Reserved[RESERVED_SIZE];
} GCC_PACKED;
struct GF1LayerData
{
BYTE LayerDuplicate;
BYTE Layer;
uint8_t LayerDuplicate;
uint8_t Layer;
int LayerSize;
BYTE Samples;
BYTE Reserved[LAYER_RESERVED_SIZE];
uint8_t Samples;
uint8_t Reserved[LAYER_RESERVED_SIZE];
} GCC_PACKED;
struct GF1PatchData
{
char WaveName[7];
BYTE Fractions;
uint8_t Fractions;
int WaveSize;
int StartLoop;
int EndLoop;
@ -65,19 +65,19 @@ struct GF1PatchData
int HighFrequency;
int RootFrequency;
int16_t Tune;
BYTE Balance;
BYTE EnvelopeRate[ENVELOPES];
BYTE EnvelopeOffset[ENVELOPES];
BYTE TremoloSweep;
BYTE TremoloRate;
BYTE TremoloDepth;
BYTE VibratoSweep;
BYTE VibratoRate;
BYTE VibratoDepth;
BYTE Modes;
uint8_t Balance;
uint8_t EnvelopeRate[ENVELOPES];
uint8_t EnvelopeOffset[ENVELOPES];
uint8_t TremoloSweep;
uint8_t TremoloRate;
uint8_t TremoloDepth;
uint8_t VibratoSweep;
uint8_t VibratoRate;
uint8_t VibratoDepth;
uint8_t Modes;
int16_t ScaleFrequency;
uint16_t ScaleFactor; /* From 0 to 2048 or 0 to 2 */
BYTE Reserved[PATCH_DATA_RESERVED_SIZE];
uint8_t Reserved[PATCH_DATA_RESERVED_SIZE];
} GCC_PACKED;
#ifdef _MSC_VER
#pragma pack(pop)

View file

@ -81,7 +81,7 @@ ToneBank::~ToneBank()
}
}
int convert_tremolo_sweep(Renderer *song, BYTE sweep)
int convert_tremolo_sweep(Renderer *song, uint8_t sweep)
{
if (sweep == 0)
return 0;
@ -90,7 +90,7 @@ int convert_tremolo_sweep(Renderer *song, BYTE sweep)
int(((song->control_ratio * SWEEP_TUNING) << SWEEP_SHIFT) / (song->rate * sweep));
}
int convert_vibrato_sweep(Renderer *song, BYTE sweep, int vib_control_ratio)
int convert_vibrato_sweep(Renderer *song, uint8_t sweep, int vib_control_ratio)
{
if (sweep == 0)
return 0;
@ -104,13 +104,13 @@ int convert_vibrato_sweep(Renderer *song, BYTE sweep, int vib_control_ratio)
*/
}
int convert_tremolo_rate(Renderer *song, BYTE rate)
int convert_tremolo_rate(Renderer *song, uint8_t rate)
{
return
int(((song->control_ratio * rate) << RATE_SHIFT) / (TREMOLO_RATE_TUNING * song->rate));
}
int convert_vibrato_rate(Renderer *song, BYTE rate)
int convert_vibrato_rate(Renderer *song, uint8_t rate)
{
/* Return a suitable vibrato_control_ratio value */
return
@ -403,7 +403,7 @@ fail:
{
sp->envelope.gf1.rate[j] = patch_data.EnvelopeRate[j];
/* [RH] GF1NEW clamps the offsets to the range [5,251], so we do too. */
sp->envelope.gf1.offset[j] = clamp<BYTE>(patch_data.EnvelopeOffset[j], 5, 251);
sp->envelope.gf1.offset[j] = clamp<uint8_t>(patch_data.EnvelopeOffset[j], 5, 251);
}
/* Then read the sample data */
@ -492,7 +492,7 @@ void convert_sample_data(Sample *sp, const void *data)
case PATCH_UNSIGNED:
{ /* 8-bit, unsigned */
BYTE *cp = (BYTE *)data;
uint8_t *cp = (uint8_t *)data;
newdata = (sample_t *)safe_malloc((sp->data_length + 1) * sizeof(sample_t));
for (int i = 0; i < sp->data_length; ++i)
{

View file

@ -59,7 +59,7 @@ struct RIFF_Chunk
uint32_t magic;
uint32_t length;
uint32_t subtype;
BYTE *data;
uint8_t *data;
RIFF_Chunk *child;
RIFF_Chunk *next;
};
@ -85,9 +85,9 @@ static int ChunkHasSubChunks(uint32_t magic)
return (magic == RIFF || magic == LIST);
}
static void LoadSubChunks(RIFF_Chunk *chunk, BYTE *data, uint32_t left)
static void LoadSubChunks(RIFF_Chunk *chunk, uint8_t *data, uint32_t left)
{
BYTE *subchunkData;
uint8_t *subchunkData;
uint32_t subchunkDataLen;
while ( left > 8 ) {
@ -133,7 +133,7 @@ static void LoadSubChunks(RIFF_Chunk *chunk, BYTE *data, uint32_t left)
RIFF_Chunk *LoadRIFF(FILE *src)
{
RIFF_Chunk *chunk;
BYTE *subchunkData;
uint8_t *subchunkData;
uint32_t subchunkDataLen;
/* Allocate the chunk structure */
@ -148,7 +148,7 @@ RIFF_Chunk *LoadRIFF(FILE *src)
delete chunk;
return NULL;
}
chunk->data = (BYTE *)malloc(chunk->length);
chunk->data = (uint8_t *)malloc(chunk->length);
if ( chunk->data == NULL ) {
__Sound_SetError(ERR_OUT_OF_MEMORY);
delete chunk;
@ -274,7 +274,7 @@ struct WaveFMT
struct DLS_Wave
{
WaveFMT *format;
BYTE *data;
uint8_t *data;
uint32_t length;
WSMPL *wsmp;
WLOOP *wsmp_loop;
@ -451,7 +451,7 @@ static void Parse_wsmp(DLS_Data *data, RIFF_Chunk *chunk, WSMPL **wsmp_ptr, WLOO
wsmp->lAttenuation = LittleLong(wsmp->lAttenuation);
wsmp->fulOptions = LittleLong(wsmp->fulOptions);
wsmp->cSampleLoops = LittleLong(wsmp->cSampleLoops);
loop = (WLOOP *)((BYTE *)chunk->data + wsmp->cbSize);
loop = (WLOOP *)((uint8_t *)chunk->data + wsmp->cbSize);
*wsmp_ptr = wsmp;
*wsmp_loop_ptr = loop;
for ( i = 0; i < wsmp->cSampleLoops; ++i ) {
@ -470,7 +470,7 @@ static void Parse_art(DLS_Data *data, RIFF_Chunk *chunk, CONNECTIONLIST **art_pt
CONNECTION *artList;
art->cbSize = LittleLong(art->cbSize);
art->cConnections = LittleLong(art->cConnections);
artList = (CONNECTION *)((BYTE *)chunk->data + art->cbSize);
artList = (CONNECTION *)((uint8_t *)chunk->data + art->cbSize);
*art_ptr = art;
*artList_ptr = artList;
for ( i = 0; i < art->cConnections; ++i ) {
@ -591,7 +591,7 @@ static void Parse_ptbl(DLS_Data *data, RIFF_Chunk *chunk)
ptbl->cbSize = LittleLong(ptbl->cbSize);
ptbl->cCues = LittleLong(ptbl->cCues);
data->ptbl = ptbl;
data->ptblList = (POOLCUE *)((BYTE *)chunk->data + ptbl->cbSize);
data->ptblList = (POOLCUE *)((uint8_t *)chunk->data + ptbl->cbSize);
for ( i = 0; i < ptbl->cCues; ++i ) {
data->ptblList[i].ulOffset = LittleLong(data->ptblList[i].ulOffset);
}
@ -1127,8 +1127,8 @@ static void load_region_dls(Renderer *song, Sample *sample, DLS_Instrument *ins,
sample->low_freq = note_to_freq(rgn->header->RangeKey.usLow);
sample->high_freq = note_to_freq(rgn->header->RangeKey.usHigh);
sample->root_freq = note_to_freq(rgn->wsmp->usUnityNote + rgn->wsmp->sFineTune * .01f);
sample->low_vel = (BYTE)rgn->header->RangeVelocity.usLow;
sample->high_vel = (BYTE)rgn->header->RangeVelocity.usHigh;
sample->low_vel = (uint8_t)rgn->header->RangeVelocity.usLow;
sample->high_vel = (uint8_t)rgn->header->RangeVelocity.usHigh;
sample->modes = wave->format->wBitsPerSample == 8 ? PATCH_UNSIGNED : PATCH_16;
sample->sample_rate = wave->format->dwSamplesPerSec;

View file

@ -12,7 +12,7 @@
using namespace Timidity;
#define cindex(identifier) (BYTE)(((size_t)&((SFGenComposite *)1)->identifier - 1) / 2)
#define cindex(identifier) (uint8_t)(((size_t)&((SFGenComposite *)1)->identifier - 1) / 2)
class CIOErr {};
class CBadForm {};
@ -36,8 +36,8 @@ struct GenDef
{
short Min;
short Max;
BYTE StructIndex;
BYTE Flags;
uint8_t StructIndex;
uint8_t Flags;
};
static const GenDef GenDefs[] =
@ -230,7 +230,7 @@ static inline DWORD read_id(FileReader *f)
static inline int read_byte(FileReader *f)
{
BYTE x;
uint8_t x;
if (f->Read(&x, 1) != 1)
{
throw CIOErr();
@ -1140,7 +1140,7 @@ void SFFile::TranslatePercussionPresetZone(SFPreset *preset, SFBag *pzone)
}
SetInstrumentGenerators(&perc.Generators, InstrBags[i].GenIndex, InstrBags[i + 1].GenIndex);
AddPresetGenerators(&perc.Generators, pzone->GenIndex, (pzone + 1)->GenIndex, preset);
perc.Generators.drumset = (BYTE)preset->Program;
perc.Generators.drumset = (uint8_t)preset->Program;
perc.Generators.key = key;
perc.Generators.velRange.Lo = MAX(pzone->VelRange.Lo, InstrBags[i].VelRange.Lo);
perc.Generators.velRange.Hi = MIN(pzone->VelRange.Hi, InstrBags[i].VelRange.Hi);
@ -1522,7 +1522,7 @@ void SFFile::LoadSample(SFSample *sample)
fp->Seek(SampleDataLSBOffset + sample->Start, SEEK_SET);
for (i = 0; i < sample->End - sample->Start; ++i)
{
BYTE samp;
uint8_t samp;
*fp >> samp;
sample->InMemoryData[i] = ((((int32_t(sample->InMemoryData[i] * 32768) << 8) | samp) << 8) >> 8) / 8388608.f;
}

View file

@ -32,7 +32,7 @@
namespace Timidity
{
static int convert_envelope_rate(Renderer *song, BYTE rate)
static int convert_envelope_rate(Renderer *song, uint8_t rate)
{
int r;

View file

@ -116,7 +116,7 @@ void Renderer::recompute_freq(int v)
voice[v].sample_increment = (int)(a);
}
static const BYTE vol_table[] = {
static const uint8_t vol_table[] = {
000 /* 000 */, 129 /* 001 */, 145 /* 002 */, 155 /* 003 */,
161 /* 004 */, 166 /* 005 */, 171 /* 006 */, 174 /* 007 */,
177 /* 008 */, 180 /* 009 */, 182 /* 010 */, 185 /* 011 */,
@ -872,7 +872,7 @@ void Renderer::DataEntryFineNRPN(int chan, int nrpn, int val)
{
}
void Renderer::HandleLongMessage(const BYTE *data, int len)
void Renderer::HandleLongMessage(const uint8_t *data, int len)
{
// SysEx handling goes here.
}

View file

@ -2,15 +2,15 @@ typedef uint16_t SFGenerator;
struct SFRange
{
BYTE Lo;
BYTE Hi;
uint8_t Lo;
uint8_t Hi;
};
struct SFPreset
{
char Name[21];
BYTE LoadOrder:7;
BYTE bHasGlobalZone:1;
uint8_t LoadOrder:7;
uint8_t bHasGlobalZone:1;
uint16_t Program;
uint16_t Bank;
uint16_t BagIndex;
@ -29,8 +29,8 @@ struct SFBag
struct SFInst
{
char Name[21];
BYTE Pad:7;
BYTE bHasGlobalZone:1;
uint8_t Pad:7;
uint8_t bHasGlobalZone:1;
uint16_t BagIndex;
};
@ -42,7 +42,7 @@ struct SFSample
DWORD StartLoop;
DWORD EndLoop;
DWORD SampleRate;
BYTE OriginalPitch;
uint8_t OriginalPitch;
int8_t PitchCorrection;
uint16_t SampleLink;
uint16_t SampleType;
@ -199,8 +199,8 @@ struct SFGenComposite
SFRange keyRange; // For normal use
struct // For intermediate percussion use
{
BYTE drumset;
BYTE key;
uint8_t drumset;
uint8_t key;
};
};
SFRange velRange;
@ -263,7 +263,7 @@ struct SFPerc
{
SFPreset *Preset;
SFGenComposite Generators;
BYTE LoadOrder;
uint8_t LoadOrder;
};
// Container for all parameters from a SoundFont file

View file

@ -579,7 +579,7 @@ int LoadDMXGUS()
char readbuffer[1024];
long size = data.GetLength();
long read = 0;
BYTE remap[256];
uint8_t remap[256];
FString patches[256];
memset(remap, 255, sizeof(remap));

View file

@ -220,7 +220,7 @@ struct Sample
{
struct
{
BYTE rate[6], offset[6];
uint8_t rate[6], offset[6];
} gf1;
struct
{
@ -236,7 +236,7 @@ struct Sample
int32_t
tremolo_sweep_increment, tremolo_phase_increment,
vibrato_sweep_increment, vibrato_control_ratio;
BYTE
uint8_t
tremolo_depth, vibrato_depth,
low_vel, high_vel,
type;
@ -428,7 +428,7 @@ struct Channel
bank, program, sustain, pitchbend,
mono, /* one note only on this channel */
pitchsens;
BYTE
uint8_t
volume, expression;
int8_t
panning;
@ -445,8 +445,8 @@ struct Channel
struct MinEnvelope
{
BYTE stage;
BYTE bUpdating;
uint8_t stage;
uint8_t bUpdating;
};
struct GF1Envelope : public MinEnvelope
@ -490,7 +490,7 @@ struct Envelope
SF2Envelope sf2;
};
BYTE Type;
uint8_t Type;
void Init(struct Renderer *song, struct Voice *v);
bool Update(struct Voice *v)
@ -515,7 +515,7 @@ struct Envelope
struct Voice
{
BYTE
uint8_t
status, channel, note, velocity;
Sample *sample;
float
@ -633,7 +633,7 @@ struct Renderer
~Renderer();
void HandleEvent(int status, int parm1, int parm2);
void HandleLongMessage(const BYTE *data, int len);
void HandleLongMessage(const uint8_t *data, int len);
void HandleController(int chan, int ctrl, int val);
void ComputeOutput(float *buffer, int num_samples);
void MarkInstrument(int bank, int percussion, int instr);
@ -641,10 +641,10 @@ struct Renderer
int load_missing_instruments();
int set_default_instrument(const char *name);
int convert_tremolo_sweep(BYTE sweep);
int convert_vibrato_sweep(BYTE sweep, int vib_control_ratio);
int convert_tremolo_rate(BYTE rate);
int convert_vibrato_rate(BYTE rate);
int convert_tremolo_sweep(uint8_t sweep);
int convert_vibrato_sweep(uint8_t sweep, int vib_control_ratio);
int convert_tremolo_rate(uint8_t rate);
int convert_vibrato_rate(uint8_t rate);
void recompute_freq(int voice);
void recompute_amp(Voice *v);