mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-11-11 15:21:48 +00:00
c660bfb129
2. Added the svn:ignore properties to clean up the output of "svn update" so that it doesn't show some unversioned files anymore sush as compiled binaries and object files(*.a). 3. Converted the end-of-line charapter sequences from Windows(CR LF) to Unix format(LF). It used to be a mixture of both styles that often confuse some programs. If some files have to be in Windows format, you should add the svn:eol-style on them(svn propset svn:eol-style native polymer/eduke32/source/thefile.c). git-svn-id: https://svn.eduke32.com/eduke32@854 1a8010ca-5511-0410-912e-c29ae57300e0
491 lines
16 KiB
Text
491 lines
16 KiB
Text
.586P
|
|
|
|
EXTRN _MV_HarshClipTable : dword
|
|
EXTRN _MV_MixDestination : dword
|
|
EXTRN _MV_MixPosition : dword
|
|
EXTRN _MV_LeftVolume : dword
|
|
EXTRN _MV_RightVolume : dword
|
|
EXTRN _MV_SampleSize : dword
|
|
EXTRN _MV_RightChannelOffset : dword
|
|
|
|
CODE SEGMENT PUBLIC USE32 'DATA'
|
|
ASSUME cs:CODE,ds:CODE
|
|
|
|
;================
|
|
;
|
|
; MV_Mix8BitMono
|
|
;
|
|
;================
|
|
|
|
; eax - position
|
|
; edx - rate
|
|
; ebx - start
|
|
; ecx - number of samples to mix
|
|
|
|
ALIGN 16
|
|
PUBLIC MV_Mix8BitMono_
|
|
MV_Mix8BitMono_:
|
|
; Two at once
|
|
pushad
|
|
; Thanks to Lauri Liinat for spotting this lunacy
|
|
;mov eax, dword ptr [esp + 0*4 + 9*4]
|
|
;mov edx, dword ptr [esp + 1*4 + 9*4]
|
|
;mov ebx, dword ptr [esp + 2*4 + 9*4]
|
|
;mov ecx, dword ptr [esp + 3*4 + 9*4]
|
|
|
|
mov ebp, eax
|
|
|
|
mov esi, ebx ; Source pointer
|
|
|
|
; Sample size
|
|
mov ebx, _MV_SampleSize
|
|
mov byte ptr [apatch7+2],bl
|
|
mov byte ptr [apatch8+2],bl
|
|
mov byte ptr [apatch9+3],bl
|
|
|
|
; Volume table ptr
|
|
mov ebx, _MV_LeftVolume ; Since we're mono, use left volume
|
|
mov dword ptr [apatch1+4],ebx
|
|
mov dword ptr [apatch2+4],ebx
|
|
|
|
; Harsh Clip table ptr
|
|
mov ebx, _MV_HarshClipTable
|
|
add ebx, 128
|
|
mov dword ptr [apatch3+2],ebx
|
|
mov dword ptr [apatch4+2],ebx
|
|
|
|
; Rate scale ptr
|
|
mov dword ptr [apatch5+2],edx
|
|
mov dword ptr [apatch6+2],edx
|
|
|
|
mov edi, _MV_MixDestination ; Get the position to write to
|
|
|
|
; Number of samples to mix
|
|
shr ecx, 1 ; double sample count
|
|
cmp ecx, 0
|
|
je short exit8m
|
|
|
|
; eax - scratch
|
|
; ebx - scratch
|
|
; edx - scratch
|
|
; ecx - count
|
|
; edi - destination
|
|
; esi - source
|
|
; ebp - frac pointer
|
|
; apatch1 - volume table
|
|
; apatch2 - volume table
|
|
; apatch3 - harsh clip table
|
|
; apatch4 - harsh clip table
|
|
; apatch5 - sample rate
|
|
; apatch6 - sample rate
|
|
|
|
mov eax,ebp ; begin calculating first sample
|
|
add ebp,edx ; advance frac pointer
|
|
shr eax,16 ; finish calculation for first sample
|
|
|
|
mov ebx,ebp ; begin calculating second sample
|
|
add ebp,edx ; advance frac pointer
|
|
shr ebx,16 ; finish calculation for second sample
|
|
|
|
movzx eax, byte ptr [esi+eax] ; get first sample
|
|
movzx ebx, byte ptr [esi+ebx] ; get second sample
|
|
|
|
;ALIGN 4
|
|
mix8Mloop:
|
|
movzx edx, byte ptr [edi] ; get current sample from destination
|
|
apatch1:
|
|
movsx eax, byte ptr [2*eax+12345678h] ; volume translate first sample
|
|
apatch2:
|
|
movsx ebx, byte ptr [2*ebx+12345678h] ; volume translate second sample
|
|
add eax, edx ; mix first sample
|
|
apatch9:
|
|
movzx edx, byte ptr [edi + 1] ; get current sample from destination
|
|
apatch3:
|
|
mov eax, [eax + 12345678h] ; harsh clip new sample
|
|
add ebx, edx ; mix second sample
|
|
mov [edi], al ; write new sample to destination
|
|
mov edx, ebp ; begin calculating third sample
|
|
apatch4:
|
|
mov ebx, [ebx + 12345678h] ; harsh clip new sample
|
|
apatch5:
|
|
add ebp,12345678h ; advance frac pointer
|
|
shr edx, 16 ; finish calculation for third sample
|
|
mov eax, ebp ; begin calculating fourth sample
|
|
apatch7:
|
|
add edi, 1 ; move destination to second sample
|
|
shr eax, 16 ; finish calculation for fourth sample
|
|
mov [edi], bl ; write new sample to destination
|
|
apatch6:
|
|
add ebp,12345678h ; advance frac pointer
|
|
movzx ebx, byte ptr [esi+eax] ; get fourth sample
|
|
movzx eax, byte ptr [esi+edx] ; get third sample
|
|
apatch8:
|
|
add edi, 2 ; move destination to third sample
|
|
dec ecx ; decrement count
|
|
jnz mix8Mloop ; loop
|
|
|
|
mov _MV_MixDestination, edi ; Store the current write position
|
|
mov _MV_MixPosition, ebp ; return position
|
|
exit8m:
|
|
popad
|
|
ret
|
|
|
|
|
|
;================
|
|
;
|
|
; MV_Mix8BitStereo
|
|
;
|
|
;================
|
|
|
|
; eax - position
|
|
; edx - rate
|
|
; ebx - start
|
|
; ecx - number of samples to mix
|
|
|
|
ALIGN 16
|
|
PUBLIC MV_Mix8BitStereo_
|
|
MV_Mix8BitStereo_:
|
|
pushad
|
|
; Thanks to Lauri Liinat for spotting this lunacy
|
|
;mov eax, dword ptr [esp + 0*4 + 9*4]
|
|
;mov edx, dword ptr [esp + 1*4 + 9*4]
|
|
;mov ebx, dword ptr [esp + 2*4 + 9*4]
|
|
;mov ecx, dword ptr [esp + 3*4 + 9*4]
|
|
|
|
mov ebp, eax
|
|
|
|
mov esi, ebx ; Source pointer
|
|
|
|
; Sample size
|
|
mov ebx, _MV_SampleSize
|
|
mov byte ptr [bpatch8+2],bl
|
|
|
|
; Right channel offset
|
|
mov ebx, _MV_RightChannelOffset
|
|
mov dword ptr [bpatch6+3],ebx
|
|
mov dword ptr [bpatch7+2],ebx
|
|
|
|
; Volume table ptr
|
|
mov ebx, _MV_LeftVolume
|
|
mov dword ptr [bpatch1+4],ebx
|
|
|
|
mov ebx, _MV_RightVolume
|
|
mov dword ptr [bpatch2+4],ebx
|
|
|
|
; Rate scale ptr
|
|
mov dword ptr [bpatch3+2],edx
|
|
|
|
; Harsh Clip table ptr
|
|
mov ebx, _MV_HarshClipTable
|
|
add ebx,128
|
|
mov dword ptr [bpatch4+2],ebx
|
|
mov dword ptr [bpatch5+2],ebx
|
|
|
|
mov edi, _MV_MixDestination ; Get the position to write to
|
|
|
|
; Number of samples to mix
|
|
cmp ecx, 0
|
|
je short exit8S
|
|
|
|
; eax - scratch
|
|
; ebx - scratch
|
|
; edx - scratch
|
|
; ecx - count
|
|
; edi - destination
|
|
; esi - source
|
|
; ebp - frac pointer
|
|
; bpatch1 - left volume table
|
|
; bpatch2 - right volume table
|
|
; bpatch3 - sample rate
|
|
; bpatch4 - harsh clip table
|
|
; bpatch5 - harsh clip table
|
|
|
|
mov eax,ebp ; begin calculating first sample
|
|
shr eax,16 ; finish calculation for first sample
|
|
|
|
movzx ebx, byte ptr [esi+eax] ; get first sample
|
|
|
|
;ALIGN 4
|
|
mix8Sloop:
|
|
bpatch1:
|
|
movsx eax, byte ptr [2*ebx+12345678h] ; volume translate left sample
|
|
movzx edx, byte ptr [edi] ; get current sample from destination
|
|
bpatch2:
|
|
movsx ebx, byte ptr [2*ebx+12345678h] ; volume translate right sample
|
|
add eax, edx ; mix left sample
|
|
bpatch3:
|
|
add ebp,12345678h ; advance frac pointer
|
|
bpatch6:
|
|
movzx edx, byte ptr [edi+12345678h] ; get current sample from destination
|
|
bpatch4:
|
|
mov eax, [eax + 12345678h] ; harsh clip left sample
|
|
add ebx, edx ; mix right sample
|
|
mov [edi], al ; write left sample to destination
|
|
bpatch5:
|
|
mov ebx, [ebx + 12345678h] ; harsh clip right sample
|
|
mov edx, ebp ; begin calculating second sample
|
|
bpatch7:
|
|
mov [edi+12345678h], bl ; write right sample to destination
|
|
shr edx, 16 ; finish calculation for second sample
|
|
bpatch8:
|
|
add edi, 2 ; move destination to second sample
|
|
movzx ebx, byte ptr [esi+edx] ; get second sample
|
|
dec ecx ; decrement count
|
|
jnz mix8Sloop ; loop
|
|
|
|
mov _MV_MixDestination, edi ; Store the current write position
|
|
mov _MV_MixPosition, ebp ; return position
|
|
|
|
EXIT8S:
|
|
popad
|
|
ret
|
|
|
|
|
|
;================
|
|
;
|
|
; MV_Mix16BitMono
|
|
;
|
|
;================
|
|
|
|
; eax - position
|
|
; edx - rate
|
|
; ebx - start
|
|
; ecx - number of samples to mix
|
|
|
|
ALIGN 16
|
|
PUBLIC MV_Mix16BitMono_
|
|
MV_Mix16BitMono_:
|
|
; Two at once
|
|
pushad
|
|
; Thanks to Lauri Liinat for spotting this lunacy
|
|
;mov eax, dword ptr [esp + 0*4 + 9*4]
|
|
;mov edx, dword ptr [esp + 1*4 + 9*4]
|
|
;mov ebx, dword ptr [esp + 2*4 + 9*4]
|
|
;mov ecx, dword ptr [esp + 3*4 + 9*4]
|
|
|
|
mov ebp, eax
|
|
|
|
mov esi, ebx ; Source pointer
|
|
|
|
; Sample size
|
|
mov ebx, _MV_SampleSize
|
|
mov byte ptr [cpatch5+3],bl
|
|
mov byte ptr [cpatch6+3],bl
|
|
add bl,bl
|
|
mov byte ptr [cpatch7+2],bl
|
|
|
|
; Volume table ptr
|
|
mov ebx, _MV_LeftVolume
|
|
mov dword ptr [cpatch1+4],ebx
|
|
mov dword ptr [cpatch2+4],ebx
|
|
|
|
; Rate scale ptr
|
|
mov dword ptr [cpatch3+2],edx
|
|
mov dword ptr [cpatch4+2],edx
|
|
|
|
mov edi, _MV_MixDestination ; Get the position to write to
|
|
|
|
; Number of samples to mix
|
|
shr ecx, 1 ; double sample count
|
|
cmp ecx, 0
|
|
je exit16M
|
|
|
|
; eax - scratch
|
|
; ebx - scratch
|
|
; edx - scratch
|
|
; ecx - count
|
|
; edi - destination
|
|
; esi - source
|
|
; ebp - frac pointer
|
|
; cpatch1 - volume table
|
|
; cpatch2 - volume table
|
|
; cpatch3 - sample rate
|
|
; cpatch4 - sample rate
|
|
|
|
mov eax,ebp ; begin calculating first sample
|
|
add ebp,edx ; advance frac pointer
|
|
shr eax,16 ; finish calculation for first sample
|
|
|
|
mov ebx,ebp ; begin calculating second sample
|
|
add ebp,edx ; advance frac pointer
|
|
shr ebx,16 ; finish calculation for second sample
|
|
|
|
movzx eax, byte ptr [esi+eax] ; get first sample
|
|
movzx ebx, byte ptr [esi+ebx] ; get second sample
|
|
|
|
;ALIGN 4
|
|
mix16Mloop:
|
|
movsx edx, word ptr [edi] ; get current sample from destination
|
|
cpatch1:
|
|
movsx eax, word ptr [2*eax+12345678h] ; volume translate first sample
|
|
cpatch2:
|
|
movsx ebx, word ptr [2*ebx+12345678h] ; volume translate second sample
|
|
add eax, edx ; mix first sample
|
|
cpatch5:
|
|
movsx edx, word ptr [edi + 2] ; get current sample from destination
|
|
|
|
cmp eax, -32768 ; Harsh clip sample
|
|
jge short m16skip1
|
|
mov eax, -32768
|
|
jmp short m16skip2
|
|
m16skip1:
|
|
cmp eax, 32767
|
|
jle short m16skip2
|
|
mov eax, 32767
|
|
m16skip2:
|
|
add ebx, edx ; mix second sample
|
|
mov [edi], ax ; write new sample to destination
|
|
mov edx, ebp ; begin calculating third sample
|
|
|
|
cmp ebx, -32768 ; Harsh clip sample
|
|
jge short m16skip3
|
|
mov ebx, -32768
|
|
jmp short m16skip4
|
|
m16skip3:
|
|
cmp ebx, 32767
|
|
jle short m16skip4
|
|
mov ebx, 32767
|
|
m16skip4:
|
|
cpatch3:
|
|
add ebp,12345678h ; advance frac pointer
|
|
shr edx, 16 ; finish calculation for third sample
|
|
mov eax, ebp ; begin calculating fourth sample
|
|
cpatch6:
|
|
mov [edi + 2], bx ; write new sample to destination
|
|
shr eax, 16 ; finish calculation for fourth sample
|
|
|
|
cpatch4:
|
|
add ebp,12345678h ; advance frac pointer
|
|
movzx ebx, byte ptr [esi+eax] ; get fourth sample
|
|
cpatch7:
|
|
add edi, 4 ; move destination to third sample
|
|
movzx eax, byte ptr [esi+edx] ; get third sample
|
|
dec ecx ; decrement count
|
|
jnz mix16Mloop ; loop
|
|
|
|
mov _MV_MixDestination, edi ; Store the current write position
|
|
mov _MV_MixPosition, ebp ; return position
|
|
EXIT16M:
|
|
popad
|
|
ret
|
|
|
|
|
|
;================
|
|
;
|
|
; MV_Mix16BitStereo
|
|
;
|
|
;================
|
|
|
|
; eax - position
|
|
; edx - rate
|
|
; ebx - start
|
|
; ecx - number of samples to mix
|
|
|
|
ALIGN 16
|
|
PUBLIC MV_Mix16BitStereo_
|
|
MV_Mix16BitStereo_:
|
|
pushad
|
|
; Thanks to Lauri Liinat for spotting this lunacy
|
|
;mov eax, dword ptr [esp + 0*4 + 9*4]
|
|
;mov edx, dword ptr [esp + 1*4 + 9*4]
|
|
;mov ebx, dword ptr [esp + 2*4 + 9*4]
|
|
;mov ecx, dword ptr [esp + 3*4 + 9*4]
|
|
|
|
mov ebp, eax
|
|
|
|
mov esi, ebx ; Source pointer
|
|
|
|
; Sample size
|
|
mov ebx, _MV_SampleSize
|
|
mov byte ptr [dpatch6+2],bl
|
|
|
|
; Right channel offset
|
|
mov ebx, _MV_RightChannelOffset
|
|
mov dword ptr [dpatch4+3],ebx
|
|
mov dword ptr [dpatch5+3],ebx
|
|
|
|
; Volume table ptr
|
|
mov ebx, _MV_LeftVolume
|
|
mov dword ptr [dpatch1+4],ebx
|
|
|
|
mov ebx, _MV_RightVolume
|
|
mov dword ptr [dpatch2+4],ebx
|
|
|
|
; Rate scale ptr
|
|
mov dword ptr [dpatch3+2],edx
|
|
|
|
mov edi, _MV_MixDestination ; Get the position to write to
|
|
|
|
; Number of samples to mix
|
|
cmp ecx, 0
|
|
je exit16S
|
|
|
|
; eax - scratch
|
|
; ebx - scratch
|
|
; edx - scratch
|
|
; ecx - count
|
|
; edi - destination
|
|
; esi - source
|
|
; ebp - frac pointer
|
|
; dpatch1 - left volume table
|
|
; dpatch2 - right volume table
|
|
; dpatch3 - sample rate
|
|
|
|
mov eax,ebp ; begin calculating first sample
|
|
shr eax,16 ; finish calculation for first sample
|
|
|
|
movzx ebx, byte ptr [esi+eax] ; get first sample
|
|
|
|
;ALIGN 4
|
|
mix16Sloop:
|
|
dpatch1:
|
|
movsx eax, word ptr [2*ebx+12345678h] ; volume translate left sample
|
|
movsx edx, word ptr [edi] ; get current sample from destination
|
|
dpatch2:
|
|
movsx ebx, word ptr [2*ebx+12345678h] ; volume translate right sample
|
|
add eax, edx ; mix left sample
|
|
dpatch3:
|
|
add ebp,12345678h ; advance frac pointer
|
|
dpatch4:
|
|
movsx edx, word ptr [edi+12345678h] ; get current sample from destination
|
|
|
|
cmp eax, -32768 ; Harsh clip sample
|
|
jge short s16skip1
|
|
mov eax, -32768
|
|
jmp short s16skip2
|
|
s16skip1:
|
|
cmp eax, 32767
|
|
jle short s16skip2
|
|
mov eax, 32767
|
|
s16skip2:
|
|
add ebx, edx ; mix right sample
|
|
mov [edi], ax ; write left sample to destination
|
|
|
|
cmp ebx, -32768 ; Harsh clip sample
|
|
jge short s16skip3
|
|
mov ebx, -32768
|
|
jmp short s16skip4
|
|
s16skip3:
|
|
cmp ebx, 32767
|
|
jle short s16skip4
|
|
mov ebx, 32767
|
|
s16skip4:
|
|
|
|
mov edx, ebp ; begin calculating second sample
|
|
dpatch5:
|
|
mov [edi+12345678h], bx ; write right sample to destination
|
|
shr edx, 16 ; finish calculation for second sample
|
|
dpatch6:
|
|
add edi, 4 ; move destination to second sample
|
|
movzx ebx, byte ptr [esi+edx] ; get second sample
|
|
dec ecx ; decrement count
|
|
jnz mix16Sloop ; loop
|
|
|
|
mov _MV_MixDestination, edi ; Store the current write position
|
|
mov _MV_MixPosition, ebp ; return position
|
|
exit16S:
|
|
popad
|
|
ret
|
|
|
|
CODE ENDS
|
|
END
|