Hi,
I have just added support for Impulse Tracker's resonant filters
in my TimPlayer module and tought I'd try it on RPCEmu too.
On most of the files it sound just te same as on a real RPC
but in a few cases note on which the filter is applied becomes
garbage. As the equalizer uses not too dissimilar in form
(y0 = a0 * x0 + a1 * x1 + a2 * x2 + b1 * y1 + b2 * y2)
I tried using it on a normal song and bingo, the sound becomes
completely distorted.
My best guess is that there is some problem with SMULL or SMLAL,
probably in the upper 32-bit part, but just in cas
I have listed below a complete listing of the IT Filter.
André
;-------------------------------------------------------------------------------
; Voice_ITFilter
;
; Filter in the form y0 = a0 * x0 + b1 * y1 + b2 * y2
; where xi is in(-i*T), yi is out(-i*T), ai and bj are in 1.24 fixed point
;
; In - R0 stream ptr
; R11 buffer size (in nr of values), must be multiple of 2
; R12 seq data ptr
;
; Out -
;-------------------------------------------------------------------------------
ALIGN
Voice_ITFilter FNAME
DEFPROC "R0-R8,R11-R12"
; Do nothing if no SMLA support
LDR R1,[R12,#data_Status]
TST R1,#seq_status_SMLASupport
ENDPROC EQ
TST R1,#seq_status_disable_ITFilters
ENDPROC NE
; Nothing to do if no filter
LDRB R1,[R0,#stream_flags]
TST R1,#stream_flag_filter
ENDPROC EQ
; R12 = ptr start, R11 = ptr end
LDR R12,[R0,#stream_pbuffer]
ADD R11,R12,R11,LSL #1
; R0 = old values and filter parameters
ADD R0,R0,#stream_filter_y1
; read saved values
; read filter parameters
LDMIA R0,{R3-R4,R5-R7}
MOV R8,#&8000
Voice_ITFilter_Loop
; read two samples
LDR R1,[R12]
MOV R2,R1,ASR #16
MOV R1,R1,LSL #16
MOV R1,R1,ASR #16
; process first sample
SMULL R4,R14,R7,R4
SMLAL R4,R14,R6,R3
SMLAL R4,R14,R5,R1
MOV R4,R4,LSR #24
ORRS R4,R4,R14,ASL #8
ADDLT R4,R4,#1 ; cf rounding error of shift for negative
; process second sample
SMULL R3,R14,R7,R3
SMLAL R3,R14,R6,R4
SMLAL R3,R14,R5,R2
MOV R3,R3,LSR #24
ORRS R3,R3,R14,ASL #8
ADDLT R3,R3,#1 ; cf rounding error of shift for negative
; Even if sum of coefficients is one, due to one negative coefficient
; samples may locally be amplified by up to 2
; so divide output by 2 to avoid saturation.
; We will mix these filtered note at twice the volume to compensate.
MOV R1,R3,ASR #1
MOV R2,R4,ASR #1
; clip values
CMP R1,R8
SUBGE R1,R8,#1
CMN R1,R8
MOVLT R1,R8
CMP R2,R8
SUBGE R2,R8,#1
CMN R2,R8
MOVLT R2,R8
; store output values
MOV R1,R1,LSL #16
MOV R1,R1,LSR #16
ORR R1,R1,R2,LSL #16
STR R1,[R12],#4
CMP R12,R11
BLO Voice_ITFilter_Loop
; save old values
STMIA R0,{R3-R4}
ENDPROC
_______________________________________________
Rpcemu mailing list
[email protected]
http://www.riscos.info/cgi-bin/mailman/listinfo/rpcemu