- Removed some GCC warnings.

- Fixed: MinGW doesn't have _get_pgmptr(), so it couldn't compile i_main.cpp.
- Fixed: MOD_WAVETABLE and MOD_SWSYNTH are not defined by w32api, so MinGW
  failed compiling the new MIDI code.
- Fixed: LocalSndInfo and LocalSndSeq in S_Start() need to be const char
  pointers, since "" is a constant.
- Fixed: parsecontext.h was missing a newline at the end of the file.


SVN r904 (trunk)
This commit is contained in:
Randy Heit 2008-04-12 05:33:20 +00:00
parent 0d18580ff0
commit b340f9c762
10 changed files with 52 additions and 19 deletions

View file

@ -1,4 +1,11 @@
April 11, 2008 April 11, 2008
- Removed some GCC warnings.
- Fixed: MinGW doesn't have _get_pgmptr(), so it couldn't compile i_main.cpp.
- Fixed: MOD_WAVETABLE and MOD_SWSYNTH are not defined by w32api, so MinGW
failed compiling the new MIDI code.
- Fixed: LocalSndInfo and LocalSndSeq in S_Start() need to be const char
pointers, since "" is a constant.
- Fixed: parsecontext.h was missing a newline at the end of the file.
- Fixed: Timidity::Channel::mono, rpn, and nrpn were not initialized. In - Fixed: Timidity::Channel::mono, rpn, and nrpn were not initialized. In
particular, this meant that every channel was almost certainly in mono mode, particular, this meant that every channel was almost certainly in mono mode,
which can sound pretty bad if the song isn't meant to be played that way. which can sound pretty bad if the song isn't meant to be played that way.

View file

@ -150,4 +150,4 @@ struct FParseContext
}; };
#endif #endif

View file

@ -359,8 +359,8 @@ void S_Start ()
// Check for local sound definitions. Only reload if they differ // Check for local sound definitions. Only reload if they differ
// from the previous ones. // from the previous ones.
char *LocalSndInfo; const char *LocalSndInfo;
char *LocalSndSeq; const char *LocalSndSeq;
// To be certain better check whether level is valid! // To be certain better check whether level is valid!
if (level.info && level.info->soundinfo) if (level.info && level.info->soundinfo)

View file

@ -89,6 +89,12 @@ typedef BYTE *LPSTR;
#define MEVT_EVENTPARM(x) ((x) & 0xffffff) #define MEVT_EVENTPARM(x) ((x) & 0xffffff)
#define MOM_DONE 969 #define MOM_DONE 969
#else
// w32api does not define these
#ifndef MOD_WAVETABLE
#define MOD_WAVETABLE 6
#define MOD_SWSYNTH 7
#endif
#endif #endif
class MIDIDevice class MIDIDevice

View file

