From 7651ba52271ea25d29c1a0629a9ddebbfe50da46 Mon Sep 17 00:00:00 2001 From: "Sergey Semyonov (Serge)" Date: Sat, 7 Jul 2007 11:13:26 +0000 Subject: [PATCH] infinity.asm: fix 2_16_48 stream git-svn-id: svn://kolibrios.org@568 a494cfbc-eb01-0410-851d-a64ba20cac60 --- kernel/trunk/drivers/infinity.asm | 20 +++++-------- kernel/trunk/drivers/mixer.asm | 49 ++++++++++++++++++++++++++----- kernel/trunk/drivers/sound.asm | 2 +- 3 files changed, 50 insertions(+), 21 deletions(-) diff --git a/kernel/trunk/drivers/infinity.asm b/kernel/trunk/drivers/infinity.asm index 127fb05bb4..909878cb16 100644 --- a/kernel/trunk/drivers/infinity.asm +++ b/kernel/trunk/drivers/infinity.asm @@ -322,13 +322,12 @@ proc CreateBuffer stdcall, format:dword, size:dword jnz .test_ring ;staic test eax, PCM_STATIC - jz .fail - test eax, PCM_OUT+PCM_RING - jnz .fail + jz .test_out ;use PCM_OUT as default format jmp .test_ok .test_out: test eax, PCM_RING+PCM_STATIC jnz .fail + or [format], PCM_OUT ;force set jmp .test_ok .test_ring: test eax, PCM_OUT+PCM_STATIC @@ -621,8 +620,8 @@ proc wave_out stdcall, str:dword,src:dword,size:dword mov edx, [str] mov eax, [edx+STREAM.format] - test eax, PCM_STATIC+PCM_RING - jnz .fail + test eax, PCM_OUT + jz .fail cmp ax, PCM_ALL je .fail @@ -786,8 +785,8 @@ align 4 proc SetBufferPos stdcall, str:dword, pos:dword mov edx, [str] - test [edx+STREAM.format], PCM_OUT+PCM_RING - jnz .fail + test [edx+STREAM.format], PCM_STATIC + jz .fail mov [edx+STREAM.flags], SND_STOP @@ -813,8 +812,8 @@ align 4 proc GetBufferPos stdcall, str:dword mov edx, [str] - test [edx+STREAM.format], PCM_OUT+PCM_RING - jnz .fail + test [edx+STREAM.format], PCM_STATIC + jz .fail mov ebx, [edx+STREAM.in_rp] sub ebx, [edx+STREAM.in_base] @@ -940,9 +939,6 @@ endp align 4 proc play_buffer stdcall, str:dword, flags:dword - locals - fpu_state rb 528 - endl mov ebx, [str] mov eax, [ebx+STREAM.format] diff --git a/kernel/trunk/drivers/mixer.asm b/kernel/trunk/drivers/mixer.asm index 2ea3eef05f..47ae529c3b 100644 --- a/kernel/trunk/drivers/mixer.asm +++ b/kernel/trunk/drivers/mixer.asm @@ -74,9 +74,7 @@ align 4 proc update_stream locals stream_index dd ? - ev_code dd ? ;EVENT - ev_offs dd ? - rd 4 + event rd 6 endl mov [stream_index], 0 @@ -112,6 +110,7 @@ proc update_stream jmp .skip .copy: mov ebx, esi + mov esi, [ebx+STREAM.in_rp] mov edi, [ebx+STREAM.out_wp] cmp edi, [ebx+STREAM.out_top] jb @f @@ -119,23 +118,58 @@ proc update_stream sub edi, 64*1024 mov [ebx+STREAM.out_wp], edi @@: - mov esi, [ebx+STREAM.in_rp] - mov ecx, 16384/4 + test [ebx+STREAM.format], PCM_RING + 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 rep movsd mov [ebx+STREAM.out_wp], edi - cmp esi, [ebx+STREAM.in_top] jb @f - sub esi, 0x10000 + sub esi, [ebx+STREAM.in_size] @@: 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 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] + test eax, eax + jz .l_end + mov ebx, [ebx+STREAM.notify_id] mov ecx, EVENT_WATCHED xor edx, edx @@ -151,7 +185,6 @@ align 4 proc refill stdcall, str:dword locals r_size rd 1 - event rd 6 endl mov ebx, [str] diff --git a/kernel/trunk/drivers/sound.asm b/kernel/trunk/drivers/sound.asm index e70a9b2a91..35850f8e5b 100644 --- a/kernel/trunk/drivers/sound.asm +++ b/kernel/trunk/drivers/sound.asm @@ -750,7 +750,7 @@ proc init_controller if 0 -;;patch for some ugly BIOS +;;patch for some ugly BIOS ICH-ICH5 compatible cmp [ctrl.vendor], VID_INTEL jne .default