Filewatcher File Search
FTP Search
  
Directory (beta)
  
Content Search (beta)
   
pkg://awesfx-0.4.3a-14.src.rpm:118458/awesfx-0.4.3a.tgz  info  downloads

awesfx-0.4.3a/ 40755    764    144           0  6670755423  11432 5ustar  iwaiusersawesfx-0.4.3a/SBKtoSF2.txt100644    764    144        6634  6341074507  13566 0ustar  iwaiusers================================================================
     SoundFont 1 (sbk) --> SoundFont 2 (sf2) Conversion
================================================================

The following conversion rules are on the basis of my experience.
Please do not consult to Creative about this.
						-- iwai

================================================================
modenv, volenv, lfo1, lfo2
delay time	msec
attack time	msec
hold time	msec
decay time	msec
release time	msec
--
sf2		time cents
	sf2 = log2(sbk/1000) * 1200

================================================================
vol sustain	0-127 (or larger)
--
sf2		cB below full scale
	sf2 = 1000 - 10.5 * sbk		when sbk < 96
	sf2 = 0				when sbk >= 96
  Note: the default sustain level is 1000 in SBK, while 0 in SF2.

================================================================
mod sustain	0-96 (96 = zero attenuation, 0 = minimum)
--
sf2		0.1% below full scale
	sf2 = 1000 * (96 - val) / 96	when sbk < 96
	sf2 = 0				when sbk >= 96
  Note: the default sustain level is 1000 in SBK, while 0 in SF2.

================================================================
time change per key	??
--
sf2		timecent per key
	sf2 = sbk * 5.55  (??)

================================================================
pan position	0-127 (just same as MIDI)
--
sf2		0.1% (left=0, center=500)
	sf2 = sbk * 1000 / 127 - 500

================================================================
init attenuation	0-127 (127 = full scale, 0 = minimum)
--
sf2		cB from full scale (see the note below)
	sf2 = -200 * log10(sbk / 127)

[note:	SF2 spec document says initial attenuation is in unit of
	centibels, but actual data looks like 2 to 10 times greater.
	The above conversion does NOT include this correction.]

================================================================
chorus		0-255
reverb
--
sf2		0.1%
	sf2 = sbk * 1000 / 255

================================================================
initFilterFc
--
sf2		absolute cents
	sf2 = 59 * sbk + 4366	when sbk < 127
	(alternatively, sf2 = 50 * sbk + 4721 (4721=125Hz))
	sf2 = 14400		when sbk = 127

================================================================
initFilterQ
--
sf2		cB above DC gain
	sf2 = sbk * 3 / 2

================================================================
LFO1 freq
LFO2 freq
--
sf2		absolte cents
	sf2 = 1200 * log10(sbk) / log10(2) - 7925

================================================================
modenv pitch shift
LFO1 pitch shift
LFO2 pitch shift
--
sf2		cents
	sf2 = (1200 * sbk / 64 + 1) / 2

================================================================
moenv cutoff shift
LFO1 cutoff shift
--
sf2		cents
	sf2 = (1200 * ratio * sbk) / 64
		ratio = 6	when modenv
		ratio = 3	when lfo1

================================================================
lfo1 tremolo volume
--
sf2		cB
	sf2 = (120 * sbk) / 64

================================================================
scale tuning	0/1
--
sf2		semitone
	sf2 = 100	when sbk = 0
	sf2 = 50	when sbk = 1
  NOTE: scale tuning can overwrite in preset layer to instruments.
	don't add the "converted" value.  Otherwise, convert
	after adding the value.

