Example 3: FilterSignal_FloatOut()
include
c:\dsp_1for2\dsp_1for2.inc
;prototypes, datatypes and structures definitions
includelib
c:\dsp_1for2\dsp_1for2.lib
;import library
N equ
256
.data?
SignalIn SIGNAL N
dup(?) ;Input signal, array of N SIGNAL points
Filter
COMPLEX N/2+1 dup(?)
;filter freq response
SignalOut FSIGNAL N dup
(?);Output signal, array of N FSIGNAL points
DspStruct1 DSPSTRUCT <>
;uninitialized DSPSTRUCT structure
.
.
.code
.
.
;The following is in the window procedure:
;----------------------------------------
.if uMsg==WM_CREATE ;initialization
invoke
NewDSP,N,addr dspstruct1,2 ;allocate 2
computation blocks
;here: fill the input signal (SignalIn) with test values
;and fill filter frequency response
.
.elseif uMsg==WM_COMMAND
;menu
mov eax,wParam
;as any other program
.if ax==IDM_FILTER_SIGNAL
;user chooses to filter the
signal
invoke FilterSignal_FloatOut,addr SignalIn,addr
Filter,addr SignalOut,DspStruct1
;Note that here we passed
the whole DSPSTRUCT structure
.
.
.endif
;menu
.elseif uMsg==WM_DESTROY
;clean up
invoke
DeleteDSP,addr dspstruct1
.
.
.endif ;uMsg
.
.
end