- 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
- 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
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.

View file

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

View file

@ -89,6 +89,12 @@ typedef BYTE *LPSTR;
#define MEVT_EVENTPARM(x) ((x) & 0xffffff)
#define MOM_DONE 969
#else
// w32api does not define these
#ifndef MOD_WAVETABLE
#define MOD_WAVETABLE 6
#define MOD_SWSYNTH 7
#endif
#endif
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_FMSYNTH: Printf ("FMSYNTH"); break;
case MOD_MAPPER: Printf ("MAPPER"); break;
#ifdef MOD_WAVETABLE
case MOD_WAVETABLE: Printf ("WAVETABLE"); break;
case MOD_SWSYNTH: Printf ("SWSYNTH"); break;
#endif
}
if (support & MIDICAPS_CACHE)
{
@ -154,8 +152,8 @@ CCMD (snd_listmididevices)
MMRESULT res;
PrintMidiDevice (-3, "Emulated OPL FM Synth", MOD_FMSYNTH, 0);
PrintMidiDevice (-2, "TiMidity++", 0, MOD_WAVETABLE | MOD_SWSYNTH);
PrintMidiDevice (-1, "FMOD", 0, MOD_WAVETABLE | MOD_SWSYNTH);
PrintMidiDevice (-2, "TiMidity++", 0, MOD_SWSYNTH);
PrintMidiDevice (-1, "FMOD", 0, MOD_SWSYNTH);
if (nummididevices != 0)
{
for (id = 0; id < nummididevices; ++id)

View file

@ -784,6 +784,7 @@ void MIDISong2::Precache()
BYTE ev, data1, data2, command, channel;
int len;
data2 = 0; // Silence, GCC
while (track->TrackP < track->MaxTrackP)
{
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
*/
vlayer_count = 0; // Silence, GCC
if (!memcmp(tmp + 93, "SF2EXT", 6))
{
sf2flag = true;
@ -318,7 +320,8 @@ static InstrumentLayer *load_instrument(Renderer *song, const char *name, int fo
vlayer_count = 1;
}
lastlp = 0;
lastlp = NULL;
headlp = NULL; // Silence, GCC
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;
}
else
{
sample_count = 0;
}
for (i = 0; i < sample_count; i++)
{
@ -453,6 +460,11 @@ fail:
{
sp = &(ip->right_sample[i]);
}
else
{
assert(0);
sp = NULL;
}
READ_LONG(sp->data_length);
READ_LONG(sp->loop_start);
@ -544,6 +556,9 @@ fail:
else
{
skip(fp, 36);
sample_volume = 0;
sf2delay = 0;
}
/* 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)
{
/* convert everything to 32-bit floating point data */
sample_t *newdata;
sample_t *newdata = NULL;
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,
"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);
errors++;
}

View file

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

View file

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

View file

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