================================================================
sample pitch (SF1 only; reserved3(#55) in SF2)
--
sf2		N/A
	sf2 rootkey = sbk / 100
	sf2 finetune = -sbk % 100
	if finetune <= -50 then
	  rootkey++
	  finetune = 100 + finetune
	endif

================================================================

awesfx-0.4.3a/include/ 40755    764    144           0  6666574642  13064 5ustar  iwaiusersawesfx-0.4.3a/include/awebank.h100644    764    144        5600  6666567004  14735 0ustar  iwaiusers/*================================================================
 * AWElib patch loader
 *
 * Copyright (C) 1996-1999 Takashi Iwai
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU 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 General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 *================================================================*/

#ifndef AWEBANK_H_DEF
#define AWEBANK_H_DEF

/* external variable */

extern int seqfd;
extern int awe_dev;

/* return value */
#define AWE_RET_OK		0	/* successfully loaded */
#define AWE_RET_ERR		1	/* some fatal error occurs */
#define AWE_RET_SKIP		2	/* some fonts are skipped */
#define AWE_RET_NOMEM		3	/* out or memory; not all fonts loaded */
#define AWE_RET_NOT_FOUND	4	/* the file is not found */


/*----------------------------------------------------------------
 * preset/bank/keynote bag
 *----------------------------------------------------------------*/

typedef struct _SFPatchRec {
	int preset, bank, keynote; /* -1 = matches all */
} SFPatchRec;

/* compare two patch sets */
int awe_match_preset(SFPatchRec *rec, SFPatchRec *pat);
/* merge two patch sets (p1 + p2 -> rec) */
void awe_merge_keys(SFPatchRec *p1, SFPatchRec *p2, SFPatchRec *rec);

/* parse the text and store source/map patch sets */
int awe_parse_loadlist(char *arg, SFPatchRec *pat, SFPatchRec *map, char **strp);


/* dynamic loading list */
typedef struct _LoadList {
	SFPatchRec pat;
	SFPatchRec map;
	int loaded;
	struct _LoadList *next;
} LoadList;

/* add a patch set on the list */
LoadList *add_loadlist(LoadList *list, SFPatchRec *pat, SFPatchRec *map);
/* merge the elements in latter list */
LoadList *merge_loadlist(LoadList *list, LoadList *old);
/* free all list elements */
void free_loadlist(LoadList *p);

/*----------------------------------------------------------------
 * load a soundfont or virtual bank file
 *----------------------------------------------------------------
 * 'name' is the file name of the sound font.  The file is searched
 * along the prescribed search path.
 * If 'list' is not NULL, only the presets listed are loaded.
 * 'locked' is boolean value to specify the fonts are locked or not.
 * The locked fonts are not removed by -x option of sfxload.
 *----------------------------------------------------------------*/

int awe_load_bank(char *name, LoadList *list, int locked);


#endif	/* AWEBANK_H_DEF */

awesfx-0.4.3a/include/aweseq.h100644    764    144        4050  6666567010  14605 0ustar  iwaiusers/*================================================================
 * Load AWE patch data
 *
 * Copyright (C) 1996-1999 Takashi Iwai
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU 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 General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 *================================================================*/

#ifndef AWESEQ_H_DEF
#define AWESEQ_H_DEF

#include "sffile.h"
#include "awebank.h"

/*----------------------------------------------------------------
 * initialize and finish the loading
 *----------------------------------------------------------------*/

int awe_open_font(SFInfo *sf, FILE *fp, int locked);
void awe_close_font(SFInfo *sf);
int awe_is_ram_fonts(SFInfo *sf);

int awe_open_patch(char *name, int type, int locked);
int awe_close_patch(void);
int awe_load_map(LoadList *lp);

/*----------------------------------------------------------------
 * load each preset: load a preset "pat" on "map"
 *----------------------------------------------------------------*/

int awe_load_font(SFInfo *sf, SFPatchRec *pat, SFPatchRec *map);
int awe_load_font_list(SFInfo *sf, LoadList *part_list, int load_alt);


/*----------------------------------------------------------------
 * load the whole file (with checking loadlist)
 *----------------------------------------------------------------*/

/*int awe_load_font_buffered(SFInfo *sf, LoadList *part_only, LoadList *exclude, int load_alt);*/
int awe_load_all_fonts(SFInfo *sf, LoadList *exclude);


#endif	/* AWESEQ_H_DEF */
awesfx-0.4.3a/include/itypes.h100644    764    144        1502  6335614512  14625 0ustar  iwaiusers/*================================================================
 * integer types
 *================================================================*/

#ifndef ITYPES_H_DEF
#define ITYPES_H_DEF

/* 8bit bytes */
typedef unsigned char byte;

/* 16bit integers */
typedef unsigned short uint16;
typedef short int16;

/* 32bit long integers */
typedef unsigned int uint32;
typedef int int32;

/**/
typedef union uint32rec {
	byte b8[4];
	uint16 b16[4];
	uint32 b32;
} uint32rec;

/* vp=uint32rec, cp=char* */
#define get32rec(vp,cp) memcpy(vp, cp, 4)

#if 1
/* little endian */
#define swapi(x) x
#define swapl(x) x

#else
/* big endian */
#define swapi(x) ((((x)&0xFF)<<8) | (((x)>>8)&0xFF))
#define swapl(x) ((((x)&0xFF)<<24) | \
		      (((x)&0xFF00)<<8) | \
		      (((x)&0xFF0000)>>8) | \
		      (((x)>>24)&0xFF))
#endif

#endif
awesfx-0.4.3a/include/sffile.h100644    764    144        6137  6666567012  14602 0ustar  iwaiusers/*================================================================
 * sffile.h
 *	SoundFont file (SBK/SF2) format defintions
 *
 * Copyright (C) 1996-1999 Takashi Iwai
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU 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 General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 *================================================================*/

#ifndef SFFILE_H_DEF
#define SFFILE_H_DEF

#include <stdio.h>
#include "itypes.h"

/* chunk record header */
typedef struct _SFChunk {
	char id[4];
	int32 size;
} SFChunk;

/* generator record */
typedef struct _SFGenRec {
	int16 oper;
	int16 amount;
} SFGenRec;

/* layered generators record */
typedef struct _SFGenLayer {
	int nlists;
	SFGenRec *list;
} SFGenLayer;

/* header record */
typedef struct _SFHeader {
	char name[20];
	uint16 bagNdx;
	/* layered stuff */
	int nlayers;
	SFGenLayer *layer;
} SFHeader;

/* preset header record */
typedef struct _SFPresetHdr {
	SFHeader hdr;
	uint16 preset, bank;
	/*int32 lib, genre, morphology;*/ /* not used */
} SFPresetHdr;

/* instrument header record */
typedef struct _SFInstHdr {
	SFHeader hdr;
} SFInstHdr;

/* sample info record */
typedef struct _SFSampleInfo {
	char name[20];
	int32 startsample, endsample;
	int32 startloop, endloop;
	/* ver.2 additional info */
	int32 samplerate;
	byte originalPitch;
	byte pitchCorrection;
	uint16 samplelink;
	uint16 sampletype;  /*1=mono, 2=right, 4=left, 8=linked, $8000=ROM*/
	/* optional info */
	int32 size; /* sample size */
	int32 loopshot; /* short-shot loop size */
} SFSampleInfo;


/*----------------------------------------------------------------
 * soundfont file info record
 *----------------------------------------------------------------*/

typedef struct _SFInfo {
	/* file name */
	char *sf_name;

	/* version of this file */
	int16 version, minorversion;
	/* sample position (from origin) & total size (in bytes) */
	long samplepos;
	int32 samplesize;

	/* raw INFO chunk list */
	long infopos, infosize;

	/* preset headers */
	int npresets;
	SFPresetHdr *preset;
	
	/* sample infos */
	int nsamples;
	SFSampleInfo *sample;

	/* instrument headers */
	int ninsts;
	SFInstHdr *inst;

} SFInfo;


/*----------------------------------------------------------------
 * functions
 *----------------------------------------------------------------*/

/* sffile.c */
int load_soundfont(SFInfo *sf, FILE *fp, int is_seekable);
void free_soundfont(SFInfo *sf);
void save_soundfont(SFInfo *sf, FILE *fin, FILE *fout);
void load_textinfo(SFInfo *sf, FILE *fp);

/* sample.c */
void correct_samples(SFInfo *sf);

#endif
awesfx-0.4.3a/include/slist.h100644    764    144        3456  6666567024  14474 0ustar  iwaiusers/*================================================================
 * slist.h:
 *	S-expression list
 *
 * Copyright (C) 1996-1999 Takashi Iwai
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU 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 General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 *================================================================*/

#ifndef SLIST_H_DEF
#define SLIST_H_DEF

enum { S_ATOM_NIL, S_ATOM_LIST, S_ATOM_CHR, S_ATOM_INT, S_ATOM_STR, S_ATOM_FUN, };

typedef struct _SAtom *SList;

typedef union {
	char c;
	int i;
	char *s;
	char *f;
	SList p;
} SAtomVal;

typedef struct _SAtom {
	int type;
	SAtomVal val, nxt;
} SAtom;

SList SCons(void);
SList SReadFile(FILE *fp);
void SFree(SList);

#define NIL	(SList)0

#define SIsNil(at)	((at)->type == S_ATOM_NIL)
#define SListP(at)	((at)->type == S_ATOM_LIST)
#define SChrP(at)	((at)->type == S_ATOM_CHR)
#define SIntP(at)	((at)->type == S_ATOM_INT)
#define SStrP(at)	((at)->type == S_ATOM_STR)
#define SFunP(at)	((at)->type == S_ATOM_FUN)

#define SCar(at)	((at)->val.p)
#define SCdr(at)	((at)->nxt.p)

#define SChr(at)	((at)->val.c)
#define SStr(at)	((at)->val.s)
#define SInt(at)	((at)->val.i)
#define SFun(at)	((at)->val.f)
#define SFunIs(at,fun)	(strcmp(SFun(at),fun) == 0)

int SIndex(SList);

#endif
awesfx-0.4.3a/include/util.h100644    764    144        4524  6666567026  14312 0ustar  iwaiusers/*================================================================
 * utility routines
 *
 * Copyright (C) 1996-1999 Takashi Iwai
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU 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 General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 *================================================================*/

#ifndef UTIL_H_DEF
#define UTIL_H_DEF

#ifndef TRUE
#define TRUE  1
#endif
#ifndef FALSE
#define FALSE 0
#endif

#define numberof(ary)	(sizeof(ary)/sizeof(ary[0]))
#ifndef offsetof
#define offsetof(s_type,field) ((int)(((char*)(&(((s_type*)NULL)->field)))-((char*)NULL)))
#endif

#define BITON(var,flag)	((var) |= (flag))
#define BITOFF(var,flag) ((var) &= ~(flag))
#define BITSWT(var,flag) ((var) ^= (flag))

extern int awe_verbose, debug;
#define DEBUG(LVL,XXX)	{if (awe_verbose > LVL) { XXX; }}

/* cmpopen.c */
char *CmpGetExtension(char *name);
FILE *CmpOpenFile(char *name, int *flag);
void CmpCloseFile(FILE *fp, int flag);
void CmpAddList(char *ext, char *format);

/* malloc.c */
void *safe_malloc(int size);
void safe_free(void *ptr);
char *safe_strdup(char *src);

/* bool.c */
char *strtoken(char *src);
char *strschr(char *str, char *dels);
int strlcmp(char *ap, char *bp);
int bool_val(char *val);

/* fskip.c */
void fskip(int size, FILE *fd, int seekable);

/* path.c */
int search_file_name(char *fresult, char *fname, char *path, char **ext);

/* mygetopt.c */

typedef struct awe_option_args {
	char *str;
	int has_arg;
	int *flag;
	int val;
} awe_option_args;

/*
#define	no_argument		0
#define required_argument	1
#define optional_argument	2
*/

int awe_getopt(int argc, char **argv, char *optstr, awe_option_args *args, int *optind);
int awe_get_argument(int argc, char **argv, char *optstr, awe_option_args *args);

extern char *optarg;
extern int optind;


#endif
awesfx-0.4.3a/include/sfopts.h100644    764    144        3553  6666567022  14650 0ustar  iwaiusers/*----------------------------------------------------------------
 * general options for AWElib
 *
 * Copyright (C) 1996-1999 Takashi Iwai
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU 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 General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 *----------------------------------------------------------------*/

#ifndef SFOPTS_H_DEF
#define SFOPTS_H_DEF

#include "util.h"

/* options */
typedef struct _sf_options {
	int auto_add_blank;	/* bool: add 48 blank samples */
	int default_bank;	/* int: bank map number for bank #0 */
	int default_chorus;	/* int: chorus effects in percent */
	int default_reverb;	/* int: reverb effects in percent */
	int default_volume;	/* int: total volume in percent */
	double atten_sense;	/* attenuation sensitivity (default is 10.0) */
	int default_atten;	/* zero attenuation level (default is 32) */
	double decay_sense;	/* decay sensitivity (default is 50.0) */
	char *search_path;	/* search path for soundfont files */
	int compatible;		/* compatible mode */
} sf_options;

void awe_init_option(void);
int awe_calc_def_atten(double sense);	/* calculate zero atten level */

extern sf_options awe_option;

void awe_read_option_file(char *fname);
int awe_parse_options(int argc, char **argv, char *optflags,
		      awe_option_args *long_opts, int *optidx);

#endif
awesfx-0.4.3a/include/sfitem.h100644    764    144        4674  6666567015  14630 0ustar  iwaiusers/*================================================================
 * sfitem.h
 *	soundfont generator conversion table
 *
 * Copyright (C) 1996-1999 Takashi Iwai
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU 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 General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 *================================================================*/

#ifndef SFITEM_H_DEF
#define SFITEM_H_DEF

#include "sflayer.h"
#include "sffile.h"

typedef struct _LayerItem {
	int copy;	/* copy policy */
	int type;	/* conversion type */
	int minv;	/* minimum value */
	int maxv;	/* maximum value */
	int defv;	/* default value */
} LayerItem;

/* copy policy */
enum {
	L_INHRT,	/* add to global */
	L_OVWRT,	/* overwrite on global */
	L_RANGE,	/* range */
	L_PRSET,	/* preset only */
	L_INSTR,	/* instrument only */
};

/* data type */
enum {
	T_NOP,		/* nothing */
	T_NOCONV,	/* no conversion */
	T_OFFSET,	/* address offset */
	T_HI_OFF,	/* address coarse offset (32k) */
	T_RANGE,	/* range; composite values (0-127/0-127) */

	T_CUTOFF,	/* initial cutoff */
	T_FILTERQ,	/* initial resonance */
	T_TENPCT,	/* effects send */
	T_PANPOS,	/* panning position */
	T_ATTEN,	/* initial attenuation */
	T_SCALE,	/* scale tuning */

	T_TIME,		/* envelope/LFO time */
	T_TM_KEY,	/* time change per key */
	T_FREQ,		/* LFO frequency */
	T_PSHIFT,	/* env/LFO pitch shift */
	T_CSHIFT,	/* env/LFO cutoff shift */
	T_TREMOLO,	/* LFO tremolo shift */
	T_MODSUST,	/* modulation env sustain level */
	T_VOLSUST,	/* volume env sustain level */

	T_EOT,		/* end of type */
};

/* sbk->sf2 convertor function */
typedef int (*SBKConv)(int gen, int amount);

/* macros for range operation */
#define RANGE(lo,hi)	(((hi)&0xff) << 8 | ((lo)&0xff))
#define LOWNUM(val)	((val) & 0xff)
#define HIGHNUM(val)	(((val) >> 8) & 0xff)

/* layer type definitions */
extern LayerItem layer_items[SF_EOF];

int sbk_to_sf2(int oper, int amount);

#endif
awesfx-0.4.3a/include/sflayer.h100644    764    144       10363  6666567017  15020 0ustar  iwaiusers/*================================================================
 * sflayer.h
 *	soundfont generator type definitions
 *
 * Copyright (C) 1996-1999 Takashi Iwai
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU 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 General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 *================================================================*/

#ifndef SFLAYER_H_DEF
#define SFLAYER_H_DEF

/*----------------------------------------------------------------
 * the following enum table is taken from the Creative's
 * ADIP (AWE32 Developers' Information Package)
 * The complete set is found in the CreativeLab's web page (in ftp
 * download page).
 *----------------------------------------------------------------*/

enum {
	SF_startAddrs,         /* sample start address -4 (0 to * 0xffffff) */
        SF_endAddrs,
        SF_startloopAddrs,     /* loop start address -4 (0 to * 0xffffff) */
        SF_endloopAddrs,       /* loop end address -3 (0 to * 0xffffff) */
        SF_startAddrsHi,       /* high word of startAddrs */
        SF_lfo1ToPitch,        /* main fm: lfo1-> pitch */
        SF_lfo2ToPitch,        /* aux fm:  lfo2-> pitch */
        SF_env1ToPitch,        /* pitch env: env1(aux)-> pitch */
        SF_initialFilterFc,    /* initial filter cutoff */
        SF_initialFilterQ,     /* filter Q */
        SF_lfo1ToFilterFc,     /* filter modulation: lfo1 -> filter * cutoff */
        SF_env1ToFilterFc,     /* filter env: env1(aux)-> filter * cutoff */
        SF_endAddrsHi,         /* high word of endAddrs */
        SF_lfo1ToVolume,       /* tremolo: lfo1-> volume */
        SF_env2ToVolume,       /* Env2Depth: env2-> volume */
        SF_chorusEffectsSend,  /* chorus */
        SF_reverbEffectsSend,  /* reverb */
        SF_panEffectsSend,     /* pan */
        SF_auxEffectsSend,     /* pan auxdata (internal) */
        SF_sampleVolume,       /* used internally */
        SF_unused3,
        SF_delayLfo1,          /* delay 0x8000-n*(725us) */
        SF_freqLfo1,           /* frequency */
        SF_delayLfo2,          /* delay 0x8000-n*(725us) */
        SF_freqLfo2,           /* frequency */
        SF_delayEnv1,          /* delay 0x8000 - n(725us) */
        SF_attackEnv1,         /* attack */
        SF_holdEnv1,             /* hold */
        SF_decayEnv1,            /* decay */
        SF_sustainEnv1,          /* sustain */
        SF_releaseEnv1,          /* release */
        SF_autoHoldEnv1,
        SF_autoDecayEnv1,
        SF_delayEnv2,            /* delay 0x8000 - n(725us) */
        SF_attackEnv2,           /* attack */
        SF_holdEnv2,             /* hold */
        SF_decayEnv2,            /* decay */
        SF_sustainEnv2,          /* sustain */
        SF_releaseEnv2,          /* release */
        SF_autoHoldEnv2,
        SF_autoDecayEnv2,
        SF_instrument,           /* */
        SF_nop,
        SF_keyRange,             /* */
        SF_velRange,             /* */
        SF_startloopAddrsHi,     /* high word of startloopAddrs */
        SF_keynum,               /* */
        SF_velocity,             /* */
        SF_initAtten,              /* */
        SF_keyTuning,
        SF_endloopAddrsHi,       /* high word of endloopAddrs */
        SF_coarseTune,
        SF_fineTune,
        SF_sampleId,
        SF_sampleFlags,
        SF_samplePitch,          /* SF1 only */
        SF_scaleTuning,
        SF_keyExclusiveClass,
        SF_rootKey,
	SF_EOF,
};


/* name strings */
extern char *sf_gen_text[SF_EOF];


/*----------------------------------------------------------------
 * layer value table
 *----------------------------------------------------------------*/

typedef struct _LayerTable {
	short val[SF_EOF];
	char set[SF_EOF];
} LayerTable;


#endif
awesfx-0.4.3a/include/awe_parm.h100644    764    144        4056  6666567001  15121 0ustar  iwaiusers/*================================================================
 * awe_parm.h  --  convert to Emu8000 native parameters
 *
 * Copyright (C) 1996-1999 Takashi Iwai
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU 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 General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 *================================================================*/

#ifndef AWE_PARM_H_DEF
#define AWE_PARM_H_DEF

#ifdef linux
#include <linux/awe_voice.h>
#else
#include <awe_voice.h>
#endif

void awe_init_parm(awe_voice_parm *pp);
void awe_init_voice(awe_voice_info *vp);

int awe_timecent_to_msec(int timecent);
int awe_msec_to_timecent(int msec);
int awe_abscent_to_mHz(int abscents);
int awe_mHz_to_abscent(int mHz);
int awe_Hz_to_abscent(int Hz);
int awe_abscent_to_Hz(int abscents);

short awe_calc_rate_offset(int Hz);
unsigned short awe_calc_delay(int tcent);
unsigned short awe_calc_atkhld(int atk_tcent, int hld_tcent);
unsigned char awe_calc_sustain(int sust_cB);
unsigned char awe_calc_mod_sustain(int sust_cB);
unsigned char awe_calc_decay(int dcy_tcent);
unsigned char awe_calc_cutoff(int abscents);
unsigned char awe_calc_filterQ(int gain_cB);
unsigned char awe_calc_pitch_shift(int cents);
unsigned char awe_calc_cutoff_shift(int cents, int octave_shift);
unsigned short awe_calc_tremolo(int vol_cB);
unsigned char awe_calc_freq(int abscents);
char awe_calc_pan(int val);
unsigned char awe_calc_chorus(int val);
unsigned char awe_calc_reverb(int val);
unsigned char awe_calc_attenuation(int att_cB);

#endif
awesfx-0.4.3a/include/Imakefile100644    764    144         354  6377232675  14750 0ustar  iwaiusers#include "../awelib/config.h"

INCDIR = /usr/local/include/awe

HEADERS = awebank.h aweseq.h awe_parm.h sffile.h itypes.h sfitem.h sflayer.h\
	sfopts.h slist.h util.h

#ifdef INSTALL_AWELIB
InstallMultiple($(HEADERS), $(INCDIR))
#endif
awesfx-0.4.3a/include/Makefile100644    764    144       43301  6666566421  14636 0ustar  iwaiusers# Makefile generated by imake - do not edit!
# $TOG: imake.c /main/97 1997/06/20 20:23:51 kaleb $

# ----------------------------------------------------------------------
# Makefile generated from "Imake.tmpl" and <Imakefile>
# $TOG: Imake.tmpl /main/245 1997/05/20 10:05:47 kaleb $
#
#
#
#
# $XFree86: xc/config/cf/Imake.tmpl,v 3.32.2.8 1998/02/08 11:19:24 dawes Exp $
# ----------------------------------------------------------------------

all::

.SUFFIXES: .i

# $TOG: Imake.cf /main/28 1997/06/25 08:31:36 barstow $
# $XFree86: xc/config/cf/Imake.cf,v 3.34.2.4 1998/05/22 16:38:18 dawes Exp $

# -----------------------------------------------------------------------
# site-specific configuration parameters that need to come before
# the platform-specific parameters - edit site.def to change

# site:  $XConsortium: site.def /main/revisionist/4 1996/12/31 08:02:07 kaleb $
# site:  $XFree86: xc/config/cf/site.def,v 3.17.2.1 1997/06/22 10:32:21 dawes Exp $

# $XFree86: xc/config/cf/xf86site.def,v 3.101.2.15 1998/02/24 19:05:42 hohndel Exp $

# ----------------------------------------------------------------------
# platform-specific configuration parameters - edit linux.cf to change

# platform:  $TOG: linux.cf /main/36 1997/06/16 22:21:03 kaleb $
# platform:  $XFree86: xc/config/cf/linux.cf,v 3.57.2.12 1998/03/01 01:57:10 dawes Exp $

# operating system:  Linux 2.2.1 i586 [ELF] (2.2.1)
# libc:	(5.4.33)
# binutils:	(28)

# $XConsortium: lnxLib.rules /main/13 1996/09/28 16:11:01 rws $
# $XFree86: xc/config/cf/lnxLib.rules,v 3.28.2.3 1997/06/22 10:32:20 dawes Exp $

# $XFree86: xc/config/cf/xfree86.cf,v 3.129.2.22 1998/02/24 19:05:43 hohndel Exp $

# $XConsortium: xfree86.cf /main/34 1996/12/06 11:45:18 rws $

LINKKITDIR = $(USRLIBDIR)/Server
XF98LINKKITDIR = $(USRLIBDIR)/Server

       XF86SRC = $(SERVERSRC)/hw/xfree86
  XF86ACCELSRC = $(XF86SRC)/accel
    XF86COMSRC = $(XF86SRC)/common
 XF86CONFIGSRC = $(XF86COMSRC)
     XF86HWSRC = $(XF86SRC)/common_hw
     XF86OSSRC = $(XF86SRC)/os-support
  VGADRIVERSRC = $(XF86SRC)/vga256/drivers
VGA16DRIVERSRC = $(XF86SRC)/vga16/drivers
 VGA2DRIVERSRC = $(XF86SRC)/vga2/drivers
 MONODRIVERSRC = $(XF86SRC)/mono/drivers
   S3DRIVERSRC = $(XF86SRC)/accel/s3/drivers
  S3VDRIVERSRC = $(XF86SRC)/accel/s3_virge/drivers

       XF68SRC = $(SERVERSRC)/hw/xfree68
    XF68COMSRC = $(XF68SRC)/common
 XF68CONFIGSRC = $(XF68COMSRC)
     XF68OSSRC = $(XF68SRC)/os-support

           XF98SRC = $(SERVERSRC)/hw/xfree98
      XF98ACCELSRC = $(XF98SRC)/accel
        XF98COMSRC = $(XF98SRC)/common
     XF98CONFIGSRC = $(XF98COMSRC)
         XF98HWSRC = $(XF98SRC)/common_hw/generic
      XF98HWNECSRC = $(XF98SRC)/common_hw/nec
    XF98HWPWSKBSRC = $(XF98SRC)/common_hw/pwskb
     XF98HWPWLBSRC = $(XF98SRC)/common_hw/pwlb
    XF98HWGA968SRC = $(XF98SRC)/common_hw/ga968
         XF98OSSRC = $(XF98SRC)/os-support
  XF98VGADRIVERSRC = $(XF98SRC)/vga256/drivers
XF98VGA16DRIVERSRC = $(XF98SRC)/vga16/drivers
 XF98VGA2DRIVERSRC = $(XF98SRC)/vga2/drivers
 XF98MONODRIVERSRC = $(XF98SRC)/mono/drivers
XF98NECS3DRIVERSRC = $(XF98SRC)/accel/s3nec/drivers
XF98PWSKBDRIVERSRC = $(XF98SRC)/accel/s3pwskb/drivers
 XF98PWLBDRIVERSRC = $(XF98SRC)/accel/s3pwlb/drivers
XF98GA968DRIVERSRC = $(XF98SRC)/accel/s3ga968/drivers

        XFREE86DOCDIR = $(LIBDIR)/doc
      XFREE86PSDOCDIR = $(XFREE86DOCDIR)/PostScript
    XFREE86HTMLDOCDIR = $(XFREE86DOCDIR)/html
XFREE86JAPANESEDOCDIR = $(XFREE86DOCDIR)/Japanese

# $XConsortium: xf86.rules /main/9 1996/10/31 14:54:26 kaleb $
# $XFree86: xc/config/cf/xf86.rules,v 3.16.2.1 1997/05/18 12:00:01 dawes Exp $

# ----------------------------------------------------------------------
# site-specific configuration parameters that go after
# the platform-specific parameters - edit site.def to change

# site:  $XConsortium: site.def /main/revisionist/4 1996/12/31 08:02:07 kaleb $
# site:  $XFree86: xc/config/cf/site.def,v 3.17.2.1 1997/06/22 10:32:21 dawes Exp $

# ---------------------------------------------------------------------
# Imake rules for building libraries, programs, scripts, and data files
# rules:  $TOG: Imake.rules /main/222 1997/07/17 20:04:40 kaleb $
# rules:  $XFree86: xc/config/cf/Imake.rules,v 3.33.2.7 1998/02/06 09:02:17 dawes Exp $

 _NULLCMD_ = @ echo -n

TKLIBNAME =

TKLIBDIR =

TCLLIBNAME =

TCLIBDIR =

          PATHSEP = /
            SHELL = /bin/sh

              TOP = ..
      CURRENT_DIR = include

            IMAKE = imake
           DEPEND = gccmakedep
        MKDIRHIER = mkdir -p
    EXPORTLISTGEN =
        CONFIGSRC = $(TOP)/config
         IMAKESRC = $(CONFIGSRC)/imake
        DEPENDSRC = $(CONFIGSRC)/util

          INCROOT = /usr/X11R6/include
        USRLIBDIR = /usr/X11R6/lib
        VARLIBDIR = /var/lib
         SHLIBDIR = /usr/X11R6/lib
       LINTLIBDIR = $(USRLIBDIR)/lint
          MANPATH = /usr/X11R6/man
    MANSOURCEPATH = $(MANPATH)/man
           MANDIR = $(MANSOURCEPATH)1
        LIBMANDIR = $(MANSOURCEPATH)3
       FILEMANDIR = $(MANSOURCEPATH)5

               AR = ar clq
  BOOTSTRAPCFLAGS =
               CC = gcc
               AS = as

.SUFFIXES: .cc

              CXX = c++
          CXXFILT = c++filt
           CXXLIB =
    CXXDEBUGFLAGS = -O2 -fno-strength-reduce
CXXDEPENDINCLUDES =
 CXXEXTRA_DEFINES =
CXXEXTRA_INCLUDES =
   CXXSTD_DEFINES = -Dlinux -D__i386__ -D_POSIX_SOURCE -D_BSD_SOURCE -D_SVID_SOURCE -DX_LOCALE $(CXXPROJECT_DEFINES)
       CXXOPTIONS =
      CXXINCLUDES = $(INCLUDES) $(TOP_INCLUDES) $(CXXEXTRA_INCLUDES)
       CXXDEFINES = $(CXXINCLUDES) $(CXXSTD_DEFINES) $(THREADS_CXXDEFINES) $(CXXEXTRA_DEFINES) $(DEFINES)
         CXXFLAGS = $(CXXDEBUGFLAGS) $(CXXOPTIONS) $(THREADS_CXXFLAGS) $(CXXDEFINES)

         COMPRESS = compress
          GZIPCMD = gzip
              CPP = /lib/cpp $(STD_CPP_DEFINES)
    PREPROCESSCMD = gcc -E $(STD_CPP_DEFINES)
          INSTALL = install
     INSTALLFLAGS = -c
               LD = ld
              LEX = flex -l
           LEXLIB = -lfl
             YACC = bison -y
           CCYACC = bison -y
             LINT = lint
      LINTLIBFLAG = -C
         LINTOPTS = -axz
               LN = ln -s
             MAKE = make
               MV = mv -f
               CP = cp

           RANLIB = ranlib
  RANLIBINSTFLAGS =

               RM = rm -f
        MANSUFFIX = 1x
     LIBMANSUFFIX = 3x
    FILEMANSUFFIX = 5x
            TROFF = psroff
            NROFF = nroff
         MSMACROS = -ms
        MANMACROS = -man
              TBL = tbl
              EQN = eqn
             NEQN = neqn
              COL = col

            DVIPS = dvips
            LATEX = latex

     STD_INCLUDES =
  STD_CPP_DEFINES = -traditional -Dlinux -D__i386__ -D_POSIX_SOURCE -D_BSD_SOURCE -D_SVID_SOURCE -DX_LOCALE $(PROJECT_DEFINES)
      STD_DEFINES = -Dlinux -D__i386__ -D_POSIX_SOURCE -D_BSD_SOURCE -D_SVID_SOURCE -DX_LOCALE $(PROJECT_DEFINES)
 EXTRA_LOAD_FLAGS =
  EXTRA_LDOPTIONS =
  EXTRA_LIBRARIES =
             TAGS = ctags

   PARALLELMFLAGS =

    SHAREDCODEDEF =
         SHLIBDEF =

     SHLIBLDFLAGS = -shared

         PICFLAGS = -fPIC

      CXXPICFLAGS = -fPIC

    PROTO_DEFINES = -DFUNCPROTO=15 -DNARROWPROTO

     INSTPGMFLAGS = -s

     INSTBINFLAGS = -m 0755
     INSTUIDFLAGS = -m 4711
     INSTLIBFLAGS = -m 0644
     INSTINCFLAGS = -m 0444
     INSTMANFLAGS = -m 0444
     INSTDATFLAGS = -m 0444
    INSTKMEMFLAGS = -m 4711

      PROJECTROOT = /usr/X11R6

      CDEBUGFLAGS = -O2 -fno-strength-reduce
        CCOPTIONS =

      ALLINCLUDES = $(INCLUDES) $(EXTRA_INCLUDES) $(TOP_INCLUDES) $(STD_INCLUDES)
       ALLDEFINES = $(ALLINCLUDES) $(STD_DEFINES) $(EXTRA_DEFINES) $(PROTO_DEFINES) $(THREADS_DEFINES) $(DEFINES)
           CFLAGS = $(CDEBUGFLAGS) $(CCOPTIONS) $(THREADS_CFLAGS) $(ALLDEFINES)
        LINTFLAGS = $(LINTOPTS) -DLINT $(ALLDEFINES) $(DEPEND_DEFINES)
         LDPRELIB = -L$(USRLIBDIR)
        LDPOSTLIB =
        LDOPTIONS = $(CDEBUGFLAGS) $(CCOPTIONS)  $(EXTRA_LDOPTIONS) $(THREADS_LDFLAGS) $(LOCAL_LDFLAGS) $(LDPRELIBS)
     CXXLDOPTIONS = $(CXXDEBUGFLAGS) $(CXXOPTIONS) $(EXTRA_LDOPTIONS) $(THREADS_CXXLDFLAGS) $(LOCAL_LDFLAGS) $(LDPRELIBS)

           LDLIBS = $(LDPOSTLIBS) $(THREADS_LIBS) $(SYS_LIBRARIES) $(EXTRA_LIBRARIES)

           CCLINK = $(CC)

          CXXLINK = $(CXX)

     LDSTRIPFLAGS = -x
   LDCOMBINEFLAGS = -r
      DEPENDFLAGS =

# Not sure this belongs here
         TKLIBDIR =
         TKINCDIR =
        TKLIBNAME =
        TKLIBRARY = -L$(TKLIBDIR) -l$(TKLIBNAME)
        TCLLIBDIR =
        TCLINCDIR =
       TCLLIBNAME =
       TCLLIBRARY = -L$(TCLLIBDIR) -l$(TCLLIBNAME)

        MACROFILE = linux.cf
           RM_CMD = $(RM)

    IMAKE_DEFINES =

         IRULESRC = $(CONFIGDIR)
        IMAKE_CMD = $(IMAKE) -DUseInstalled -I$(IRULESRC) $(IMAKE_DEFINES)

     ICONFIGFILES = $(IRULESRC)/Imake.tmpl $(IRULESRC)/X11.tmpl 			$(IRULESRC)/site.def $(IRULESRC)/$(MACROFILE) 			$(IRULESRC)/xfree86.cf $(IRULESRC)/xf86.rules $(IRULESRC)/xf86site.def $(IRULESRC)/host.def $(EXTRA_ICONFIGFILES)

# $TOG: X11.rules /main/4 1997/04/30 15:23:24 kaleb $

# ----------------------------------------------------------------------
# X Window System Build Parameters and Rules
# $TOG: X11.tmpl /main/292 1997/05/20 10:05:59 kaleb $
#
#
#
#
# $XFree86: xc/config/cf/X11.tmpl,v 1.8.2.4 1998/01/23 12:35:08 dawes Exp $

# -----------------------------------------------------------------------
# X Window System make variables; these need to be coordinated with rules

             XTOP = $(TOP)
           BINDIR = /usr/X11R6/bin
     BUILDINCROOT = $(TOP)/exports
      BUILDINCDIR = $(BUILDINCROOT)/include
      BUILDINCTOP = ../..
      BUILDLIBDIR = $(TOP)/exports/lib
      BUILDLIBTOP = ../..
      BUILDBINDIR = $(TOP)/exports/bin
      BUILDBINTOP = ../..
    XBUILDINCROOT = $(XTOP)/exports
     XBUILDINCDIR = $(XBUILDINCROOT)/include/X11
     XBUILDINCTOP = ../../..
     XBUILDBINDIR = $(XBUILDINCROOT)/bin
           INCDIR = $(INCROOT)
           ADMDIR = /usr/adm
           LIBDIR = $(USRLIBDIR)/X11
   TOP_X_INCLUDES = -I$(XPROJECTROOT)/include

           VARDIR = /var/X11

          FONTDIR = $(LIBDIR)/fonts
         XINITDIR = $(LIBDIR)/xinit
           XDMDIR = $(LIBDIR)/xdm
        XDMVARDIR = $(VARLIBDIR)/xdm
           TWMDIR = $(LIBDIR)/twm
           XSMDIR = $(LIBDIR)/xsm
           NLSDIR = $(LIBDIR)/nls
       XLOCALEDIR = $(LIBDIR)/locale
        PEXAPIDIR = $(LIBDIR)/PEX
      LBXPROXYDIR = $(LIBDIR)/lbxproxy
  PROXYMANAGERDIR = $(LIBDIR)/proxymngr
        XPRINTDIR = $(LIBDIR)
      XAPPLOADDIR = $(LIBDIR)/app-defaults
       FONTCFLAGS = -t

     INSTAPPFLAGS = $(INSTDATFLAGS)

              RGB = rgb
            FONTC = bdftopcf
        MKFONTDIR = mkfontdir

       DOCUTILSRC = $(XTOP)/doc/util
        CLIENTSRC = $(TOP)/clients
          DEMOSRC = $(TOP)/demos
       XDOCMACROS = $(DOCUTILSRC)/macros.t
       XIDXMACROS = $(DOCUTILSRC)/indexmacros.t
       PROGRAMSRC = $(TOP)/programs
           LIBSRC = $(XTOP)/lib
          FONTSRC = $(XTOP)/fonts
       INCLUDESRC = $(BUILDINCROOT)/include
      XINCLUDESRC = $(INCLUDESRC)/X11
        SERVERSRC = $(XTOP)/programs/Xserver
       CONTRIBSRC = $(XTOP)/../contrib
   UNSUPPORTEDSRC = $(XTOP)/unsupported
           DOCSRC = $(XTOP)/doc
           RGBSRC = $(XTOP)/programs/rgb
      BDFTOPCFSRC = $(PROGRAMSRC)/bdftopcf
     MKFONTDIRSRC = $(PROGRAMSRC)/mkfontdir
    FONTSERVERSRC = $(PROGRAMSRC)/xfs
       FONTINCSRC = $(XTOP)/include/fonts
        EXTINCSRC = $(XTOP)/include/extensions
     TRANSCOMMSRC = $(LIBSRC)/xtrans
   TRANS_INCLUDES = -I$(TRANSCOMMSRC)

       XENVLIBDIR = $(USRLIBDIR)
   CLIENTENVSETUP = LD_LIBRARY_PATH=$(XENVLIBDIR)

# $XConsortium: lnxLib.tmpl,v 1.5 95/01/11 21:44:44 kaleb Exp $
# $XFree86: xc/config/cf/lnxLib.tmpl,v 3.9 1996/02/24 04:32:52 dawes Exp $

          XLIBSRC = $(LIBSRC)/X11

SOXLIBREV = 6.1
DEPXONLYLIB =
XONLYLIB =  -lX11

LINTXONLY = $(LINTLIBDIR)/llib-lX11.ln

         XLIBONLY = $(XONLYLIB)

      XEXTLIBSRC = $(LIBSRC)/Xext

SOXEXTREV = 6.3
DEPEXTENSIONLIB =
EXTENSIONLIB =  -lXext

LINTEXTENSION = $(LINTLIBDIR)/llib-lXext.ln

LINTEXTENSIONLIB = $(LINTEXTENSION)
          DEPXLIB = $(DEPEXTENSIONLIB) $(DEPXONLYLIB)
             XLIB = $(EXTENSIONLIB) $(XONLYLIB)
         LINTXLIB = $(LINTXONLYLIB)

    XSSLIBSRC = $(LIBSRC)/Xss

DEPXSSLIB = $(USRLIBDIR)/libXss.a
XSSLIB =  -lXss

LINTXSS = $(LINTLIBDIR)/llib-lXss.ln

    XXF86MISCLIBSRC = $(LIBSRC)/Xxf86misc

DEPXXF86MISCLIB = $(USRLIBDIR)/libXxf86misc.a
XXF86MISCLIB =  -lXxf86misc

LINTXXF86MISC = $(LINTLIBDIR)/llib-lXxf86misc.ln

    XXF86VMLIBSRC = $(LIBSRC)/Xxf86vm

DEPXXF86VMLIB = $(USRLIBDIR)/libXxf86vm.a
XXF86VMLIB =  -lXxf86vm

LINTXXF86VM = $(LINTLIBDIR)/llib-lXxf86vm.ln

    XXF86DGALIBSRC = $(LIBSRC)/Xxf86dga

DEPXXF86DGALIB = $(USRLIBDIR)/libXxf86dga.a
XXF86DGALIB =  -lXxf86dga

LINTXXF86DGA = $(LINTLIBDIR)/llib-lXxf86dga.ln

    XDPMSLIBSRC = $(LIBSRC)/Xdpms

DEPXDPMSLIB = $(USRLIBDIR)/libXdpms.a
XDPMSLIB =  -lXdpms

LINTXDPMS = $(LINTLIBDIR)/llib-lXdpms.ln

         XAUTHSRC = $(LIBSRC)/Xau

DEPXAUTHLIB = $(USRLIBDIR)/libXau.a
XAUTHLIB =  -lXau

LINTXAUTH = $(LINTLIBDIR)/llib-lXau.ln

      XDMCPLIBSRC = $(LIBSRC)/Xdmcp

DEPXDMCPLIB = $(USRLIBDIR)/libXdmcp.a
XDMCPLIB =  -lXdmcp

LINTXDMCP = $(LINTLIBDIR)/llib-lXdmcp.ln

           XMUSRC = $(LIBSRC)/Xmu

SOXMUREV = 6.0
DEPXMULIB =
XMULIB =  -lXmu

LINTXMU = $(LINTLIBDIR)/llib-lXmu.ln

       OLDXLIBSRC = $(LIBSRC)/oldX

DEPOLDXLIB = $(USRLIBDIR)/liboldX.a
OLDXLIB =  -loldX

LINTOLDX = $(LINTLIBDIR)/llib-loldX.ln

         XPLIBSRC = $(LIBSRC)/Xp

SOXPREV = 6.2
DEPXPLIB =
XPLIB =  -lXp

LINTXP = $(LINTLIBDIR)/llib-lXp.ln

       TOOLKITSRC = $(LIBSRC)/Xt

SOXTREV = 6.0
DEPXTOOLONLYLIB =
XTOOLONLYLIB =  -lXt

LINTXTOOLONLY = $(LINTLIBDIR)/llib-lXt.ln

      DEPXTOOLLIB = $(DEPXTOOLONLYLIB) $(DEPSMLIB) $(DEPICELIB)
         XTOOLLIB = $(XTOOLONLYLIB) $(SMLIB) $(ICELIB)
     LINTXTOOLLIB = $(LINTXTOOLONLYLIB)

       XALIBSRC = $(LIBSRC)/Xa

SOXAREV = 1.0
DEPXALIB =
XALIB =  -lXa

LINTXA = $(LINTLIBDIR)/llib-lXa.ln

       AWIDGETSRC = $(LIBSRC)/Xaw

SOXAWREV = 6.1
DEPXAWLIB =
XAWLIB =  -lXaw

LINTXAW = $(LINTLIBDIR)/llib-lXaw.ln

         XILIBSRC = $(LIBSRC)/Xi

SOXINPUTREV = 6.0
DEPXILIB =
XILIB =  -lXi

LINTXI = $(LINTLIBDIR)/llib-lXi.ln

      XTESTLIBSRC = $(LIBSRC)/Xtst

SOXTESTREV = 6.1
DEPXTESTLIB =
XTESTLIB =  -lXtst

LINTXTEST = $(LINTLIBDIR)/llib-lXtst.ln

        PEXLIBSRC = $(LIBSRC)/PEX5

SOPEXREV = 6.0
DEPPEXLIB =
PEXLIB =  -lPEX5

LINTPEX = $(LINTLIBDIR)/llib-lPEX5.ln

        XIELIBSRC = $(LIBSRC)/XIE

SOXIEREV = 6.0
DEPXIELIB =
XIELIB =  -lXIE

LINTXIE = $(LINTLIBDIR)/llib-lXIE.ln

      PHIGSLIBSRC = $(LIBSRC)/PHIGS

DEPPHIGSLIB = $(USRLIBDIR)/libphigs.a
PHIGSLIB =  -lphigs

LINTPHIGS = $(LINTLIBDIR)/llib-lphigs.ln

DEPXBSDLIB = $(USRLIBDIR)/libXbsd.a
XBSDLIB =  -lXbsd

LINTXBSD = $(LINTLIBDIR)/llib-lXbsd.ln

           ICESRC = $(LIBSRC)/ICE

SOICEREV = 6.3
DEPICELIB =
ICELIB =  -lICE

LINTICE = $(LINTLIBDIR)/llib-lICE.ln

            SMSRC = $(LIBSRC)/SM

SOSMREV = 6.0
DEPSMLIB =
SMLIB =  -lSM

LINTSM = $(LINTLIBDIR)/llib-lSM.ln

           XKEYSRC = $(LIBSRC)/Xkey

SOXKEYREV = 6.0
DEPXKEYLIB =
XKEYLIB =  -lXkey

LINTXKEY = $(LINTLIBDIR)/llib-lXkey.ln

         FSLIBSRC = $(LIBSRC)/FS

DEPFSLIB = $(USRLIBDIR)/libFS.a
FSLIB =  -lFS

LINTFS = $(LINTLIBDIR)/llib-lFS.ln

         FONTLIBSRC = $(LIBSRC)/font

DEPFONTLIB = $(USRLIBDIR)/libfont.a
FONTLIB =  -lfont

LINTFONT = $(LINTLIBDIR)/llib-lfont.ln

          XPMLIBSRC = $(LIBSRC)/Xpm

DEPXPMLIB = $(USRLIBDIR)/libXpm.a
XPMLIB =  -lXpm

LINTXPM = $(LINTLIBDIR)/llib-lXpm.ln

    XKBFILELIBSRC = $(LIBSRC)/xkbfile

DEPXKBFILELIB = $(USRLIBDIR)/libxkbfile.a
XKBFILELIB =  -lxkbfile

LINTXKBFILE = $(LINTLIBDIR)/llib-lxkbfile.ln

     XKBCOMPCMD = xkbcomp

    XKBUILIBSRC = $(LIBSRC)/xkbui

DEPXKBUILIB = $(USRLIBDIR)/libxkbui.a
XKBUILIB =  -lxkbui

LINTXKBUI = $(LINTLIBDIR)/llib-lxkbui.ln

          DEPLIBS = $(DEPXAWLIB) $(DEPXMULIB) $(DEPXTOOLLIB) $(DEPXLIB)

         DEPLIBS1 = $(DEPLIBS)
         DEPLIBS2 = $(DEPLIBS)
         DEPLIBS3 = $(DEPLIBS)
         DEPLIBS4 = $(DEPLIBS)
         DEPLIBS5 = $(DEPLIBS)
         DEPLIBS6 = $(DEPLIBS)
         DEPLIBS7 = $(DEPLIBS)
         DEPLIBS8 = $(DEPLIBS)
         DEPLIBS9 = $(DEPLIBS)
         DEPLIBS10 = $(DEPLIBS)

XMULIBONLY = -lXmu
XMULIB = $(XMULIBONLY) $(XTOOLLIB) $(XLIB)

        CONFIGDIR = $(LIBDIR)/config

    USRLIBDIRPATH = $(USRLIBDIR)
        LDPRELIBS = -L$(USRLIBDIR)
       LDPOSTLIBS =
     TOP_INCLUDES = -I$(INCROOT) $(TOP_X_INCLUDES)
  PROJECT_DEFINES =

CXXPROJECT_DEFINES =

# ----------------------------------------------------------------------
# start of Imakefile

INCDIR = /usr/local/include/awe

HEADERS = awebank.h aweseq.h awe_parm.h sffile.h itypes.h sfitem.h sflayer.h	sfopts.h slist.h util.h

install:: $(HEADERS)
	@if [ -d $(DESTDIR) $(INCDIR) ]; then set +x; \
	else (set -x; $(MKDIRHIER) $(DESTDIR) $(INCDIR)); fi
	@for flag in ${MAKEFLAGS} ''; do \
	case "$$flag" in *=*) ;; *[i]*) set +e;; esac; done; \
	for i in $(HEADERS); do \
	(set -x; $(INSTALL) $(INSTALLFLAGS) $(INSTDATFLAGS) $$i $(DESTDIR) $(INCDIR)); \
	done

