The Sound Rountines -- Mike Fricke


 

PlayMid PROC NEAR
;inputs: cx - which midi to play
;outputs: plays music
;purpose: calls helper functions to play midi
; background music

 

StopMid PROC NEAR
;inputs: none
;outputs: stops music
;purpose: instructs midpak to stop playing
; midi music

 

OpenMid PROC NEAR
;inputs: cx - index of midi to be played
;output: Soundbuf - buffer in memory with
; file stored in it
; LowFileSize - low word of file length
; HighFileSize - high word of file length
;purpose: opens a .xmi file and stores it in
; memory, then closes the file

RegMid PROC NEAR
;inputs: Soundbuf - buffer with .xmi file in it
; LowFileSize - low word of file length
; HighFileSize - high word of file length
;outputs: none
;purpose: using an int 66 call, registers an xmi with midpak
; to be played later.

Play PROC NEAR
;inputs: none
;outputs: plays midi
;puspose: calls midpak's int 66 to play the currently
; registered file

; __SoundHandler - ISR Callback___________
; SoundHandler is called whenever the DSP generates an interrupt
; This example handler increases the value in the buffer, which generates
; the continually loudening tone you can hear.
SoundHandler proc far uses ax ds dx bx es di


; OpenWav opens a wav file and advances to the beginning of data
; It does no error checking. Implement error checking in your own.
; Input: None.
; Output: eax = data length = bytes of Sound Data.
OpenWav proc near

; LoadHalfBuffer takes a 1 or 0 in ax, and reads from the file into the
; appropriate half of sndbuf.
; Input ax = secondhalf
; Output: CF = 1 if just loaded last buffer
; ax = number of bytes read
LoadHalfBuffer proc near uses bx cx dx es di

 

PlayWav Proc NEAR