From 8a4afd01d4c9f7eaa2713e4a6be84b66281af393 Mon Sep 17 00:00:00 2001 From: "Sergey Semyonov (Serge)" Date: Wed, 10 Nov 2010 19:18:26 +0000 Subject: [PATCH] sound.asm: fix counter bug git-svn-id: svn://kolibrios.org@1697 a494cfbc-eb01-0410-851d-a64ba20cac60 --- kernel/trunk/drivers/infinity.asm | 7 +++++++ kernel/trunk/drivers/main.inc | 1 + kernel/trunk/drivers/mixer.asm | 1 + kernel/trunk/drivers/sound.asm | 4 +++- 4 files changed, 12 insertions(+), 1 deletion(-) diff --git a/kernel/trunk/drivers/infinity.asm b/kernel/trunk/drivers/infinity.asm index 283299c4bf..2b5d58ebc7 100644 --- a/kernel/trunk/drivers/infinity.asm +++ b/kernel/trunk/drivers/infinity.asm @@ -359,6 +359,9 @@ align 4 cmp [edi+out_size], 8 jne .fail + pushfd + cli + xor ebx, ebx push 48 push ebx ; local storage @@ -392,6 +395,7 @@ align 4 @@: mov edi, [edi+output] + emms fild qword [edx+STREAM.time_stamp] fiadd dword [esp] ; primary buffer offset fidiv dword [esp+4] ; total_samples / frequency @@ -399,6 +403,8 @@ align 4 fstp qword [edi] add esp, 8 + popfd + xor eax, eax ret endp @@ -547,6 +553,7 @@ proc CreateBuffer stdcall, format:dword, size:dword mov dword [edi+STREAM.time_stamp], ebx mov dword [edi+STREAM.time_stamp+4], ebx + mov dword [edi+STREAM.last_ts], ebx stdcall AllocPages, dword 64/4 mov edi, [str] diff --git a/kernel/trunk/drivers/main.inc b/kernel/trunk/drivers/main.inc index e1d10b3160..75a0c09b05 100644 --- a/kernel/trunk/drivers/main.inc +++ b/kernel/trunk/drivers/main.inc @@ -127,6 +127,7 @@ align 8 .time_base dq ? .time_stamp dq ? + .last_ts dd ? .notify_event dd ? .notify_id dd ? diff --git a/kernel/trunk/drivers/mixer.asm b/kernel/trunk/drivers/mixer.asm index 690f028104..8feb37703e 100644 --- a/kernel/trunk/drivers/mixer.asm +++ b/kernel/trunk/drivers/mixer.asm @@ -100,6 +100,7 @@ proc update_streams add dword [esi+STREAM.time_stamp], 4096 adc dword [esi+STREAM.time_stamp+4], 0 + mov dword [esi+STREAM.last_ts], 0 mov eax, [esi+STREAM.out_rp] cmp eax, [esi+STREAM.out_top] diff --git a/kernel/trunk/drivers/sound.asm b/kernel/trunk/drivers/sound.asm index c30c9e7623..0fc57564fb 100644 --- a/kernel/trunk/drivers/sound.asm +++ b/kernel/trunk/drivers/sound.asm @@ -459,10 +459,12 @@ proc service_proc stdcall, ioctl:dword cmp eax, DEV_GET_POS jne @F - mov ebx, 4096 + mov ebx, 8192 mov edx, 0x18 + xor eax, eax call [ctrl.ctrl_read16] sub ebx, eax + shr ebx, 1 mov edx, [edi+output] mov [edx], ebx xor eax, eax