# ----------------------------------------------------------------------
# common rules for all Makefiles - do not edit

.c.i:
	$(RM) $@
	 $(CC) -E $(CFLAGS) $(_NOOP_) $*.c > $@

emptyrule::

clean::
	$(RM) *.CKP *.ln *.BAK *.bak *.o core errs ,* *~ *.a .emacs_* tags TAGS make.log MakeOut  "#"*

Makefile::
	-@if [ -f Makefile ]; then set -x; \
	$(RM) Makefile.bak; $(MV) Makefile Makefile.bak; \
	else exit 0; fi
	$(IMAKE_CMD) -DTOPDIR=$(TOP) -DCURDIR=$(CURRENT_DIR)

tags::
	$(TAGS) -w *.[ch]
	$(TAGS) -xw *.[ch] > TAGS

man_keywords::

# ----------------------------------------------------------------------
# empty rules for directories that do not have SUBDIRS - do not edit

install::
	@echo "install in $(CURRENT_DIR) done"

install.man::
	@echo "install.man in $(CURRENT_DIR) done"

install.linkkit::
	@echo "install.linkkit in $(CURRENT_DIR) done"

Makefiles::

includes::

depend::

# ----------------------------------------------------------------------
# dependencies generated by makedepend

awesfx-0.4.3a/seq.c100644    764    144        6335  6666566667  12511 0ustar  iwaiusers/*================================================================
 * seq.c
 *	sequencer control routine for awe sound driver
 *
 * Copyright (C) 1996-1999 Takashi Iwai
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU 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 General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 *================================================================*/

