Changeset 3417:4b788d82b0dd in roaraudio for libroarpulse


Ignore:
Timestamp:
02/11/10 19:24:46 (10 years ago)
Author:
phi
Branch:
default
Message:

implemented the rest

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libroarpulse/sample.c

    r3416 r3417  
    7474 
    7575/** Calculate the time the specified bytes take to play with the specified sample type */ 
    76 pa_usec_t pa_bytes_to_usec(uint64_t length, const pa_sample_spec *spec); 
     76pa_usec_t pa_bytes_to_usec(uint64_t length, const pa_sample_spec *spec) { 
     77 if ( spec == NULL ) 
     78  return 0; 
     79 
     80 return (pa_usec_t) (((double) length/pa_frame_size(spec)*1000000)/spec->rate); 
     81} 
    7782 
    7883/** Calculates the number of bytes that are required for the specified time. \since 0.9 */ 
    79 size_t pa_usec_to_bytes(pa_usec_t t, const pa_sample_spec *spec); 
     84size_t pa_usec_to_bytes(pa_usec_t t, const pa_sample_spec *spec) { 
     85 if ( spec == NULL ) 
     86  return 0; 
     87 
     88 return (size_t) (((double) t * spec->rate / 1000000))*pa_frame_size(spec); 
     89} 
    8090 
    8191/** Return non-zero when the sample type specification is valid */ 
Note: See TracChangeset for help on using the changeset viewer.