@ -123,10 +123,8 @@ static void PrintMidiDevice (int id, const char *name, WORD tech, DWORD support)
case MOD_SQSYNTH: Printf ("SQSYNTH"); break; case MOD_SQSYNTH: Printf ("SQSYNTH"); break;
case MOD_FMSYNTH: Printf ("FMSYNTH"); break; case MOD_FMSYNTH: Printf ("FMSYNTH"); break;
case MOD_MAPPER: Printf ("MAPPER"); break; case MOD_MAPPER: Printf ("MAPPER"); break;
#ifdef MOD_WAVETABLE
case MOD_WAVETABLE: Printf ("WAVETABLE"); break; case MOD_WAVETABLE: Printf ("WAVETABLE"); break;
case MOD_SWSYNTH: Printf ("SWSYNTH"); break; case MOD_SWSYNTH: Printf ("SWSYNTH"); break;
#endif
} }
if (support & MIDICAPS_CACHE) if (support & MIDICAPS_CACHE)
{ {
@ -154,8 +152,8 @@ CCMD (snd_listmididevices)
MMRESULT res; MMRESULT res;
PrintMidiDevice (-3, "Emulated OPL FM Synth", MOD_FMSYNTH, 0); PrintMidiDevice (-3, "Emulated OPL FM Synth", MOD_FMSYNTH, 0);
PrintMidiDevice (-2, "TiMidity++", 0, MOD_WAVETABLE | MOD_SWSYNTH); PrintMidiDevice (-2, "TiMidity++", 0, MOD_SWSYNTH);
PrintMidiDevice (-1, "FMOD", 0, MOD_WAVETABLE | MOD_SWSYNTH); PrintMidiDevice (-1, "FMOD", 0, MOD_SWSYNTH);
if (nummididevices != 0) if (nummididevices != 0)
{ {
for (id = 0; id < nummididevices; ++id) for (id = 0; id < nummididevices; ++id)

View file

@ -784,6 +784,7 @@ void MIDISong2::Precache()
BYTE ev, data1, data2, command, channel; BYTE ev, data1, data2, command, channel;
int len; int len;
data2 = 0; // Silence, GCC
while (track->TrackP < track->MaxTrackP) while (track->TrackP < track->MaxTrackP)
{ {
ev = track->TrackBegin[track->TrackP++]; ev = track->TrackBegin[track->TrackP++];

View file

@ -278,6 +278,8 @@ static InstrumentLayer *load_instrument(Renderer *song, const char *name, int fo
* THEN, for each sample, see below * THEN, for each sample, see below
*/ */
vlayer_count = 0; // Silence, GCC
if (!memcmp(tmp + 93, "SF2EXT", 6)) if (!memcmp(tmp + 93, "SF2EXT", 6))
{ {
sf2flag = true; sf2flag = true;
@ -318,7 +320,8 @@ static InstrumentLayer *load_instrument(Renderer *song, const char *name, int fo
vlayer_count = 1; vlayer_count = 1;
} }
lastlp = 0; lastlp = NULL;
headlp = NULL; // Silence, GCC
for (vlayer = 0; vlayer < vlayer_count; vlayer++) for (vlayer = 0; vlayer < vlayer_count; vlayer++)
{ {
@ -375,6 +378,10 @@ static InstrumentLayer *load_instrument(Renderer *song, const char *name, int fo
{ {
sample_count = ip->right_samples; sample_count = ip->right_samples;
} }
else
{
sample_count = 0;
}
for (i = 0; i < sample_count; i++) for (i = 0; i < sample_count; i++)
{ {
@ -453,6 +460,11 @@ fail:
{ {
sp = &(ip->right_sample[i]); sp = &(ip->right_sample[i]);
} }
else
{
assert(0);
sp = NULL;
}
READ_LONG(sp->data_length); READ_LONG(sp->data_length);
READ_LONG(sp->loop_start); READ_LONG(sp->loop_start);
@ -544,6 +556,9 @@ fail:
else else
{ {
skip(fp, 36); skip(fp, 36);
sample_volume = 0;
sf2delay = 0;
} }
/* Mark this as a fixed-pitch instrument if such a deed is desired. */ /* Mark this as a fixed-pitch instrument if such a deed is desired. */
@ -729,7 +744,7 @@ fail:
void convert_sample_data(Sample *sp, const void *data) void convert_sample_data(Sample *sp, const void *data)
{ {
/* convert everything to 32-bit floating point data */ /* convert everything to 32-bit floating point data */
sample_t *newdata; sample_t *newdata = NULL;
switch (sp->modes & (MODES_16BIT | MODES_UNSIGNED)) switch (sp->modes & (MODES_16BIT | MODES_UNSIGNED))
{ {
@ -895,7 +910,7 @@ static int fill_bank(Renderer *song, int dr, int b)
{ {
cmsg(CMSG_ERROR, VERB_NORMAL, cmsg(CMSG_ERROR, VERB_NORMAL,
"Couldn't load instrument %s (%s %d, program %d)", "Couldn't load instrument %s (%s %d, program %d)",
bank->tone[i].name, bank->tone[i].name.GetChars(),
(dr)? "drum set" : "tone bank", b, i); (dr)? "drum set" : "tone bank", b, i);
errors++; errors++;
} }

View file

@ -1063,7 +1063,7 @@ void Timidity_FreeDLS(DLS_Data *patches)
/* convert timecents to sec */ /* convert timecents to sec */
static double to_msec(int timecent) static double to_msec(int timecent)
{ {
if (timecent == 0x80000000 || timecent == 0) if (timecent == INT_MIN || timecent == 0)
return 0.0; return 0.0;
return 1000.0 * pow(2.0, (double)(timecent / 65536) / 1200.0); return 1000.0 * pow(2.0, (double)(timecent / 65536) / 1200.0);
} }
@ -1209,7 +1209,7 @@ InstrumentLayer *load_instrument_dls(Renderer *song, int drum, int bank, int ins
{ {
InstrumentLayer *layer; InstrumentLayer *layer;
DWORD i; DWORD i;
DLS_Instrument *dls_ins; DLS_Instrument *dls_ins = NULL;
if (song->patches == NULL) if (song->patches == NULL)
return NULL; return NULL;
@ -1217,16 +1217,16 @@ InstrumentLayer *load_instrument_dls(Renderer *song, int drum, int bank, int ins
drum = drum ? 0x80000000 : 0; drum = drum ? 0x80000000 : 0;
for (i = 0; i < song->patches->cInstruments; ++i) { for (i = 0; i < song->patches->cInstruments; ++i) {
dls_ins = &song->patches->instruments[i]; dls_ins = &song->patches->instruments[i];
if ((dls_ins->header->Locale.ulBank & 0x80000000) == drum && if ((dls_ins->header->Locale.ulBank & 0x80000000) == (ULONG)drum &&
((dls_ins->header->Locale.ulBank >> 8) & 0xFF) == bank && ((dls_ins->header->Locale.ulBank >> 8) & 0xFF) == (ULONG)bank &&
dls_ins->header->Locale.ulInstrument == instrument) dls_ins->header->Locale.ulInstrument == (ULONG)instrument)
break; break;
} }
if (i == song->patches->cInstruments && !bank) { if (i == song->patches->cInstruments && !bank) {
for (i = 0; i < song->patches->cInstruments; ++i) { for (i = 0; i < song->patches->cInstruments; ++i) {
dls_ins = &song->patches->instruments[i]; dls_ins = &song->patches->instruments[i];
if ((dls_ins->header->Locale.ulBank & 0x80000000) == drum && if ((dls_ins->header->Locale.ulBank & 0x80000000) == (ULONG)drum &&
dls_ins->header->Locale.ulInstrument == instrument) dls_ins->header->Locale.ulInstrument == (ULONG)instrument)
break; break;
} }
} }

View file

@ -28,8 +28,6 @@
#include "timidity.h" #include "timidity.h"
#pragma intrinsic(pow)
namespace Timidity namespace Timidity
{ {

View file

@ -825,10 +825,18 @@ void DoMain (HINSTANCE hInstance)
// Figure out what directory the program resides in. // Figure out what directory the program resides in.
char *program; char *program;
#ifdef _MSC_VER
if (_get_pgmptr(&program) != 0) if (_get_pgmptr(&program) != 0)
{ {
I_FatalError("Could not determine program location."); I_FatalError("Could not determine program location.");
} }
#else
char progbuff[1024];
GetModuleFileName(0, progbuff, sizeof(progbuff));
progbuff[1023] = '\0';
program = progbuff;
#endif
progdir = program; progdir = program;
program = progdir.LockBuffer(); program = progdir.LockBuffer();
*(strrchr(program, '\\') + 1) = '\0'; *(strrchr(program, '\\') + 1) = '\0';