#include <stdio.h>
#include <unistd.h>
#include <sys/time.h>
#include <sys/ioctl.h>
#include <math.h>
#include <fcntl.h>
#ifdef __FreeBSD__
#  include <machine/soundcard.h>
#  include <awe_voice.h>
#elif defined(linux)
#  include <linux/soundcard.h>
#  include <linux/awe_voice.h>
#endif
#include "util.h"
#include "seq.h"

SEQ_DEFINEBUF(128);
int seqfd;

void seqbuf_dump()
{
	if (_seqbufptr)
		if (write(seqfd, _seqbuf, _seqbufptr) == -1) {
			perror("write device");
			exit(-1);
		}
	_seqbufptr = 0;
}


#define MAX_CARDS	16
int awe_dev;
/*int max_synth_voices;*/

static void seq_init_priv(char *devname);

void seq_init(char *devname)
{
	if (devname == NULL)
		seq_init_priv(OSS_SEQUENCER_DEV);
	else
		seq_init_priv(devname);
}

static void seq_init_priv(char *devname)
{
	int i;
	int nrsynths;
	struct synth_info card_info;

	if ((seqfd = open(devname, O_WRONLY, 0)) < 0) {
		perror(devname);
		exit(1);
	}

	if (ioctl(seqfd, SNDCTL_SEQ_NRSYNTHS, &nrsynths) == -1) {
		fprintf(stderr, "there is no soundcard\n");
		exit(1);
	}
	awe_dev = -1;
	for (i = 0; i < nrsynths; i++) {
		card_info.device = i;
		if (ioctl(seqfd, SNDCTL_SYNTH_INFO, &card_info) == -1) {
			fprintf(stderr, "cannot get info on soundcard\n");
			perror(devname);
			exit(1);
		}
		if (card_info.synth_type == SYNTH_TYPE_SAMPLE
		    && card_info.synth_subtype == SAMPLE_TYPE_AWE32) {
			awe_dev = i;
			/*max_synth_voices = card_info.nr_voices;*/
			break;
		}
	}

	if (awe_dev < 0) {
		fprintf(stderr, "No AWE synth device is found\n");
		exit(1);
	}
}

void seq_reset_samples(void)
{
	if (ioctl(seqfd, SNDCTL_SEQ_RESETSAMPLES, &awe_dev) == -1) {
		perror("Sample reset");
		exit(1);
	}
}

void seq_end(void)
{
	SEQ_DUMPBUF();
	/*ioctl(seqfd, SNDCTL_SEQ_SYNC);*/
	close(seqfd);
}

void seq_remove_samples(void)
{
	AWE_REMOVE_LAST_SAMPLES(seqfd, awe_dev);
}

void seq_default_atten(int val)
{
	AWE_MISC_MODE(awe_dev, AWE_MD_ZERO_ATTEN, val);
	SEQ_DUMPBUF();
}

void seq_set_gus_bank(int bank)
{
	AWE_SET_GUS_BANK(awe_dev, bank);
	SEQ_DUMPBUF();
}

int seq_load_patch(void *patch, int len)
{
	awe_patch_info *p;
	SEQ_DUMPBUF();
	p = (awe_patch_info*)patch;
	p->key = AWE_PATCH;
	p->device_no = awe_dev;
	p->sf_id = 0;
	return write(seqfd, patch, len);
}

int seq_mem_avail(void)
{
	int mem_avail = awe_dev;
	ioctl(seqfd, SNDCTL_SYNTH_MEMAVL, &mem_avail);
	return mem_avail;
}

awesfx-0.4.3a/README100644    764    144       34001  6666567441  12433 0ustar  iwaiusers================================================================
    AWE32 Sound Driver Utility Programs for Linux / FreeBSD
		version 0.4.3; Mar. 1, 1999

			Takashi Iwai
		iwai@ww.uni-erlangen.de
		http://bahamut.mm.t.u-tokyo.ac.jp/~iwai
================================================================

----------------------------------------------------------------
* GENERAL NOTES

Thie package includes a couple of utilities for AWE32 sound driver on
Linux and FreeBSD systems.  You need to use these utilities to enable
sounds on the driver properly.

Ver.0.4.3 improves the parameter calculation as almost compatible with
the DOS/Win drivers.  This is more effective in the case of ROM sounds.
If you prefer the old type sounds, use --compatible option.

This packaing contains the following programs:

 - sfxload
 - setfx
 - aweset
 - sf2text
 - text2sf
 - gusload
 - sfxtest

The programs above link to AWE library included in this package.
As default, AWElib will be installed as a shared library.
To build a static library, please modify awelib/config.h.

----------------------------------------------------------------
* SFXLOAD

SFXLOAD is a utility program to transfer the sound wave and
instruments data in a SoundFont file to the AWE32 sound driver.
This program is necessary for playing MIDI samples via sequencer
programs supporting AWE driver.

Basically, sfxload behaves as two ways.

	% sfxload fontfile
	% sfxload -b1 fontfile

The first usage is to read SF2 (or SBK) file and transfer to the awe
driver.  In this case, the samples which were loaded on the driver are
replaced with the new one.
In the second case, sfxload reads the file and appends it to the
pre-loaded samples on the driver with specified bank number.  The old
samples remain in the driver.  The additional samples can be cleared
via -x option (see below).

The sound files are searched through the path list.  The path list is
defined as built-in.  If the environment variable SFBANKDIR or the
command line option -P is given, it replaces the default search list.
The file extension .sf2, and .sbk can be abbreviated.

The new sfxload can deal with a virtual bank file.  It contains
a list of presets from various soundfonts.  See the virtual bank file
section for more details.


OPTIONS:

  -i, --clear[=bool]
	Remove all samples before loading the fonts.
	This is an explicit directive (see -b option).
	If this option is specified alone without soundfont file
	arguments, sfxload does onlay remove samples.
	Either of "on", "off", "yes", "no", "true", or "false" can be
	specified as an optional argument.
	
  -x, --remove[=bool]
  	Remove the optional samples previouly loaded via -b option.
	Otherwise, all new samples are simply appended.

  -N, --increment[=bool]
	Do not clear samples even with the absence of -b option.
	However, this option is not exclusive with -x option.  If both 
	options are specified, and the memory full error is
	encountered during loading fonts, sfxload will try to remove
	samples and load the fonts again.

  -b, --bank=number
	Append the sound samples on the specified bank.
	Without this option, all present samples in the driver are
	removed before loading the new fonts unless -N option is
	specified.  Usually, this option is necessary to load user
	bank, typically in bank one.

	eg)
		% sfxload synthgm.sbk
		% sfxload -b1 surprise.sf2

  -l, --lock[=bool]
	Lock the font.  The locked font is no longer removed via
	remove option (-x) even if it's loaded together with -b
	option.

  -C, --compat[=bool]
	Use the old (v0.4.2) parameter calculations.
	
  -A, --sense=sensitivity
  -a, --atten=attenuation
	(Only valid on compatible mode)

	These options are used to control the attenuation of samples.
	The former defines the sensitivity of initial attenuation 
	parameter of each instrument in SoundFont file.  In the
	program, the actual attenuaton is calculated from the divided
	value by this sensitivity from the original parameter.  Then,
	1.0 means to use the original parameter without modification.
	Generally, smaller number makes drum sounds louder.  The
	default value is 10.  (I think -A 2 would be similar to
	Windows sounds.)

	The latter option defines the minimum attenuation.  The value
	is given in the raw parameter for AWE driver, that is, in 8/3
	dB unit.  The default value is 32.  Note that since -A option
	will change the minimum attenuation automatically, the option
	-a must be speicifed later from -A option.

  -d, --decay=scale
	(Only valid on compatible mode)

	Set the scale of envelope decay time.  Default value is 50.0.
	Sounds decay fast when larger number is set.

	The ver.0.3 sfxload uses 54.8.  If you want to keep the same
	sound, use this number instead.

  -B, --addblank[=bool]
	Add 48 size of blank loop on each sample data.  Usually, this
	option is not necessary.  Most of soundfont files are designed 
	well for enough blank loops for each sample.

  -M, --memory[=0|1]
	Display the left memory size of DRAM on the AWE32 card.

  -c, --chorus=percent
  -r, --reverb=percent
	Specify the effects of chorus and reverb, respectively.  The
	value is in percent, from 0 to 100.  The default is
	unspecified.
	Note: these values may be overwritten by MIDI control
	messages. 

  -L, --extract=source[:map]
	Extract and load only the specified preset(s).
	This option is usually employed by drvmidi.
	The preset is given as same as in virtual bank file.

  -v, --verbose[=level]
	Increase or set the verbosity level.

  -V, --volume=percent
	Set the total volume of sounds, provided in percent.
	Default volume is 70%.

  -P, --path=path1:path2:...
	Specify the search path for sound files.  It overrides both
	the system path and environment variable SFBANKDIR.

  -d, --device=file
	Specify the device file name.  As default, /dev/sequencer
	is used.

