- most WORD and SWORD are gone.
This commit is contained in:
parent
8ab562ef13
commit
ba0f5a3f94
84 changed files with 471 additions and 469 deletions
|
|
@ -29,15 +29,15 @@ struct GF1PatchHeader
|
|||
BYTE Instruments;
|
||||
BYTE Voices;
|
||||
BYTE Channels;
|
||||
WORD WaveForms;
|
||||
WORD MasterVolume;
|
||||
uint16_t WaveForms;
|
||||
uint16_t MasterVolume;
|
||||
DWORD DataSize;
|
||||
BYTE Reserved[PATCH_HEADER_RESERVED_SIZE];
|
||||
} GCC_PACKED;
|
||||
|
||||
struct GF1InstrumentData
|
||||
{
|
||||
WORD Instrument;
|
||||
uint16_t Instrument;
|
||||
char InstrumentName[INST_NAME_SIZE];
|
||||
int InstrumentSize;
|
||||
BYTE Layers;
|
||||
|
|
@ -60,11 +60,11 @@ struct GF1PatchData
|
|||
int WaveSize;
|
||||
int StartLoop;
|
||||
int EndLoop;
|
||||
WORD SampleRate;
|
||||
uint16_t SampleRate;
|
||||
int LowFrequency;
|
||||
int HighFrequency;
|
||||
int RootFrequency;
|
||||
SWORD Tune;
|
||||
int16_t Tune;
|
||||
BYTE Balance;
|
||||
BYTE EnvelopeRate[ENVELOPES];
|
||||
BYTE EnvelopeOffset[ENVELOPES];
|
||||
|
|
@ -75,8 +75,8 @@ struct GF1PatchData
|
|||
BYTE VibratoRate;
|
||||
BYTE VibratoDepth;
|
||||
BYTE Modes;
|
||||
SWORD ScaleFrequency;
|
||||
WORD ScaleFactor; /* From 0 to 2048 or 0 to 2 */
|
||||
int16_t ScaleFrequency;
|
||||
uint16_t ScaleFactor; /* From 0 to 2048 or 0 to 2 */
|
||||
BYTE Reserved[PATCH_DATA_RESERVED_SIZE];
|
||||
} GCC_PACKED;
|
||||
#ifdef _MSC_VER
|
||||
|
|
|
|||
|
|
@ -511,7 +511,7 @@ void convert_sample_data(Sample *sp, const void *data)
|
|||
|
||||
case PATCH_16:
|
||||
{ /* 16-bit, signed */
|
||||
SWORD *cp = (SWORD *)data;
|
||||
int16_t *cp = (int16_t *)data;
|
||||
/* Convert these to samples */
|
||||
sp->data_length >>= 1;
|
||||
sp->loop_start >>= 1;
|
||||
|
|
@ -534,7 +534,7 @@ void convert_sample_data(Sample *sp, const void *data)
|
|||
|
||||
case PATCH_16 | PATCH_UNSIGNED:
|
||||
{ /* 16-bit, unsigned */
|
||||
WORD *cp = (WORD *)data;
|
||||
auto *cp = (uint16_t *)data;
|
||||
/* Convert these to samples */
|
||||
sp->data_length >>= 1;
|
||||
sp->loop_start >>= 1;
|
||||
|
|
|
|||
|
|
@ -56,9 +56,9 @@ struct RIFF_Chunk
|
|||
}
|
||||
}
|
||||
|
||||
DWORD magic;
|
||||
DWORD length;
|
||||
DWORD subtype;
|
||||
uint32_t magic;
|
||||
uint32_t length;
|
||||
uint32_t subtype;
|
||||
BYTE *data;
|
||||
RIFF_Chunk *child;
|
||||
RIFF_Chunk *next;
|
||||
|
|
@ -75,20 +75,20 @@ void PrintRIFF(RIFF_Chunk *chunk, int level);
|
|||
#define RIFF MAKE_ID('R','I','F','F')
|
||||
#define LIST MAKE_ID('L','I','S','T')
|
||||
|
||||
static bool ChunkHasSubType(DWORD magic)
|
||||
static bool ChunkHasSubType(uint32_t magic)
|
||||
{
|
||||
return (magic == RIFF || magic == LIST);
|
||||
}
|
||||
|
||||
static int ChunkHasSubChunks(DWORD magic)
|
||||
static int ChunkHasSubChunks(uint32_t magic)
|
||||
{
|
||||
return (magic == RIFF || magic == LIST);
|
||||
}
|
||||
|
||||
static void LoadSubChunks(RIFF_Chunk *chunk, BYTE *data, DWORD left)
|
||||
static void LoadSubChunks(RIFF_Chunk *chunk, BYTE *data, uint32_t left)
|
||||
{
|
||||
BYTE *subchunkData;
|
||||
DWORD subchunkDataLen;
|
||||
uint32_t subchunkDataLen;
|
||||
|
||||
while ( left > 8 ) {
|
||||
RIFF_Chunk *child = new RIFF_Chunk;
|
||||
|
|
@ -102,10 +102,10 @@ static void LoadSubChunks(RIFF_Chunk *chunk, BYTE *data, DWORD left)
|
|||
chunk->child = child;
|
||||
}
|
||||
|
||||
child->magic = *(DWORD *)data;
|
||||
child->magic = *(uint32_t *)data;
|
||||
data += 4;
|
||||
left -= 4;
|
||||
child->length = LittleLong(*(DWORD *)data);
|
||||
child->length = LittleLong(*(uint32_t *)data);
|
||||
data += 4;
|
||||
left -= 4;
|
||||
child->data = data;
|
||||
|
|
@ -117,7 +117,7 @@ static void LoadSubChunks(RIFF_Chunk *chunk, BYTE *data, DWORD left)
|
|||
subchunkData = child->data;
|
||||
subchunkDataLen = child->length;
|
||||
if ( ChunkHasSubType(child->magic) && subchunkDataLen >= 4 ) {
|
||||
child->subtype = *(DWORD *)subchunkData;
|
||||
child->subtype = *(uint32_t *)subchunkData;
|
||||
subchunkData += 4;
|
||||
subchunkDataLen -= 4;
|
||||
}
|
||||
|
|
@ -134,7 +134,7 @@ RIFF_Chunk *LoadRIFF(FILE *src)
|
|||
{
|
||||
RIFF_Chunk *chunk;
|
||||
BYTE *subchunkData;
|
||||
DWORD subchunkDataLen;
|
||||
uint32_t subchunkDataLen;
|
||||
|
||||
/* Allocate the chunk structure */
|
||||
chunk = new RIFF_Chunk;
|
||||
|
|
@ -162,7 +162,7 @@ RIFF_Chunk *LoadRIFF(FILE *src)
|
|||
subchunkData = chunk->data;
|
||||
subchunkDataLen = chunk->length;
|
||||
if ( ChunkHasSubType(chunk->magic) && subchunkDataLen >= 4 ) {
|
||||
chunk->subtype = *(DWORD *)subchunkData;
|
||||
chunk->subtype = *(uint32_t *)subchunkData;
|
||||
subchunkData += 4;
|
||||
subchunkDataLen -= 4;
|
||||
}
|
||||
|
|
@ -251,10 +251,10 @@ http://www.midi.org/about-midi/dls/dlsspec.shtml
|
|||
|
||||
/* Some typedefs so the public dls headers don't need to be modified */
|
||||
#define FAR
|
||||
typedef SWORD SHORT;
|
||||
typedef WORD USHORT;
|
||||
typedef int16_t SHORT;
|
||||
typedef uint16_t USHORT;
|
||||
typedef int32_t LONG;
|
||||
typedef DWORD ULONG;
|
||||
typedef uint32_t ULONG;
|
||||
#define mmioFOURCC MAKE_ID
|
||||
#define DEFINE_GUID(A, B, C, E, F, G, H, I, J, K, L, M)
|
||||
|
||||
|
|
@ -263,19 +263,19 @@ typedef DWORD ULONG;
|
|||
|
||||
struct WaveFMT
|
||||
{
|
||||
WORD wFormatTag;
|
||||
WORD wChannels;
|
||||
DWORD dwSamplesPerSec;
|
||||
DWORD dwAvgBytesPerSec;
|
||||
WORD wBlockAlign;
|
||||
WORD wBitsPerSample;
|
||||
uint16_t wFormatTag;
|
||||
uint16_t wChannels;
|
||||
uint32_t dwSamplesPerSec;
|
||||
uint32_t dwAvgBytesPerSec;
|
||||
uint16_t wBlockAlign;
|
||||
uint16_t wBitsPerSample;
|
||||
};
|
||||
|
||||
struct DLS_Wave
|
||||
{
|
||||
WaveFMT *format;
|
||||
BYTE *data;
|
||||
DWORD length;
|
||||
uint32_t length;
|
||||
WSMPL *wsmp;
|
||||
WLOOP *wsmp_loop;
|
||||
};
|
||||
|
|
@ -303,7 +303,7 @@ struct DLS_Data
|
|||
{
|
||||
RIFF_Chunk *chunk;
|
||||
|
||||
DWORD cInstruments;
|
||||
uint32_t cInstruments;
|
||||
DLS_Instrument *instruments;
|
||||
|
||||
POOLTABLE *ptbl;
|
||||
|
|
@ -367,7 +367,7 @@ static void AllocRegions(DLS_Instrument *instrument)
|
|||
static void FreeInstruments(DLS_Data *data)
|
||||
{
|
||||
if ( data->instruments ) {
|
||||
DWORD i;
|
||||
uint32_t i;
|
||||
for ( i = 0; i < data->cInstruments; ++i ) {
|
||||
FreeRegions(&data->instruments[i]);
|
||||
}
|
||||
|
|
@ -404,7 +404,7 @@ static void AllocWaveList(DLS_Data *data)
|
|||
|
||||
static void Parse_colh(DLS_Data *data, RIFF_Chunk *chunk)
|
||||
{
|
||||
data->cInstruments = LittleLong(*(DWORD *)chunk->data);
|
||||
data->cInstruments = LittleLong(*(uint32_t *)chunk->data);
|
||||
AllocInstruments(data);
|
||||
}
|
||||
|
||||
|
|
@ -442,7 +442,7 @@ static void Parse_wlnk(DLS_Data *data, RIFF_Chunk *chunk, DLS_Region *region)
|
|||
|
||||
static void Parse_wsmp(DLS_Data *data, RIFF_Chunk *chunk, WSMPL **wsmp_ptr, WLOOP **wsmp_loop_ptr)
|
||||
{
|
||||
DWORD i;
|
||||
uint32_t i;
|
||||
WSMPL *wsmp = (WSMPL *)chunk->data;
|
||||
WLOOP *loop;
|
||||
wsmp->cbSize = LittleLong(wsmp->cbSize);
|
||||
|
|
@ -465,7 +465,7 @@ static void Parse_wsmp(DLS_Data *data, RIFF_Chunk *chunk, WSMPL **wsmp_ptr, WLOO
|
|||
|
||||
static void Parse_art(DLS_Data *data, RIFF_Chunk *chunk, CONNECTIONLIST **art_ptr, CONNECTION **artList_ptr)
|
||||
{
|
||||
DWORD i;
|
||||
uint32_t i;
|
||||
CONNECTIONLIST *art = (CONNECTIONLIST *)chunk->data;
|
||||
CONNECTION *artList;
|
||||
art->cbSize = LittleLong(art->cbSize);
|
||||
|
|
@ -487,7 +487,7 @@ static void Parse_lart(DLS_Data *data, RIFF_Chunk *chunk, CONNECTIONLIST **conn_
|
|||
{
|
||||
/* FIXME: This only supports one set of connections */
|
||||
for ( chunk = chunk->child; chunk; chunk = chunk->next ) {
|
||||
DWORD magic = (chunk->magic == FOURCC_LIST) ? chunk->subtype : chunk->magic;
|
||||
uint32_t magic = (chunk->magic == FOURCC_LIST) ? chunk->subtype : chunk->magic;
|
||||
switch(magic) {
|
||||
case FOURCC_ART1:
|
||||
case FOURCC_ART2:
|
||||
|
|
@ -500,7 +500,7 @@ static void Parse_lart(DLS_Data *data, RIFF_Chunk *chunk, CONNECTIONLIST **conn_
|
|||
static void Parse_rgn(DLS_Data *data, RIFF_Chunk *chunk, DLS_Region *region)
|
||||
{
|
||||
for ( chunk = chunk->child; chunk; chunk = chunk->next ) {
|
||||
DWORD magic = (chunk->magic == FOURCC_LIST) ? chunk->subtype : chunk->magic;
|
||||
uint32_t magic = (chunk->magic == FOURCC_LIST) ? chunk->subtype : chunk->magic;
|
||||
switch(magic) {
|
||||
case FOURCC_RGNH:
|
||||
Parse_rgnh(data, chunk, region);
|
||||
|
|
@ -521,9 +521,9 @@ static void Parse_rgn(DLS_Data *data, RIFF_Chunk *chunk, DLS_Region *region)
|
|||
|
||||
static void Parse_lrgn(DLS_Data *data, RIFF_Chunk *chunk, DLS_Instrument *instrument)
|
||||
{
|
||||
DWORD region = 0;
|
||||
uint32_t region = 0;
|
||||
for ( chunk = chunk->child; chunk; chunk = chunk->next ) {
|
||||
DWORD magic = (chunk->magic == FOURCC_LIST) ? chunk->subtype : chunk->magic;
|
||||
uint32_t magic = (chunk->magic == FOURCC_LIST) ? chunk->subtype : chunk->magic;
|
||||
switch(magic) {
|
||||
case FOURCC_RGN:
|
||||
case FOURCC_RGN2:
|
||||
|
|
@ -538,7 +538,7 @@ static void Parse_lrgn(DLS_Data *data, RIFF_Chunk *chunk, DLS_Instrument *instru
|
|||
static void Parse_INFO_INS(DLS_Data *data, RIFF_Chunk *chunk, DLS_Instrument *instrument)
|
||||
{
|
||||
for ( chunk = chunk->child; chunk; chunk = chunk->next ) {
|
||||
DWORD magic = (chunk->magic == FOURCC_LIST) ? chunk->subtype : chunk->magic;
|
||||
uint32_t magic = (chunk->magic == FOURCC_LIST) ? chunk->subtype : chunk->magic;
|
||||
switch(magic) {
|
||||
case FOURCC_INAM: /* Name */
|
||||
instrument->name = (const char *)chunk->data;
|
||||
|
|
@ -550,7 +550,7 @@ static void Parse_INFO_INS(DLS_Data *data, RIFF_Chunk *chunk, DLS_Instrument *in
|
|||
static void Parse_ins(DLS_Data *data, RIFF_Chunk *chunk, DLS_Instrument *instrument)
|
||||
{
|
||||
for ( chunk = chunk->child; chunk; chunk = chunk->next ) {
|
||||
DWORD magic = (chunk->magic == FOURCC_LIST) ? chunk->subtype : chunk->magic;
|
||||
uint32_t magic = (chunk->magic == FOURCC_LIST) ? chunk->subtype : chunk->magic;
|
||||
switch(magic) {
|
||||
case FOURCC_INSH:
|
||||
Parse_insh(data, chunk, instrument);
|
||||
|
|
@ -571,9 +571,9 @@ static void Parse_ins(DLS_Data *data, RIFF_Chunk *chunk, DLS_Instrument *instrum
|
|||
|
||||
static void Parse_lins(DLS_Data *data, RIFF_Chunk *chunk)
|
||||
{
|
||||
DWORD instrument = 0;
|
||||
uint32_t instrument = 0;
|
||||
for ( chunk = chunk->child; chunk; chunk = chunk->next ) {
|
||||
DWORD magic = (chunk->magic == FOURCC_LIST) ? chunk->subtype : chunk->magic;
|
||||
uint32_t magic = (chunk->magic == FOURCC_LIST) ? chunk->subtype : chunk->magic;
|
||||
switch(magic) {
|
||||
case FOURCC_INS:
|
||||
if ( instrument < data->cInstruments ) {
|
||||
|
|
@ -586,7 +586,7 @@ static void Parse_lins(DLS_Data *data, RIFF_Chunk *chunk)
|
|||
|
||||
static void Parse_ptbl(DLS_Data *data, RIFF_Chunk *chunk)
|
||||
{
|
||||
DWORD i;
|
||||
uint32_t i;
|
||||
POOLTABLE *ptbl = (POOLTABLE *)chunk->data;
|
||||
ptbl->cbSize = LittleLong(ptbl->cbSize);
|
||||
ptbl->cCues = LittleLong(ptbl->cCues);
|
||||
|
|
@ -619,7 +619,7 @@ static void Parse_data(DLS_Data *data, RIFF_Chunk *chunk, DLS_Wave *wave)
|
|||
static void Parse_wave(DLS_Data *data, RIFF_Chunk *chunk, DLS_Wave *wave)
|
||||
{
|
||||
for ( chunk = chunk->child; chunk; chunk = chunk->next ) {
|
||||
DWORD magic = (chunk->magic == FOURCC_LIST) ? chunk->subtype : chunk->magic;
|
||||
uint32_t magic = (chunk->magic == FOURCC_LIST) ? chunk->subtype : chunk->magic;
|
||||
switch(magic) {
|
||||
case FOURCC_FMT:
|
||||
Parse_fmt(data, chunk, wave);
|
||||
|
|
@ -636,9 +636,9 @@ static void Parse_wave(DLS_Data *data, RIFF_Chunk *chunk, DLS_Wave *wave)
|
|||
|
||||
static void Parse_wvpl(DLS_Data *data, RIFF_Chunk *chunk)
|
||||
{
|
||||
DWORD wave = 0;
|
||||
uint32_t wave = 0;
|
||||
for ( chunk = chunk->child; chunk; chunk = chunk->next ) {
|
||||
DWORD magic = (chunk->magic == FOURCC_LIST) ? chunk->subtype : chunk->magic;
|
||||
uint32_t magic = (chunk->magic == FOURCC_LIST) ? chunk->subtype : chunk->magic;
|
||||
switch(magic) {
|
||||
case FOURCC_wave:
|
||||
if ( wave < data->ptbl->cCues ) {
|
||||
|
|
@ -652,7 +652,7 @@ static void Parse_wvpl(DLS_Data *data, RIFF_Chunk *chunk)
|
|||
static void Parse_INFO_DLS(DLS_Data *data, RIFF_Chunk *chunk)
|
||||
{
|
||||
for ( chunk = chunk->child; chunk; chunk = chunk->next ) {
|
||||
DWORD magic = (chunk->magic == FOURCC_LIST) ? chunk->subtype : chunk->magic;
|
||||
uint32_t magic = (chunk->magic == FOURCC_LIST) ? chunk->subtype : chunk->magic;
|
||||
switch(magic) {
|
||||
case FOURCC_IARL: /* Archival Location */
|
||||
break;
|
||||
|
|
@ -713,7 +713,7 @@ DLS_Data *LoadDLS(FILE *src)
|
|||
}
|
||||
|
||||
for ( chunk = data->chunk->child; chunk; chunk = chunk->next ) {
|
||||
DWORD magic = (chunk->magic == FOURCC_LIST) ? chunk->subtype : chunk->magic;
|
||||
uint32_t magic = (chunk->magic == FOURCC_LIST) ? chunk->subtype : chunk->magic;
|
||||
switch(magic) {
|
||||
case FOURCC_COLH:
|
||||
Parse_colh(data, chunk);
|
||||
|
|
@ -883,7 +883,7 @@ static const char *DestinationToString(USHORT usDestination)
|
|||
|
||||
static void PrintArt(const char *type, CONNECTIONLIST *art, CONNECTION *artList)
|
||||
{
|
||||
DWORD i;
|
||||
uint32_t i;
|
||||
printf("%s Connections:\n", type);
|
||||
for ( i = 0; i < art->cConnections; ++i ) {
|
||||
printf(" Source: %s, Control: %s, Destination: %s, Transform: %s, Scale: %d\n",
|
||||
|
|
@ -895,14 +895,14 @@ static void PrintArt(const char *type, CONNECTIONLIST *art, CONNECTION *artList)
|
|||
}
|
||||
}
|
||||
|
||||
static void PrintWave(DLS_Wave *wave, DWORD index)
|
||||
static void PrintWave(DLS_Wave *wave, uint32_t index)
|
||||
{
|
||||
WaveFMT *format = wave->format;
|
||||
if ( format ) {
|
||||
printf(" Wave %u: Format: %hu, %hu channels, %u Hz, %hu bits (length = %u)\n", index, format->wFormatTag, format->wChannels, format->dwSamplesPerSec, format->wBitsPerSample, wave->length);
|
||||
}
|
||||
if ( wave->wsmp ) {
|
||||
DWORD i;
|
||||
uint32_t i;
|
||||
printf(" wsmp->usUnityNote = %hu\n", wave->wsmp->usUnityNote);
|
||||
printf(" wsmp->sFineTune = %hd\n", wave->wsmp->sFineTune);
|
||||
printf(" wsmp->lAttenuation = %d\n", wave->wsmp->lAttenuation);
|
||||
|
|
@ -917,7 +917,7 @@ static void PrintWave(DLS_Wave *wave, DWORD index)
|
|||
}
|
||||
}
|
||||
|
||||
static void PrintRegion(DLS_Region *region, DWORD index)
|
||||
static void PrintRegion(DLS_Region *region, uint32_t index)
|
||||
{
|
||||
printf(" Region %u:\n", index);
|
||||
if ( region->header ) {
|
||||
|
|
@ -933,7 +933,7 @@ static void PrintRegion(DLS_Region *region, DWORD index)
|
|||
printf(" wlnk->ulTableIndex = %u\n", region->wlnk->ulTableIndex);
|
||||
}
|
||||
if ( region->wsmp ) {
|
||||
DWORD i;
|
||||
uint32_t i;
|
||||
printf(" wsmp->usUnityNote = %hu\n", region->wsmp->usUnityNote);
|
||||
printf(" wsmp->sFineTune = %hd\n", region->wsmp->sFineTune);
|
||||
printf(" wsmp->lAttenuation = %d\n", region->wsmp->lAttenuation);
|
||||
|
|
@ -951,14 +951,14 @@ static void PrintRegion(DLS_Region *region, DWORD index)
|
|||
}
|
||||
}
|
||||
|
||||
static void PrintInstrument(DLS_Instrument *instrument, DWORD index)
|
||||
static void PrintInstrument(DLS_Instrument *instrument, uint32_t index)
|
||||
{
|
||||
printf("Instrument %u:\n", index);
|
||||
if ( instrument->name ) {
|
||||
printf(" Name: %s\n", instrument->name);
|
||||
}
|
||||
if ( instrument->header ) {
|
||||
DWORD i;
|
||||
uint32_t i;
|
||||
printf(" ulBank = 0x%8.8x\n", instrument->header->Locale.ulBank);
|
||||
printf(" ulInstrument = %u\n", instrument->header->Locale.ulInstrument);
|
||||
printf(" Regions: %u\n", instrument->header->cRegions);
|
||||
|
|
@ -976,13 +976,13 @@ void PrintDLS(DLS_Data *data)
|
|||
printf("DLS Data:\n");
|
||||
printf("cInstruments = %u\n", data->cInstruments);
|
||||
if ( data->instruments ) {
|
||||
DWORD i;
|
||||
uint32_t i;
|
||||
for ( i = 0; i < data->cInstruments; ++i ) {
|
||||
PrintInstrument(&data->instruments[i], i);
|
||||
}
|
||||
}
|
||||
if ( data->ptbl && data->ptbl->cCues > 0 ) {
|
||||
DWORD i;
|
||||
uint32_t i;
|
||||
printf("Cues: ");
|
||||
for ( i = 0; i < data->ptbl->cCues; ++i ) {
|
||||
if ( i > 0 ) {
|
||||
|
|
@ -993,7 +993,7 @@ void PrintDLS(DLS_Data *data)
|
|||
printf("\n");
|
||||
}
|
||||
if ( data->waveList && data->ptbl ) {
|
||||
DWORD i;
|
||||
uint32_t i;
|
||||
printf("Waves:\n");
|
||||
for ( i = 0; i < data->ptbl->cCues; ++i ) {
|
||||
PrintWave(&data->waveList[i], i);
|
||||
|
|
@ -1116,7 +1116,7 @@ static int load_connection(ULONG cConnections, CONNECTION *artList, USHORT desti
|
|||
return value;
|
||||
}
|
||||
|
||||
static void load_region_dls(Renderer *song, Sample *sample, DLS_Instrument *ins, DWORD index)
|
||||
static void load_region_dls(Renderer *song, Sample *sample, DLS_Instrument *ins, uint32_t index)
|
||||
{
|
||||
DLS_Region *rgn = &ins->regions[index];
|
||||
DLS_Wave *wave = &song->patches->waveList[rgn->wlnk->ulTableIndex];
|
||||
|
|
@ -1187,7 +1187,7 @@ static void load_region_dls(Renderer *song, Sample *sample, DLS_Instrument *ins,
|
|||
Instrument *load_instrument_dls(Renderer *song, int drum, int bank, int instrument)
|
||||
{
|
||||
Instrument *inst;
|
||||
DWORD i;
|
||||
uint32_t i;
|
||||
DLS_Instrument *dls_ins = NULL;
|
||||
|
||||
if (song->patches == NULL)
|
||||
|
|
|
|||
|
|
@ -192,7 +192,7 @@ ListHandler PdtaHandlers[] =
|
|||
{ 0, 0 }
|
||||
};
|
||||
|
||||
static double timecent_to_sec(SWORD timecent)
|
||||
static double timecent_to_sec(int16_t timecent)
|
||||
{
|
||||
if (timecent == -32768)
|
||||
return 0;
|
||||
|
|
@ -250,7 +250,7 @@ static inline int read_char(FileReader *f)
|
|||
|
||||
static inline int read_uword(FileReader *f)
|
||||
{
|
||||
WORD x;
|
||||
uint16_t x;
|
||||
if (f->Read(&x, 2) != 2)
|
||||
{
|
||||
throw CIOErr();
|
||||
|
|
@ -260,7 +260,7 @@ static inline int read_uword(FileReader *f)
|
|||
|
||||
static inline int read_sword(FileReader *f)
|
||||
{
|
||||
SWORD x;
|
||||
int16_t x;
|
||||
if (f->Read(&x, 2) != 2)
|
||||
{
|
||||
throw CIOErr();
|
||||
|
|
@ -317,7 +317,7 @@ static void check_list(FileReader *f, DWORD id, DWORD filelen, DWORD &chunklen)
|
|||
|
||||
static void ParseIfil(SFFile *sf2, FileReader *f, DWORD chunkid, DWORD chunklen)
|
||||
{
|
||||
WORD major, minor;
|
||||
uint16_t major, minor;
|
||||
|
||||
if (chunklen != 4)
|
||||
{
|
||||
|
|
@ -473,7 +473,7 @@ static void ParsePhdr(SFFile *sf2, FileReader *f, DWORD chunkid, DWORD chunklen)
|
|||
static void ParseBag(SFFile *sf2, FileReader *f, DWORD chunkid, DWORD chunklen)
|
||||
{
|
||||
SFBag *bags, *bag;
|
||||
WORD prev_mod = 0;
|
||||
uint16_t prev_mod = 0;
|
||||
int numbags;
|
||||
int i;
|
||||
|
||||
|
|
@ -513,7 +513,7 @@ static void ParseBag(SFFile *sf2, FileReader *f, DWORD chunkid, DWORD chunklen)
|
|||
for (bag = bags, i = numbags; i != 0; --i, ++bag)
|
||||
{
|
||||
bag->GenIndex = read_uword(f);
|
||||
WORD mod = read_uword(f);
|
||||
uint16_t mod = read_uword(f);
|
||||
// Section 7.3, page 22:
|
||||
// If the generator or modulator indices are non-monotonic or do not
|
||||
// match the size of the respective PGEN or PMOD sub-chunks, the file
|
||||
|
|
@ -1165,7 +1165,7 @@ void SFFile::SetInstrumentGenerators(SFGenComposite *composite, int start, int s
|
|||
continue;
|
||||
}
|
||||
// Set the generator
|
||||
((WORD *)composite)[GenDefs[gen->Oper].StructIndex] = gen->uAmount;
|
||||
((uint16_t *)composite)[GenDefs[gen->Oper].StructIndex] = gen->uAmount;
|
||||
if (gen->Oper == GEN_sampleID)
|
||||
{ // Anything past sampleID is ignored.
|
||||
break;
|
||||
|
|
@ -1209,7 +1209,7 @@ void SFFile::AddPresetGenerators(SFGenComposite *composite, int start, int stop,
|
|||
continue;
|
||||
}
|
||||
// Add to instrument/default generator.
|
||||
int added = ((SWORD *)composite)[def->StructIndex] + gen->Amount;
|
||||
int added = ((int16_t *)composite)[def->StructIndex] + gen->Amount;
|
||||
// Clamp to proper range.
|
||||
if (added <= -32768 && def->Flags & GENF_32768_Ok)
|
||||
{
|
||||
|
|
@ -1219,7 +1219,7 @@ void SFFile::AddPresetGenerators(SFGenComposite *composite, int start, int stop,
|
|||
{
|
||||
added = clamp<int>(added, def->Min, def->Max);
|
||||
}
|
||||
((SWORD *)composite)[def->StructIndex] = added;
|
||||
((int16_t *)composite)[def->StructIndex] = added;
|
||||
gen_set[gen->Oper] = true;
|
||||
if (gen->Oper == GEN_instrument)
|
||||
{ // Anything past the instrument generator is ignored.
|
||||
|
|
@ -1513,7 +1513,7 @@ void SFFile::LoadSample(SFSample *sample)
|
|||
// Load 16-bit sample data.
|
||||
for (i = 0; i < sample->End - sample->Start; ++i)
|
||||
{
|
||||
SWORD samp;
|
||||
int16_t samp;
|
||||
*fp >> samp;
|
||||
sample->InMemoryData[i] = samp / 32768.f;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -485,7 +485,7 @@ static sample_t *rs_vib_bidir(sample_t *resample_buffer, float rate, Voice *vp,
|
|||
sample_t *resample_voice(Renderer *song, Voice *vp, int *countptr)
|
||||
{
|
||||
int ofs;
|
||||
WORD modes;
|
||||
uint16_t modes;
|
||||
|
||||
if (vp->sample->sample_rate == 0)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
typedef WORD SFGenerator;
|
||||
typedef uint16_t SFGenerator;
|
||||
|
||||
struct SFRange
|
||||
{
|
||||
|
|
@ -11,16 +11,16 @@ struct SFPreset
|
|||
char Name[21];
|
||||
BYTE LoadOrder:7;
|
||||
BYTE bHasGlobalZone:1;
|
||||
WORD Program;
|
||||
WORD Bank;
|
||||
WORD BagIndex;
|
||||
uint16_t Program;
|
||||
uint16_t Bank;
|
||||
uint16_t BagIndex;
|
||||
/* Don't care about library, genre, and morphology */
|
||||
};
|
||||
|
||||
struct SFBag
|
||||
{
|
||||
WORD GenIndex;
|
||||
// WORD ModIndex; // If I am feeling ambitious, I might add support for modulators some day.
|
||||
uint16_t GenIndex;
|
||||
// uint16_t ModIndex; // If I am feeling ambitious, I might add support for modulators some day.
|
||||
SFRange KeyRange;
|
||||
SFRange VelRange;
|
||||
int Target; // Either an instrument or sample index
|
||||
|
|
@ -31,7 +31,7 @@ struct SFInst
|
|||
char Name[21];
|
||||
BYTE Pad:7;
|
||||
BYTE bHasGlobalZone:1;
|
||||
WORD BagIndex;
|
||||
uint16_t BagIndex;
|
||||
};
|
||||
|
||||
struct SFSample
|
||||
|
|
@ -44,8 +44,8 @@ struct SFSample
|
|||
DWORD SampleRate;
|
||||
BYTE OriginalPitch;
|
||||
SBYTE PitchCorrection;
|
||||
WORD SampleLink;
|
||||
WORD SampleType;
|
||||
uint16_t SampleLink;
|
||||
uint16_t SampleType;
|
||||
char Name[21];
|
||||
};
|
||||
|
||||
|
|
@ -68,8 +68,8 @@ struct SFGenList
|
|||
union
|
||||
{
|
||||
SFRange Range;
|
||||
SWORD Amount;
|
||||
WORD uAmount;
|
||||
int16_t Amount;
|
||||
uint16_t uAmount;
|
||||
};
|
||||
};
|
||||
|
||||
|
|
@ -142,20 +142,20 @@ enum
|
|||
|
||||
struct SFModulator
|
||||
{
|
||||
WORD Index:7;
|
||||
WORD CC:1;
|
||||
WORD Dir:1; /* 0 = min->max, 1 = max->min */
|
||||
WORD Polarity:1; /* 0 = unipolar, 1 = bipolar */
|
||||
WORD Type:6;
|
||||
uint16_t Index:7;
|
||||
uint16_t CC:1;
|
||||
uint16_t Dir:1; /* 0 = min->max, 1 = max->min */
|
||||
uint16_t Polarity:1; /* 0 = unipolar, 1 = bipolar */
|
||||
uint16_t Type:6;
|
||||
};
|
||||
|
||||
struct SFModList
|
||||
{
|
||||
SFModulator SrcOper;
|
||||
SFGenerator DestOper;
|
||||
SWORD Amount;
|
||||
int16_t Amount;
|
||||
SFModulator AmtSrcOper;
|
||||
WORD Transform;
|
||||
uint16_t Transform;
|
||||
};
|
||||
|
||||
// Modulator sources when CC is 0
|
||||
|
|
@ -206,55 +206,55 @@ struct SFGenComposite
|
|||
SFRange velRange;
|
||||
union
|
||||
{
|
||||
WORD instrument; // At preset level
|
||||
WORD sampleID; // At instrument level
|
||||
uint16_t instrument; // At preset level
|
||||
uint16_t sampleID; // At instrument level
|
||||
};
|
||||
SWORD modLfoToPitch;
|
||||
SWORD vibLfoToPitch;
|
||||
SWORD modEnvToPitch;
|
||||
SWORD initialFilterFc;
|
||||
SWORD initialFilterQ;
|
||||
SWORD modLfoToFilterFc;
|
||||
SWORD modEnvToFilterFc;
|
||||
SWORD modLfoToVolume;
|
||||
SWORD chorusEffectsSend;
|
||||
SWORD reverbEffectsSend;
|
||||
SWORD pan;
|
||||
SWORD delayModLFO;
|
||||
SWORD freqModLFO;
|
||||
SWORD delayVibLFO;
|
||||
SWORD freqVibLFO;
|
||||
SWORD delayModEnv;
|
||||
SWORD attackModEnv;
|
||||
SWORD holdModEnv;
|
||||
SWORD decayModEnv;
|
||||
SWORD sustainModEnv;
|
||||
SWORD releaseModEnv;
|
||||
SWORD keynumToModEnvHold;
|
||||
SWORD keynumToModEnvDecay;
|
||||
SWORD delayVolEnv;
|
||||
SWORD attackVolEnv;
|
||||
SWORD holdVolEnv;
|
||||
SWORD decayVolEnv;
|
||||
SWORD sustainVolEnv;
|
||||
SWORD releaseVolEnv;
|
||||
SWORD keynumToVolEnvHold;
|
||||
SWORD keynumToVolEnvDecay;
|
||||
SWORD initialAttenuation;
|
||||
SWORD coarseTune;
|
||||
SWORD fineTune;
|
||||
SWORD scaleTuning;
|
||||
int16_t modLfoToPitch;
|
||||
int16_t vibLfoToPitch;
|
||||
int16_t modEnvToPitch;
|
||||
int16_t initialFilterFc;
|
||||
int16_t initialFilterQ;
|
||||
int16_t modLfoToFilterFc;
|
||||
int16_t modEnvToFilterFc;
|
||||
int16_t modLfoToVolume;
|
||||
int16_t chorusEffectsSend;
|
||||
int16_t reverbEffectsSend;
|
||||
int16_t pan;
|
||||
int16_t delayModLFO;
|
||||
int16_t freqModLFO;
|
||||
int16_t delayVibLFO;
|
||||
int16_t freqVibLFO;
|
||||
int16_t delayModEnv;
|
||||
int16_t attackModEnv;
|
||||
int16_t holdModEnv;
|
||||
int16_t decayModEnv;
|
||||
int16_t sustainModEnv;
|
||||
int16_t releaseModEnv;
|
||||
int16_t keynumToModEnvHold;
|
||||
int16_t keynumToModEnvDecay;
|
||||
int16_t delayVolEnv;
|
||||
int16_t attackVolEnv;
|
||||
int16_t holdVolEnv;
|
||||
int16_t decayVolEnv;
|
||||
int16_t sustainVolEnv;
|
||||
int16_t releaseVolEnv;
|
||||
int16_t keynumToVolEnvHold;
|
||||
int16_t keynumToVolEnvDecay;
|
||||
int16_t initialAttenuation;
|
||||
int16_t coarseTune;
|
||||
int16_t fineTune;
|
||||
int16_t scaleTuning;
|
||||
|
||||
// The following are only for instruments:
|
||||
SWORD startAddrsOffset, startAddrsCoarseOffset;
|
||||
SWORD endAddrsOffset, endAddrsCoarseOffset;
|
||||
SWORD startLoopAddrsOffset, startLoopAddrsCoarseOffset;
|
||||
SWORD endLoopAddrsOffset, endLoopAddrsCoarseOffset;
|
||||
SWORD keynum;
|
||||
SWORD velocity;
|
||||
WORD sampleModes;
|
||||
SWORD exclusiveClass;
|
||||
SWORD overridingRootKey;
|
||||
int16_t startAddrsOffset, startAddrsCoarseOffset;
|
||||
int16_t endAddrsOffset, endAddrsCoarseOffset;
|
||||
int16_t startLoopAddrsOffset, startLoopAddrsCoarseOffset;
|
||||
int16_t endLoopAddrsOffset, endLoopAddrsCoarseOffset;
|
||||
int16_t keynum;
|
||||
int16_t velocity;
|
||||
uint16_t sampleModes;
|
||||
int16_t exclusiveClass;
|
||||
int16_t overridingRootKey;
|
||||
};
|
||||
|
||||
// Intermediate percussion representation
|
||||
|
|
|
|||
|
|
@ -240,13 +240,13 @@ struct Sample
|
|||
tremolo_depth, vibrato_depth,
|
||||
low_vel, high_vel,
|
||||
type;
|
||||
WORD
|
||||
uint16_t
|
||||
modes;
|
||||
SWORD
|
||||
int16_t
|
||||
panning;
|
||||
WORD
|
||||
uint16_t
|
||||
scale_factor, key_group;
|
||||
SWORD
|
||||
int16_t
|
||||
scale_note;
|
||||
bool
|
||||
self_nonexclusive;
|
||||
|
|
@ -254,7 +254,7 @@ struct Sample
|
|||
left_offset, right_offset;
|
||||
|
||||
// SF2 stuff
|
||||
SWORD tune;
|
||||
int16_t tune;
|
||||
SBYTE velocity;
|
||||
|
||||
float initial_attenuation;
|
||||
|
|
@ -432,7 +432,7 @@ struct Channel
|
|||
volume, expression;
|
||||
SBYTE
|
||||
panning;
|
||||
WORD
|
||||
uint16_t
|
||||
rpn, nrpn;
|
||||
bool
|
||||
nrpn_mode;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue