FS#12259: Remove '-w' compiler option for MikMod. Resolve all yet unreported compiler warnings and fix a bug in load_gt2.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30424 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Andree Buschmann 2011-09-03 23:17:42 +00:00
parent 7887e596a9
commit e2186479d5
27 changed files with 239 additions and 58 deletions

View file

@ -250,6 +250,7 @@ int S69_Load(int curious)
int i;
SAMPLE *current;
S69SAMPLE sample;
(void)curious;
/* module header */
_mm_read_UBYTES(mh->marker,2,modreader);

View file

@ -332,12 +332,14 @@ static UBYTE* AMF_ConvertTrack(void)
int AMF_Load(int curious)
{
int t,u,realtrackcnt,realsmpcnt,defaultpanning;
int u,defaultpanning;
unsigned int t,realtrackcnt,realsmpcnt;
AMFSAMPLE s;
SAMPLE *q;
UWORD *track_remap;
ULONG samplepos;
int channel_remap[16];
(void)curious;
/* try to read module header */
_mm_read_UBYTES(mh->id,3,modreader);
@ -505,7 +507,7 @@ int AMF_Load(int curious)
realtrackcnt=track_remap[t];
for(t=0;t<of.numpat*of.numchn;t++)
of.patterns[t]=(of.patterns[t]<=mh->numtracks)?
track_remap[of.patterns[t]]-1:realtrackcnt;
track_remap[of.patterns[t]]-1:(int)realtrackcnt;
MikMod_free(track_remap);

View file

@ -237,7 +237,8 @@ static UBYTE *ConvertTrack(MODNOTE *n)
/* Loads all patterns of a modfile and converts them into the 3 byte format. */
static int ML_LoadPatterns(void)
{
int t, s, tracks = 0;
int t, tracks = 0;
unsigned int s;
if (!AllocPatterns()) {
return 0;
@ -277,6 +278,7 @@ static int ASY_Load(int curious)
MSAMPINFO *s;
CHAR *descr=asylum;
ULONG seekpos;
(void)curious;
// no title in asylum amf files :(
strcpy(mh->songname, "");
@ -286,7 +288,7 @@ static int ASY_Load(int curious)
mh->num_orders = _mm_read_UBYTE(modreader);
// skip unknown byte
_mm_read_UBYTE(modreader);
(void)_mm_read_UBYTE(modreader);
_mm_read_UBYTES(mh->positions, 256, modreader);
/* read samples headers*/
@ -300,7 +302,7 @@ static int ASY_Load(int curious)
s->finetune = _mm_read_UBYTE(modreader);
s->volume = _mm_read_UBYTE(modreader);
_mm_read_UBYTE(modreader); // skip unknown byte
(void)_mm_read_UBYTE(modreader); // skip unknown byte
s->length = _mm_read_I_ULONG(modreader);
s->reppos = _mm_read_I_ULONG(modreader);
s->replen = _mm_read_I_ULONG(modreader);

View file

@ -237,6 +237,7 @@ int DSM_Load(int curious)
DSMINST s;
SAMPLE *q;
int cursmp=0,curpat=0,track=0;
(void)curious;
blocklp=0;
blockln=12;

View file

@ -180,6 +180,7 @@ int FAR_Load(int curious)
FARSAMPLE s;
FARNOTE *crow;
UBYTE smap[8];
(void)curious;
/* try to read module header (first part) */
_mm_read_UBYTES(mh1->id,4,modreader);

View file

@ -343,6 +343,7 @@ int GDM_Load(int curious)
SAMPLE *q;
GDMSAMPLE s;
ULONG position;
(void)curious;
/* read header */
_mm_read_string(mh->id1,4,modreader);

View file

@ -217,7 +217,7 @@ GT_CHUNK *loadChunk(void)
_mm_read_M_ULONGS(&new_chunk->gt2.chunk_size, 1, modreader);
new_chunk->gt2.module_name[32] = 0;
_mm_read_UBYTES(&new_chunk->gt2.module_name, 32, modreader);
new_chunk->gt2.module_name[160] = 0;
new_chunk->gt2.comments_author[160] = 0;
_mm_read_UBYTES(&new_chunk->gt2.comments_author, 160, modreader);
_mm_read_UBYTES(&new_chunk->gt2.date_day, 1, modreader);
_mm_read_UBYTES(&new_chunk->gt2.date_month, 1, modreader);
@ -332,6 +332,7 @@ int GT2_Test(void)
int GT2_Load(int curious)
{
GT_CHUNK *tmp;
(void)curious;
_mm_fseek(modreader, 0, SEEK_SET);
while ( (tmp = loadChunk() ))

View file

@ -388,6 +388,7 @@ int IMF_Load(int curious)
ULONG *nextwav=NULL;
UWORD wavcnt=0;
UBYTE id[4];
(void)curious;
/* try to read the module header */
_mm_read_string(mh->songname,32,modreader);
@ -515,9 +516,9 @@ int IMF_Load(int curious)
ih. name##beg=_mm_read_UBYTE(modreader); \
ih. name##end=_mm_read_UBYTE(modreader); \
ih. name##flg=_mm_read_UBYTE(modreader); \
_mm_read_UBYTE(modreader); \
_mm_read_UBYTE(modreader); \
_mm_read_UBYTE(modreader)
(void)_mm_read_UBYTE(modreader); \
(void)_mm_read_UBYTE(modreader); \
(void)_mm_read_UBYTE(modreader)
#else
#define IMF_FinishLoadingEnvelope(name) \
ih. name/**/pts=_mm_read_UBYTE(modreader); \
@ -525,9 +526,9 @@ int IMF_Load(int curious)
ih. name/**/beg=_mm_read_UBYTE(modreader); \
ih. name/**/end=_mm_read_UBYTE(modreader); \
ih. name/**/flg=_mm_read_UBYTE(modreader); \
_mm_read_UBYTE(modreader); \
_mm_read_UBYTE(modreader); \
_mm_read_UBYTE(modreader)
(void)_mm_read_UBYTE(modreader); \
(void)_mm_read_UBYTE(modreader); \
(void)_mm_read_UBYTE(modreader)
#endif
IMF_FinishLoadingEnvelope(vol);
@ -626,7 +627,7 @@ int IMF_Load(int curious)
}
_mm_read_string(s->samplename,13,modreader);
_mm_read_UBYTE(modreader);_mm_read_UBYTE(modreader);_mm_read_UBYTE(modreader);
(void)_mm_read_UBYTE(modreader);(void)_mm_read_UBYTE(modreader);(void)_mm_read_UBYTE(modreader);
s->length =_mm_read_I_ULONG(modreader);
s->loopstart =_mm_read_I_ULONG(modreader);
s->loopend =_mm_read_I_ULONG(modreader);

View file

@ -238,10 +238,10 @@ static int IT_GetNumChannels(UWORD patrows)
ch=(flag-1)&63;
remap[ch]=0;
if(flag & 128) mask[ch]=_mm_read_UBYTE(modreader);
if(mask[ch]&1) _mm_read_UBYTE(modreader);
if(mask[ch]&2) _mm_read_UBYTE(modreader);
if(mask[ch]&4) _mm_read_UBYTE(modreader);
if(mask[ch]&8) { _mm_read_UBYTE(modreader);_mm_read_UBYTE(modreader); }
if(mask[ch]&1) (void)_mm_read_UBYTE(modreader);
if(mask[ch]&2) (void)_mm_read_UBYTE(modreader);
if(mask[ch]&4) (void)_mm_read_UBYTE(modreader);
if(mask[ch]&8) { (void)_mm_read_UBYTE(modreader);(void)_mm_read_UBYTE(modreader); }
}
} while(row<patrows);
@ -726,7 +726,7 @@ int IT_Load(int curious)
ih.trkvers = _mm_read_I_UWORD(modreader);
ih.numsmp = _mm_read_UBYTE(modreader);
_mm_read_UBYTE(modreader);
(void)_mm_read_UBYTE(modreader);
_mm_read_string(ih.name,26,modreader);
_mm_read_UBYTES(ih.blank01,6,modreader);
_mm_read_I_UWORDS(ih.samptable,ITNOTECNT,modreader);
@ -751,7 +751,7 @@ int IT_Load(int curious)
ih. name##node[lp]=_mm_read_##type (modreader); \
ih. name##tick[lp]=_mm_read_I_UWORD(modreader); \
} \
_mm_read_UBYTE(modreader)
(void)_mm_read_UBYTE(modreader)
#else
#define IT_LoadEnvelope(name,type) \
ih. name/**/flg =_mm_read_UBYTE(modreader); \
@ -764,7 +764,7 @@ int IT_Load(int curious)
ih. name/**/node[lp]=_mm_read_/**/type (modreader); \
ih. name/**/tick[lp]=_mm_read_I_UWORD(modreader); \
} \
_mm_read_UBYTE(modreader)
(void)_mm_read_UBYTE(modreader)
#endif
IT_LoadEnvelope(vol,UBYTE);

