home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
DP Tool Club 24
/
CD_ASCQ_24_0995.iso
/
dos
/
prg
/
dsik205
/
dsik.dat
/
INCLUDE
/
AUDIO.INC
< prev
next >
Wrap
Text File
|
1995-04-10
|
9KB
|
352 lines
;/***************************************************************************
;*
;* Digital Sound Interface Kit (DSIK)
;* Version 2.00
;*
;* by Carlos Hasan
;*
;* Filename: audio.inc
;* Version: Revision 1.1
;*
;* Language: Turbo Assembler 4.0 (Ideal Mode)
;* Environment: IBM PC (DOS/4GW)
;*
;* Description: Audio Interface assembly header file.
;*
;* Revision History:
;* ----------------
;*
;* Revision 1.1 95/01/13 22:43:26 chv
;* Now can be assembled using TASM 3.2 or later
;*
;* Revision 1.0 94/12/28 14:32:41 chv
;* Initial revision
;*
;***************************************************************************/
pushstate
; Misc defines
MAXVOICES = 32
MAXTRACKS = 16
MAXSAMPLES = 256
MAXORDERS = 128
MINPERIOD = 28
MAXPERIOD = 6848
MIDCPERIOD = 428
MIDCFREQ = 8363
; Soundcards ID values
ID_NONE = 0
ID_SB = 1
ID_SB201 = 2
ID_SBPRO = 3
ID_SB16 = 4
ID_PAS = 5
ID_PASPLUS = 6
ID_PAS16 = 7
ID_WSS = 8
ID_GUS = 9
ID_DEBUG = 255
; Soundcards capabilities bit flags
AF_8BITS = 00000000b
AF_16BITS = 00000001b
AF_MONO = 00000000b
AF_STEREO = 00000010b
AF_NODRAM = 00000000b
AF_DRAM = 00000100b
; Stereo panning values
PAN_LEFT = 000h
PAN_MIDDLE = 040h
PAN_RIGHT = 080h
PAN_SURROUND = 0A4h
; Internal lowlevel audio messages bitflags
AM_SAMPLE = 00000001b
AM_KEYON = 00000010b
AM_KEYOFF = 00000100b
AM_VOLUME = 00001000b
AM_BALANCE = 00010000b
AM_SETCTL = 00100000b
AM_GETCTL = 01000000b
AM_PAUSE = 10000000b
; Music playing status values
PS_STOPPED = 0
PS_PLAYING = 1
PS_PAUSED = 2
; Music pattern break modes
PB_NONE = 0
PB_BREAK = 1
PB_JUMP = 2
PB_HOLD = 3
PB_TRACE = 4
; RIFF/DSMF block identifier values
ID_RIFF = 46464952h
ID_DSMF = 464D5344h
ID_SONG = 474E4F53h
ID_INST = 54534E49h
ID_PATT = 54544150h
; RIFF/WAVE block identifier values
ID_WAVE = 45564157h
ID_FMT = 20746D66h
ID_DATA = 61746164h
; RIFF/DSMF INST digital samples bit flags
SF_LOOPED = 00000001b
SF_UNSIGNED = 00000000b
SF_SIGNED = 00000010b
SF_8BITS = 00000000b
SF_16BITS = 00000100b
SF_DELTA = 01000000b
SF_LIBRARY = 10000000b
; RIFF/WAVE sample format
WAVE_FMT_PCM = 1
; Error values
ERR_OK = 0
ERR_FORMAT = 1
ERR_NOFILE = 2
ERR_FILEIO = 3
ERR_NOMEM = 4
ERR_NODRAM = 5
; Internal lowlevel audio drivers structure
struc Driver
Magic dd ?
Next dd ?
ID db ?
Modes db ?
DriverName db 32 dup (?)
Port dw ?
IrqLine db ?
DmaChannel db ?
MinRate dw ?
MaxRate dw ?
BufferLength dw ?
ProcTablePtr dd ?
DriverPtr dd ?
ParmTablePtr dd ?
ends Driver
; Internal soundcards configuration structure
struc SoundCard
ID db ?
Modes db ?
Port dw ?
IrqLine db ?
DmaChannel db ?
SampleRate dw ?
DriverName db 16 dup (?)
ends SoundCard
; RIFF file and block headers structures
struc RiffHeader
ID dd ?
FileLength dd ?
FileType dd ?
ends RiffHeader
struc RiffBlock
ID dd ?
BlockLength dd ?
ends RiffBlock
; RIFF/WAVE fmt block structure
struc WaveFmt
Format dw ?
Channels dw ?
SampleRate dd ?
BytesPerSecond dd ?
BlockAlign dw ?
BitsPerSample dw ?
ends WaveFmt
; RIFF/DSMF SONG block structure
struc Song
ModuleName db 28 dup (?)
FileVersion dw ?
Flags dw ?
OrderPos dw ?
ReStart dw ?
NumOrders dw ?
NumSamples dw ?
NumPatterns dw ?
NumTracks dw ?
GlobalVolume db ?
MasterVolume db ?
InitTempo db ?
InitBPM db ?
ChanMap db MAXTRACKS dup (?)
Orders db MAXORDERS dup (?)
ends Song
; RIFF/DSMF INST block structure
struc Sample
FileName db 13 dup (?)
Flags dw ?
Volume db ?
SampleLength dd ?
LoopStart dd ?
LoopEnd dd ?
DataPtr dd ?
Rate dw ?
Voice dw ?
SampleName db 28 dup (?)
ends Sample
; RIFF/DSMF PATT block structure
struc Pattern
PtnLength dw ?
PtnData db ?
ends Pattern
; Internal RIFF/DSMF music module structure
struc DSM
Header Song ?
Samples dd ?
Patterns dd ?
ends DSM
; Internal music structures
struc MTrk
Note db ?
SampleNo db ?
Volume db ?
Balance db ?
Effect dw ?
Rate dw ?
VUMeter db ?
Flags db ?
Reserved db 38 dup (?)
ends MTrk
struc MHdr
MusicVolume dd ?
SoundVolume dd ?
Tracks MTrk MAXVOICES dup (?)
NumTracks db ?
NumVoices db ?
OrderPos db ?
OrderLen db ?
ReStart db ?
PattNum db ?
PattRow db ?
BreakFlag db ?
Tempo db ?
TempoCount db ?
BPM db ?
SyncMark db ?
Status db ?
DriverStatus db ?
PattPtr dd ?
SongPtr dd ?
ends MHdr
; External lowlevel audio drivers
codeseg
global SBDriver:Driver
global PASDriver:Driver
global WSSDriver:Driver
global GUSDriver:Driver
macro dRegisterDrivers
lea eax,[SBDriver]
call dRegisterDriver
lea eax,[PASDriver]
call dRegisterDriver
lea eax,[WSSDriver]
call dRegisterDriver
lea eax,[GUSDriver]
call dRegisterDriver
endm
; Global error variable
dataseg
global dError:dword
global dErrorMsg:dword
; Audio interface API prototypes
codeseg
global dRegisterDriver:proc
global dGetDriverStruc:proc
global dGetDriverFlags:proc
global dInit:proc
global dDone:proc
global dPoll:proc
global dSetupVoices:proc
global dMemAlloc:proc
global dMemFree:proc
global dMemAvail:proc
global dSetMusicVolume:proc
global dSetSoundVolume:proc
global dPlayMusic:proc
global dPlayPatterns:proc
global dStopMusic:proc
global dPauseMusic:proc
global dResumeMusic:proc
global dGetMusicStatus:proc
global dGetMusicStruc:proc
global dPlayVoice:proc
global dStopVoice:proc
global dSetVoiceFreq:proc
global dSetVoiceVolume:proc
global dSetVoiceBalance:proc
global dGetVoicePos:proc
global dGetVoiceStatus:proc
global dAutoDetect:proc
global dLoadModule:proc
global dFreeModule:proc
global dLoadSample:proc
global dFreeSample:proc
global dLoadModuleFile:proc
global dLoadSampleFile:proc
global dLoadSetup:proc
global dSaveSetup:proc
; Include the sound system AUDIO.LIB static-link library file
includelib "audio.lib"
;[]------------------------------------------------------------------------[]
; Register calling conventions used by the API routines: The parameters
; are passed using the EAX, EDX, EBX and ECX registers, all the registers
; are preserved except the accumulator when it is used to return values.
;[]------------------------------------------------------------------------[]
popstate