From b4e70422a3455e327433a7471c929ef100ef3b10 Mon Sep 17 00:00:00 2001 From: Solomon Peachy Date: Sat, 8 Aug 2020 21:56:15 -0400 Subject: mikmod: Upgrade mikmod core from v3.2.0 to v3.3.11 * Get rid of the non-functional GT2 loader * Add the UMX loader * Add HQ mixer routines (and make it configurable) * Allow samplerate to be configured at run/playtime * Support >64KHz mixing/playback * Correctly restore non-boost status (The diff to upstream is much smaller now too!) Change-Id: Iaa4ac901ba9cd4123bb225656976e78271353a72 --- apps/plugins/mikmod/load_gdm.c | 33 +++++++++++++++++++++------------ 1 file changed, 21 insertions(+), 12 deletions(-) (limited to 'apps/plugins/mikmod/load_gdm.c') diff --git a/apps/plugins/mikmod/load_gdm.c b/apps/plugins/mikmod/load_gdm.c index 694d534236..5f06f9c70b 100644 --- a/apps/plugins/mikmod/load_gdm.c +++ b/apps/plugins/mikmod/load_gdm.c @@ -20,7 +20,7 @@ /*============================================================================== - $Id: load_gdm.c,v 1.3 2005/04/07 19:57:38 realtech Exp $ + $Id$ General DigiMusic (GDM) module loader @@ -114,7 +114,7 @@ typedef struct GDMSAMPLE { static GDMHEADER *mh=NULL; /* pointer to GDM header */ static GDMNOTE *gdmbuf=NULL; /* pointer to a complete GDM pattern */ -CHAR GDM_Version[]="General DigiMusic 1.xx"; +static CHAR GDM_Version[]="General DigiMusic 1.xx"; static int GDM_Test(void) { @@ -146,36 +146,45 @@ static void GDM_Cleanup(void) { MikMod_free(mh); MikMod_free(gdmbuf); + mh=NULL; + gdmbuf=NULL; } static int GDM_ReadPattern(void) { - int pos,flag,ch,i,maxch; + int pos,flag,ch,i; GDMNOTE n; - UWORD length,x=0; + SLONG length,x=0; /* get pattern length */ - length=_mm_read_I_UWORD(modreader)-2; + length=(SLONG)_mm_read_I_UWORD(modreader); + length-=2; /* clear pattern data */ memset(gdmbuf,255,32*64*sizeof(GDMNOTE)); pos=0; - maxch=0; while (xmaxch) maxch=ch; + if (ch > of.numchn) + return 0; + if (!flag) { pos++; + if (x==length) { + if (pos > 64) + return 0; + } else { + if (pos >= 64) + return 0; + } continue; } if (flag&0x60) { @@ -343,7 +352,7 @@ static int GDM_Load(int curious) SAMPLE *q; GDMSAMPLE s; ULONG position; - (void)curious; + (void)curious; /* read header */ _mm_read_string(mh->id1,4,modreader); @@ -390,7 +399,7 @@ static int GDM_Load(int curious) } /* now we fill */ - of.modtype=StrDup(GDM_Version); + of.modtype=MikMod_strdup(GDM_Version); of.modtype[18]=mh->majorver+'0'; of.modtype[20]=mh->minorver/10+'0'; of.modtype[21]=mh->minorver%10+'0'; -- cgit v1.2.3