supermario/bin/MPW-3.2.3/Interfaces/AIncludes/Sound.a
2019-06-29 22:17:03 +08:00

407 lines
12 KiB
Plaintext

; Version: 3.24
; Created: Friday, October 20, 1989 at 9:54:13 PM
;
; File: Sound.a
;
; Assembler Interface to the Macintosh Libraries
; Copyright Apple Computer, Inc. 1986-1990
; All Rights Reserved
;
;--------------------------------------------------------------------
IF &TYPE('__IncludingSound__') = 'UNDEFINED' THEN
__IncludingSound__ SET 1
; _______________________________________________________________________
;
; Sound Driver
;
; _______________________________________________________________________
swMode EQU -1
ftMode EQU 1
ffMode EQU 0
FFSynthRec RECORD 0
mode DS.W 1
count DS.L 1
waveBytes DS.B 30001
ENDR
Tone RECORD 0
count DS.W 1
amplitude DS.W 1
duration DS.W 1
toneRecSize EQU *
ENDR
SWSynthRec RECORD 0
mode DS.W 1
triplets DS.B 5001*Tone.toneRecSize
ENDR
FTSoundRec RECORD 0
duration DS.W 1
sound1Rate DS.L 1
sound1Phase DS.L 1
sound2Rate DS.L 1
sound2Phase DS.L 1
sound3Rate DS.L 1
sound3Phase DS.L 1
sound4Rate DS.L 1
sound4Phase DS.L 1
sound1Wave DS.L 1
sound2Wave DS.L 1
sound3Wave DS.L 1
sound4Wave DS.L 1
ENDR
FTSynthRec RECORD 0
mode DS.W 1
sndRec DS.L 1
ENDR
; _______________________________________________________________________
;
; Sound Manager constants
;
; _______________________________________________________________________
synthCodeRsrc EQU 'snth'
soundListRsrc EQU 'snd '
rate22khz EQU $56EE8BA3 ; 22254.54545
rate11khz EQU $2B7745D1 ; 11127.27273
; synthesizer numbers for SndNewChannel
squareWaveSynth EQU 1 ; square wave synthesizer
waveTableSynth EQU 3 ; wave table synthesizer
sampledSynth EQU 5 ; sampled sound synthesizer
; Command Numbers
nullCmd EQU 0
initCmd EQU 1
freeCmd EQU 2
quietCmd EQU 3
flushCmd EQU 4
reInitCmd EQU 5
waitCmd EQU 10
pauseCmd EQU 11
resumeCmd EQU 12
callBackCmd EQU 13
syncCmd EQU 14
emptyCmd EQU 15
tickleCmd EQU 20
requestNextCmd EQU 21
howOftenCmd EQU 22
wakeUpCmd EQU 23
availableCmd EQU 24
versionCmd EQU 25
totalLoadCmd EQU 26
loadCmd EQU 27
scaleCmd EQU 30
tempoCmd EQU 31
freqDurationCmd EQU 40
restCmd EQU 41
freqCmd EQU 42
ampCmd EQU 43
timbreCmd EQU 44
getAmpCmd EQU 45
waveTableCmd EQU 60
phaseCmd EQU 61
soundCmd EQU 80
bufferCmd EQU 81
rateCmd EQU 82
continueCmd EQU 83
doubleBufferCmd EQU 84
getRateCmd EQU 85
sizeCmd EQU 90
convertCmd EQU 91
stdQLength EQU 128
dataOffsetFlag EQU $8000
waveInitChannelMask EQU $07
waveInitChannel0 EQU $04
waveInitChannel1 EQU $05
waveInitChannel2 EQU $06
waveInitChannel3 EQU $07
; channel initialization parameters
initPanMask EQU $0003 ; mask for right/left pan values
initSRateMask EQU $0030 ; mask for sample rate values
initStereoMask EQU $00C0 ; mask for mono/stereo values
initCompMask EQU $FF00 ; mask for compression IDs
initChanLeft EQU $0002 ; left stereo channel
initChanRight EQU $0003 ; right stereo channel
initSRate22k EQU $0020 ; 22k sampling rate
initMono EQU $0080 ; monophonic channel
initStereo EQU $00C0 ; stereo channel
initNoInterp EQU $0004 ; no linear interpolation
initNoDrop EQU $0008 ; no drop-sample conversion
initMACE3 EQU $0300 ; MACE 3:1
initMACE6 EQU $0400 ; MACE 6:1
initChan0 EQU $0004 ; channel 0 - wave table only
initChan1 EQU $0005 ; channel 1 - wave table only
initChan2 EQU $0006 ; channel 2 - wave table only
initChan3 EQU $0007 ; channel 3 - wave table only
stdSH EQU $0
extSH EQU $FF
cmpSH EQU $FE
notCompressed EQU 0
twoToOne EQU 1
eightToThree EQU 2
threeToOne EQU 3
sixToOne EQU 4
outsideCmpSH EQU 0
insideCmpSH EQU 1
aceSuccess EQU 0
aceMemFull EQU 1
aceNilBlock EQU 2
aceBadComp EQU 3
aceBadEncode EQU 4
aceBadDest EQU 5
aceBadCmd EQU 6
sixToOnePacketSize EQU 8
threeToOnePacketSize EQU 16
stateBlockSize EQU 64
leftOverBlockSize EQU 32
firstSoundFormat EQU 1
secondSoundFormat EQU 2
dbBufferReady EQU $00000001
dbLastBuffer EQU $00000004
sysBeepDisable EQU $0000
sysBeepEnable EQU $0001
unitTypeNoSelection EQU $FFFF
unitTypeSeconds EQU $0000
noneCompType EQU 'NONE' ; use no compression on samples
MACE3CompType EQU 'MAC3' ; use MACE 3:1 compression on samples
MACE6CompType EQU 'MAC6' ; use MACE 6:1 compression on samples
; _______________________________________________________________________
;
; Sound Manager structures
;
; _______________________________________________________________________
SndCommand RECORD 0
cmd DS.W 1 ; INTEGER
param1 DS.W 1 ; INTEGER
param2 DS.L 1 ; LONGINT
sndCSize EQU * ; size of SndCommand
ENDR
SndChannel RECORD 0
nextChan DS.L 1 ; ^SndChannel
firstMod DS.L 1 ; Ptr
callBack DS.L 1 ; ProcPtr
userInfo DS.L 1
; The following is for internal Sound Manager use only.
wait DS.L 1 ; Time [LONGINT]
cmdInProgress DS SndCommand
flags DS.W 1 ; INTEGER
qLength DS.W 1 ; INTEGER
qHead DS.W 1 ; INTEGER
qTail DS.W 1 ; INTEGER
queue DS stdQLength*SndCommand.sndCSize
sndChSize EQU * ; size of SndChannel
ENDR
SoundHeader RECORD 0
samplePtr DS.L 1 ; Ptr - if NIL then samples are in sampleArea
length DS.L 1 ; LONGINT
sampleRate DS.L 1 ; Fixed
loopStart DS.L 1 ; LONGINT
loopEnd DS.L 1 ; LONGINT
baseFrequency DS.W 1 ; INTEGER
;sampleArea DS.B 0 ; PACKED ARRAY [0..0] OF Byte
ENDR
SMStatus RECORD 0
smMaxCPULoad DS.W 1
smNumChannels DS.W 1
smCurCPULoad DS.W 1
ENDR
SCStatus RECORD 0
scStartTime DS.L 1
scEndTime DS.L 1
scCurrentTime DS.L 1
scChannelBusy DS.B 1
scChannelDisposed DS.B 1
scChannelPaused DS.B 1
scUnused DS.B 1
scChannelAttributes DS.L 1
scCPULoad DS.L 1
ENDR
AudioSelection RECORD 0
unitType DS.L 1
selStart DS.L 1 ; Fixed;
selEnd DS.L 1 ; Fixed;
ENDR
SndDoubleBuffer RECORD 0
dbNumFrames DS.L 1
dbFlags DS.L 1
dbUserInfo DS.L 2
dbSoundData EQU *
ENDR
SndDoubleBufferHeader RECORD 0
dbhNumChannels DS.W 1
dbhSampleSize DS.W 1
dbhCompressionID DS.W 1
dbhPacketSize DS.W 1
dbhSampleRate DS.L 1
dbhBufferPtr DS.L 2
dbhDoubleBack DS.L 1
SndDoubleBufferHeaderSz EQU *
ENDR
; _______________________________________________________________________
;
; MACE structures
;
; _______________________________________________________________________
LeftOverBlock RECORD 0
count DS.W 1
sampleArea DS.W leftOverBlockSize
ENDR
CmpSoundHeader RECORD 0
samplePtr DS.L 1 ; if NIL then samples are in sampleArea
numChannels DS.L 1 ; number of channels mono = 1
sampleRate DS.L 1 ; sample rate in Apples Fixed point representation
loopStart DS.L 1 ; loopStart of sound before compression
loopEnd DS.L 1 ; loopEnd of sound before compression
encode DS.B 1 ; data structure used , stdSH, extSH, or cmpSH
baseFrequency DS.B 1 ; same meaning as regular SoundHeader
numFrames DS.L 1 ; length in frames ( packetFrames or sampleFrames
AIFFSampleRate DS.X 1 ; IEEE sample rate EXTENDED number
markerChunk DS.L 1 ; sync track
futureUse1 DS.L 1 ; reserved by Apple
futureUse2 DS.L 1 ; reserved by Apple
stateVars DS.L 1 ; pointer to State Block
leftOverSamples DS.L 1 ; used to save truncated samples between compression calls
compressionID DS.W 1 ; 0 means no compression, non zero means compressionID
packetSize DS.W 1 ; number of bits in compressed sample packet
snthID DS.W 1 ; Resource ID of Sound Manager snth that contains NRT C/E
sampleSize DS.W 1 ; number of bits in non-compressed sample
;sampleArea DS.B 0 ; space for when samples follow directly
ENDR
ExtSoundHeader RECORD 0
samplePtr DS.L 1 ; if NIL then samples are in sampleArea
numChannels DS.L 1 ; number of channels mono = 1
sampleRate DS.L 1 ; sample rate in Apples Fixed point representation
loopStart DS.L 1 ; loopStart of sound before compression
loopEnd DS.L 1 ; loopEnd of sound before compression
encode DS.B 1 ; data structure used , stdSH, extSH, or cmpSH
baseFrequency DS.B 1 ; same meaning as regular SoundHeader
numFrames DS.L 1 ; length in total number of frames
AIFFSampleRate DS.X 1 ; IEEE sample rate
markerChunk DS.L 1 ; sync track
instrumentChunks DS.L 1
AESRecording DS.L 1
sampleSize DS.W 1 ; number of bits in sample
futureUse1 DS.W 1 ; reserved by Apple
futureUse2 DS.L 1 ; reserved by Apple
futureUse3 DS.L 1 ; reserved by Apple
futureUse4 DS.L 1 ; reserved by Apple
;sampleArea DS.B 0 ; space for when samples follow directly
ENDR
; _______________________________________________________________________
;
; Sound Input
;
; _______________________________________________________________________
siDeviceIsConnected EQU 1 ; input device is connected and ready for input
siDeviceNotConnected EQU 0 ; input device is not connected
siDontKnowIfConnected EQU -1 ; can't tell if input device is connected
; Info Selectors for the SPBGetDeviceInfo and SPBSetDeviceInfo calls
siDeviceConnected EQU 'dcon' ; input device connection status
siAGCOnOff EQU 'agc ' ; automatic gain control state
siPlayThruOnOff EQU 'plth' ; playthrough state
siTwosComplementOnOff EQU 'twos' ; two's complement state
siLevelMeterOnOff EQU 'lmet' ; level meter state
siRecordingQuality EQU 'qual' ; recording quality
siVoxRecordInfo EQU 'voxr' ; VOX record parameters
siVoxStopInfo EQU 'voxs' ; VOX stop parameters
siNumberChannels EQU 'chan' ; current number of channels
siSampleSize EQU 'ssiz' ; current sample size
siSampleRate EQU 'srat' ; current sample rate
siCompressionType EQU 'comp' ; current compression type
siCompressionFactor EQU 'cmfa' ; current compression factor
siCompressionHeader EQU 'cmhd' ; return compression header
siDeviceName EQU 'name' ; input device name
siDeviceIcon EQU 'icon' ; input device icon
siDeviceBufferInfo EQU 'dbin' ; size of interrupt buffer
siSampleSizeAvailable EQU 'ssav' ; sample sizes available
siSampleRateAvailable EQU 'srav' ; sample rates available
siCompressionAvailable EQU 'cmav' ; compression types available
siChannelAvailable EQU 'chav' ; number of channels available
siAsync EQU 'asyn' ; asynchronous capability
siOptionsDialog EQU 'optd' ; display options dialog
siContinuous EQU 'cont' ; continous recording
siActiveChannels EQU 'chac' ; active channels
siActiveLevels EQU 'lmac' ; active meter levels
siInitializeDriver EQU 'init' ; reserved for internal use only
siCloseDriver EQU 'clos' ; reserved for internal use only
siPauseRecording EQU 'paus' ; reserved for internal use only
siUserInterruptProc EQU 'user' ; reserved for internal use only
; Quality Selectors for the SndRecord and SndRecordToFile calls
siBestQuality EQU 'best'
siBetterQuality EQU 'betr'
siGoodQuality EQU 'good'
; Sound Input Parameter Block (SPB)
SInParam RECORD 0
inRefNum DS.L 1 ; pointer to Application Reference Block
count DS.L 1 ; the # of bytes to read
milliseconds DS.L 1 ; the # of ms of sound to read
bufferLength DS.L 1 ; length of input buffer
inputBuffer DS.L 1 ; pointer to input buffer
completionRoutine DS.L 1 ; procPtr to the user completion routine
interruptRoutine DS.L 1 ; procPtr to the user interrupt routine
userLong DS.L 1 ; reserved for user data
error DS.W 1 ; OSErr will be returned to asynch routines
unused1 DS.L 1 ; reserved for future expansion - must be zero
SInPARAMSize EQU * ; size of SInParam
ENDR
ENDIF ; ...already included