View file

@ -147,12 +147,12 @@ static int LoadModuleHeader(MODULEHEADER *mh)
Returns: 0 indecisive; 1 = UST; 2 = 15-inst */
static int CheckPatternType(int numpat)
{
int t;
unsigned int t;
UBYTE eff, dat;
for(t=0;t<numpat*(64U*4);t++) {
/* Load the pattern into the temp buffer and scan it */
_mm_read_UBYTE(modreader);_mm_read_UBYTE(modreader);
(void)_mm_read_UBYTE(modreader);(void)_mm_read_UBYTE(modreader);
eff = _mm_read_UBYTE(modreader);
dat = _mm_read_UBYTE(modreader);
@ -372,7 +372,8 @@ static UBYTE *M15_ConvertTrack(MODNOTE* n)
/* Loads all patterns of a modfile and converts them into the 3 byte format. */
static int M15_LoadPatterns(void)
{
int t,s,tracks=0;
int t,tracks=0;
unsigned int s;
if(!AllocPatterns()) return 0;
if(!AllocTracks()) return 0;

View file

@ -309,7 +309,8 @@ static UBYTE *ConvertTrack(MODNOTE *n, int numchn)
/* Loads all patterns of a modfile and converts them into the 3 byte format. */
static int ML_LoadPatterns(void)
{
int t, s, tracks = 0;
int t, tracks = 0;
unsigned int s;
if (!AllocPatterns())
return 0;

View file

@ -145,6 +145,7 @@ int MTM_Load(int curious)
int t,u;
MTMSAMPLE s;
SAMPLE *q;
(void)curious;
/* try to read module header */
_mm_read_UBYTES(mh->id,3,modreader);
@ -219,7 +220,7 @@ int MTM_Load(int curious)
if(!AllocPositions(of.numpos)) return 0;
for(t=0;t<of.numpos;t++)
of.positions[t]=_mm_read_UBYTE(modreader);
for(;t<128;t++) _mm_read_UBYTE(modreader);
for(;t<128;t++) (void)_mm_read_UBYTE(modreader);
if(_mm_eof(modreader)) {
_mm_errno = MMERR_LOADING_HEADER;
return 0;

View file

@ -203,7 +203,7 @@ static int OKT_doSAMP(int len)
s.len = _mm_read_M_ULONG(modreader);
s.loopbeg = _mm_read_M_UWORD(modreader) * 2;
s.looplen = _mm_read_M_UWORD(modreader) * 2;
_mm_read_UBYTE(modreader);
(void)_mm_read_UBYTE(modreader);
s.volume = _mm_read_UBYTE(modreader);
_mm_read_M_UWORD(modreader);
@ -330,6 +330,7 @@ int OKT_Load(int curious)
int seen_cmod = 0, seen_samp = 0, seen_slen = 0, seen_plen = 0, seen_patt
= 0, seen_spee = 0;
int patnum = 0, insnum = 0;
(void)curious;
/* skip OKTALYZER header */
_mm_fseek(modreader, 8, SEEK_SET);

View file

@ -172,9 +172,9 @@ static int S3M_GetNumChannels(void)
if(flag) {
ch=flag&31;
if(mh->channels[ch]<32) remap[ch] = 0;
if(flag&32) {_mm_read_UBYTE(modreader);_mm_read_UBYTE(modreader);}
if(flag&64) _mm_read_UBYTE(modreader);
if(flag&128){_mm_read_UBYTE(modreader);_mm_read_UBYTE(modreader);}
if(flag&32) {(void)_mm_read_UBYTE(modreader);(void)_mm_read_UBYTE(modreader);}
if(flag&64) (void)_mm_read_UBYTE(modreader);
if(flag&128){(void)_mm_read_UBYTE(modreader);(void)_mm_read_UBYTE(modreader);}
} else row++;
}
return 0;

View file

@ -224,7 +224,8 @@ static UBYTE *STM_ConvertTrack(STMNOTE *n)
static int STM_LoadPatterns(void)
{
int t,s,tracks=0;
int t,tracks=0;
unsigned int s;
if(!AllocPatterns()) return 0;
if(!AllocTracks()) return 0;
@ -254,6 +255,7 @@ int STM_Load(int curious)
int t;
ULONG MikMod_ISA; /* We must generate our own ISA, it's not stored in stm */
SAMPLE *q;
(void)curious;
/* try to read stm header */
_mm_read_string(mh->songname,20,modreader);

View file

@ -131,6 +131,7 @@ int ULT_Load(int curious)
ULTSAMPLE s;
ULTHEADER mh;
UBYTE nos,noc,rbnop;
(void)curious;
/* try to read module header */
_mm_read_string(mh.id,15,modreader);

View file

@ -504,6 +504,7 @@ int UNI_Load(int curious)
char *modtype,*oldtype=NULL;
INSTRUMENT *d;
SAMPLE *q;
(void)curious;
/* read module header */
_mm_read_UBYTES(mh.id,4,modreader);
@ -514,7 +515,7 @@ int UNI_Load(int curious)
if(universion>=6) {
if (universion==6)
_mm_read_UBYTE(modreader);
(void)_mm_read_UBYTE(modreader);
else
universion=_mm_read_M_UWORD(modreader);

View file

@ -500,7 +500,7 @@ static int LoadInstruments(void)
/* read the remainder of the header
(2 bytes for 1.03, 22 for 1.04) */
if (headend>=_mm_ftell(modreader)) for(u=headend-_mm_ftell(modreader);u;u--) _mm_read_UBYTE(modreader);
if (headend>=_mm_ftell(modreader)) for(u=headend-_mm_ftell(modreader);u;u--) (void)_mm_read_UBYTE(modreader);
/* we can't trust the envelope point count here, as some
modules have incorrect values (K_OSPACE.XM reports 32 volume
@ -634,7 +634,7 @@ static int LoadInstruments(void)
break;
}
_mm_fseek(modreader,ck,SEEK_SET);
for(u=headend-_mm_ftell(modreader);u;u--) _mm_read_UBYTE(modreader);
for(u=headend-_mm_ftell(modreader);u;u--) (void)_mm_read_UBYTE(modreader);
if(_mm_eof(modreader)) {
MikMod_free(nextwav);MikMod_free(wh);
@ -664,6 +664,7 @@ int XM_Load(int curious)
int t,u;
int dummypat=0;
char tracker[21],modtype[60];
(void)curious;
/* try to read module header */
_mm_read_string(mh->id,17,modreader);

View file

@ -50,9 +50,6 @@ static unsigned char* audio_buffer;
static size_t audio_buffer_free;
/* The rockbox plugin interface */
MEM_FUNCTION_WRAPPERS;
bool quit;
int playingtime IBSS_ATTR;
MODULE *module IBSS_ATTR;
@ -147,10 +144,12 @@ void mmsupp_printf(const char *fmt, ...)
/************************* File Access ***************************/
/* support function for qsort() */
/* not used
static int compare(const void* p1, const void* p2)
{
return rb->strcasecmp(*((char **)p1), *((char **)p2));
}
*/
bool mod_ext(const char ext[])
{
@ -290,7 +289,7 @@ void get_more(unsigned char** start, size_t* size)
#endif
}
void showinfo()
void showinfo(void)
{
char statustext[LINE_LENGTH];
@ -348,9 +347,9 @@ void showinfo()
rb->lcd_update();
}
void showsamples()
void showsamples(void)
{
int i, j;
int i;
char statustext[LINE_LENGTH];
if ( screenupdated )
@ -367,9 +366,9 @@ void showsamples()
screenupdated = true;
}
void showinstruments()
void showinstruments(void)
{
int i, j;
int i;
char statustext[LINE_LENGTH];
if ( screenupdated )
@ -386,7 +385,7 @@ void showinstruments()
screenupdated = true;
}
void showcomments()
void showcomments(void)
{
int i, j=0, k=0, l;
char statustext[LINE_LENGTH];
@ -425,7 +424,7 @@ void showcomments()
screenupdated = true;
}
int changedisplay()
void changedisplay(void)
{
display = (display+1) % 4;
@ -494,7 +493,7 @@ static struct configdata config[] =
{ TYPE_BOOL, 0, 1, { .bool_p = &settings.boost }, "CPU Boost", NULL},
};
void applysettings()
void applysettings(void)
{
md_pansep = settings.pansep;
md_reverb = settings.reverb;
@ -525,7 +524,6 @@ void applysettings()
int settings_menu(void)
{
int selection = 0;
bool old_val;
MENUITEM_STRINGLIST(settings_menu, "Mikmod Settings", NULL, "Panning Separation",
"Reverberation", "Interpolation", "Reverse Channels", "Surround",

View file

@ -18,7 +18,7 @@ MIKMOD_OBJ := $(call c2obj, $(MIKMOD_SRC))
# add source files to OTHER_SRC to get automatic dependencies
OTHER_SRC += $(MIKMOD_SRC)
MIKMODCFLAGS = $(PLUGINFLAGS) -I$(MIKMODSRCDIR) -w
MIKMODCFLAGS = $(PLUGINFLAGS) -I$(MIKMODSRCDIR)
ifeq ($(CPU),coldfire)
MIKMODCFLAGS += -O0
else

View file

@ -140,7 +140,9 @@ extern void _mm_iobase_setcur(MREADER*);
extern void _mm_iobase_revert(MREADER*);
extern int _mm_fopen(CHAR*,CHAR*);
extern int _mm_fclose(int);
#if !defined(ROCKBOX)
extern void _mm_write_string(CHAR*,MWRITER*);
#endif
extern int _mm_read_string (CHAR*,int,MREADER*);
extern SWORD _mm_read_M_SWORD(MREADER*);

View file

@ -93,7 +93,7 @@ void FreeLinear(void)
int speed_to_finetune(ULONG speed,int sample)
{
int ctmp=0,tmp,note=1,finetune=0;
ULONG ctmp=0,tmp,note=1,finetune=0;
speed>>=1;
while((tmp=getfrequency(of.flags,getlinearperiod(note<<1,0)))<speed) {

View file

@ -33,7 +33,7 @@
#include "mikmod_internals.h"
#define ALIGN_STRIDE 16
/* not used
static void * align_pointer(char *ptr, size_t stride)
{
char *pptr = ptr + sizeof(void*);
@ -53,7 +53,7 @@ static void *get_pointer(void *data)
size_t _ptr = *(size_t*)_pptr;
return (void*)_ptr;
}
*/
void* MikMod_realloc(void *data, size_t size)
{

View file

@ -80,6 +80,7 @@ static long _mm_MemReader_Tell(MREADER* reader);
int _mm_fopen(CHAR* fname,CHAR* attrib)
{
int fp;
(void)attrib;
//if(!(fp=fopen(fname,attrib))) {
// _mm_errno = MMERR_OPENING_FILE;
@ -212,11 +213,17 @@ static long _mm_FileWriter_Tell(MWRITER* writer)
static int _mm_FileWriter_Write(MWRITER* writer,void* ptr,size_t size)
{
//return (fwrite(ptr,size,1,((MFILEWRITER*)writer)->file)==size);
return (write(ptr,size,((MFILEWRITER*)writer)->file)==size);
//return (write(ptr,size,((MFILEWRITER*)writer)->file)==(int)size);
(void)writer;
(void)ptr;
(void)size;
return 0;
}
static int _mm_FileWriter_Put(MWRITER* writer,int value)
{
(void)writer;
(void)value;
//return fputc(value,((MFILEWRITER*)writer)->file);
return 1; // TODO
}
@ -292,7 +299,7 @@ static int _mm_MemReader_Read(MREADER* reader,void* ptr,size_t size)
s = ((MMEMREADER*)reader)->buffer;
s += ((MMEMREADER*)reader)->pos;
if ( ((MMEMREADER*)reader)->pos + size > ((MMEMREADER*)reader)->len)
if ( ((MMEMREADER*)reader)->pos + (long)size > ((MMEMREADER*)reader)->len)
{
((MMEMREADER*)reader)->pos = ((MMEMREADER*)reader)->len;
return 0; /* not enough remaining bytes */
@ -354,7 +361,6 @@ static long _mm_MemReader_Tell(MREADER* reader)
}
/*========== Write functions */
void _mm_write_string(CHAR* data,MWRITER* writer)
{
if(data)

View file

@ -546,6 +546,8 @@ static void DoArpeggio(UWORD tick, UWORD flags, MP_CONTROL *a, UBYTE style)
static int DoPTEffect0(UWORD tick, UWORD flags, MP_CONTROL *a, MODULE *mod, SWORD channel)
{
UBYTE dat;
(void)mod;
(void)channel;
dat = UniGetByte();
if (!tick) {
@ -563,6 +565,9 @@ static int DoPTEffect0(UWORD tick, UWORD flags, MP_CONTROL *a, MODULE *mod, SWOR
static int DoPTEffect1(UWORD tick, UWORD flags, MP_CONTROL *a, MODULE *mod, SWORD channel)
{
UBYTE dat;
(void)flags;
(void)mod;
(void)channel;
dat = UniGetByte();
if (!tick && dat)
@ -577,6 +582,9 @@ static int DoPTEffect1(UWORD tick, UWORD flags, MP_CONTROL *a, MODULE *mod, SWOR
static int DoPTEffect2(UWORD tick, UWORD flags, MP_CONTROL *a, MODULE *mod, SWORD channel)
{
UBYTE dat;
(void)flags;
(void)mod;
(void)channel;
dat = UniGetByte();
if (!tick && dat)
@ -621,6 +629,9 @@ static void DoToneSlide(UWORD tick, MP_CONTROL *a)
static int DoPTEffect3(UWORD tick, UWORD flags, MP_CONTROL *a, MODULE *mod, SWORD channel)
{
UBYTE dat;
(void)flags;
(void)mod;
(void)channel;
dat=UniGetByte();
if ((!tick)&&(dat)) a->portspeed=(UWORD)dat<<2;
@ -673,6 +684,9 @@ static void DoVibrato(UWORD tick, MP_CONTROL *a)
static int DoPTEffect4(UWORD tick, UWORD flags, MP_CONTROL *a, MODULE *mod, SWORD channel)
{
UBYTE dat;
(void)flags;
(void)mod;
(void)channel;
dat=UniGetByte();
if (!tick) {
@ -701,6 +715,9 @@ static void DoVolSlide(MP_CONTROL *a, UBYTE dat)
static int DoPTEffect5(UWORD tick, UWORD flags, MP_CONTROL *a, MODULE *mod, SWORD channel)
{
UBYTE dat;
(void)flags;
(void)mod;
(void)channel;
dat=UniGetByte();
if (a->main.period)
@ -719,6 +736,9 @@ static int DoPTEffect7(UWORD tick, UWORD flags, MP_CONTROL *a, MODULE *mod, SWOR
UBYTE dat;
UBYTE q;
UWORD temp = 0; /* silence warning */
(void)flags;
(void)mod;
(void)channel;
dat=UniGetByte();
if (!tick) {
@ -766,6 +786,8 @@ static int DoPTEffect7(UWORD tick, UWORD flags, MP_CONTROL *a, MODULE *mod, SWOR
static int DoPTEffect8(UWORD tick, UWORD flags, MP_CONTROL *a, MODULE *mod, SWORD channel)
{
UBYTE dat;
(void)tick;
(void)flags;
dat = UniGetByte();
if (mod->panflag)
@ -777,13 +799,16 @@ static int DoPTEffect8(UWORD tick, UWORD flags, MP_CONTROL *a, MODULE *mod, SWOR
static int DoPTEffect9(UWORD tick, UWORD flags, MP_CONTROL *a, MODULE *mod, SWORD channel)
{
UBYTE dat;
(void)flags;
(void)mod;
(void)channel;
dat=UniGetByte();
if (!tick) {
if (dat) a->soffset=(UWORD)dat<<8;
a->main.start=a->hioffset|a->soffset;
if ((a->main.s)&&(a->main.start>a->main.s->length))
if ((a->main.s)&&(a->main.start > (SLONG)a->main.s->length))
a->main.start=a->main.s->flags&(SF_LOOP|SF_BIDI)?
a->main.s->loopstart:a->main.s->length;
}
@ -794,6 +819,9 @@ static int DoPTEffect9(UWORD tick, UWORD flags, MP_CONTROL *a, MODULE *mod, SWOR
static int DoPTEffectA(UWORD tick, UWORD flags, MP_CONTROL *a, MODULE *mod, SWORD channel)
{
UBYTE dat;
(void)flags;
(void)mod;
(void)channel;
dat=UniGetByte();
if (tick)
@ -814,6 +842,8 @@ static int DoPTEffect6(UWORD tick, UWORD flags, MP_CONTROL *a, MODULE *mod, SWOR
static int DoPTEffectB(UWORD tick, UWORD flags, MP_CONTROL *a, MODULE *mod, SWORD channel)
{
UBYTE dat;
(void)a;
(void)channel;
dat=UniGetByte();
@ -848,6 +878,9 @@ static int DoPTEffectB(UWORD tick, UWORD flags, MP_CONTROL *a, MODULE *mod, SWOR
static int DoPTEffectC(UWORD tick, UWORD flags, MP_CONTROL *a, MODULE *mod, SWORD channel)
{
UBYTE dat;
(void)flags;
(void)mod;
(void)channel;
dat=UniGetByte();
if (tick) return 0;
@ -861,6 +894,8 @@ static int DoPTEffectC(UWORD tick, UWORD flags, MP_CONTROL *a, MODULE *mod, SWOR
static int DoPTEffectD(UWORD tick, UWORD flags, MP_CONTROL *a, MODULE *mod, SWORD channel)
{
UBYTE dat;
(void)a;
(void)channel;
dat=UniGetByte();
if ((tick)||(mod->patdly2)) return 0;
@ -1022,6 +1057,9 @@ static int DoPTEffectE(UWORD tick, UWORD flags, MP_CONTROL *a, MODULE *mod, SWOR
static int DoPTEffectF(UWORD tick, UWORD flags, MP_CONTROL *a, MODULE *mod, SWORD channel)
{
UBYTE dat;
(void)flags;
(void)a;
(void)channel;
dat=UniGetByte();
if (tick||mod->patdly2) return 0;
@ -1041,6 +1079,9 @@ static int DoPTEffectF(UWORD tick, UWORD flags, MP_CONTROL *a, MODULE *mod, SWOR
static int DoS3MEffectA(UWORD tick, UWORD flags, MP_CONTROL *a, MODULE *mod, SWORD channel)
{
UBYTE speed;
(void)flags;
(void)a;
(void)channel;
speed = UniGetByte();
@ -1091,6 +1132,9 @@ static void DoS3MVolSlide(UWORD tick, UWORD flags, MP_CONTROL *a, UBYTE inf)
static int DoS3MEffectD(UWORD tick, UWORD flags, MP_CONTROL *a, MODULE *mod, SWORD channel)
{
(void)mod;
(void)channel;
DoS3MVolSlide(tick, flags, a, UniGetByte());
return 1;
@ -1121,6 +1165,9 @@ static void DoS3MSlideDn(UWORD tick, MP_CONTROL *a, UBYTE inf)
static int DoS3MEffectE(UWORD tick, UWORD flags, MP_CONTROL *a, MODULE *mod, SWORD channel)
{
UBYTE dat;
(void)flags;
(void)mod;
(void)channel;
dat=UniGetByte();
if (a->main.period)
@ -1152,6 +1199,9 @@ static void DoS3MSlideUp(UWORD tick, MP_CONTROL *a, UBYTE inf)
static int DoS3MEffectF(UWORD tick, UWORD flags, MP_CONTROL *a, MODULE *mod, SWORD channel)
{
UBYTE dat;
(void)flags;
(void)mod;
(void)channel;
dat=UniGetByte();
if (a->main.period)
@ -1163,6 +1213,9 @@ static int DoS3MEffectF(UWORD tick, UWORD flags, MP_CONTROL *a, MODULE *mod, SWO
static int DoS3MEffectI(UWORD tick, UWORD flags, MP_CONTROL *a, MODULE *mod, SWORD channel)
{
UBYTE inf, on, off;
(void)flags;
(void)mod;
(void)channel;
inf = UniGetByte();
if (inf)
@ -1189,6 +1242,8 @@ static int DoS3MEffectI(UWORD tick, UWORD flags, MP_CONTROL *a, MODULE *mod, SWO
static int DoS3MEffectQ(UWORD tick, UWORD flags, MP_CONTROL *a, MODULE *mod, SWORD channel)
{
UBYTE inf;
(void)mod;
(void)channel;
inf = UniGetByte();
if (a->main.period) {
@ -1251,6 +1306,9 @@ static int DoS3MEffectR(UWORD tick, UWORD flags, MP_CONTROL *a, MODULE *mod, SWO
{
UBYTE dat, q;
UWORD temp=0; /* silence warning */
(void)flags;
(void)mod;
(void)channel;
dat = UniGetByte();
if (!tick) {
@ -1298,6 +1356,9 @@ static int DoS3MEffectR(UWORD tick, UWORD flags, MP_CONTROL *a, MODULE *mod, SWO
static int DoS3MEffectT(UWORD tick, UWORD flags, MP_CONTROL *a, MODULE *mod, SWORD channel)
{
UBYTE tempo;
(void)flags;
(void)a;
(void)channel;
tempo = UniGetByte();
@ -1313,6 +1374,9 @@ static int DoS3MEffectU(UWORD tick, UWORD flags, MP_CONTROL *a, MODULE *mod, SWO
{
UBYTE dat, q;
UWORD temp = 0; /* silence warning */
(void)flags;
(void)mod;
(void)channel;
dat = UniGetByte();
if (!tick) {
@ -1358,6 +1422,10 @@ static int DoS3MEffectU(UWORD tick, UWORD flags, MP_CONTROL *a, MODULE *mod, SWO
static int DoKeyOff(UWORD tick, UWORD flags, MP_CONTROL *a, MODULE *mod, SWORD channel)
{
(void)tick;
(void)flags;
(void)mod;
(void)channel;
a->main.keyoff|=KEY_OFF;
if ((!(a->main.volflg&EF_ON))||(a->main.volflg&EF_LOOP))
a->main.keyoff=KEY_KILL;
@ -1368,6 +1436,8 @@ static int DoKeyOff(UWORD tick, UWORD flags, MP_CONTROL *a, MODULE *mod, SWORD c
static int DoKeyFade(UWORD tick, UWORD flags, MP_CONTROL *a, MODULE *mod, SWORD channel)
{
UBYTE dat;
(void)flags;
(void)channel;
dat=UniGetByte();
if ((tick>=dat)||(tick==mod->sngspd-1)) {
@ -1386,6 +1456,9 @@ static int DoKeyFade(UWORD tick, UWORD flags, MP_CONTROL *a, MODULE *mod, SWORD
static int DoXMEffectA(UWORD tick, UWORD flags, MP_CONTROL *a, MODULE *mod, SWORD channel)
{
UBYTE inf, lo, hi;
(void)flags;
(void)mod;
(void)channel;
inf = UniGetByte();
if (inf)
@ -1411,6 +1484,9 @@ static int DoXMEffectA(UWORD tick, UWORD flags, MP_CONTROL *a, MODULE *mod, SWOR
static int DoXMEffect6(UWORD tick, UWORD flags, MP_CONTROL *a, MODULE *mod, SWORD channel)
{
(void)flags;
(void)mod;
(void)channel;
if (a->main.period)
DoVibrato(tick, a);
@ -1420,6 +1496,9 @@ static int DoXMEffect6(UWORD tick, UWORD flags, MP_CONTROL *a, MODULE *mod, SWOR
static int DoXMEffectE1(UWORD tick, UWORD flags, MP_CONTROL *a, MODULE *mod, SWORD channel)
{
UBYTE dat;
(void)flags;
(void)mod;
(void)channel;
dat=UniGetByte();
if (!tick) {
@ -1434,6 +1513,9 @@ static int DoXMEffectE1(UWORD tick, UWORD flags, MP_CONTROL *a, MODULE *mod, SWO
static int DoXMEffectE2(UWORD tick, UWORD flags, MP_CONTROL *a, MODULE *mod, SWORD channel)
{
UBYTE dat;
(void)flags;
(void)mod;
(void)channel;
dat=UniGetByte();
if (!tick) {
@ -1448,6 +1530,9 @@ static int DoXMEffectE2(UWORD tick, UWORD flags, MP_CONTROL *a, MODULE *mod, SWO
static int DoXMEffectEA(UWORD tick, UWORD flags, MP_CONTROL *a, MODULE *mod, SWORD channel)
{
UBYTE dat;
(void)flags;
(void)mod;
(void)channel;
dat=UniGetByte();
if (!tick)
@ -1461,6 +1546,9 @@ static int DoXMEffectEA(UWORD tick, UWORD flags, MP_CONTROL *a, MODULE *mod, SWO
static int DoXMEffectEB(UWORD tick, UWORD flags, MP_CONTROL *a, MODULE *mod, SWORD channel)
{
UBYTE dat;
(void)flags;
(void)mod;
(void)channel;
dat=UniGetByte();
if (!tick)
@ -1473,6 +1561,10 @@ static int DoXMEffectEB(UWORD tick, UWORD flags, MP_CONTROL *a, MODULE *mod, SWO
static int DoXMEffectG(UWORD tick, UWORD flags, MP_CONTROL *a, MODULE *mod, SWORD channel)
{
(void)tick;
(void)flags;
(void)a;
(void)channel;
mod->volume=UniGetByte()<<1;
if (mod->volume>128) mod->volume=128;
@ -1482,6 +1574,9 @@ static int DoXMEffectG(UWORD tick, UWORD flags, MP_CONTROL *a, MODULE *mod, SWOR
static int DoXMEffectH(UWORD tick, UWORD flags, MP_CONTROL *a, MODULE *mod, SWORD channel)
{
UBYTE inf;
(void)flags;
(void)a;
(void)channel;
inf = UniGetByte();
@ -1503,6 +1598,9 @@ static int DoXMEffectH(UWORD tick, UWORD flags, MP_CONTROL *a, MODULE *mod, SWOR
static int DoXMEffectL(UWORD tick, UWORD flags, MP_CONTROL *a, MODULE *mod, SWORD channel)
{
UBYTE dat;
(void)flags;
(void)mod;
(void)channel;
dat=UniGetByte();
if ((!tick)&&(a->main.i)) {
@ -1529,6 +1627,8 @@ static int DoXMEffectP(UWORD tick, UWORD flags, MP_CONTROL *a, MODULE *mod, SWOR
{
UBYTE inf, lo, hi;
SWORD pan;
(void)flags;
(void)channel;
inf = UniGetByte();
if (!mod->panflag)
@ -1557,6 +1657,9 @@ static int DoXMEffectP(UWORD tick, UWORD flags, MP_CONTROL *a, MODULE *mod, SWOR
static int DoXMEffectX1(UWORD tick, UWORD flags, MP_CONTROL *a, MODULE *mod, SWORD channel)
{
UBYTE dat;
(void)flags;
(void)mod;
(void)channel;
dat = UniGetByte();
if (dat)
@ -1577,6 +1680,9 @@ static int DoXMEffectX1(UWORD tick, UWORD flags, MP_CONTROL *a, MODULE *mod, SWO
static int DoXMEffectX2(UWORD tick, UWORD flags, MP_CONTROL *a, MODULE *mod, SWORD channel)
{
UBYTE dat;
(void)flags;
(void)mod;
(void)channel;
dat = UniGetByte();
if (dat)
@ -1638,6 +1744,9 @@ static void DoITToneSlide(UWORD tick, MP_CONTROL *a, UBYTE dat)
static int DoITEffectG(UWORD tick, UWORD flags, MP_CONTROL *a, MODULE *mod, SWORD channel)
{
(void)flags;
(void)mod;
(void)channel;
DoITToneSlide(tick, a, UniGetByte());
return 0;
@ -1689,6 +1798,9 @@ static void DoITVibrato(UWORD tick, MP_CONTROL *a, UBYTE dat)
static int DoITEffectH(UWORD tick, UWORD flags, MP_CONTROL *a, MODULE *mod, SWORD channel)
{
(void)flags;
(void)mod;
(void)channel;
DoITVibrato(tick, a, UniGetByte());
return 0;
@ -1697,6 +1809,10 @@ static int DoITEffectH(UWORD tick, UWORD flags, MP_CONTROL *a, MODULE *mod, SWOR
static int DoITEffectI(UWORD tick, UWORD flags, MP_CONTROL *a, MODULE *mod, SWORD channel)
{
UBYTE inf, on, off;
(void)tick;
(void)flags;
(void)mod;
(void)channel;
inf = UniGetByte();
if (inf)
@ -1720,6 +1836,10 @@ static int DoITEffectI(UWORD tick, UWORD flags, MP_CONTROL *a, MODULE *mod, SWOR
static int DoITEffectM(UWORD tick, UWORD flags, MP_CONTROL *a, MODULE *mod, SWORD channel)
{
(void)tick;
(void)flags;
(void)mod;
(void)channel;
a->main.chanvol=UniGetByte();
if (a->main.chanvol>64)
a->main.chanvol=64;
@ -1732,6 +1852,10 @@ static int DoITEffectM(UWORD tick, UWORD flags, MP_CONTROL *a, MODULE *mod, SWOR
static int DoITEffectN(UWORD tick, UWORD flags, MP_CONTROL *a, MODULE *mod, SWORD channel)
{
UBYTE inf, lo, hi;
(void)tick;
(void)flags;
(void)mod;
(void)channel;
inf = UniGetByte();
@ -1768,6 +1892,9 @@ static int DoITEffectP(UWORD tick, UWORD flags, MP_CONTROL *a, MODULE *mod, SWOR
{
UBYTE inf, lo, hi;
SWORD pan;
(void)flags;
(void)mod;
(void)channel;
inf = UniGetByte();
if (inf)
@ -1805,6 +1932,10 @@ static int DoITEffectT(UWORD tick, UWORD flags, MP_CONTROL *a, MODULE *mod, SWOR
{
UBYTE tempo;
SWORD temp;
(void)tick;
(void)flags;
(void)a;
(void)channel;
tempo = UniGetByte();
@ -1826,6 +1957,9 @@ static int DoITEffectU(UWORD tick, UWORD flags, MP_CONTROL *a, MODULE *mod, SWOR
{
UBYTE dat, q;
UWORD temp = 0; /* silence warning */
(void)flags;
(void)mod;
(void)channel;
dat = UniGetByte();
if (!tick) {
@ -1870,6 +2004,9 @@ static int DoITEffectU(UWORD tick, UWORD flags, MP_CONTROL *a, MODULE *mod, SWOR
static int DoITEffectW(UWORD tick, UWORD flags, MP_CONTROL *a, MODULE *mod, SWORD channel)
{
UBYTE inf, lo, hi;
(void)flags;
(void)a;
(void)channel;
inf = UniGetByte();
@ -1906,6 +2043,7 @@ static int DoITEffectY(UWORD tick, UWORD flags, MP_CONTROL *a, MODULE *mod, SWOR
{
UBYTE dat, q;
SLONG temp = 0; /* silence warning */
(void)flags;
dat=UniGetByte();
@ -1998,7 +2136,7 @@ static int DoITEffectS0(UWORD tick, UWORD flags, MP_CONTROL *a, MODULE *mod, SWO
a->hioffset=inf<<16;
a->main.start=a->hioffset|a->soffset;
if ((a->main.s)&&(a->main.start>a->main.s->length))
if ((a->main.s)&&(a->main.start > (SLONG)a->main.s->length))
a->main.start=a->main.s->flags&(SF_LOOP|SF_BIDI)?
a->main.s->loopstart:a->main.s->length;
}
@ -2030,6 +2168,7 @@ static int DoITEffectS0(UWORD tick, UWORD flags, MP_CONTROL *a, MODULE *mod, SWO
static int DoVolEffects(UWORD tick, UWORD flags, MP_CONTROL *a, MODULE *mod, SWORD channel)
{
UBYTE c, inf;
(void)channel;
c = UniGetByte();
inf = UniGetByte();
@ -2080,12 +2219,16 @@ static int DoVolEffects(UWORD tick, UWORD flags, MP_CONTROL *a, MODULE *mod, SWO
static int DoULTEffect9(UWORD tick, UWORD flags, MP_CONTROL *a, MODULE *mod, SWORD channel)
{
UWORD offset=UniGetWord();
(void)tick;
(void)flags;
(void)mod;
(void)channel;
if (offset)
a->ultoffset=offset;
a->main.start=a->ultoffset<<2;
if ((a->main.s)&&(a->main.start>a->main.s->length))
if ((a->main.s)&&(a->main.start > (SLONG)a->main.s->length))
a->main.start=a->main.s->flags&(SF_LOOP|SF_BIDI)?
a->main.s->loopstart:a->main.s->length;
@ -2097,6 +2240,10 @@ static int DoULTEffect9(UWORD tick, UWORD flags, MP_CONTROL *a, MODULE *mod, SWO
static int DoMEDSpeed(UWORD tick, UWORD flags, MP_CONTROL *a, MODULE *mod, SWORD channel)
{
UWORD speed=UniGetWord();
(void)tick;
(void)flags;
(void)a;
(void)channel;
mod->bpm=speed;
@ -2129,6 +2276,8 @@ static int DoMEDEffectF3(UWORD tick, UWORD flags, MP_CONTROL *a, MODULE *mod, SW
static int DoOktArp(UWORD tick, UWORD flags, MP_CONTROL *a, MODULE *mod, SWORD channel)
{
UBYTE dat, dat2;
(void)mod;
(void)channel;
dat2 = UniGetByte(); /* arpeggio style */
dat = UniGetByte();
@ -2148,6 +2297,11 @@ static int DoOktArp(UWORD tick, UWORD flags, MP_CONTROL *a, MODULE *mod, SWORD c
static int DoNothing(UWORD tick, UWORD flags, MP_CONTROL *a, MODULE *mod, SWORD channel)
{
(void)tick;
(void)flags;
(void)a;
(void)mod;
(void)channel;
UniSkipOpcode();
return 0;
@ -2330,7 +2484,7 @@ void pt_UpdateVoices(MODULE *mod, int max_volume)
if ((aout->main.kick==KICK_NOTE)||(aout->main.kick==KICK_KEYOFF)) {
Voice_Play_internal(channel,s,(aout->main.start==-1)?
((s->flags&SF_UST_LOOP)?s->loopstart:0):aout->main.start);
((s->flags&SF_UST_LOOP) ? (SLONG)s->loopstart : 0) : aout->main.start);
aout->main.fadevol=32768;
aout->aswppos=0;
}
@ -3242,7 +3396,7 @@ MIKMODAPI void Player_Mute(SLONG arg1,...)
static void Player_ToggleMute_internal(SLONG arg1,va_list ap)
{
SLONG arg2,arg3=0;
ULONG t;
SLONG t;
if (pf) {
switch (arg1) {

View file

@ -1134,7 +1134,7 @@ void VC1_WriteSamples(SBYTE* buf,ULONG todo)
if(vc_mode & DMODE_SOFT_MUSIC) md_player();
tickleft=(md_mixfreq*125L)/(md_bpm*50L);
}
left = MIN(tickleft, todo);
left = MIN(tickleft, (int)todo);
buffer = buf;
tickleft -= left;
todo -= left;

View file

@ -416,11 +416,13 @@ SWORD VC1_SampleLoad(struct SAMPLOAD* sload,int type)
ULONG VC1_SampleSpace(int type)
{
(void)type;
return vc_memory;
}
ULONG VC1_SampleLength(int type,SAMPLE* s)
{
(void)type;
if (!s) return 0;
return (s->length*((s->flags&SF_16BITS)?2:1))+16;