📄 mikmod.h.in
字号:
/* MikMod sound library (c) 1998, 1999, 2000 Miodrag Vallat and others - see file AUTHORS for complete list. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.*//*============================================================================== $Id: mikmod.h.in,v 1.1 2004/02/16 17:36:00 raph Exp $ MikMod sound library include file==============================================================================*/#ifndef _MIKMOD_H_#define _MIKMOD_H_#include <stdio.h>#include <stdlib.h>#ifdef __cplusplusextern "C" {#endif/* * ========== Compiler magic for shared libraries */#if defined WIN32 && defined _DLL#ifdef DLL_EXPORTS#define MIKMODAPI __declspec(dllexport)#else#define MIKMODAPI __declspec(dllimport)#endif#else#define MIKMODAPI#endif/* * ========== Library version */#define LIBMIKMOD_VERSION_MAJOR @LIBMIKMOD_MAJOR_VERSION@L#define LIBMIKMOD_VERSION_MINOR @LIBMIKMOD_MINOR_VERSION@L#define LIBMIKMOD_REVISION @LIBMIKMOD_MICRO_VERSION@L#define LIBMIKMOD_VERSION \ ((LIBMIKMOD_VERSION_MAJOR<<16)| \ (LIBMIKMOD_VERSION_MINOR<< 8)| \ (LIBMIKMOD_REVISION))MIKMODAPI extern long MikMod_GetVersion(void);/* * ========== Platform independent-type definitions */#ifdef WIN32#define WIN32_LEAN_AND_MEAN#include <windows.h>#include <io.h>#include <mmsystem.h>#endif#if defined(__OS2__)||defined(__EMX__)#define INCL_DOSSEMAPHORES#include <os2.h>#elsetypedef char CHAR;#endif@DOES_NOT_HAVE_SIGNED@#if defined(__arch64__) || defined(__alpha)/* 64 bit architectures */typedef signed char SBYTE; /* 1 byte, signed */typedef unsigned char UBYTE; /* 1 byte, unsigned */typedef signed short SWORD; /* 2 bytes, signed */typedef unsigned short UWORD; /* 2 bytes, unsigned */typedef signed int SLONG; /* 4 bytes, signed */typedef unsigned int ULONG; /* 4 bytes, unsigned */typedef int BOOL; /* 0=false, <>0 true */#else/* 32 bit architectures */typedef signed char SBYTE; /* 1 byte, signed */typedef unsigned char UBYTE; /* 1 byte, unsigned */typedef signed short SWORD; /* 2 bytes, signed */typedef unsigned short UWORD; /* 2 bytes, unsigned */typedef signed long SLONG; /* 4 bytes, signed */#if !defined(__OS2__)&&!defined(__EMX__)&&!defined(WIN32)typedef unsigned long ULONG; /* 4 bytes, unsigned */typedef int BOOL; /* 0=false, <>0 true */#endif#endif/* * ========== Error codes */enum { MMERR_OPENING_FILE = 1, MMERR_OUT_OF_MEMORY, MMERR_DYNAMIC_LINKING, MMERR_SAMPLE_TOO_BIG, MMERR_OUT_OF_HANDLES, MMERR_UNKNOWN_WAVE_TYPE, MMERR_LOADING_PATTERN, MMERR_LOADING_TRACK, MMERR_LOADING_HEADER, MMERR_LOADING_SAMPLEINFO, MMERR_NOT_A_MODULE, MMERR_NOT_A_STREAM, MMERR_MED_SYNTHSAMPLES, MMERR_ITPACK_INVALID_DATA, MMERR_DETECTING_DEVICE, MMERR_INVALID_DEVICE, MMERR_INITIALIZING_MIXER, MMERR_OPENING_AUDIO, MMERR_8BIT_ONLY, MMERR_16BIT_ONLY, MMERR_STEREO_ONLY, MMERR_ULAW, MMERR_NON_BLOCK, MMERR_AF_AUDIO_PORT, MMERR_AIX_CONFIG_INIT, MMERR_AIX_CONFIG_CONTROL, MMERR_AIX_CONFIG_START, MMERR_GUS_SETTINGS, MMERR_GUS_RESET, MMERR_GUS_TIMER, MMERR_HP_SETSAMPLESIZE, MMERR_HP_SETSPEED, MMERR_HP_CHANNELS, MMERR_HP_AUDIO_OUTPUT, MMERR_HP_AUDIO_DESC, MMERR_HP_BUFFERSIZE, MMERR_OSS_SETFRAGMENT, MMERR_OSS_SETSAMPLESIZE, MMERR_OSS_SETSTEREO, MMERR_OSS_SETSPEED, MMERR_SGI_SPEED, MMERR_SGI_16BIT, MMERR_SGI_8BIT, MMERR_SGI_STEREO, MMERR_SGI_MONO, MMERR_SUN_INIT, MMERR_OS2_MIXSETUP, MMERR_OS2_SEMAPHORE, MMERR_OS2_TIMER, MMERR_OS2_THREAD, MMERR_DS_PRIORITY, MMERR_DS_BUFFER, MMERR_DS_FORMAT, MMERR_DS_NOTIFY, MMERR_DS_EVENT, MMERR_DS_THREAD, MMERR_DS_UPDATE, MMERR_WINMM_HANDLE, MMERR_WINMM_ALLOCATED, MMERR_WINMM_DEVICEID, MMERR_WINMM_FORMAT, MMERR_WINMM_UNKNOWN, MMERR_MAC_SPEED, MMERR_MAC_START, MMERR_OSX_UNKNOWN_DEVICE, MMERR_OSX_BAD_PROPERTY, MMERR_OSX_UNSUPPORTED_FORMAT, MMERR_OSX_SET_STEREO, MMERR_OSX_BUFFER_ALLOC, MMERR_OSX_ADD_IO_PROC, MMERR_OSX_DEVICE_START, MMERR_OSX_PTHREAD, MMERR_DOSWSS_STARTDMA, MMERR_DOSSB_STARTDMA, MMERR_MAX};/* * ========== Error handling */typedef void (MikMod_handler)(void);typedef MikMod_handler *MikMod_handler_t;MIKMODAPI extern int MikMod_errno;MIKMODAPI extern BOOL MikMod_critical;MIKMODAPI extern char *MikMod_strerror(int);MIKMODAPI extern MikMod_handler_t MikMod_RegisterErrorHandler(MikMod_handler_t);/* * ========== Library initialization and core functions */struct MDRIVER;MIKMODAPI extern void MikMod_RegisterAllDrivers(void);MIKMODAPI extern CHAR* MikMod_InfoDriver(void);MIKMODAPI extern void MikMod_RegisterDriver(struct MDRIVER*);MIKMODAPI extern int MikMod_DriverFromAlias(CHAR*);MIKMODAPI extern struct MDRIVER *MikMod_DriverByOrdinal(int);MIKMODAPI extern BOOL MikMod_Init(CHAR*);MIKMODAPI extern void MikMod_Exit(void);MIKMODAPI extern BOOL MikMod_Reset(CHAR*);MIKMODAPI extern BOOL MikMod_SetNumVoices(int,int);MIKMODAPI extern BOOL MikMod_Active(void);MIKMODAPI extern BOOL MikMod_EnableOutput(void);MIKMODAPI extern void MikMod_DisableOutput(void);MIKMODAPI extern void MikMod_Update(void);MIKMODAPI extern BOOL MikMod_InitThreads(void);MIKMODAPI extern void MikMod_Lock(void);MIKMODAPI extern void MikMod_Unlock(void);/* * ========== Reader, Writer */typedef struct MREADER { BOOL (*Seek)(struct MREADER*,long,int); long (*Tell)(struct MREADER*); BOOL (*Read)(struct MREADER*,void*,size_t); int (*Get)(struct MREADER*); BOOL (*Eof)(struct MREADER*);} MREADER;typedef struct MWRITER { BOOL (*Seek)(struct MWRITER*,long,int); long (*Tell)(struct MWRITER*); BOOL (*Write)(struct MWRITER*,void*,size_t); BOOL (*Put)(struct MWRITER*,int);} MWRITER;/* * ========== Samples *//* Sample playback should not be interrupted */#define SFX_CRITICAL 1/* Sample format [loading and in-memory] flags: */#define SF_16BITS 0x0001#define SF_STEREO 0x0002#define SF_SIGNED 0x0004#define SF_BIG_ENDIAN 0x0008#define SF_DELTA 0x0010#define SF_ITPACKED 0x0020#define SF_FORMATMASK 0x003F/* General Playback flags */#define SF_LOOP 0x0100#define SF_BIDI 0x0200#define SF_REVERSE 0x0400#define SF_SUSTAIN 0x0800#define SF_PLAYBACKMASK 0x0C00/* Module-only Playback Flags */#define SF_OWNPAN 0x1000#define SF_UST_LOOP 0x2000#define SF_EXTRAPLAYBACKMASK 0x3000/* Panning constants */#define PAN_LEFT 0#define PAN_HALFLEFT 64#define PAN_CENTER 128#define PAN_HALFRIGHT 192#define PAN_RIGHT 255#define PAN_SURROUND 512 /* panning value for Dolby Surround */typedef struct SAMPLE { SWORD panning; /* panning (0-255 or PAN_SURROUND) */ ULONG speed; /* Base playing speed/frequency of note */ UBYTE volume; /* volume 0-64 */ UWORD inflags; /* sample format on disk */ UWORD flags; /* sample format in memory */ ULONG length; /* length of sample (in samples!) */ ULONG loopstart; /* repeat position (relative to start, in samples) */ ULONG loopend; /* repeat end */ ULONG susbegin; /* sustain loop begin (in samples) \ Not Supported */ ULONG susend; /* sustain loop end / Yet! */ /* Variables used by the module player only! (ignored for sound effects) */ UBYTE globvol; /* global volume */ UBYTE vibflags; /* autovibrato flag stuffs */ UBYTE vibtype; /* Vibratos moved from INSTRUMENT to SAMPLE */ UBYTE vibsweep; UBYTE vibdepth; UBYTE vibrate; CHAR* samplename; /* name of the sample */ /* Values used internally only */ UWORD avibpos; /* autovibrato pos [player use] */ UBYTE divfactor; /* for sample scaling, maintains proper period slides */ ULONG seekpos; /* seek position in file */ SWORD handle; /* sample handle used by individual drivers */} SAMPLE;/* Sample functions */MIKMODAPI extern SAMPLE *Sample_Load(CHAR*);MIKMODAPI extern SAMPLE *Sample_LoadFP(FILE*);MIKMODAPI extern SAMPLE *Sample_LoadGeneric(MREADER*);MIKMODAPI extern void Sample_Free(SAMPLE*);MIKMODAPI extern SBYTE Sample_Play(SAMPLE*,ULONG,UBYTE);MIKMODAPI extern void Voice_SetVolume(SBYTE,UWORD);MIKMODAPI extern UWORD Voice_GetVolume(SBYTE);MIKMODAPI extern void Voice_SetFrequency(SBYTE,ULONG);MIKMODAPI extern ULONG Voice_GetFrequency(SBYTE);MIKMODAPI extern void Voice_SetPanning(SBYTE,ULONG);MIKMODAPI extern ULONG Voice_GetPanning(SBYTE);MIKMODAPI extern void Voice_Play(SBYTE,SAMPLE*,ULONG);MIKMODAPI extern void Voice_Stop(SBYTE);MIKMODAPI extern BOOL Voice_Stopped(SBYTE);MIKMODAPI extern SLONG Voice_GetPosition(SBYTE);MIKMODAPI extern ULONG Voice_RealVolume(SBYTE);/* * ========== Internal module representation (UniMod) *//* Instrument definition - for information only, the only field which may be of use in user programs is the name field*//* Instrument note count */#define INSTNOTES 120/* Envelope point */typedef struct ENVPT { SWORD pos; SWORD val;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -