Macros defined and used by networking routines.
MIDISTART MACRO
; Input: None
; Output: None
; Calls: LoadFile - Loads the midi file into memory
; Purpose: This macro should be called when a midi file is to be played.
; It will open it, dump the file into memory, registers the file with
; Midpak by calling an int66h interrupt, and then calls Midpak's
; int 66h again to begin playing the file.
push ax
push bx
push cx
push dx
push si
push di
mov dx, OFFSET midifile ; Open and read midi file
mov ax, SEG SNDSEG
mov bx, OFFSET midisong
mov cx, 15448
call LoadFile
mov cx, SEG SNDSEG ; Register midi filename with midpak
mov bx, OFFSET midisong
mov si, 15448
mov di, 0
mov ax, 704h
int 66h
xor bx, bx
mov ax, 702h ; Play midi
int 66h
pop di
pop si
pop dx
pop cx
pop bx
pop ax
ENDM
|
STOPMIDI MACRO
; Input: None
; Output: None
; Calls: None
; Purpose: This simply stops any currently playing midi.
push ax
mov ax, 705h
int 66h
pop ax
ENDM
|
WAVPLAY MACRO SoundNum
; Input: SoundNum - the number indicating which wav file is to be played
; Output: None
; Calls: PlayWav - This function plays the wav file
; SB_Stop - This function stops any wav file playing beforehand
; Purpose: This macro calls SB_Stop to kill any currently playing wav, and then
; plays the wave indicated by SoundNum.
push dx
call SB_Stop
mov dx, SoundNum
call PlayWav
pop dx
ENDM
|
WAVEND MACRO
; Input: Variable needrefill - Tells if we're on teh final cycle
; Output: None
; Calls: SB_SingleCycle - Puts the DSP in single cycle mode.
; LoadHalfBuffer - Fills the sound buffer.
; Purpose: This macro is called within a main loop of a program. If a sound
; is playing and it is on the final cycle, this will load the sound
; buffer, change the soundblaster from auto mode to single cycle mode to
; play the last cycle, and then the wav file in question will be closed.
local WaitContinue
push ax
push bx
push cx
cmp needrefill, 1 ; Check if we're on the final cycle
jae WaitContinue
mov ax, mycounter
and ax, 1
call LoadHalfBuffer ; fills buffer half ax (0 or 1)
dec needrefill
cmp wavdone, 2 ; one for current buffer, one for last
jne WaitContinue
mov cx, finalbuffersize
call SB_SingleCycle
mov ah, 3Eh ; Close wav file
mov bx, fileno
int 21h
WaitContinue:
pop cx
pop bx
pop ax
ENDM
|
|