infinity.asm: fix 2_16_48 stream

git-svn-id: svn://kolibrios.org@568 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Sergey Semyonov (Serge) 2007-07-07 11:13:26 +00:00
parent 3880bd7325
commit 7651ba5227
3 changed files with 50 additions and 21 deletions

View File

@ -322,13 +322,12 @@ proc CreateBuffer stdcall, format:dword, size:dword
jnz .test_ring jnz .test_ring
;staic ;staic
test eax, PCM_STATIC test eax, PCM_STATIC
jz .fail jz .test_out ;use PCM_OUT as default format
test eax, PCM_OUT+PCM_RING
jnz .fail
jmp .test_ok jmp .test_ok
.test_out: .test_out:
test eax, PCM_RING+PCM_STATIC test eax, PCM_RING+PCM_STATIC
jnz .fail jnz .fail
or [format], PCM_OUT ;force set
jmp .test_ok jmp .test_ok
.test_ring: .test_ring:
test eax, PCM_OUT+PCM_STATIC test eax, PCM_OUT+PCM_STATIC
@ -621,8 +620,8 @@ proc wave_out stdcall, str:dword,src:dword,size:dword
mov edx, [str] mov edx, [str]
mov eax, [edx+STREAM.format] mov eax, [edx+STREAM.format]
test eax, PCM_STATIC+PCM_RING test eax, PCM_OUT
jnz .fail jz .fail
cmp ax, PCM_ALL cmp ax, PCM_ALL
je .fail je .fail
@ -786,8 +785,8 @@ align 4
proc SetBufferPos stdcall, str:dword, pos:dword proc SetBufferPos stdcall, str:dword, pos:dword
mov edx, [str] mov edx, [str]
test [edx+STREAM.format], PCM_OUT+PCM_RING test [edx+STREAM.format], PCM_STATIC
jnz .fail jz .fail
mov [edx+STREAM.flags], SND_STOP mov [edx+STREAM.flags], SND_STOP
@ -813,8 +812,8 @@ align 4
proc GetBufferPos stdcall, str:dword proc GetBufferPos stdcall, str:dword
mov edx, [str] mov edx, [str]
test [edx+STREAM.format], PCM_OUT+PCM_RING test [edx+STREAM.format], PCM_STATIC
jnz .fail jz .fail
mov ebx, [edx+STREAM.in_rp] mov ebx, [edx+STREAM.in_rp]
sub ebx, [edx+STREAM.in_base] sub ebx, [edx+STREAM.in_base]
@ -940,9 +939,6 @@ endp
align 4 align 4
proc play_buffer stdcall, str:dword, flags:dword proc play_buffer stdcall, str:dword, flags:dword
locals
fpu_state rb 528
endl
mov ebx, [str] mov ebx, [str]
mov eax, [ebx+STREAM.format] mov eax, [ebx+STREAM.format]

View File

@ -74,9 +74,7 @@ align 4
proc update_stream proc update_stream
locals locals
stream_index dd ? stream_index dd ?
ev_code dd ? ;EVENT event rd 6
ev_offs dd ?
rd 4
endl endl
mov [stream_index], 0 mov [stream_index], 0
@ -112,6 +110,7 @@ proc update_stream
jmp .skip jmp .skip
.copy: .copy:
mov ebx, esi mov ebx, esi
mov esi, [ebx+STREAM.in_rp]
mov edi, [ebx+STREAM.out_wp] mov edi, [ebx+STREAM.out_wp]
cmp edi, [ebx+STREAM.out_top] cmp edi, [ebx+STREAM.out_top]
jb @f jb @f
@ -119,23 +118,58 @@ proc update_stream
sub edi, 64*1024 sub edi, 64*1024
mov [ebx+STREAM.out_wp], edi mov [ebx+STREAM.out_wp], edi
@@: @@:
mov esi, [ebx+STREAM.in_rp] test [ebx+STREAM.format], PCM_RING
mov ecx, 16384/4 jnz .stream
mov ecx, [ebx+STREAM.in_count]
test ecx, ecx
jz .done
cmp ecx, 16384
jbe @F
mov ecx, 16386
@@:
sub [ebx+STREAM.in_count], ecx
.stream:
add [ebx+STREAM.in_free], ecx
add [ebx+STREAM.out_count], ecx
shr ecx, 2
cld cld
rep movsd rep movsd
mov [ebx+STREAM.out_wp], edi mov [ebx+STREAM.out_wp], edi
cmp esi, [ebx+STREAM.in_top] cmp esi, [ebx+STREAM.in_top]
jb @f jb @f
sub esi, 0x10000 sub esi, [ebx+STREAM.in_size]
@@: @@:
mov [ebx+STREAM.in_rp], esi mov [ebx+STREAM.in_rp], esi
test [ebx+STREAM.format], PCM_RING
jz .done
sub esi, [ebx+STREAM.in_base]
sub esi, 128
lea edx, [event]
mov dword [edx], RT_INP_EMPTY
mov dword [edx+4], 0
mov dword [edx+8], ebx
mov dword [edx+12], esi
mov eax, [ebx+STREAM.notify_event]
test eax, eax test eax, eax
jz .l_end jz .l_end
mov ebx, [ebx+STREAM.notify_id]
xor ecx, ecx
call RaiseEvent ;eax, ebx, ecx, edx
jmp .l_end
.done:
mov eax, [ebx+STREAM.notify_event] mov eax, [ebx+STREAM.notify_event]
test eax, eax
jz .l_end
mov ebx, [ebx+STREAM.notify_id] mov ebx, [ebx+STREAM.notify_id]
mov ecx, EVENT_WATCHED mov ecx, EVENT_WATCHED
xor edx, edx xor edx, edx
@ -151,7 +185,6 @@ align 4
proc refill stdcall, str:dword proc refill stdcall, str:dword
locals locals
r_size rd 1 r_size rd 1
event rd 6
endl endl
mov ebx, [str] mov ebx, [str]

View File

@ -750,7 +750,7 @@ proc init_controller
if 0 if 0
;;patch for some ugly BIOS ;;patch for some ugly BIOS ICH-ICH5 compatible
cmp [ctrl.vendor], VID_INTEL cmp [ctrl.vendor], VID_INTEL
jne .default jne .default