📄 mikmod_internals.h
字号:
VOL_VOLUME = 1,
VOL_PANNING,
VOL_VOLSLIDE,
VOL_PITCHSLIDEDN,
VOL_PITCHSLIDEUP,
VOL_PORTAMENTO,
VOL_VIBRATO
};
/* IT resonant filter information */
#define UF_MAXMACRO 0x10
#define UF_MAXFILTER 0x100
#define FILT_CUT 0x80
#define FILT_RESONANT 0x81
typedef struct FILTER {
UBYTE filter,inf;
} FILTER;
/*========== Instruments */
/* Instrument format flags */
#define IF_OWNPAN 1
#define IF_PITCHPAN 2
/* Envelope flags: */
#define EF_ON 1
#define EF_SUSTAIN 2
#define EF_LOOP 4
#define EF_VOLENV 8
/* New Note Action Flags */
#define NNA_CUT 0
#define NNA_CONTINUE 1
#define NNA_OFF 2
#define NNA_FADE 3
#define NNA_MASK 3
#define DCT_OFF 0
#define DCT_NOTE 1
#define DCT_SAMPLE 2
#define DCT_INST 3
#define DCA_CUT 0
#define DCA_OFF 1
#define DCA_FADE 2
#define KEY_KICK 0
#define KEY_OFF 1
#define KEY_FADE 2
#define KEY_KILL (KEY_OFF|KEY_FADE)
#define KICK_ABSENT 0
#define KICK_NOTE 1
#define KICK_KEYOFF 2
#define KICK_ENV 4
#define AV_IT 1 /* IT vs. XM vibrato info */
/*========== Playing */
#define POS_NONE (-2) /* no loop position defined */
#define LAST_PATTERN (UWORD)(-1) /* special ``end of song'' pattern */
typedef struct ENVPR {
UBYTE flg; /* envelope flag */
UBYTE pts; /* number of envelope points */
UBYTE susbeg; /* envelope sustain index begin */
UBYTE susend; /* envelope sustain index end */
UBYTE beg; /* envelope loop begin */
UBYTE end; /* envelope loop end */
SWORD p; /* current envelope counter */
UWORD a; /* envelope index a */
UWORD b; /* envelope index b */
ENVPT* env; /* envelope points */
} ENVPR;
typedef struct MP_CHANNEL {
INSTRUMENT* i;
SAMPLE* s;
UBYTE sample; /* which sample number */
UBYTE note; /* the audible note as heard, direct rep of period */
SWORD outvolume; /* output volume (vol + sampcol + instvol) */
SBYTE chanvol; /* channel's "global" volume */
UWORD fadevol; /* fading volume rate */
SWORD panning; /* panning position */
UBYTE kick; /* if true = sample has to be restarted */
UBYTE kick_flag; /* kick has been true */
UWORD period; /* period to play the sample at */
UBYTE nna; /* New note action type + master/slave flags */
UBYTE volflg; /* volume envelope settings */
UBYTE panflg; /* panning envelope settings */
UBYTE pitflg; /* pitch envelope settings */
UBYTE keyoff; /* if true = fade out and stuff */
SWORD handle; /* which sample-handle */
UBYTE notedelay; /* (used for note delay) */
SLONG start; /* The starting byte index in the sample */
} MP_CHANNEL;
typedef struct MP_CONTROL {
struct MP_CHANNEL main;
struct MP_VOICE *slave; /* Audio Slave of current effects control channel */
UBYTE slavechn; /* Audio Slave of current effects control channel */
UBYTE muted; /* if set, channel not played */
UWORD ultoffset; /* fine sample offset memory */
UBYTE anote; /* the note that indexes the audible */
UBYTE oldnote;
SWORD ownper;
SWORD ownvol;
UBYTE dca; /* duplicate check action */
UBYTE dct; /* duplicate check type */
UBYTE* row; /* row currently playing on this channel */
SBYTE retrig; /* retrig value (0 means don't retrig) */
ULONG speed; /* what finetune to use */
SWORD volume; /* amiga volume (0 t/m 64) to play the sample at */
SWORD tmpvolume; /* tmp volume */
UWORD tmpperiod; /* tmp period */
UWORD wantedperiod; /* period to slide to (with effect 3 or 5) */
UBYTE arpmem; /* arpeggio command memory */
UBYTE pansspd; /* panslide speed */
UWORD slidespeed;
UWORD portspeed; /* noteslide speed (toneportamento) */
UBYTE s3mtremor; /* s3m tremor (effect I) counter */
UBYTE s3mtronof; /* s3m tremor ontime/offtime */
UBYTE s3mvolslide; /* last used volslide */
SBYTE sliding;
UBYTE s3mrtgspeed; /* last used retrig speed */
UBYTE s3mrtgslide; /* last used retrig slide */
UBYTE glissando; /* glissando (0 means off) */
UBYTE wavecontrol;
SBYTE vibpos; /* current vibrato position */
UBYTE vibspd; /* "" speed */
UBYTE vibdepth; /* "" depth */
SBYTE trmpos; /* current tremolo position */
UBYTE trmspd; /* "" speed */
UBYTE trmdepth; /* "" depth */
UBYTE fslideupspd;
UBYTE fslidednspd;
UBYTE fportupspd; /* fx E1 (extra fine portamento up) data */
UBYTE fportdnspd; /* fx E2 (extra fine portamento dn) data */
UBYTE ffportupspd; /* fx X1 (extra fine portamento up) data */
UBYTE ffportdnspd; /* fx X2 (extra fine portamento dn) data */
ULONG hioffset; /* last used high order of sample offset */
UWORD soffset; /* last used low order of sample-offset (effect 9) */
UBYTE sseffect; /* last used Sxx effect */
UBYTE ssdata; /* last used Sxx data info */
UBYTE chanvolslide; /* last used channel volume slide */
UBYTE panbwave; /* current panbrello waveform */
UBYTE panbpos; /* current panbrello position */
SBYTE panbspd; /* "" speed */
UBYTE panbdepth; /* "" depth */
UWORD 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 */
SWORD pat_reppos; /* patternloop position */
UWORD pat_repcnt; /* times to loop */
} MP_CONTROL;
/* Used by NNA only player (audio control. AUDTMP is used for full effects
control). */
typedef struct MP_VOICE {
struct MP_CHANNEL main;
ENVPR venv;
ENVPR penv;
ENVPR cenv;
UWORD avibpos; /* autovibrato pos */
UWORD aswppos; /* autovibrato sweep pos */
ULONG totalvol; /* total volume of channel (before global mixings) */
BOOL mflag;
SWORD masterchn;
UWORD masterperiod;
MP_CONTROL* master; /* index of "master" effects channel */
} MP_VOICE;
/*========== Loaders */
typedef struct MLOADER {
struct MLOADER* next;
CHAR* type;
CHAR* version;
BOOL (*Init)(void);
BOOL (*Test)(void);
BOOL (*Load)(BOOL);
void (*Cleanup)(void);
CHAR* (*LoadTitle)(void);
} MLOADER;
/* internal loader variables */
extern MREADER* modreader;
extern UWORD finetune[16];
extern MODULE of; /* static unimod loading space */
extern UWORD npertab[7*OCTAVE]; /* used by the original MOD loaders */
extern SBYTE remap[UF_MAXCHAN]; /* for removing empty channels */
extern UBYTE* poslookup; /* lookup table for pattern jumps after
blank pattern removal */
extern UBYTE poslookupcnt;
extern UWORD* origpositions;
extern BOOL filters; /* resonant filters in use */
extern UBYTE activemacro; /* active midi macro number for Sxx */
extern UBYTE filtermacros[UF_MAXMACRO]; /* midi macro settings */
extern FILTER filtersettings[UF_MAXFILTER]; /* computed filter settings */
extern int* noteindex;
/*========== Internal loader interface */
extern BOOL ReadComment(UWORD);
extern BOOL ReadLinedComment(UWORD,UWORD);
extern BOOL AllocPositions(int);
extern BOOL AllocPatterns(void);
extern BOOL AllocTracks(void);
extern BOOL AllocInstruments(void);
extern BOOL AllocSamples(void);
extern CHAR* DupStr(CHAR*,UWORD,BOOL);
/* loader utility functions */
extern int* AllocLinear(void);
extern void FreeLinear(void);
extern int speed_to_finetune(ULONG,int);
extern void S3MIT_ProcessCmd(UBYTE,UBYTE,unsigned int);
extern void S3MIT_CreateOrders(BOOL);
/* flags for S3MIT_ProcessCmd */
#define S3MIT_OLDSTYLE 1 /* behave as old scream tracker */
#define S3MIT_IT 2 /* behave as impulse tracker */
#define S3MIT_SCREAM 4 /* enforce scream tracker specific limits */
/* used to convert c4spd to linear XM periods (IT and IMF loaders). */
extern UWORD getlinearperiod(UWORD,ULONG);
extern ULONG getfrequency(UWORD,ULONG);
/* loader shared data */
#define STM_NTRACKERS 3
extern CHAR *STM_Signatures[STM_NTRACKERS];
/*========== Player interface */
extern BOOL Player_Init(MODULE*);
extern void Player_Exit(MODULE*);
extern void Player_HandleTick(void);
/*========== Drivers */
/* max. number of handles a driver has to provide. (not strict) */
#define MAXSAMPLEHANDLES 384
/* These variables can be changed at ANY time and results will be immediate */
extern UWORD md_bpm; /* current song / hardware BPM rate */
/* Variables below can be changed via MD_SetNumVoices at any time. However, a
call to MD_SetNumVoicess while the driver is active will cause the sound to
skip slightly. */
extern UBYTE md_numchn; /* number of song + sound effects voices */
extern UBYTE md_sngchn; /* number of song voices */
extern UBYTE md_sfxchn; /* number of sound effects voices */
extern UBYTE md_hardchn; /* number of hardware mixed voices */
extern UBYTE md_softchn; /* number of software mixed voices */
/* This is for use by the hardware drivers only. It points to the registered
tickhandler function. */
extern void (*md_player)(void);
extern SWORD MD_SampleLoad(SAMPLOAD*,int);
extern void MD_SampleUnload(SWORD);
extern ULONG MD_SampleSpace(int);
extern ULONG MD_SampleLength(int,SAMPLE*);
/* uLaw conversion */
extern void unsignedtoulaw(char *,int);
/* Parameter extraction helper */
extern CHAR *MD_GetAtom(CHAR*,CHAR*,BOOL);
/* Internal software mixer stuff */
extern void VC_SetupPointers(void);
extern BOOL VC1_Init(void);
extern BOOL VC2_Init(void);
#if defined(unix) || defined(__APPLE__) && defined(__MACH__)
/* POSIX helper functions */
extern BOOL MD_Access(CHAR *);
extern BOOL MD_DropPrivileges(void);
#endif
/* Macro to define a missing driver, yet allowing binaries to dynamically link
with the library without missing symbol errors */
#define MISSING(a) MDRIVER a = { NULL, NULL, NULL, 0, 0 }
/*========== Prototypes for non-MT safe versions of some public functions */
extern void _mm_registerdriver(struct MDRIVER*);
extern void _mm_registerloader(struct MLOADER*);
extern BOOL MikMod_Active_internal(void);
extern void MikMod_DisableOutput_internal(void);
extern BOOL MikMod_EnableOutput_internal(void);
extern void MikMod_Exit_internal(void);
extern BOOL MikMod_SetNumVoices_internal(int,int);
extern void Player_Exit_internal(MODULE*);
extern void Player_Stop_internal(void);
extern BOOL Player_Paused_internal(void);
extern void Sample_Free_internal(SAMPLE*);
extern void Voice_Play_internal(SBYTE,SAMPLE*,ULONG);
extern void Voice_SetFrequency_internal(SBYTE,ULONG);
extern void Voice_SetPanning_internal(SBYTE,ULONG);
extern void Voice_SetVolume_internal(SBYTE,UWORD);
extern void Voice_Stop_internal(SBYTE);
extern BOOL Voice_Stopped_internal(SBYTE);
#ifdef __cplusplus
}
#endif
#endif
/* ex:set ts=4: */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -