import of GPL'd AWE32 Sound Driver v0.4.2c

Submitted by:	Randall Hopper
This commit is contained in:
John-Mark Gurney 1998-01-08 22:17:17 +00:00
parent 42f9a8963d
commit 2796129cbb
6 changed files with 5488 additions and 0 deletions

View File

@ -0,0 +1,190 @@
/*----------------------------------------------------------------
* compatibility macros for AWE32 driver
*----------------------------------------------------------------*/
/* redefine following macros */
#undef IOCTL_IN
#undef IOCTL_OUT
#undef OUTW
#undef COPY_FROM_USER
#undef COPY_TO_USER
#undef GET_BYTE_FROM_USER
#undef GET_SHORT_FROM_USER
#undef IOCTL_TO_USER
#ifdef linux
/*================================================================
* Linux macros
*================================================================*/
/* use inline prefix */
#define INLINE inline
/*----------------------------------------------------------------
* memory management for linux
*----------------------------------------------------------------*/
#ifdef AWE_OBSOLETE_VOXWARE
/* old type linux system */
/* i/o requests; nothing */
#define awe_check_port() 0 /* always false */
#define awe_request_region() /* nothing */
#define awe_release_region() /* nothing */
static int _mem_start; /* memory pointer for permanent buffers */
#define my_malloc_init(memptr) _mem_start = (memptr)
#define my_malloc_memptr() _mem_start
#define my_free(ptr) /* do nothing */
#define my_realloc(buf,oldsize,size) NULL /* no realloc */
static void *my_malloc(int size)
{
char *ptr;
PERMANENT_MALLOC(ptr, char*, size, _mem_start);
return (void*)ptr;
}
/* allocate buffer only once */
#define INIT_TABLE(buffer,index,nums,type) {\
buffer = my_malloc(sizeof(type) * (nums)); index = (nums);\
}
#else
#define AWE_DYNAMIC_BUFFER
#define my_malloc_init(ptr) /* nothing */
#define my_malloc_memptr() 0
#define my_malloc(size) vmalloc(size)
#define my_free(ptr) if (ptr) {vfree(ptr);}
static void *my_realloc(void *buf, int oldsize, int size)
{
void *ptr;
if ((ptr = vmalloc(size)) == NULL)
return NULL;
memcpy(ptr, buf, ((oldsize < size) ? oldsize : size) );
vfree(buf);
return ptr;
}
/* do not allocate buffer at beginning */
#define INIT_TABLE(buffer,index,nums,type) {buffer=NULL; index=0;}
/* old type macro */
#define RET_ERROR(err) -err
#endif
/*----------------------------------------------------------------
* i/o interfaces for linux
*----------------------------------------------------------------*/
#define OUTW(data,addr) outw(data, addr)
#ifdef AWE_NEW_KERNEL_INTERFACE
#define COPY_FROM_USER(target,source,offs,count) \
copy_from_user(target, (source)+(offs), count)
#define GET_BYTE_FROM_USER(target,addr,offs) \
get_user(target, (unsigned char*)&((addr)[offs]))
#define GET_SHORT_FROM_USER(target,addr,offs) \
get_user(target, (unsigned short*)&((addr)[offs]))
#ifdef AWE_OSS38
#define IOCTL_TO_USER(target,offs,source,count) \
memcpy(target, (source)+(offs), count)
#define IO_WRITE_CHECK(cmd) (_SIOC_DIR(cmd) & _IOC_WRITE)
#else
#define IOCTL_TO_USER(target,offs,source,count) \
copy_to_user(target, (source)+(offs), count)
#define IO_WRITE_CHECK(cmd) (_IOC_DIR(cmd) & _IOC_WRITE)
#endif /* AWE_OSS38 */
#define COPY_TO_USER IOCTL_TO_USER
#define IOCTL_IN(arg) (*(int*)(arg))
#define IOCTL_OUT(arg,val) (*(int*)(arg) = (val))
#else /* old type i/o */
#define COPY_FROM_USER(target,source,offs,count) \
memcpy_fromfs(target, (source)+(offs), (count))
#define GET_BYTE_FROM_USER(target,addr,offs) \
*((char *)&(target)) = get_fs_byte((addr)+(offs))
#define GET_SHORT_FROM_USER(target,addr,offs) \
*((short *)&(target)) = get_fs_word((addr)+(offs))
#define IOCTL_TO_USER(target,offs,source,count) \
memcpy_tofs(target, (source)+(offs), (count))
#define COPY_TO_USER IOCTL_TO_USER
#define IO_WRITE_CHECK(cmd) (cmd & IOC_IN)
#define IOCTL_IN(arg) get_fs_long((long *)(arg))
#define IOCTL_OUT(arg,ret) snd_ioctl_return((int *)arg, ret)
#endif /* AWE_NEW_KERNEL_INTERFACE */
#define BZERO(target,len) memset(target, 0, len)
#define MEMCPY(dst,src,len) memcpy(dst, src, len)
#elif defined(__FreeBSD__)
/*================================================================
* FreeBSD macros
*================================================================*/
/* inline is not checked yet.. maybe it'll work */
#define INLINE /*inline*/
/*----------------------------------------------------------------
* memory management for freebsd
*----------------------------------------------------------------*/
/* i/o requests; nothing */
#define awe_check_port() 0 /* always false */
#define awe_request_region() /* nothing */
#define awe_release_region() /* nothing */
#define AWE_DYNAMIC_BUFFER
#define my_malloc_init(ptr) /* nothing */
#define my_malloc_memptr() 0
#define my_malloc(size) malloc(size, M_TEMP, M_WAITOK)
#define my_free(ptr) if (ptr) {free(ptr, M_TEMP);}
#define INIT_TABLE(buffer,index,nums,type) {buffer=NULL; index=0;}
/* it should be realloc? */
static void *my_realloc(void *buf, int oldsize, int size)
{
void *ptr;
if ((ptr = my_malloc(size)) == NULL)
return NULL;
memcpy(ptr, buf, ((oldsize < size) ? oldsize : size) );
my_free(buf);
return ptr;
}
/*----------------------------------------------------------------
* i/o interfaces for freebsd
*----------------------------------------------------------------*/
/* according to linux rule; the arguments are swapped */
#define OUTW(data,addr) outw(addr, data)
#define COPY_FROM_USER(target,source,offs,count) \
uiomove(((caddr_t)(target)),(count),((struct uio *)(source)))
#define COPY_TO_USER(target,source,offs,count) \
uiomove(((caddr_t)(source)),(count),((struct uio *)(target)))
#define GET_BYTE_FROM_USER(target,addr,offs) \
uiomove(((char*)&(target)), 1, ((struct uio *)(addr)))
#define GET_SHORT_FROM_USER(target,addr,offs) \
uiomove(((char*)&(target)), 2, ((struct uio *)(addr)))
#define IOCTL_TO_USER(target,offs,source,count) \
memcpy(&((target)[offs]), (source), (count))
#define IO_WRITE_CHECK(cmd) (cmd & IOC_IN)
#define IOCTL_IN(arg) (*(int*)(arg))
#define IOCTL_OUT(arg,val) (*(int*)(arg) = (val))
#define BZERO(target,len) bzero((caddr_t)target, len)
#define MEMCPY(dst,src,len) bcopy((caddr_t)src, (caddr_t)dst, len)
#endif

View File

@ -0,0 +1,145 @@
/*
* sound/awe_config.h
*
* Configuration of AWE32 sound driver
* version 0.4.2; Sep. 15, 1997
*
* Copyright (C) 1996 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_CONFIG_H_DEF
#define AWE_CONFIG_H_DEF
/*----------------------------------------------------------------
* system configuration
*----------------------------------------------------------------*/
/* if you're using obsolete VoxWare 3.0.x on Linux 1.2.x (or FreeBSD),
* define the following line.
*/
#undef AWE_OBSOLETE_VOXWARE
#ifdef __FreeBSD__
# define AWE_OBSOLETE_VOXWARE
#endif
/* if you're using OSS-Lite on Linux 2.1.6 or later, define the
* following line.
*/
#undef AWE_NEW_KERNEL_INTERFACE
/* if you have lowlevel.h in the lowlevel directory (OSS-Lite), define
* the following line.
*/
#undef HAS_LOWLEVEL_H
/* if your system doesn't support patch manager (OSS 3.7 or newer),
* define the following line.
*/
#undef AWE_NO_PATCHMGR
/* if your system has an additional parameter (OSS 3.8b5 or newer),
* define this.
*/
#undef AWE_OSS38
/*----------------------------------------------------------------
* AWE32 card configuration:
* uncomment the following lines only when auto detection doesn't
* work properly on your machine.
*----------------------------------------------------------------*/
/*#define AWE_DEFAULT_BASE_ADDR 0x620*/ /* base port address */
/*#define AWE_DEFAULT_MEM_SIZE 512*/ /* kbytes */
/*----------------------------------------------------------------
* maximum size of soundfont list table:
* you usually don't need to touch this value.
*----------------------------------------------------------------*/
#define AWE_MAX_SF_LISTS 16
/*----------------------------------------------------------------
* chunk size of sample and voice tables:
* you usually don't need to touch these values.
*----------------------------------------------------------------*/
#define AWE_MAX_SAMPLES 400
#define AWE_MAX_INFOS 800
/*----------------------------------------------------------------
* chorus & reverb effects send for FM chip: from 0 to 0xff
* larger numbers often cause weird sounds.
*----------------------------------------------------------------*/
#define DEF_FM_CHORUS_DEPTH 0x10
#define DEF_FM_REVERB_DEPTH 0x10
/*----------------------------------------------------------------*
* other compile conditions
*----------------------------------------------------------------*/
/* initialize FM passthrough even without extended RAM */
#undef AWE_ALWAYS_INIT_FM
/* debug on */
#define AWE_DEBUG_ON
/* GUS compatible mode */
#define AWE_HAS_GUS_COMPATIBILITY
/* accept all notes/sounds off controls */
#define AWE_ACCEPT_ALL_SOUNDS_CONTROL
/* add mixer control of emu8000 equalizer */
#define CONFIG_AWE32_MIXER
/* look up voices according to MIDI channel priority */
#define AWE_LOOKUP_MIDI_PRIORITY
/*----------------------------------------------------------------*/
/* reading configuration of sound driver */
#ifdef AWE_OBSOLETE_VOXWARE
#ifdef __FreeBSD__
# include <i386/isa/sound/sound_config.h>
#else
# include "sound_config.h"
#endif
#if defined(CONFIGURE_SOUNDCARD) && !defined(EXCLUDE_AWE32)
#define CONFIG_AWE32_SYNTH
#endif
#else /* AWE_OBSOLETE_VOXWARE */
#ifdef HAS_LOWLEVEL_H
#include "lowlevel.h"
#endif
#include "../sound_config.h"
#endif /* AWE_OBSOLETE_VOXWARE */
#endif /* AWE_CONFIG_H_DEF */

View File

@ -0,0 +1,100 @@
/*
* sound/awe_hw.h
*
* Access routines and definitions for the low level driver for the
* AWE32/Sound Blaster 32 wave table synth.
* version 0.4.2; Sep. 15, 1997
*
* Copyright (C) 1996,1997 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_HW_H_DEF
#define AWE_HW_H_DEF
/*
* Emu-8000 control registers
* name(channel) reg, port
*/
#define awe_cmd_idx(reg,ch) (((reg)<< 5) | (ch))
#define Data0 0x620 /* doubleword r/w */
#define Data1 0xA20 /* doubleword r/w */
#define Data2 0xA22 /* word r/w */
#define Data3 0xE20 /* word r/w */
#define Pointer 0xE22 /* register pointer r/w */
#define AWE_CPF(ch) awe_cmd_idx(0,ch), Data0 /* DW: current pitch and fractional address */
#define AWE_PTRX(ch) awe_cmd_idx(1,ch), Data0 /* DW: pitch target and reverb send */
#define AWE_CVCF(ch) awe_cmd_idx(2,ch), Data0 /* DW: current volume and filter cutoff */
#define AWE_VTFT(ch) awe_cmd_idx(3,ch), Data0 /* DW: volume and filter cutoff targets */
#define AWE_PSST(ch) awe_cmd_idx(6,ch), Data0 /* DW: pan send and loop start address */
#define AWE_CSL(ch) awe_cmd_idx(7,ch), Data0 /* DW: chorus send and loop end address */
#define AWE_CCCA(ch) awe_cmd_idx(0,ch), Data1 /* DW: Q, control bits, and current address */
#define AWE_HWCF4 awe_cmd_idx(1,9), Data1 /* DW: config dw 4 */
#define AWE_HWCF5 awe_cmd_idx(1,10), Data1 /* DW: config dw 5 */
#define AWE_HWCF6 awe_cmd_idx(1,13), Data1 /* DW: config dw 6 */
#define AWE_HWCF7 awe_cmd_idx(1,14), Data1 /* DW: config dw 7? (not documented) */
#define AWE_SMALR awe_cmd_idx(1,20), Data1 /* DW: sound memory address for left read */
#define AWE_SMARR awe_cmd_idx(1,21), Data1 /* DW: for right read */
#define AWE_SMALW awe_cmd_idx(1,22), Data1 /* DW: sound memory address for left write */
#define AWE_SMARW awe_cmd_idx(1,23), Data1 /* DW: for right write */
#define AWE_SMLD awe_cmd_idx(1,26), Data1 /* W: sound memory left data */
#define AWE_SMRD awe_cmd_idx(1,26), Data2 /* W: right data */
#define AWE_WC awe_cmd_idx(1,27), Data2 /* W: sample counter */
#define AWE_WC_Cmd awe_cmd_idx(1,27)
#define AWE_WC_Port Data2
#define AWE_HWCF1 awe_cmd_idx(1,29), Data1 /* W: config w 1 */
#define AWE_HWCF2 awe_cmd_idx(1,30), Data1 /* W: config w 2 */
#define AWE_HWCF3 awe_cmd_idx(1,31), Data1 /* W: config w 3 */
#define AWE_INIT1(ch) awe_cmd_idx(2,ch), Data1 /* W: init array 1 */
#define AWE_INIT2(ch) awe_cmd_idx(2,ch), Data2 /* W: init array 2 */
#define AWE_INIT3(ch) awe_cmd_idx(3,ch), Data1 /* W: init array 3 */
#define AWE_INIT4(ch) awe_cmd_idx(3,ch), Data2 /* W: init array 4 */
#define AWE_ENVVOL(ch) awe_cmd_idx(4,ch), Data1 /* W: volume envelope delay */
#define AWE_DCYSUSV(ch) awe_cmd_idx(5,ch), Data1 /* W: volume envelope sustain and decay */
#define AWE_ENVVAL(ch) awe_cmd_idx(6,ch), Data1 /* W: modulation envelope delay */
#define AWE_DCYSUS(ch) awe_cmd_idx(7,ch), Data1 /* W: modulation envelope sustain and decay */
#define AWE_ATKHLDV(ch) awe_cmd_idx(4,ch), Data2 /* W: volume envelope attack and hold */
#define AWE_LFO1VAL(ch) awe_cmd_idx(5,ch), Data2 /* W: LFO#1 Delay */
#define AWE_ATKHLD(ch) awe_cmd_idx(6,ch), Data2 /* W: modulation envelope attack and hold */
#define AWE_LFO2VAL(ch) awe_cmd_idx(7,ch), Data2 /* W: LFO#2 Delay */
#define AWE_IP(ch) awe_cmd_idx(0,ch), Data3 /* W: initial pitch */
#define AWE_IFATN(ch) awe_cmd_idx(1,ch), Data3 /* W: initial filter cutoff and attenuation */
#define AWE_PEFE(ch) awe_cmd_idx(2,ch), Data3 /* W: pitch and filter envelope heights */
#define AWE_FMMOD(ch) awe_cmd_idx(3,ch), Data3 /* W: vibrato and filter modulation freq */
#define AWE_TREMFRQ(ch) awe_cmd_idx(4,ch), Data3 /* W: LFO#1 tremolo amount and freq */
#define AWE_FM2FRQ2(ch) awe_cmd_idx(5,ch), Data3 /* W: LFO#2 vibrato amount and freq */
/* used during detection (returns ROM version?; not documented in ADIP) */
#define AWE_U1 0xE0, Data3 /* (R)(W) used in initialization */
#define AWE_U2(ch) 0xC0+(ch), Data3 /* (W)(W) used in init envelope */
#define AWE_MAX_VOICES 32
#define AWE_NORMAL_VOICES 30 /*30&31 are reserved for DRAM refresh*/
#define AWE_MAX_CHANNELS 32 /* max midi channels (must >= voices) */
#define AWE_MAX_LAYERS AWE_MAX_VOICES /* maximum number of multiple layers */
#define AWE_DRAM_OFFSET 0x200000
#define AWE_MAX_DRAM_SIZE (28 * 1024) /* 28 MB is max onboard memory */
#define AWE_DEFAULT_ATTENUATION 32 /* 12dB below */
#define AWE_DEFAULT_MOD_SENSE 18
#endif

View File

@ -0,0 +1,12 @@
/* AWE32 driver version number */
#ifndef AWE_VERSION_H_DEF
#define AWE_VERSION_H_DEF
#define AWE_VERSION_NUMBER 0x00040203
#define AWEDRV_VERSION "0.4.2c"
#define AWE_MAJOR_VERSION(id) (((id) >> 16) & 0xff)
#define AWE_MINOR_VERSION(id) (((id) >> 8) & 0xff)
#define AWE_TINY_VERSION(id) ((id) & 0xff)
#endif

View File

@ -0,0 +1,490 @@
/*
* sound/awe_voice.h
*
* Voice information definitions for the low level driver for the
* AWE32/Sound Blaster 32 wave table synth.
* version 0.4.2c; Oct. 7, 1997
*
* Copyright (C) 1996,1997 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_VOICE_H
#define AWE_VOICE_H
#ifndef SAMPLE_TYPE_AWE32
#define SAMPLE_TYPE_AWE32 0x20
#endif
#ifndef _PATCHKEY
#define _PATCHKEY(id) ((id<<8)|0xfd)
#endif
/*----------------------------------------------------------------
* patch information record
*----------------------------------------------------------------*/
/* patch interface header: 16 bytes */
typedef struct awe_patch_info {
short key; /* use AWE_PATCH here */
#define AWE_PATCH _PATCHKEY(0x07)
short device_no; /* synthesizer number */
unsigned short sf_id; /* file id (should be zero) */
short optarg; /* optional argument */
int len; /* data length (without this header) */
short type; /* patch operation type */
#define AWE_LOAD_INFO 0 /* awe_voice_rec */
#define AWE_LOAD_DATA 1 /* awe_sample_info */
#define AWE_OPEN_PATCH 2 /* awe_open_parm */
#define AWE_CLOSE_PATCH 3 /* none */
#define AWE_UNLOAD_PATCH 4 /* none */
#define AWE_REPLACE_DATA 5 /* awe_sample_info (optarg=#channels)*/
#define AWE_MAP_PRESET 6 /* awe_voice_map */
#define AWE_LOAD_CHORUS_FX 0x10 /* awe_chorus_fx_rec (optarg=mode) */
#define AWE_LOAD_REVERB_FX 0x11 /* awe_reverb_fx_rec (optarg=mode) */
short reserved; /* word alignment data */
/* the actual patch data begins after this */
#if defined(AWE_COMPAT_030) && AWE_COMPAT_030
char data[0];
#endif
} awe_patch_info;
/*#define AWE_PATCH_INFO_SIZE 16*/
#define AWE_PATCH_INFO_SIZE sizeof(awe_patch_info)
/*----------------------------------------------------------------
* open patch
*----------------------------------------------------------------*/
#define AWE_PATCH_NAME_LEN 32
typedef struct _awe_open_parm {
unsigned short type; /* sample type */
#define AWE_PAT_TYPE_MISC 0
#define AWE_PAT_TYPE_GM 1
#define AWE_PAT_TYPE_GS 2
#define AWE_PAT_TYPE_MT32 3
#define AWE_PAT_TYPE_XG 4
#define AWE_PAT_TYPE_SFX 5
#define AWE_PAT_TYPE_GUS 6
#define AWE_PAT_TYPE_MAP 7
#define AWE_PAT_LOCKED 0x100 /* lock the samples */
short reserved;
char name[AWE_PATCH_NAME_LEN];
} awe_open_parm;
/*#define AWE_OPEN_PARM_SIZE 28*/
#define AWE_OPEN_PARM_SIZE sizeof(awe_open_parm)
/*----------------------------------------------------------------
* raw voice information record
*----------------------------------------------------------------*/
/* wave table envelope & effect parameters to control EMU8000 */
typedef struct _awe_voice_parm {
unsigned short moddelay; /* modulation delay (0x8000) */
unsigned short modatkhld; /* modulation attack & hold time (0x7f7f) */
unsigned short moddcysus; /* modulation decay & sustain (0x7f7f) */
unsigned short modrelease; /* modulation release time (0x807f) */
short modkeyhold, modkeydecay; /* envelope change per key (not used) */
unsigned short voldelay; /* volume delay (0x8000) */
unsigned short volatkhld; /* volume attack & hold time (0x7f7f) */
unsigned short voldcysus; /* volume decay & sustain (0x7f7f) */
unsigned short volrelease; /* volume release time (0x807f) */
short volkeyhold, volkeydecay; /* envelope change per key (not used) */
unsigned short lfo1delay; /* LFO1 delay (0x8000) */
unsigned short lfo2delay; /* LFO2 delay (0x8000) */
unsigned short pefe; /* modulation pitch & cutoff (0x0000) */
unsigned short fmmod; /* LFO1 pitch & cutoff (0x0000) */
unsigned short tremfrq; /* LFO1 volume & freq (0x0000) */
unsigned short fm2frq2; /* LFO2 pitch & freq (0x0000) */
unsigned char cutoff; /* initial cutoff (0xff) */
unsigned char filterQ; /* initial filter Q [0-15] (0x0) */
unsigned char chorus; /* chorus send (0x00) */
unsigned char reverb; /* reverb send (0x00) */
unsigned short reserved[4]; /* not used */
} awe_voice_parm;
#define AWE_VOICE_PARM_SIZE 48
/* wave table parameters: 92 bytes */
typedef struct _awe_voice_info {
unsigned short sf_id; /* file id (should be zero) */
unsigned short sample; /* sample id */
int start, end; /* sample offset correction */
int loopstart, loopend; /* loop offset correction */
short rate_offset; /* sample rate pitch offset */
unsigned short mode; /* sample mode */
#define AWE_MODE_ROMSOUND 0x8000
#define AWE_MODE_STEREO 1
#define AWE_MODE_LOOPING 2
#define AWE_MODE_NORELEASE 4 /* obsolete */
#define AWE_MODE_INIT_PARM 8
short root; /* midi root key */
short tune; /* pitch tuning (in cents) */
char low, high; /* key note range */
char vellow, velhigh; /* velocity range */
char fixkey, fixvel; /* fixed key, velocity */
char pan, fixpan; /* panning, fixed panning */
short exclusiveClass; /* exclusive class (0 = none) */
unsigned char amplitude; /* sample volume (127 max) */
unsigned char attenuation; /* attenuation (0.375dB) */
short scaleTuning; /* pitch scale tuning(%), normally 100 */
awe_voice_parm parm; /* voice envelope parameters */
short index; /* internal index (set by driver) */
} awe_voice_info;
/*#define AWE_VOICE_INFO_SIZE 92*/
#define AWE_VOICE_INFO_SIZE sizeof(awe_voice_info)
/*----------------------------------------------------------------*/
/* The info entry of awe_voice_rec is changed from 0 to 1
* for some compilers refusing zero size array.
* Due to this change, sizeof(awe_voice_rec) becomes different
* from older versions.
* Use AWE_VOICE_REC_SIZE instead.
*/
/* instrument info header: 4 bytes */
typedef struct _awe_voice_rec_hdr {
unsigned char bank; /* midi bank number */
unsigned char instr; /* midi preset number */
char nvoices; /* number of voices */
char write_mode; /* write mode; normally 0 */
#define AWE_WR_APPEND 0 /* append anyway */
#define AWE_WR_EXCLUSIVE 1 /* skip if already exists */
#define AWE_WR_REPLACE 2 /* replace if already exists */
} awe_voice_rec_hdr;
/*#define AWE_VOICE_REC_SIZE 4*/
#define AWE_VOICE_REC_SIZE sizeof(awe_voice_rec_hdr)
/* the standard patch structure for one sample */
typedef struct _awe_voice_rec_patch {
awe_patch_info patch;
awe_voice_rec_hdr hdr;
awe_voice_info info;
} awe_voice_rec_patch;
/* obsolete data type */
#if defined(AWE_COMPAT_030) && AWE_COMPAT_030
#define AWE_INFOARRAY_SIZE 0
#else
#define AWE_INFOARRAY_SIZE 1
#endif
typedef struct _awe_voice_rec {
unsigned char bank; /* midi bank number */
unsigned char instr; /* midi preset number */
short nvoices; /* number of voices */
/* voice information follows here */
awe_voice_info info[AWE_INFOARRAY_SIZE];
} awe_voice_rec;
/*----------------------------------------------------------------
* sample wave information
*----------------------------------------------------------------*/
/* wave table sample header: 32 bytes */
typedef struct awe_sample_info {
unsigned short sf_id; /* file id (should be zero) */
unsigned short sample; /* sample id */
int start, end; /* start & end offset */
int loopstart, loopend; /* loop start & end offset */
int size; /* size (0 = ROM) */
short checksum_flag; /* use check sum = 1 */
unsigned short mode_flags; /* mode flags */
#define AWE_SAMPLE_8BITS 1 /* wave data is 8bits */
#define AWE_SAMPLE_UNSIGNED 2 /* wave data is unsigned */
#define AWE_SAMPLE_NO_BLANK 4 /* no blank loop is attached */
#define AWE_SAMPLE_SINGLESHOT 8 /* single-shot w/o loop */
#define AWE_SAMPLE_BIDIR_LOOP 16 /* bidirectional looping */
#define AWE_SAMPLE_STEREO_LEFT 32 /* stereo left sound */
#define AWE_SAMPLE_STEREO_RIGHT 64 /* stereo right sound */
#define AWE_SAMPLE_REVERSE_LOOP 128 /* reverse looping */
unsigned int checksum; /* check sum */
#if defined(AWE_COMPAT_030) && AWE_COMPAT_030
unsigned short data[0]; /* sample data follows here */
#endif
} awe_sample_info;
/*#define AWE_SAMPLE_INFO_SIZE 32*/
#define AWE_SAMPLE_INFO_SIZE sizeof(awe_sample_info)
/*----------------------------------------------------------------
* voice preset mapping
*----------------------------------------------------------------*/
typedef struct awe_voice_map {
int map_bank, map_instr, map_key; /* key = -1 means all keys */
int src_bank, src_instr, src_key;
} awe_voice_map;
#define AWE_VOICE_MAP_SIZE sizeof(awe_voice_map)
/*----------------------------------------------------------------
* awe hardware controls
*----------------------------------------------------------------*/
#define _AWE_DEBUG_MODE 0x00
#define _AWE_REVERB_MODE 0x01
#define _AWE_CHORUS_MODE 0x02
#define _AWE_REMOVE_LAST_SAMPLES 0x03
#define _AWE_INITIALIZE_CHIP 0x04
#define _AWE_SEND_EFFECT 0x05
#define _AWE_TERMINATE_CHANNEL 0x06
#define _AWE_TERMINATE_ALL 0x07
#define _AWE_INITIAL_VOLUME 0x08
#define _AWE_INITIAL_ATTEN _AWE_INITIAL_VOLUME
#define _AWE_RESET_CHANNEL 0x09
#define _AWE_CHANNEL_MODE 0x0a
#define _AWE_DRUM_CHANNELS 0x0b
#define _AWE_MISC_MODE 0x0c
#define _AWE_RELEASE_ALL 0x0d
#define _AWE_NOTEOFF_ALL 0x0e
#define _AWE_CHN_PRESSURE 0x0f
/*#define _AWE_GET_CURRENT_MODE 0x10*/
#define _AWE_EQUALIZER 0x11
/*#define _AWE_GET_MISC_MODE 0x12*/
/*#define _AWE_GET_FONTINFO 0x13*/
#define _AWE_MODE_FLAG 0x80
#define _AWE_COOKED_FLAG 0x40 /* not supported */
#define _AWE_MODE_VALUE_MASK 0x3F
/*----------------------------------------------------------------*/
#define _AWE_SET_CMD(p,dev,voice,cmd,p1,p2) \
{((char*)(p))[0] = SEQ_PRIVATE;\
((char*)(p))[1] = dev;\
((char*)(p))[2] = _AWE_MODE_FLAG|(cmd);\
((char*)(p))[3] = voice;\
((unsigned short*)(p))[2] = p1;\
((unsigned short*)(p))[3] = p2;}
/* buffered access */
#define _AWE_CMD(dev, voice, cmd, p1, p2) \
{_SEQ_NEEDBUF(8);\
_AWE_SET_CMD(_seqbuf + _seqbufptr, dev, voice, cmd, p1, p2);\
_SEQ_ADVBUF(8);}
/* direct access */
#define _AWE_CMD_NOW(seqfd,dev,voice,cmd,p1,p2) \
{struct seq_event_rec tmp;\
_AWE_SET_CMD(&tmp, dev, voice, cmd, p1, p2);\
ioctl(seqfd, SNDCTL_SEQ_OUTOFBAND, &tmp);}
/*----------------------------------------------------------------*/
/* set debugging mode */
#define AWE_DEBUG_MODE(dev,p1) _AWE_CMD(dev, 0, _AWE_DEBUG_MODE, p1, 0)
/* set reverb mode; from 0 to 7 */
#define AWE_REVERB_MODE(dev,p1) _AWE_CMD(dev, 0, _AWE_REVERB_MODE, p1, 0)
/* set chorus mode; from 0 to 7 */
#define AWE_CHORUS_MODE(dev,p1) _AWE_CMD(dev, 0, _AWE_CHORUS_MODE, p1, 0)
/* reset channel */
#define AWE_RESET_CHANNEL(dev,ch) _AWE_CMD(dev, ch, _AWE_RESET_CHANNEL, 0, 0)
#define AWE_RESET_CONTROL(dev,ch) _AWE_CMD(dev, ch, _AWE_RESET_CHANNEL, 1, 0)
/* send an effect to all layers */
#define AWE_SEND_EFFECT(dev,voice,type,value) _AWE_CMD(dev,voice,_AWE_SEND_EFFECT,type,value)
#define AWE_ADD_EFFECT(dev,voice,type,value) _AWE_CMD(dev,voice,_AWE_SEND_EFFECT,((type)|0x80),value)
#define AWE_UNSET_EFFECT(dev,voice,type) _AWE_CMD(dev,voice,_AWE_SEND_EFFECT,((type)|0x40),0)
/* send an effect to a layer */
#define AWE_SEND_LAYER_EFFECT(dev,voice,layer,type,value) _AWE_CMD(dev,voice,_AWE_SEND_EFFECT,((layer+1)<<8|(type)),value)
#define AWE_ADD_LAYER_EFFECT(dev,voice,layer,type,value) _AWE_CMD(dev,voice,_AWE_SEND_EFFECT,((layer+1)<<8|(type)|0x80),value)
#define AWE_UNSET_LAYER_EFFECT(dev,voice,layer,type) _AWE_CMD(dev,voice,_AWE_SEND_EFFECT,((layer+1)<<8|(type)|0x40),0)
/* terminate sound on the channel/voice */
#define AWE_TERMINATE_CHANNEL(dev,voice) _AWE_CMD(dev,voice,_AWE_TERMINATE_CHANNEL,0,0)
/* terminate all sounds */
#define AWE_TERMINATE_ALL(dev) _AWE_CMD(dev, 0, _AWE_TERMINATE_ALL, 0, 0)
/* release all sounds (w/o sustain effect) */
#define AWE_RELEASE_ALL(dev) _AWE_CMD(dev, 0, _AWE_RELEASE_ALL, 0, 0)
/* note off all sounds (w sustain effect) */
#define AWE_NOTEOFF_ALL(dev) _AWE_CMD(dev, 0, _AWE_NOTEOFF_ALL, 0, 0)
/* set initial attenuation */
#define AWE_INITIAL_VOLUME(dev,atten) _AWE_CMD(dev, 0, _AWE_INITIAL_VOLUME, atten, 0)
#define AWE_INITIAL_ATTEN AWE_INITIAL_VOLUME
/* relative attenuation */
#define AWE_SET_ATTEN(dev,atten) _AWE_CMD(dev, 0, _AWE_INITIAL_VOLUME, atten, 1)
/* set channel playing mode; mode=0/1/2 */
#define AWE_SET_CHANNEL_MODE(dev,mode) _AWE_CMD(dev, 0, _AWE_CHANNEL_MODE, mode, 0)
#define AWE_PLAY_INDIRECT 0 /* indirect voice mode (default) */
#define AWE_PLAY_MULTI 1 /* multi note voice mode */
#define AWE_PLAY_DIRECT 2 /* direct single voice mode */
#define AWE_PLAY_MULTI2 3 /* sequencer2 mode; used internally */
/* set drum channel mask; channels is 32bit long value */
#define AWE_DRUM_CHANNELS(dev,channels) _AWE_CMD(dev, 0, _AWE_DRUM_CHANNELS, ((channels) & 0xffff), ((channels) >> 16))
/* set bass and treble control; values are from 0 to 11 */
#define AWE_EQUALIZER(dev,bass,treble) _AWE_CMD(dev, 0, _AWE_EQUALIZER, bass, treble)
/* remove last loaded samples */
#define AWE_REMOVE_LAST_SAMPLES(seqfd,dev) _AWE_CMD_NOW(seqfd, dev, 0, _AWE_REMOVE_LAST_SAMPLES, 0, 0)
/* initialize emu8000 chip */
#define AWE_INITIALIZE_CHIP(seqfd,dev) _AWE_CMD_NOW(seqfd, dev, 0, _AWE_INITIALIZE_CHIP, 0, 0)
/* set miscellaneous modes; meta command */
#define AWE_MISC_MODE(dev,mode,value) _AWE_CMD(dev, 0, _AWE_MISC_MODE, mode, value)
/* exclusive sound off; 1=off */
#define AWE_EXCLUSIVE_SOUND(dev,mode) AWE_MISC_MODE(dev,AWE_MD_EXCLUSIVE_SOUND,mode)
/* default GUS bank number */
#define AWE_SET_GUS_BANK(dev,bank) AWE_MISC_MODE(dev,AWE_MD_GUS_BANK,bank)
/* change panning position in realtime; 0=don't 1=do */
#define AWE_REALTIME_PAN(dev,mode) AWE_MISC_MODE(dev,AWE_MD_REALTIME_PAN,mode)
/* extended pressure controls; not portable with other sound drivers */
#define AWE_KEY_PRESSURE(dev,ch,note,vel) SEQ_START_NOTE(dev,ch,(note)+128,vel)
#define AWE_CHN_PRESSURE(dev,ch,vel) _AWE_CMD(dev,ch,_AWE_CHN_PRESSURE,vel,0)
/*----------------------------------------------------------------*/
/* reverb mode parameters */
#define AWE_REVERB_ROOM1 0
#define AWE_REVERB_ROOM2 1
#define AWE_REVERB_ROOM3 2
#define AWE_REVERB_HALL1 3
#define AWE_REVERB_HALL2 4
#define AWE_REVERB_PLATE 5
#define AWE_REVERB_DELAY 6
#define AWE_REVERB_PANNINGDELAY 7
#define AWE_REVERB_PREDEFINED 8
/* user can define reverb modes up to 32 */
#define AWE_REVERB_NUMBERS 32
typedef struct awe_reverb_fx_rec {
unsigned short parms[28];
} awe_reverb_fx_rec;
/*----------------------------------------------------------------*/
/* chorus mode parameters */
#define AWE_CHORUS_1 0
#define AWE_CHORUS_2 1
#define AWE_CHORUS_3 2
#define AWE_CHORUS_4 3
#define AWE_CHORUS_FEEDBACK 4
#define AWE_CHORUS_FLANGER 5
#define AWE_CHORUS_SHORTDELAY 6
#define AWE_CHORUS_SHORTDELAY2 7
#define AWE_CHORUS_PREDEFINED 8
/* user can define chorus modes up to 32 */
#define AWE_CHORUS_NUMBERS 32
typedef struct awe_chorus_fx_rec {
unsigned short feedback; /* feedback level (0xE600-0xE6FF) */
unsigned short delay_offset; /* delay (0-0x0DA3) [1/44100 sec] */
unsigned short lfo_depth; /* LFO depth (0xBC00-0xBCFF) */
unsigned int delay; /* right delay (0-0xFFFFFFFF) [1/256/44100 sec] */
unsigned int lfo_freq; /* LFO freq LFO freq (0-0xFFFFFFFF) */
} awe_chorus_fx_rec;
/*----------------------------------------------------------------*/
/* misc mode types */
enum {
/* 0*/ AWE_MD_EXCLUSIVE_OFF, /* obsolete */
/* 1*/ AWE_MD_EXCLUSIVE_ON, /* obsolete */
/* 2*/ AWE_MD_VERSION, /* read only */
/* 3*/ AWE_MD_EXCLUSIVE_SOUND, /* ignored */
/* 4*/ AWE_MD_REALTIME_PAN, /* 0/1: do realtime pan change (default=1) */
/* 5*/ AWE_MD_GUS_BANK, /* bank number for GUS patches (default=0) */
/* 6*/ AWE_MD_KEEP_EFFECT, /* 0/1: keep effect values, (default=0) */
/* 7*/ AWE_MD_ZERO_ATTEN, /* attenuation of max volume (default=32) */
/* 8*/ AWE_MD_CHN_PRIOR, /* 0/1: set MIDI channel priority mode (default=1) */
/* 9*/ AWE_MD_MOD_SENSE, /* integer: modwheel sensitivity (def=18) */
/*10*/ AWE_MD_DEF_PRESET, /* integer: default preset number (def=0) */
/*11*/ AWE_MD_DEF_BANK, /* integer: default bank number (def=0) */
/*12*/ AWE_MD_DEF_DRUM, /* integer: default drumset number (def=0) */
/*13*/ AWE_MD_TOGGLE_DRUM_BANK, /* 0/1: toggle drum flag with bank# (def=0) */
AWE_MD_END,
};
/*----------------------------------------------------------------*/
/* effect parameters */
enum {
/* modulation envelope parameters */
/* 0*/ AWE_FX_ENV1_DELAY, /* WORD: ENVVAL */
/* 1*/ AWE_FX_ENV1_ATTACK, /* BYTE: up ATKHLD */
/* 2*/ AWE_FX_ENV1_HOLD, /* BYTE: lw ATKHLD */
/* 3*/ AWE_FX_ENV1_DECAY, /* BYTE: lw DCYSUS */
/* 4*/ AWE_FX_ENV1_RELEASE, /* BYTE: lw DCYSUS */
/* 5*/ AWE_FX_ENV1_SUSTAIN, /* BYTE: up DCYSUS */
/* 6*/ AWE_FX_ENV1_PITCH, /* BYTE: up PEFE */
/* 7*/ AWE_FX_ENV1_CUTOFF, /* BYTE: lw PEFE */
/* volume envelope parameters */
/* 8*/ AWE_FX_ENV2_DELAY, /* WORD: ENVVOL */
/* 9*/ AWE_FX_ENV2_ATTACK, /* BYTE: up ATKHLDV */
/*10*/ AWE_FX_ENV2_HOLD, /* BYTE: lw ATKHLDV */
/*11*/ AWE_FX_ENV2_DECAY, /* BYTE: lw DCYSUSV */
/*12*/ AWE_FX_ENV2_RELEASE, /* BYTE: lw DCYSUSV */
/*13*/ AWE_FX_ENV2_SUSTAIN, /* BYTE: up DCYSUSV */
/* LFO1 (tremolo & vibrato) parameters */
/*14*/ AWE_FX_LFO1_DELAY, /* WORD: LFO1VAL */
/*15*/ AWE_FX_LFO1_FREQ, /* BYTE: lo TREMFRQ */
/*16*/ AWE_FX_LFO1_VOLUME, /* BYTE: up TREMFRQ */
/*17*/ AWE_FX_LFO1_PITCH, /* BYTE: up FMMOD */
/*18*/ AWE_FX_LFO1_CUTOFF, /* BYTE: lo FMMOD */
/* LFO2 (vibrato) parameters */
/*19*/ AWE_FX_LFO2_DELAY, /* WORD: LFO2VAL */
/*20*/ AWE_FX_LFO2_FREQ, /* BYTE: lo FM2FRQ2 */
/*21*/ AWE_FX_LFO2_PITCH, /* BYTE: up FM2FRQ2 */
/* Other overall effect parameters */
/*22*/ AWE_FX_INIT_PITCH, /* SHORT: pitch offset */
/*23*/ AWE_FX_CHORUS, /* BYTE: chorus effects send (0-255) */
/*24*/ AWE_FX_REVERB, /* BYTE: reverb effects send (0-255) */
/*25*/ AWE_FX_CUTOFF, /* BYTE: up IFATN */
/*26*/ AWE_FX_FILTERQ, /* BYTE: up CCCA */
/* Sample / loop offset changes */
/*27*/ AWE_FX_SAMPLE_START, /* SHORT: offset */
/*28*/ AWE_FX_LOOP_START, /* SHORT: offset */
/*29*/ AWE_FX_LOOP_END, /* SHORT: offset */
/*30*/ AWE_FX_COARSE_SAMPLE_START, /* SHORT: upper word offset */
/*31*/ AWE_FX_COARSE_LOOP_START, /* SHORT: upper word offset */
/*32*/ AWE_FX_COARSE_LOOP_END, /* SHORT: upper word offset */
/*33*/ AWE_FX_ATTEN, /* BYTE: lo IFATN */
AWE_FX_END,
};
#endif /* AWE_VOICE_H */

File diff suppressed because it is too large Load Diff