1
0
Fork 0
forked from len0rd/rockbox

FS#13539: Resync mikmod plugin with upstream

Brings it up to libmikmod 3.3.12, relased 2024-12-31

Also fix a segfault that only happened on simulators when using
non-default samplerates.

Change-Id: I2ade2d72a00edab5395328fe76a88a88516aac72
This commit is contained in:
Solomon Peachy 2025-01-03 08:34:47 -05:00
parent 08c32cee7c
commit af7ed73f31
29 changed files with 1860 additions and 706 deletions

View file

@ -70,14 +70,11 @@ typedef long long SLONGLONG;
#endif
typedef int __s64_typetest [(sizeof(SLONGLONG)==8) * 2 - 1];
/* pointer-sized signed int (ssize_t/intptr_t) : */
#if defined(_WIN64) /* win64 is LLP64, not LP64 */
typedef long long SINTPTR_T;
#else
/* long should be pointer-sized for all others : */
typedef long SINTPTR_T;
/* signed size type (ssize_t) */
#if !defined(_WIN32) /* Win32 SDK has SSIZE_T */
typedef long SSIZE_T;
#endif
typedef int __iptr_typetest [(sizeof(SINTPTR_T)==sizeof(void*)) * 2 - 1];
typedef int __ssize_typetest [(sizeof(SSIZE_T)==sizeof(size_t)) * 2 - 1];
/*========== Error handling */
@ -106,7 +103,7 @@ extern MikMod_handler_t _mm_errorhandler;
if(_mm_mutex_##name)\
DosReleaseMutexSem(_mm_mutex_##name)
#elif defined(_WIN32)
#elif defined(_WIN32)||defined(__CYGWIN__)
#include <windows.h>
#define DECLARE_MUTEX(name) \
extern HANDLE _mm_mutex_##name
@ -338,6 +335,35 @@ enum {
/* Oktalyzer effects */
UNI_OKTARP, /* arpeggio */
/* Last effect supported by old modules in the UNI format. */
UNI_FORMAT_LAST,
/* Scream Tracker effects */
UNI_S3MEFFECTH, /* vibrato */
/* Impulse Tracker effects */
UNI_ITEFFECTH_OLD, /* vibrato (old) */
UNI_ITEFFECTU_OLD, /* fine vibrato (old) */
/* GDM effects. */
UNI_GDMEFFECT4, /* vibrato */
UNI_GDMEFFECT7, /* tremolo */
UNI_GDMEFFECT14, /* fine vibrato */
/* OctaMED effects. */
UNI_MEDEFFECT_VIB, /* MED vibrato */
UNI_MEDEFFECT_FD, /* set pitch */
UNI_MEDEFFECT_16, /* loop */
UNI_MEDEFFECT_18, /* stop note */
UNI_MEDEFFECT_1E, /* pattern delay */
UNI_MEDEFFECT_1F, /* note delay and retrigger */
/* Farandole effects. */
UNI_FAREFFECT1, /* Porta up */
UNI_FAREFFECT2, /* Porta down */
UNI_FAREFFECT3, /* Porta to note */
UNI_FAREFFECT4, /* Retrigger */
UNI_FAREFFECT6, /* Vibrato */
UNI_FAREFFECTD, /* Fine tempo down */
UNI_FAREFFECTE, /* Fine tempo up */
UNI_FAREFFECTF, /* Set tempo */
UNI_LAST
};
@ -503,6 +529,16 @@ typedef struct MP_CONTROL {
UBYTE s3mrtgspeed;/* last used retrig speed */
UBYTE s3mrtgslide;/* last used retrig slide */
UBYTE fartoneportarunning; /* FAR tone porta (effect 3) is a little bit different than other effects. It should keep running when the effect has first started, even if it is not given on subsequently rows */
SLONG fartoneportaspeed; /* FAR tone porta increment value */
SLONG farcurrentvalue; /* Because we're using fixing points as speed and the current period is an integer, we need to store the current value here for next round */
UBYTE farretrigcount; /* Number of retrigs to do */
/* These variables are only stored on the first control instance and therefore used globally.
The reason they are stored here is to minimize the number of global variables. */
UBYTE farcurtempo; /* Farandole current speed */
SWORD fartempobend; /* Used by the Farandole fine tempo effects and store the current bend value */
UBYTE glissando; /* glissando (0 means off) */
UBYTE wavecontrol;
@ -533,7 +569,8 @@ typedef struct MP_CONTROL {
SBYTE panbspd; /* "" speed */
UBYTE panbdepth; /* "" depth */
UWORD newsamp; /* set to 1 upon a sample / inst change */
UBYTE newnote; /* set to 1 if the current row contains a note */
UBYTE newsamp; /* set to 1 upon a sample / inst change */
UBYTE voleffect; /* Volume Column Effect Memory as used by IT */
UBYTE voldata; /* Volume Column Data Memory */
@ -748,7 +785,7 @@ extern MikMod_callback_t vc_callback;
#if defined(_WIN64)
# if defined(_MSC_VER)
# define IS_ALIGNED_16(ptr) (!((__int64)(ptr) & 15i64))
# else /* GCC, LCC, .. */
# else /* GCC, etc. */
# define IS_ALIGNED_16(ptr) (!((long long)(ptr) & 15LL))
# endif
#else /* long cast should be OK for all else */
@ -860,7 +897,7 @@ void MikMod_afree(void *); /* frees if ptr != NULL */
#endif
#else /* NO SIMD */
#define MikMod_amalloc MikMod_malloc
#define MikMod_amalloc(s) MikMod_calloc(1,(s))
#define MikMod_afree MikMod_free
#endif