Changeset 3417:4b788d82b0dd in roaraudio for libroarpulse
- Timestamp:
- 02/11/10 19:24:46 (14 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libroarpulse/sample.c
r3416 r3417 74 74 75 75 /** 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); 76 pa_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 } 77 82 78 83 /** 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); 84 size_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 } 80 90 81 91 /** Return non-zero when the sample type specification is valid */
Note: See TracChangeset
for help on using the changeset viewer.