midiDmon.h 4.89 KB

#include <audiotools.h>
#include <libaudio.h>
#include <dmedia/midi.h>

typedef struct {
    ALSymFileObj    SFObj;
    int             deleteFlag;

} ALSymObj;

typedef struct { char array[32]; }array32;


#define MAX_HASH_NAME_SIZE  64
#define MAX_PORTS    4

#define MEMORY_OK       0
#define MEMORY_NOT_OK   1

#define MAX_BANK_STRS        5
#define BANK_INST_STR_LEN    10
#define BANK_DEFAULT_PARAM   1
#define BANK_PERC_PARAM      2
#define BANK_INST_CT_PARAM   3
#define BANK_RATE_PARAM      4
#define BANK_INST_PARAM      5



#define MAX_INST_STRS        5
#define INST_SND_STR_LEN     5
#define INST_VOLUME_PARAM    1
#define INST_PAN_PARAM       2
#define INST_PRIOR_PARAM     3
#define INST_SNDCOUNT_PARAM  4
#define INST_SNDARRAY_PARAM  5



#define MAX_SOUND_STRS       5
#define SND_SAMPLE_PARAM     1
#define SND_KEYMAP_PARAM     2
#define SND_ENVLP_PARAM      3
#define SND_PAN_PARAM        4
#define SND_VOLUME_PARAM     5


#define MAX_ENVLP_STRS       5
#define ENVLP_ATTCK_TIME     1
#define ENVLP_ATTCK_LVL      2
#define ENVLP_DECAY_TIME     3
#define ENVLP_DECAY_LVL      4
#define ENVLP_REL_TIME       5


#define MAX_KMAP_STRS        6
#define KMAP_VEL_MIN         1
#define KMAP_VEL_MAX         2
#define KMAP_KEY_MIN         3
#define KMAP_KEY_MAX         4
#define KMAP_KEYBASE         5
#define KMAP_DETUNE          6

#define CREATE_BANK_STR_LEN     11
#define CREATE_INST_STR_LEN     17
#define CREATE_SND_STR_LEN      12
#define CREATE_ENVLP_STR_LEN    15
#define CREATE_KMAP_STR_LEN     13
#define CREATE_WAVETBL_STR_LEN  16
#define DELETE_BANK_STR_LEN     11
#define DELETE_INST_STR_LEN     17
#define DELETE_SND_STR_LEN      12
#define DELETE_ENVLP_STR_LEN    15
#define DELETE_KMAP_STR_LEN     13
#define DELETE_WAVETBL_STR_LEN  16



#define OBJECT_GROW_PAD  500  /* in number of objects, not bytes */
#define NAME_GROW_PAD    5000


int mdInit(void);


/* sysex.c */
void ProcessSysEx(MDevent *mdv);
void HandleGetString(char *param,int strType);
void HandleGetNumber(char *param,int strType);
void HandleSetString(char *param,int strType,char *data);
void HandleSetNumber(char *param,int strType,double dvalue);
void HandleGetBank(char *param);
void HandleSetBank(char *param,char *data,double dvalue);
void HandleGetInst(char *param);
void HandleSetInst(char *param,char *data,double dvalue);
void HandleGetSnd(char *param);
void HandleSetSnd(char *param,char *data,double dvalue);
void HandleGetEnvlp(char *param);
void HandleSetEnvlp(char *param,double dvalue);
void HandleGetKmap(char *param);
void HandleSetKmap(char *param,double dvalue);
void SelectBank(char *data);
void HandleTell(char *param,int strType);

/* create.c */
void CreateBankObj(char *param,char *data);
void CreateInstObj(char *param,char *data);
void CreateSndObj(char *param,char *data);
void CreateKmapObj(char *param,char *data);
void CreateEnvlpObj(char *param,char *data);
void CreateWavetblObj(char *param,char *data);
void DeleteObject(char *name);
int SndOffsetCompare(u32 *one, u32 *two);


/* loadrom.c */
void loadrom(void);


/* syscomm.c */ 
void AckPresent(char *param);
void ReplyValue(char *param,u32 value);
void ReplyString(char *param,char *ptr);
void SendClassList(int class, char *param);
void SendSoundList(char *param);
void SendInstList(char *param);


/* giocomm.c */
void WriteBlock(u32 destOffset,char *data,u32 size);
void SetValue(u32 offset,int type,u32 value);
u32 GetValue(u32 offset,int type);
void WriteRamRom(u32 destAddr,char *data,u32 size);
u32 WriteMirror(void);
void SendSetBank(u32 bankOffset);

/* symbol.c */
void ReadFiles(char *fileName);
void ReadBankFile(char *name);
void ReadSamplesFile(char *name);
char *ReadSymFile(char *name,int *fileLen);
void WriteSymFile(char *fileName,char *extn);
char *BuildClassList(int class);
char *BuildInstList(char *name);
char *BuildSoundList(char *name);
char *GetStrFromOffset(u32 offset);
ALSymObj *SymObjFromOffset(u32 offset);
void DecRefCtFromOffset(u32 offset);
void CopySymObj(u32 *dst, u32 *src);
void CopyFileObj(u32 *dst, u32 *src);
void GrowNameBuffer(void);
u32 AddName(char *str);
int CheckMemory(int mirrorSize,int numNewObj, int sampleSize);
int RebuildTables(int *expObj);
u32 CopyObjMirror(u8 *srcPtr,u8 *dstPtr, int class, int expansion);
int CleanMemory(int object,int expansion);
void CompactMemory(void);

/*utilrout.c */
int CheckString(char **requestStr, array32 *list, int maxStr);
char *parsename(char *name,char *nameStr);
int GetNumber(char **hdl);
char *listcat(char *lptr,char *nptr);
void FakeProgChnge(int inst);

/* wavefile.c */
int ReadAIFCFile(char *fname,ALWaveTable *wvTblPtr);


/*  hash.c */
int AllocNameHash(int numObjs);
int HashName(char *str);
int AddHashName(char *str, ALSymObj *obj);
ALSymObj *MatchHashName(char *name);
int NameHashSize(int numObjs);
int AllocNumHash(int numObj);
void DeallocNumHash(void);
int AddNumHash(u32 oldoffset, u32 newoffset);
u32 MatchNumHash(u32 oldOffset);
int NumHashSize(int numObjs);


/* save.c */
void SaveBanks(char *fileName);