Infinity: get streams time stamp. High precision version.

git-svn-id: svn://kolibrios.org@1690 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Sergey Semyonov (Serge) 2010-11-07 10:02:30 +00:00
parent 500832c01d
commit d80f7d849a
2 changed files with 60 additions and 12 deletions

View File

@ -55,6 +55,7 @@ MANUAL_DESTROY equ 0x80000000
DEV_PLAY equ 1
DEV_STOP equ 2
DEV_CALLBACK equ 3
DEV_GET_POS equ 9
struc IOCTL
{ .handle dd ?
@ -193,11 +194,12 @@ proc service_proc stdcall, ioctl:dword
cmp eax, (srv_calls_end-srv_calls)/4
ja .fail
cmp eax, SND_CREATE_BUFF
ja @F
cmp eax, SND_DESTROY_BUFF
jb @F
; cmp [edi+inp_size], 4
; jb .fali
jmp [srv_calls+eax*4]
@@:
mov ebx, [edi+input]
mov edx, [ebx]
@ -207,7 +209,10 @@ proc service_proc stdcall, ioctl:dword
cmp [edx+STREAM.size], STREAM.sizeof
jne .fail
@@:
jmp [srv_calls+eax*4]
.fail:
mov eax, -1
ret
@ -340,12 +345,11 @@ align 4
ret
align 4
.snd_settimebase:
cmp [edi+inp_size], 8
cmp [edi+inp_size], 12
jne .fail
mov edi, [edi+input]
mov eax, [edi]
mov ebx, [edi+4]
mov eax, [ebx]
mov ebx, [ebx+4]
mov dword [edx+STREAM.time_base], eax
mov dword [edx+STREAM.time_base+4], ebx
xor eax, eax
@ -355,15 +359,45 @@ align 4
cmp [edi+out_size], 8
jne .fail
xor ebx, ebx
push 48
push ebx ; local storage
cmp [edx+STREAM.flags], SND_STOP
je @F
mov eax, esp
push edx
push edi
push 4 ;.out_size
push eax ;.output
push ebx ;.inp_size
push ebx ;.input
push DEV_GET_POS ;.code
push dword [hSound] ;.handle
mov eax, esp
stdcall ServiceHandler, eax
add esp, 6*4
pop edi
pop edx
test eax, eax
jz @F
mov dword [esp], 0 ; clear offset
@@:
mov edi, [edi+output]
push 48
emms
fild qword [edx+STREAM.time_stamp]
fidiv dword [esp]
fiadd dword [esp] ; primary buffer offset
fidiv dword [esp+4] ; total_samples / frequency
fadd qword [edx+STREAM.time_base]
fstp qword [edi]
add esp, 4
add esp, 8
xor eax, eax
ret

View File

@ -138,6 +138,7 @@ DEV_NOTIFY equ 5
DEV_SET_MASTERVOL equ 6
DEV_GET_MASTERVOL equ 7
DEV_GET_INFO equ 8
DEV_GET_POS equ 9
struc AC_CNTRL ;AC controller base class
{ .bus dd ?
@ -453,6 +454,19 @@ proc service_proc stdcall, ioctl:dword
mov ebx, [edi+output]
stdcall get_master_vol, ebx
ret
@@:
cmp eax, DEV_GET_POS
jne @F
mov ebx, 4096
mov edx, 0x18
call [ctrl.ctrl_read16]
sub ebx, eax
mov edx, [edi+output]
mov [edx], ebx
xor eax, eax
ret
;@@:
; cmp eax, DEV_GET_INFO
; jne @F