Changeset 4636:1cd04bd163a0 in roaraudio


Ignore:
Timestamp:
12/01/10 12:38:45 (11 years ago)
Author:
phi
Branch:
default
Phase:
public
Message:

corrected latency management

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libroar/vs.c

    r4630 r4636  
    417417  _seterrre(); 
    418418 } else { 
    419   vss->writec += ret; 
     419  if ( !(vss->flags & FLAG_BUFFERED) ) 
     420   vss->writec += ret; 
    420421 } 
    421422 
     
    656657 size_t  lioc; // local IO (byte) counter 
    657658 size_t  lpos; // local possition 
    658  roar_mus_t lag; 
     659 signed long long int lag; 
    659660 
    660661 _initerr(); 
     
    685686 } 
    686687 
    687  lpos = lioc / bps; 
    688  
    689  lag = (roar_mus_t)lpos - (roar_mus_t)pos; 
     688 lpos = (lioc*8) / bps; 
     689 
     690// printf("pos=%zi, lpos=%zi, bps=%zi, diff[lpos-pos]=%zi\n", pos, lpos, bps, (lpos - pos)); 
     691 
     692 lag = (signed long long int)lpos - (signed long long int)pos; 
     693 lag /= vss->info.channels; 
    690694 
    691695 // we now have the lag in frames 
    692  // return value are ms 
    693  // so we need to multiply with 1s/ms and 
     696 // return value are mus 
     697 // so we need to multiply with 1s/mus and 
    694698 // multiply by 1/rate 
    695699 
    696  lag *= 1000000; // 1s/ms 
     700 lag *= 1000000; // 1s/mus 
    697701 lag /= vss->info.rate; 
    698702 
Note: See TracChangeset for help on using the changeset viewer.