VIRTUAL BANK FILE:

  The virtual bank file is a list of presets treated as one soundfont
  file.  The syntax of virtual bank is as follows:

	# comments
	source:map[:soundfont [preset-name]
	source:map[:soundfont [preset-name]
	...

  The first and second items are the source and mapped presets,
  respectively.  The former is the existing preset in the soundfont,
  and the latter is the actual preset loaded on the sound driver.
  The preset is described by the following three values,

	preset/bank/keynote

  If bank and keynote are omitted, bank 0 and keynote -1 (meaning to
  search all keys) are applied.

  The third item is the name of soundfont file.  The file is searched
  from the prescribed search-path.  The remaining arguments are
  ignored in sfxload.

  If the soundfont name is omitted, sfxload loads them as preset
  mapping.  It just behaves like a symbolic link of file opposing to
  copying of the file.  Any sample data is not referred at this time,
  but searched first when the note is played.

  A couple of special commands can be used together with the virtual
  presets above.  "default" command is used to specify the default
  soundfont file.  Any other presets which are not defined in the
  virtual preset lists are loaded from this default font.  For
  example, in the following virtual bank, 2mbgmgs.sf2 is used except
  for standard drumsets which employs drum.sf2:
 
	0/128:0/128:drum.sf2
	default 2mbgmgs.sf2

  Another special command is "include" command.  This simply includes
  another virtual bank file under the current position.
  For example,

	default standard.sf2
	0/128:0/128:drum.sf2
	include xgsfx.bnk


SYSTEM RESOURCE FILE:

  You can set default option arguments in the system resource file.
  There're two files loaded as default.

	$HOME/.sfxloadrc
	/etc/sfxloadrc

  The syntax is as follows:

	fontname options..

  The first argument is soundfont file name for each option.  The
  remaining arguments are identical with command line options.
  The font name "default" is used for default options for all sound
  fonts.  The default options are overridden by specific options or
  command line options.

  For example, to set default chorus level 20 except for synthgm font,
  you can write a resource file ~/.sfxloadrc like that:

	default	--chorus=20
	synthgm --chorus=0


ENVIRONMENT:

  SFBANKDIR
	Search path for sound files.  The current directory is always
	searched at first.
	

----------------------------------------------------------------
* AWESET

AWESET sets many controll parameters on AWE driver.
Most of the parameters can be controlled directly from drvmidi
MIDI sequencer.  This program is useful to control the parameters
for other non-AWE-specific programs.

The control parameters are given either by command line or a file.

	% aweset newvolume on
	% aweset n 1
	% aweset -f new-config

In the first case, aweset enables a boolean parameter "newvolume".
The second case is identical with the first case, but using an
abbreviated command.
In the last case, aweset reads a file "new-config" and parses the
contents.  The file must contain the commands like command line
arguments as former cases.

The available commands are as follows:

command(abbrev)	data type	description

- exclusive(e)	bool	exclusive note mode (default: on)
- realpan(p)	bool	real-time panning change (default: on)
- gusbank(g)	int	GUS-instrument bank number (default: 0)
- keepeffect(k)	bool	keep effect controls after clearing voices (def:off)
- zeroatten(z)	int	zero attenuation level (default: 32 - depends on sfxload)
- chnprior(C)	bool	channel priority mode (default: off)
- modsense(m)	int	modulation wheel sensitivity (default: 18)
- defpreset(P)	int	default search preset number (default: 0)
- defbank(B)	int	default search bank number (default: 0)
- defdrum(D)	int	default search drumset number (default: 0)
- toggledrum(a)	bool	accept to change bank of drum channels (def: off)
- newvolume(n)	bool	Windows/DOS-like volume calculation mode (def: on)
- chorus(c)	[0-7]	chorus mode (default: 2)
- reverb(r)	[0-7]	reverb mode (default: 4)
- bass(b)	[0-11]	equalizer bass level (default: 5)
- treble(t)	[0-11]	equalizer treble level (default: 9)
- debug(d)	int	debug mode (default: 0)
- panexchange(x) bool	exchange panning direction (left<->right) (def:off)


----------------------------------------------------------------
* SETFX

SETFX reads a configuration file and downloads the user defined
chorus/reverb effect parameters on the sound driver.

	% setfx test.cfg

The format of configuration file is as follows:

	type:mode:name:include:parameters..

	type
	    this specifies either "chorus" or "reverb".
	mode
	    the mode index in integer value from 8 to 31.
	name
	    the name of this effect in any string (except colon)
	include
	    include from the pre-defined mode.  This is valid only on
	    reverb definition.  If this index is specified, the
	    parameter lists become "pos=value pos=value.." where 'pos'
	    is a position of the parameter (from 0 to 27) and 'value'
	    is the new replaced value.
	parameters
	    effect parameters.  All values are written in hex code.  
	    In chorus mode, this contains five values, while in reverb
	    mode, 28 values must be listed.

The configuratoin file is searched according to the pre-defined
soundfont path search list.


----------------------------------------------------------------
* SF2TEXT

Sf2text converts the specified SoundFont file to the text file which
is editable easily.  Both SBK and SF2 formats can be converted. 

	% sf2text sample.sf2 sample.txt

The converted text file contains five categories.

1. major and minor versions
2. sample data position and size
3. preset information
4. instrument information
5. sample data information

The present sf2text program employes an S-expression list.
This text file can be converted to SoundFont format again via
text2sf utility program below.


----------------------------------------------------------------
* TEXT2SF

Text2sf works as an opposite convertor from text file to SoundFont
format file.  It reads an S-expression list and write it on the new
SoundFont file.

	% text2sf sample.txt sample.sf2 new.sf2

The second argument is the original SoundFont file, and the last
is the new SoundFont file.  The original file is necessary to
duplicate INFO list and wave samples to the new file.


----------------------------------------------------------------
* GUSLOAD

Gusload is a tool to load a GUS compatible patch file to AWE32 driver.

	% gusload [-i] [-v] [-b bank] [-p preset] [-k keynote] GUSfile

The voices are loaded as a preset with the prescribed instrument
number in each patch unless -p option is specified.
The bank number is also changed by -b option.
The option -k is used to specify the fixed key note for the patch.

eg)
	% gusload -b 0 -p 53 doo.pat

The option -i is identical with sfxload.  All the samples will be
cleared before loading.


----------------------------------------------------------------
* SFXTEST

Sfxtest is a sample program to control awe sound driver.

	% sfxtest commands ...

For example, to play a trumpet voice (preset 56) on key middle C (60)
for two seconds in channel access mode, execute as follows:

	% sfxtest X p 56 n 60 127 t 200 K 60

You can see the debug message of the awe driver by setting debug
mode.

	% sfxtest X D 9 p 47 n 62 100 t 150 K 47 D 0

Multiple channels can be used at the same time.

	% sfxtest X x 0 p 0 n 60 127 x 1 p 5 n 72 110 t 150 x 0 K 60 x 1 K 72


----------------------------------------------------------------
* ACKNOWLEDGMENTS

Thanks to Mark Weaver who revealed and offered ADIP compatible
parameter calculations.


----------------------------------------------------------------
* COPYRIGHT

Copyright (C) 1996-1999 by Takashi Iwai

These programs are free software; you can redistribute them and/or
modify them under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.

These programs are distributed in the hope that they will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
awesfx-0.4.3a/bank-samples/ 40755    764    144           0  6630644123  13775 5ustar  iwaiusersawesfx-0.4.3a/bank-samples/default.bnk100644    764    144         165  6630641376  16203 0ustar  iwaiusers#
# GS BANK FILE FOR DYNAMIC LOADING ON 512K DRAM
#

default 2mbgmgs

# use footsteps in synthgs
126/5:126/5:synthgs
awesfx-0.4.3a/bank-samples/test.bnk100644    764    144        1030  6376642004  15542 0ustar  iwaiusers# virtual bank structure
#
#	source:map[:soundfont [name]]
#
# preset = preset[/bank[/keynote]]
#

# map music box on preset 0
10/0:0/0:synthgm DummyPiano

# map piano1 of chaos8m on preset 1
0/0:1/0:chaos8m Piano2
# map piano1 of synthgm on preset 2
0/0:2/0:synthgm Piano3

# use all standard drums in 2mbgmgs.sf2
0/128:0/128:2mbgmgs Standard

# map standard bass drum as room bass drum in chaos4m.sf2
0/128/35:8/128/35:chaos4m Test Drum

# include XG sfx mappings
include xgsfx.bnk

# use synthgs.sbk as default fonts
default synthgs
awesfx-0.4.3a/bank-samples/xgdefault.bnk100644    764    144         117  6377223466  16543 0ustar  iwaiusers#
# XG BANK FILE FOR DYNAMIC LOADING
#

include xgmap.bnk
include default.bnk

awesfx-0.4.3a/bank-samples/xgdrum.bnk100644    764    144        6671  6377351675  16125 0ustar  iwaiusers#
# XG ADDITIONAL DRUM MAPPING
#
# Use this file with --xgmap=on option for drvmidi
#

# standard kit 1; preset number is shifted to 64

0/128:64/128		# map standard 1 from original fonts (preset#0)

0/128/86:64/128/13	# surdo mute
0/128/87:64/128/14	# surdo open
0/128/27:64/128/15	# hi-Q
0/128/28:64/128/16	# whip slap
0/128/29:64/128/17	# scratch push
0/128/30:64/128/18	# scratch pull
#0/128/26:64/128/19	# finger snap
0/128/33:64/128/19	# finger snap
0/128/32:64/128/20	# click noise
0/128/33:64/128/21	# metronome click
0/128/34:64/128/22	# metromome bell
0/128/32:64/128/23	# seq click L
0/128/32:64/128/24	# seq click H
40/128/38:64/128/25	# brush tap
40/128/40:64/128/26	# brush swirl L
40/128/39:64/128/27	# brush slap
50/128/90:64/128/28	# brush swirl H
0/128/25:64/128/29	# snare roll
0/128/88:64/128/30	# castanet
0/128/38:64/128/31	# snare L
0/128/31:64/128/32	# sticks
25/128/35:64/128/33	# BD L
#64/128/34		# open rim shot

# standard kit 2

1/128:65/128		# map standard 2

1/128/86:65/128/13	# surdo mute
1/128/87:65/128/14	# surdo open
1/128/27:65/128/15	# hi-Q
1/128/28:65/128/16	# whip slap
1/128/29:65/128/17	# scratch push
1/128/30:65/128/18	# scratch pull
#1/128/26:65/128/19	# finger snap
1/128/33:65/128/19	# finger snap
1/128/32:65/128/20	# click noise
1/128/33:65/128/21	# metronome click
1/128/34:65/128/22	# metromome bell
1/128/32:65/128/23	# seq click L
1/128/32:65/128/24	# seq click H
40/128/38:65/128/25	# brush tap
40/128/40:65/128/26	# brush swirl L
40/128/39:65/128/27	# brush slap
50/128/90:65/128/28	# brush swirl H
1/128/25:65/128/29	# snare roll
1/128/88:65/128/30	# castanet
1/128/38:65/128/31	# snare L
1/128/31:65/128/32	# sticks
25/128/35:65/128/33	# BD L
#65/128/34		# open rim shot

# electronic kit #24

24/128:88/128		# map default

24/128/86:88/128/13	# surdo mute
24/128/87:88/128/14	# surdo open
24/128/27:88/128/15	# hi-Q
24/128/28:88/128/16	# whip slap
24/128/29:88/128/17	# scratch push
24/128/30:88/128/18	# scratch pull
#24/128/26:88/128/19	# finger snap
24/128/33:88/128/19	# click noise
24/128/32:88/128/20	# click noise
24/128/33:88/128/21	# metronome click
24/128/34:88/128/22	# metromome bell
24/128/32:88/128/23	# seq click L
24/128/32:88/128/24	# seq click H
40/128/38:88/128/25	# brush tap
40/128/40:88/128/26	# brush swirl L
40/128/39:88/128/27	# brush slap
119/0/60:88/128/28	# reverse cymbal
24/128/25:88/128/29	# snare roll
24/128/27:88/128/30	# hi-Q
24/128/38:88/128/31	# snare L
24/128/31:88/128/32	# sticks
25/128/35:88/128/33	# BD L
#88/128/34		# open rim shot
24/128/29:88/128/78	# scratch push
24/128/30:88/128/79	# scratch pull

# analog kit #25

25/128:89/128		# map default

24/128/86:89/128/13	# surdo mute
24/128/87:89/128/14	# surdo open
24/128/27:89/128/15	# hi-Q
24/128/28:89/128/16	# whip slap
24/128/29:89/128/17	# scratch push
24/128/30:89/128/18	# scratch pull
#24/128/26:89/128/19	# finger snap
24/128/33:89/128/19	# click noise
24/128/32:89/128/20	# click noise
24/128/33:89/128/21	# metronome click
24/128/34:89/128/22	# metromome bell
24/128/32:89/128/23	# seq click L
24/128/32:89/128/24	# seq click H
40/128/38:89/128/25	# brush tap
40/128/40:89/128/26	# brush swirl L
40/128/39:89/128/27	# brush slap
119/0/60:88/128/28	# reverse cymbal
24/128/25:89/128/29	# snare roll
24/128/27:89/128/30	# hi-Q
24/128/38:89/128/31	# snare L
24/128/31:89/128/32	# sticks
25/128/35:89/128/33	# BD L
#89/128/34		# open rim shot
24/128/29:89/128/78	# scratch push
24/128/30:89/128/79	# scratch pull

# orchestra kit #48

48/128:114/128

awesfx-0.4.3a/bank-samples/README-bank100644    764    144        4745  6630642030  15670 0ustar  iwaiusers* CONTENTS

This directory contains some samples of virtual bank files.

[Bank Files for 512k DRAM]
default.bnk 	- bank file for dynamic loading of GS sounds
	Use this file with --dynamic option of drvmidi.
	2mbgmgs.sf2 font is used except footsteps sound.
	synthgs.sbk is used only for footsteps instead.

xgdefault.bnk	- bank file for dynamic loading of GS/XG sounds
	Use this file together with --dynamic and --xgmap=on.
	This file includes the other three XG mapping files below.
	You'll need to install all the files.

[Bank File for 8MB DRAM]
emu8m.bnk	- bank file for 8mbgmsfx.sf2 from Emu
	This file includes GS instruments from 2mbgmgs.sf2, and
	XG mapping files.  The whole file can be loaded on 8MB DRAM.

ch12msup.bnk	- bank file for chaos12m.sf2 from Chaos
	For dynamic loading 12MB fonts on 8MB DRAM.
	This file includes chaos8m.sf2 font for some GS parts.
	The XG mapping files must be also installed.

[Bank Files for XG mapping]
xgsfx.bnk 	- bank file for XG SFX kit
	Many preset mappings are defined on this file for XG SFX
	sounds.  Use this file with --xgmap=on option of drvmidi.
	If this option is enabled, bank #64 and #126 are used as
	XG SFX banks.

xgdrum.bnk	- bank file for XG Drum kit	
	Many preset mappings are defined on this file for XG Drum
	sounds.  Use this file with --xgmap=on option of drvmidi.
	If this option is enabled, from drumset #64 to #126 are used
	for XG drum sounds.

xgmap.bnk	- bank file for XG mapping
	Just including both two files above.


* HOW TO PLAY XG MIDI FILES

- Copy all the bank files above to the soundfont bank directory,
  as default, /usr/local/lib/sfbank or /dos/sb32/sfbank.
  The default bank directory is defined in awelib/config.h.
  If you'll use another GS soundfont, specify it in default.bnk.

- If you have only 512k DRAM on the soundcard, use dynamic loading.
  Set the default options of drvmidi in ~/.drvmidirc as follows:

	default --xgmap=on --dynamic=xgdefault.bnk

  xgdefault.bnk contains both GS/GM fonts and XG mappings.

  Otherwise, if you have enough DRAM, you can load all the fonts at
  once on the driver.  Then, set --xgmap option only in the default
  option of drvmidi,

	default --xgmap=on
  
- Load the font file before starting tkmidi or drvmidi.
  In the case of dynamic loading, ROM soundfont should be used:

	% sfxload synthgm

  In the case of static loading, load all the font at this time:

	% sfxload xgdefault.bnk

- Run tkmidi or drvmidi, and enjoy.

	tkmidi *.mid


----------------
Takashi Iwai	<iwai@ww.uni-erlangen.de>
awesfx-0.4.3a/bank-samples/xgmap.bnk100644    764    144         115  6377223427  15667 0ustar  iwaiusers#
# XG BANK FILE FOR STATIC LOADINIG
#

include xgsfx.bnk
include xgdrum.bnk
awesfx-0.4.3a/bank-samples/xgsfx.bnk100644    764    144        4663  6377224212  15737 0ustar  iwaiusers#
# SAMPLE MAP FILE FOR XG SFX SOUNDS
#
# Use this file with --xgmap=on option for drvmidi
#

# bank 64: XG SFX bank

120/1:0/64	# cut noise
120/1:1/64	# cut noise 2
120/1:2/64	# dist cut noise
120/2:3/64	# string slap
120/0:4/64	# bass slide
120/0:5/64	# pick strape
121/0:16/64	# fl key click
122/1:32/64	# train
122/2:33/64	# thunder
122/3:34/64	# wind
122/4:35/64	# stream
122/5:36/64	# bubble
125/127:37/64	# feed
123/1:48/64	# dog
123/2:49/64	# horse gallop
123/0:50/64	# bird
124/0:64/64	# telephone
124/2:65/64	# door creaking
124/3:66/64	# door slam
124/4:67/64	# scratch
124/4:68/64	# scratch 2
124/5:69/64	# wind chime
124/1:70/64	# telephone 2
125/1:80/64	# car engine
125/2:81/64	# car stop
125/3:82/64	# car pass
125/4:83/64	# car crash
125/5:84/64	# siren
125/6:85/64	# train
125/7:86/64	# jetplane
125/8:87/64	# starship
125/9:88/64	# burst noise
125/0:89/64	# coarster
126/1:96/64	# laughing
126/2:97/64	# screaming
126/3:98/64	# punch
126/4:99/64	# heart beat
126/5:100/64	# footsteps
126/0:101/64	# applause
127/1:112/64	# machine gun
127/2:113/64	# laser gun
127/3:114/64	# explosion
127/0:115/64	# fire work

# bank 126, preset0: XG sfx keyboard map

120/1/60:0/126/36	# cut noise
120/1/60:0/126/37	# cut noise 2
120/1/60:0/126/38	# dist cut noise
120/2/60:0/126/39	# string slap
120/0/60:0/126/40	# bass slide
120/0/60:0/126/41	# pick slide
121/1/60:0/126/52	# fl key click
122/1/60:0/126/68	# rain
122/2/60:0/126/69	# thunder
122/3/60:0/126/79	# wind
122/4/60:0/126/71	# stream
122/5/60:0/126/72	# bubble
125/127/60:0/126/73	# feed
123/1/60:0/126/84	# dog
123/2/60:0/126/85	# horse gallop
123/0/60:0/126/86	# bird 2

# bank 126, preset1: XG sfx keyboard map

124/1/60:1/126/36	# telephone 2
124/2/60:1/126/37	# door creaking
124/3/60:1/126/38	# door slam
124/4/60:1/126/39	# scratch
124/4/60:1/126/40	# scratch 2
124/5/60:1/126/41	# wind chime
124/0/60:1/126/42	# telephone ring
125/1/60:1/126/52	# engine start
125/2/60:1/126/53	# stop
125/3/60:1/126/54	# car pass
125/4/60:1/126/55	# crash
125/5/60:1/126/56	# siren
125/6/60:1/126/57	# train
125/7/60:1/126/58	# jetplane
125/8/60:1/126/59	# starship
125/9/60:1/126/60	# burst noise
125/0/60:1/126/61	# coarster
126/1/60:1/126/68	# laughing
126/2/60:1/126/69	# screaming
126/3/60:1/126/70	# punch
126/4/60:1/126/71	# heart beat
126/5/60:1/126/72	# footsteps
126/0/60:1/126/73	# applause
127/1/60:1/126/84	# machine gun
127/2/60:1/126/85	# laser gun
127/3/60:1/126/86	# explosion
127/0/60:1/126/87	# fire work
awesfx-0.4.3a/bank-samples/ch12msup.bnk100644    764    144         510  6630641363  16207 0ustar  iwaiusers#
# GS compatible bank for chaos12m
# GS parts taken from chaos8m
#

# load from bank #1 to #9 in chaos8m.sf2
*/1:*/1:chaos8m
*/2:*/2:chaos8m
*/3:*/3:chaos8m
*/4:*/4:chaos8m
*/5:*/5:chaos8m
*/6:*/6:chaos8m
*/7:*/7:chaos8m
*/8:*/8:chaos8m
*/9:*/9:chaos8m

# load XG mapping
include xgmap.bnk

# Chaos 12MB fonts
default chaos12m
awesfx-0.4.3a/bank-samples/emu8m.bnk100644    764    144        3627  6630641652  15635 0ustar  iwaiusers#
# Supplementary definitions for 8mbgmsfx.sf2 from Emu
# (included in AWE64 memory module CD-ROM)
# Some tones taken from 2mbgmgs.sf2
#

56/128/49:120/1	Cut Noise
56/128/50:120/2	String Slap
56/128/51:121/1	Key Click
56/128/79:122/1	Rain
56/128/80:122/2	Thunder
56/128/81:122/3	Wind
56/128/83:122/4	Stream
56/128/84:122/5	Bubble
56/128/76:123/1	Dog
56/128/77:123/2	Horse-Gallop
56/128/90:124/1	Telephone 2
56/128/59:124/2	Door Creaking
56/128/60:124/3	Door
56/128/61:124/4	Scratch
56/128/62:124/5	Windchime
56/128/63:125/1	Car-Engine
56/128/64:125/2	Car-Stop
56/128/65:125/3	Car-Pass
56/128/66:125/4	Car-Crash
56/128/67:125/5	Siren
56/128/68:125/6	Train
56/128/69:125/7	Jetplane
56/128/71:125/8	Starship
125/9:125/9:2mbgmgs Burst Noise
56/128/52:126/1	Laughing
56/128/53:126/2	Screaming
56/128/54:126/3	Punch
56/128/55:126/4	Hear Beat
56/128/56:126/5	Footsteps
56/128/73:127/1	Machine Gun
56/128/74:127/2	Laser Gun
56/128/75:127/3	Explosion
4/8:4/8:2mbgmgs Detuned Rhodes
5/8:5/8:2mbgmgs Detuned EP2
6/8:6/8:2mbgmgs Coupled Harpsichord
14/8:14/8:2mbgmgs Church Bell
16/8:16/8:2mbgmgs Detuned Organ 1
17/8:17/8:2mbgmgs Detuned Organ 2
19/8:19/8:2mbgmgs Detuned Organ 3
21/8:21/8:2mbgmgs Italian Accordion
24/8:24/8:2mbgmgs Ukulele
25/8:25/8:2mbgmgs 12 St. Guitar
25/16:25/16:2mbgmgs Mandolin
26/8:26/8:2mbgmgs Hawaiian Guitar
27/8:27/8:2mbgmgs Chorus Guitar
28/8:28/8:2mbgmgs Funk Guitar
30/8:30/8:2mbgmgs FeedBack Guitar
31/8:31/8:2mbgmgs Guitar FeedBack
38/8:38/8:2mbgmgs SynthBass 3
39/8:39/8:2mbgmgs SynthBass 4
48/8:48/8:2mbgmgs Orchestra Pad
50/8:50/8:2mbgmgs Syn Strings 3
61/8:61/8:2mbgmgs Brass 2
62/8:62/8:2mbgmgs Synth Brass 3
63/8:63/8:2mbgmgs Synth Brass 4
80/8:80/8:2mbgmgs Sine Wave
107/8:107/8:2mbgmgs Taisho Koto
115/8:115/8:2mbgmgs Castanets
116/8:116/8:2mbgmgs Concert BD
117/8:117/8:2mbgmgs Melo Tom 2
118/8:118/8:2mbgmgs 808 Tom
# not enough memory for this..
# */127:*/127:2mbgmgs MT

include xgmap.bnk

default 8mbgmsfx
awesfx-0.4.3a/Imakefile100644    764    144        2742  6630620162  13330 0ustar  iwaiusers/*
 * Imakefile for awesfx package
 */

/*CDEBUGFLAGS=-g*/
CDEBUGFLAGS=-Wall

#include "awelib/config.h"

#define IHaveSubdirs
SUBDIRS = awelib include
#define PassCDebugFlags 'CDEBUGFLAGS=$(CDEBUGFLAGS)'

/* binary and manual directories */
BINDIR = /usr/local/bin
MANDIR = /usr/local/man/man1
MANSUFFIX =  1

/* include directory for awelib */
INCLUDES += -Iinclude

#ifdef FreeBSDArchitecture
/* search path of awe_voice.h. */
INCLUDES += -I/usr/src/sys/i386/isa/sound
#endif

#ifdef MAKE_SHARED_LIBRARY
DEPLIB = awelib/libawe.so
#else
DEPLIB = awelib/libawe.a
#endif

AWELIB = -Lawelib -lawe

NormalProgramTarget(sfxload, sfxload.o seq.o, $(DEPLIB),  $(AWELIB), -lm)
AllTarget(sfxload)
InstallProgram(sfxload, $(BINDIR))
InstallManPage(sfxload, $(MANDIR))

NormalProgramTarget(setfx, setfx.o seq.o, $(DEPLIB),  $(AWELIB), -lm)
AllTarget(setfx)
InstallProgram(setfx, $(BINDIR))

NormalProgramTarget(sf2text, sf2text.o, $(DEPLIB), $(AWELIB), -lm)
AllTarget(sf2text)
InstallProgram(sf2text, $(BINDIR))

NormalProgramTarget(text2sf, text2sf.o, $(DEPLIB),  $(AWELIB), -lm)
AllTarget(text2sf)
InstallProgram(text2sf, $(BINDIR))

NormalProgramTarget(gusload, gusload.o seq.o,,, -lm)
AllTarget(gusload)
InstallProgram(gusload, $(BINDIR))

NormalProgramTarget(sfxtest, sfxtest.o seq.o,,, -lm)
AllTarget(sfxtest)
InstallProgram(sfxtest, $(BINDIR))

NormalProgramTarget(aweset, aweset.o seq.o, $(DEPLIB), $(AWELIB), -lm)
AllTarget(aweset)
InstallProgram(aweset, $(BINDIR))

NamedMakeSubdirs($(DEPLIB),$(SUBDIRS))
awesfx-0.4.3a/text2sf.c100644    764    144        4114  6666566710  13276 0ustar  iwaiusers/*================================================================
 * text2sf -- convert text to soundfont formmat
 *
 * Copyright (C) 1996-1999 Takashi Iwai
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU 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 General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 *================================================================*/

#include <stdio.h>
#include "util.h"
#include "sffile.h"

int seqfd, awe_dev;
static SFInfo sfinfo;

static void usage()
{
	fprintf(stderr, "text2sf -- convert text file to soundfont format\n");
	fprintf(stderr, "   version 0.4.3   copyright (c) 1996-1999 by Takashi Iwai\n");
	fprintf(stderr, "usage: text2sf text-file original-file output-file\n");
	fprintf(stderr, "    text-file: s-list text file via sf2text\n");
	fprintf(stderr, "    original-file: original soundfont file\n");
	fprintf(stderr, "    output-file: output soundfont file\n");
	exit(1);
}
	

void main(int argc, char **argv)
{
	FILE *fp, *fout;
	int piped;

	if (argc < 4) {
		usage();
		exit(1);
	}

	if ((fp = CmpOpenFile(argv[1], &piped)) == NULL) {
		fprintf(stderr, "can't open text file %s\n", argv[1]);
		exit(1);
	}
	load_textinfo(&sfinfo, fp);
	CmpCloseFile(fp, piped);

	if ((fp = fopen(argv[2], "r")) == NULL) {
		fprintf(stderr, "can't open origianl file %s\n", argv[2]);
		exit(1);
	}
	if ((fout = fopen(argv[3], "w")) == NULL) {
		fprintf(stderr, "can't open output file %s\n", argv[3]);
		exit(1);
	}

	save_soundfont(&sfinfo, fp, fout);

	fclose(fp);
	fclose(fout);

	/*free_soundfont(&sfinfo);*/
	exit(0);
}


awesfx-0.4.3a/gusload.c100644    764    144       24171  6666566664  13372 0ustar  iwaiusers/*================================================================
 * gusload -- load a GUS patch file on AWE32 sound driver
 *
 * Copyright (C) 1996-1999 Takashi Iwai
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU 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 General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 *================================================================*/

#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <math.h>
#include <sys/fcntl.h>
#ifdef __FreeBSD__
#  include <machine/soundcard.h>
#elif defined(linux)
#  include <linux/soundcard.h>
#endif
#include "guspatch.h"
#include "seq.h"
#include "util.h"

void seq_load_gus(FILE *fd);


static void usage()
{
	fprintf(stderr, "gusload -- load GUS patch file on AWE32 sound driver\n");
	fprintf(stderr, "   version 0.4.3  copyright (c) 1996-1999 by Takashi Iwai\n");
	fprintf(stderr, "usage: gusload [-options] GUSpatch\n");
	fprintf(stderr, " -v          verbose mode\n");
	fprintf(stderr, " -p number   set instrument number (default is internal value)\n");
	fprintf(stderr, " -b number   set bank number (default is 0)\n");
	fprintf(stderr, " -k keynote  set fixed keynote\n");
	exit(1);
}

static int clear_sample = FALSE;
static int preset = -1;
static int bankchange = -1;
static int keynote = -1;
int awe_verbose;

#define OPTION_FLAGS	"b:p:k:vi"

void main(int argc, char **argv)
{
	FILE *fd;
	char *gusfile;
	int c;

	while ((c = getopt(argc, argv, OPTION_FLAGS)) != -1) {
		switch (c) {
		case 'v':
			if (optarg)
				awe_verbose = atoi(optarg);
			else
				awe_verbose++;
			break;
		case 'b':
			bankchange = atoi(optarg);
			break;
		case 'p':
			preset = atoi(optarg);
			break;
		case 'k':
			keynote = atoi(optarg);
			break;
		case 'i':
			clear_sample = TRUE;
			break;
		default:
			usage();
			exit(1);
		}
	}
		
	if (argc - optind < 1) {
		usage();
		exit(1);
	}

	gusfile = argv[optind]; optind++;
	if ((fd = fopen(gusfile, "r")) == NULL) {
		fprintf(stderr, "can't open GUS patch file %s\n", gusfile);
		exit(1);
	}

	/* open awe sequencer device */
	seq_init(NULL);
	if (clear_sample)
		seq_reset_samples();

	DEBUG(0,fprintf(stderr, "uploading samples..\n"));
	seq_load_gus(fd);

	DEBUG(0,printf("DRAM memory left = %d kB\n", seq_mem_avail()/1024));

	/* close sequencer */
	seq_end();
	fclose(fd);

	exit(0);
}

static GusPatchHeader header;
static GusInstrument ins;
static GusLayerData layer;
static GusPatchData sample;

#define freq_to_note(mhz)	(int)(log((double)mhz / 8176.0) / log(2.0) * 1200.0)

/*
 * load voice record to the awe driver
 */
void seq_load_gus(FILE *fp)
{
	int j, len;
	struct patch_info *patch;

	/* Unix based routines, assume big-endian machine */
	/* read header */
	DEBUG(1,fprintf(stderr, "reading header\n"));
	fread(&header.header, sizeof(header.header), 1, fp);
	fread(&header.gravis_id, sizeof(header.gravis_id), 1, fp);
	fread(&header.description, sizeof(header.description), 1, fp);
	fread(&header.instruments, sizeof(header.instruments), 1, fp);
	fread(&header.voices, sizeof(header.voices), 1, fp);
	fread(&header.channels, sizeof(header.channels), 1, fp);
	fread(&header.wave_forms, sizeof(header.wave_forms), 1, fp);
	header.wave_forms = swapi( header.wave_forms );
	fread(&header.master_volume, sizeof(header.master_volume), 1, fp);
	header.master_volume = swapi( header.master_volume );
	fread(&header.data_size, sizeof(header.data_size), 1, fp);
	header.data_size = swapl( header.data_size );
	fread(&header.reserved, sizeof(header.reserved), 1, fp);
	/* read instrument header */
	DEBUG(1,fprintf(stderr, "reading instrument\n"));
	fread(&ins.instrument, sizeof(ins.instrument), 1, fp);
	fread(&ins.instrument_name, sizeof(ins.instrument_name), 1, fp);
	fread(&ins.instrument_size, sizeof(ins.instrument_size), 1, fp);
	ins.instrument_size = swapl( ins.instrument_size );
	fread(&ins.layers, sizeof(ins.layers), 1, fp);
	fread(&ins.reserved, sizeof(ins.reserved), 1, fp);
	/* read layer header */
	DEBUG(1,fprintf(stderr, "reading layer\n"));
	fread(&layer.layer_duplicate, sizeof(layer.layer_duplicate), 1, fp);
	fread(&layer.layer, sizeof(layer.layer), 1, fp);
	fread(&layer.layer_size, sizeof(layer.layer_size), 1, fp);
	layer.layer_size = swapl( layer.layer_size );
	fread(&layer.samples, sizeof(layer.samples), 1, fp);
	fread(&layer.reserved, sizeof(layer.reserved), 1, fp);
	if (strcmp(header.gravis_id, "ID#000002") != 0) {
		fprintf(stderr, "Not a GUS patch file\n");
		exit(1);
	}

	DEBUG(0,fprintf(stderr, "data size = %d\n", (int)header.data_size));

	/* read sample information */
	for (j = 0; j < layer.samples; j++) {
		/* read sample information */
		DEBUG(1,fprintf(stderr, "reading sample(%d)\n", j));
		fread(&sample.wave_name, sizeof(sample.wave_name), 1, fp);
		fread(&sample.fractions, sizeof(sample.fractions), 1, fp);
		fread(&sample.wave_size, sizeof(sample.wave_size), 1, fp);
		sample.wave_size = swapl( sample.wave_size );
		fread(&sample.start_loop, sizeof(sample.start_loop), 1, fp);
		fread(&sample.end_loop, sizeof(sample.end_loop), 1, fp);
		fread(&sample.sample_rate, sizeof(sample.sample_rate), 1, fp);
		sample.sample_rate = swapi( sample.sample_rate );
		fread(&sample.low_frequency, sizeof(sample.low_frequency), 1, fp);
		fread(&sample.high_frequency, sizeof(sample.high_frequency), 1, fp);
		fread(&sample.root_frequency, sizeof(sample.root_frequency), 1, fp);
		fread(&sample.tune, sizeof(sample.tune), 1, fp);
		fread(&sample.balance, sizeof(sample.balance), 1, fp);
		fread(&sample.envelope_rate, sizeof(sample.envelope_rate), 1, fp);
		fread(&sample.envelope_offset, sizeof(sample.envelope_offset), 1, fp);
		fread(&sample.tremolo_sweep, sizeof(sample.tremolo_sweep), 1, fp);
		fread(&sample.tremolo_rate, sizeof(sample.tremolo_rate), 1, fp);
		fread(&sample.tremolo_depth, sizeof(sample.tremolo_depth), 1, fp);
		fread(&sample.vibrato_sweep, sizeof(sample.vibrato_sweep), 1, fp);
		fread(&sample.vibrato_rate, sizeof(sample.vibrato_rate), 1, fp);
		fread(&sample.vibrato_depth, sizeof(sample.vibrato_depth), 1, fp);
		fread(&sample.modes, sizeof(sample.modes), 1, fp);
		fread(&sample.scale_frequency, sizeof(sample.scale_frequency), 1, fp);
		fread(&sample.scale_factor, sizeof(sample.scale_factor), 1, fp);
		sample.scale_factor = swapi( sample.scale_factor );
		fread(&sample.reserved, sizeof(sample.reserved), 1, fp);

		DEBUG(1,fprintf(stderr, "-- sample len = %d\n",
				(int)sample.wave_size));
		/* allocate sound driver patch data */
		len = sizeof(struct patch_info) + sample.wave_size - 1;
		patch = (struct patch_info*)calloc(len, 1);
		if (patch == NULL) {
			fprintf(stderr, "can't allocate patch buffer\n");
			exit(1);
		}
		patch->key = GUS_PATCH;
		patch->device_no = awe_dev;
		if (preset >= 0)
			patch->instr_no = preset;
		else
			patch->instr_no = ins.instrument;
		DEBUG(0,fprintf(stderr,"-- preset=%d\n", patch->instr_no));
		patch->mode = sample.modes;
		DEBUG(0,fprintf(stderr,"-- sample_mode=0x%x\n", patch->mode));
		patch->len = sample.wave_size;
		patch->loop_start = sample.start_loop;
		patch->loop_end = sample.end_loop;
		DEBUG(1,fprintf(stderr,"-- loop position=%d/%d\n", patch->loop_start, patch->loop_end));
		patch->base_freq = sample.sample_rate;
		if (keynote != -1) {
			/*int note = freq_to_note(sample.root_frequency);*/
			int low = freq_to_note(sample.low_frequency);
			int high = freq_to_note(sample.high_frequency);
			if (keynote < low / 100 || high / 100 < keynote)
				continue;
			low = (low / 100) * 100;
			patch->base_note = (int)(pow(2.0, (double)(keynote * 100 - low) / 1200.0) * sample.root_frequency);
			patch->low_note = (int)(pow(2.0, (double)keynote / 12.0) * 8176.0);
			patch->high_note = patch->low_note;
		} else {
			patch->base_note = sample.root_frequency;
			patch->high_note = sample.high_frequency;
			patch->low_note = sample.low_frequency;
		}
		DEBUG(0,fprintf(stderr,"-- base freq=%d, note=%d[%d] (%d[%d]-%d[%d])\n",
				(int)patch->base_freq, (int)patch->base_note,
				freq_to_note(patch->base_note)/100,
				(int)patch->low_note,
				freq_to_note(patch->low_note)/100,
				(int)patch->high_note,
				freq_to_note(patch->high_note)/100));
		patch->panning = sample.balance;
		patch->detuning = sample.tune;
		memcpy(patch->env_rate, sample.envelope_rate, 6);
		memcpy(patch->env_offset, sample.envelope_offset, 6);
		if (sample.tremolo_rate > 0 && sample.tremolo_depth > 0)
			patch->mode |= WAVE_TREMOLO;
		patch->tremolo_sweep = sample.tremolo_sweep;
		patch->tremolo_rate = sample.tremolo_rate;
		patch->tremolo_depth = sample.tremolo_depth;
		DEBUG(0,fprintf(stderr,"-- tremolo rate=%d, depth=%d\n",
		      patch->tremolo_rate, patch->tremolo_depth));
		if (sample.vibrato_rate > 0 && sample.vibrato_depth > 0)
			patch->mode |= WAVE_VIBRATO;
		patch->vibrato_sweep = sample.vibrato_sweep;
		patch->vibrato_rate = sample.vibrato_rate;
		patch->vibrato_depth = sample.vibrato_depth;
		DEBUG(0,fprintf(stderr,"-- vibrato rate=%d, depth=%d\n",
		      patch->vibrato_rate, patch->vibrato_depth));
		patch->scale_frequency = sample.scale_frequency;
		patch->scale_factor = sample.scale_factor;
		patch->volume = header.master_volume;
#if SOUND_VERSION > 301
		patch->fractions = sample.fractions;
#endif
		/* allocate raw sample buffer */
		DEBUG(1,fprintf(stderr, "-- reading wave data\n"));
		fread(patch->data, 1, patch->len, fp);

		/* if -b option is specified, change the bank value */
		if (bankchange >= 0) {
			DEBUG(1,fprintf(stderr, "-- set bank number\n"));
			seq_set_gus_bank(bankchange);
		}

		DEBUG(1,fprintf(stderr, "-- transferring\n"));
		if (write(seqfd, patch, len) == -1) {
			fprintf(stderr, "[Loading GUS %d]\n", j);
			perror("Error in loading info");
			exit(1);
		}

		/* free temporary buffer */
		free(patch);

		/* exit loop if keynote is fixed */
		if (keynote != -1)
			break;
	}
}

awesfx-0.4.3a/seq.h100644    764    144        2545  6666566357  12511 0ustar  iwaiusers/*================================================================
 * seq.h
 *	sequencer control routine
 *
 * Copyright (C) 1996-1998 Takashi Iwai
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU 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 General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 *================================================================*/

#ifndef SEQ_H_DEF
#define SEQ_H_DEF

extern int seqfd;
/*extern int nrsynths;*/
extern int awe_dev;
/*extern int max_synth_voices;*/

#define OSS_SEQUENCER_DEV	"/dev/sequencer"

void seq_init(char *devname);
void seq_reset_samples(void);
void seq_end(void);
void seq_default_atten(int val);
void seq_remove_samples(void);
void seq_initialize_chip(void);
void seq_set_gus_bank(int bank);
int seq_load_patch(void *patch, int len);
int seq_mem_avail(void);


#endif
awesfx-0.4.3a/ChangeLog.sfx100644    764    144        2640  6635576127  14105 0ustar  iwaiusersver.0.4.3p4
	- Add -i and -N options

ver.0.4.3p3
	- Load via sample sharing mode (for awedrv-0.4.3p4)
	- Fix a bug to miss some fonts in dynamic loading
	- Fix a bug in path.c
	- Change library version to 0.4.3

ver.0.4.3p2
	- Fix a bug to garbage purge_list (in parsesf.c)
	- New program: aweset

ver.0.4.3p1
	- Change parameter calculation as well as DOS drivers
	- Add --compat option to keep the compatibility with older versions
	- Avoid to load a part of layers when out of memory

ver.0.4.2
	- Add setfx command.
	- Add lock option.
	- Support for virtual bank file.
	- Support for preset mapping
	- Merge global variables to one option structure.
	- Change from Makefile to Imakefile
	- Create AWElib for easy use of patch loading
	- Fix a getopt bug.
	- Fix a bug in calculation of envelope hold time
	- Fix a bug in calculation of coarse loop addresses
	- Sfxload tells if the file is not found
	- Add keynote option in gusload
	- Change sfxtest arguments

ver.0.4.1	development versions

ver.0.4.0
	TOTALLY REWRITEN.
	- Remove -i option: always remove samples if not speicifed -b
	  option.
	- Remove other obsolte options, -I, -s, -m.
	  (though they're remained for comaptibility.)
	- Add attenuation control options, -A and -a.
	- Add memory display option, -M.
	- Do not support SFX file in sfxload utility.
	- Read & write S-expression style text file.
	- Add partial loading
	- Use default rc file
	- Support long options
awesfx-0.4.3a/sfxload.c100644    764    144       17247  6667525313  13365 0ustar  iwaiusers/*================================================================
 * sfxload -- load soundfont info onto awe sound driver
 *
 * Copyright (C) 1996-1999 Takashi Iwai
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU 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 General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 *================================================================*/

#include <stdio.h>
#include <ctype.h>
#include <unistd.h>
#include <string.h>
#include <errno.h>
#include <stdlib.h>
#include <sys/fcntl.h>
#include "util.h"
#include "seq.h"
#include "awebank.h"
#include "sfopts.h"

static char *get_fontname(int argc, char **argv);
static int parse_options(int argc, char **argv);
static void add_part_list(char *arg);

extern int awe_verbose;

/*----------------------------------------------------------------
 * print usage and exit
 *----------------------------------------------------------------*/

static void usage()
{
	fprintf(stderr, "sfxload -- load SoundFont on AWE32 sound driver\n");
	fprintf(stderr, "   version 0.4.3   copyright (c) 1996-1999 by Takashi Iwai\n");
	fprintf(stderr, "usage:	sfxload [-options] [soundfont[.sf2|.sbk|.bnk]]\n");
	fprintf(stderr, "\n");

	fprintf(stderr, " options:\n");
	fprintf(stderr, " -i, --clear[=bool]       clear all samples\n");
	fprintf(stderr, " -x, --remove[=bool]      remove additional samples\n");
	fprintf(stderr, " -N, --increment[=bool]   incremental loading\n");
	fprintf(stderr, " -b, --bank=number        append font to the specified bank\n");
	fprintf(stderr, " -l, --lock[=bool]        lock the loading fonts\n");
	fprintf(stderr, " -d, --device=file        use the given device file\n");
	fprintf(stderr, " -C, --compat[=bool]      use v0.4.2 compatible sounds\n");
	fprintf(stderr, " -A, --sense=digit        (compat) set attenuation sensitivity (default=%g)\n", awe_option.atten_sense);
	fprintf(stderr, " -a, --atten=digit        (compat) set default attenuattion (default=%d)\n", awe_option.default_atten);
	fprintf(stderr, " -d, --decay=scale        (compat) set decay time scale (default=%g)\n", awe_option.decay_sense);
	fprintf(stderr, " -M, --memory[=bool]      display available memory on DRAM\n");
	fprintf(stderr, " -B, --addblank[=bool]    add 12 words blank loop on each sample\n");
	fprintf(stderr, " -c, --chorus=percent     set chorus effect (0-100)\n");
	fprintf(stderr, " -r, --reverb=percent     set reverb effect (0-100)\n");
	fprintf(stderr, " -V, --volume=percent     set total volume (0-100) (default=%d)\n", awe_option.default_volume);
	fprintf(stderr, " -L, --extract=preset/bank/note\n");
	fprintf(stderr, "                          do partial loading\n");
	fprintf(stderr, " -P, --path=dir           set SoundFont file search path\n");
	if (awe_option.search_path)
		fprintf(stderr, "   system default path is %s\n", awe_option.search_path);
	exit(1);
}


static int sample_mode, remove_samples, dispmem, lock_sf;
enum { CLEAR_SAMPLE, INCREMENT_SAMPLE, ADD_SAMPLE };
static char *seq_devname = NULL;

static LoadList *part_list = NULL;

void main(int argc, char **argv)
{
	char *sffile;
	int rc;

	awe_init_option();

	sample_mode = ADD_SAMPLE;
	remove_samples = FALSE;
	dispmem = FALSE;
	lock_sf = -1;
	awe_verbose = 0;
	part_list = NULL;

	awe_read_option_file(NULL);
	if ((sffile = get_fontname(argc, argv)) != NULL) {
		awe_read_option_file(sffile);
	}

	parse_options(argc, argv);

	DEBUG(0,fprintf(stderr, "default bank = %d\n", awe_option.default_bank));
	DEBUG(0,fprintf(stderr, "default chorus = %d\n", awe_option.default_chorus));
	DEBUG(0,fprintf(stderr, "default reverb = %d\n", awe_option.default_reverb));
	if (awe_option.compatible) {
		DEBUG(0,fprintf(stderr, "v0.4.2-compatible mode\n"));
		DEBUG(0,fprintf(stderr, "minimum attenuation = %d\n", awe_option.default_atten));
		DEBUG(0,fprintf(stderr, "attenuation sense = %g\n", awe_option.atten_sense));
		DEBUG(0,fprintf(stderr, "decay sense = %g\n", awe_option.decay_sense));
	} else {
		DEBUG(0,fprintf(stderr, "use new calculation\n"));
	}

	/*----------------------------------------------------------------*/
	/* reset samples if necessary */
	seq_init(seq_devname);

	/* clear or remove samples */

	if (sample_mode == ADD_SAMPLE && awe_option.default_bank < 0 && sffile)
		sample_mode = CLEAR_SAMPLE;

	if (sample_mode == CLEAR_SAMPLE)
		seq_reset_samples();
	else if (sample_mode != INCREMENT_SAMPLE && remove_samples)
		seq_remove_samples();

	if (sffile == NULL && dispmem) {
		if (dispmem)
			printf("DRAM memory left = %d kB\n", seq_mem_avail()/1024);
	}
	if (sffile == NULL) {
		seq_end();
		exit(0);
	}

	/* if lock option is not specified, lockinig depends on bank mode */
	if (lock_sf < 0) {
		if (awe_option.default_bank < 0)
			lock_sf = TRUE;
		else
			lock_sf = FALSE;
	}

	rc = awe_load_bank(sffile, part_list, lock_sf);
	if (sample_mode == INCREMENT_SAMPLE && remove_samples) {
		if (rc == AWE_RET_NOMEM) {
			seq_remove_samples();
			rc = awe_load_bank(sffile, part_list, lock_sf);
		}
	}

	if (rc == AWE_RET_OK && dispmem)
		printf("DRAM memory left = %d kB\n", seq_mem_avail()/1024);

	seq_end();
	if (rc == AWE_RET_NOMEM) {
		if (awe_verbose)
			fprintf(stderr, "sfxload: no memory left\n");
		exit(1);
	} else if (rc == AWE_RET_NOT_FOUND) {
		fprintf(stderr, "sfxload: can't find font file %s\n", sffile);
		exit(1);
	} else if (rc == AWE_RET_ERR) {
		if (awe_verbose)
			fprintf(stderr, "sfxload: stopped by error\n");
	}

	exit(0);
}


/*----------------------------------------------------------------
 * long options
 *----------------------------------------------------------------*/

static awe_option_args long_options[] = {
	{"memory", 2, 0, 'M'},
	{"remove", 2, 0, 'x'},
	{"increment", 2, 0, 'N'},
	{"clear", 2, 0, 'i'},
	{"verbose", 2, 0, 'v'},
	{"extract", 1, 0, 'L'},
	{"lock", 2, 0, 'l'},
	{"device", 1, 0, 'd'},
	{0, 0, 0, 0},
};
static int option_index;

#define OPTION_FLAGS	"MxNivL:ld:"

static char *get_fontname(int argc, char **argv)
{
	int rc;
	rc = awe_get_argument(argc, argv, OPTION_FLAGS, long_options);
	if (rc < argc)
		return argv[rc];
	return NULL;
}

#define set_bool()	(optarg ? bool_val(optarg) : TRUE)

static int parse_options(int argc, char **argv)
{
	int c;
	while ((c = awe_parse_options(argc, argv, OPTION_FLAGS, long_options, &option_index)) != -1) {
		if (c == 0)
			continue;
		switch (c) {
		case 'x':
			remove_samples = set_bool();
			break;
		case 'N':
			if (set_bool())
				sample_mode = INCREMENT_SAMPLE;
			break;
		case 'i':
			if (set_bool())
				sample_mode = CLEAR_SAMPLE;
			break;
		case 'M':
			dispmem = set_bool();
			break;
		case 'v':
			if (optarg)
				awe_verbose = atoi(optarg);
			else
				awe_verbose++;
			break;
		case 'L':
			add_part_list(optarg);
			break;
		case 'l':
			lock_sf = set_bool();
			break;

		case 'd':
			seq_devname = optarg;
			break;

		case 'm':
		case 's':
		case 'I':
			break;

		default:
			usage();
			exit(1);
		}
	}
	return -1;
}

/* make a preset list from comand line options */

static void add_part_list(char *arg)
{
	char tmp[100];
	SFPatchRec pat, map;
	if (strlen(arg) > sizeof(tmp)-1) {
		fprintf(stderr, "sfxload: illegal argument %s\n", arg);
		return;
	}
	strcpy(tmp, arg);
	if (awe_parse_loadlist(tmp, &pat, &map, NULL))
		part_list = add_loadlist(part_list, &pat, &map);
}


awesfx-0.4.3a/INSTALL100644    764    144        1560  6670755423  12562 0ustar  iwaiusers====================================================================
	** INSTALLATION OF UTILIITY PROGRAMS FOR AWEDRV **
====================================================================

0. Requirements

  - AWE32 driver v0.4.3 or newer

AWE32 driver and utilities can be downloaded from:
	http://bahamut.mm.t.u-tokyo.ac.jp/~iwai/awedrv/

1. Edit awelib/config.h

    + Define MAKE_SHARED_LIBRARY to create shared AWElib.
      Comment out it if you won't build shared library.
      Define also INSTALL_AWELIB for installing AWElib on public
      directory.
      (FreeBSD-2.2.8 seems not working with shared-lib.)
    + Change DEFAULT_SF_PATH for the search path of s