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_PLAY equ 1
DEV_STOP equ 2 DEV_STOP equ 2
DEV_CALLBACK equ 3 DEV_CALLBACK equ 3
DEV_GET_POS equ 9
struc IOCTL struc IOCTL
{ .handle dd ? { .handle dd ?
@ -193,11 +194,12 @@ proc service_proc stdcall, ioctl:dword
cmp eax, (srv_calls_end-srv_calls)/4 cmp eax, (srv_calls_end-srv_calls)/4
ja .fail ja .fail
cmp eax, SND_CREATE_BUFF cmp eax, SND_DESTROY_BUFF
ja @F jb @F
; cmp [edi+inp_size], 4
; jb .fali
jmp [srv_calls+eax*4]
@@:
mov ebx, [edi+input] mov ebx, [edi+input]
mov edx, [ebx] mov edx, [ebx]
@ -207,7 +209,10 @@ proc service_proc stdcall, ioctl:dword
cmp [edx+STREAM.size], STREAM.sizeof cmp [edx+STREAM.size], STREAM.sizeof
jne .fail jne .fail
@@:
jmp [srv_calls+eax*4] jmp [srv_calls+eax*4]
.fail: .fail:
mov eax, -1 mov eax, -1
ret ret
@ -340,12 +345,11 @@ align 4
ret ret
align 4 align 4
.snd_settimebase: .snd_settimebase:
cmp [edi+inp_size], 8 cmp [edi+inp_size], 12
jne .fail jne .fail
mov edi, [edi+input] mov eax, [ebx]
mov eax, [edi] mov ebx, [ebx+4]
mov ebx, [edi+4]
mov dword [edx+STREAM.time_base], eax mov dword [edx+STREAM.time_base], eax
mov dword [edx+STREAM.time_base+4], ebx mov dword [edx+STREAM.time_base+4], ebx
xor eax, eax xor eax, eax
@ -355,15 +359,45 @@ align 4
cmp [edi+out_size], 8 cmp [edi+out_size], 8
jne .fail 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] mov edi, [edi+output]
push 48
emms
fild qword [edx+STREAM.time_stamp] 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] fadd qword [edx+STREAM.time_base]
fstp qword [edi] fstp qword [edi]
add esp, 4 add esp, 8
xor eax, eax xor eax, eax
ret ret

View File

@ -138,6 +138,7 @@ DEV_NOTIFY equ 5
DEV_SET_MASTERVOL equ 6 DEV_SET_MASTERVOL equ 6
DEV_GET_MASTERVOL equ 7 DEV_GET_MASTERVOL equ 7
DEV_GET_INFO equ 8 DEV_GET_INFO equ 8
DEV_GET_POS equ 9
struc AC_CNTRL ;AC controller base class struc AC_CNTRL ;AC controller base class
{ .bus dd ? { .bus dd ?
@ -453,6 +454,19 @@ proc service_proc stdcall, ioctl:dword
mov ebx, [edi+output] mov ebx, [edi+output]
stdcall get_master_vol, ebx stdcall get_master_vol, ebx
ret 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 ; cmp eax, DEV_GET_INFO
; jne @F ; jne @F