Changeset 20d77fb in mainline
- Timestamp:
- 2012-08-30T16:28:28Z (12 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- f3fb83a
- Parents:
- 37367f7
- Location:
- uspace/lib/pcm/include/pcm
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/pcm/include/pcm/format.h
r37367f7 r20d77fb 61 61 static inline size_t pcm_format_frame_size(const pcm_format_t *a) 62 62 { 63 return a->channels * pcm_sample_format_size(a->sample_format); 63 return pcm_sample_format_frame_size(a->channels, a->sample_format); 64 } 65 66 static inline suseconds_t pcm_format_size_to_usec(size_t size, 67 const pcm_format_t *a) 68 { 69 return pcm_sample_format_size_to_usec(size, a->sampling_rate, 70 a->channels, a->sample_format); 64 71 } 65 72 -
uspace/lib/pcm/include/pcm/sample_format.h
r37367f7 r20d77fb 38 38 39 39 #include <bool.h> 40 #include <time.h> 40 41 41 42 typedef enum { … … 121 122 } 122 123 124 static inline size_t pcm_sample_format_frame_size(unsigned channels, 125 pcm_sample_format_t format) 126 { 127 return pcm_sample_format_size(format) * channels; 128 } 129 130 static inline size_t pcm_sample_format_size_to_frames(size_t size, 131 unsigned channels, pcm_sample_format_t format) 132 { 133 const size_t frame_size = pcm_sample_format_frame_size(channels, format); 134 return (size + frame_size - 1) / frame_size; 135 } 136 137 static inline useconds_t pcm_sample_format_size_to_usec(size_t size, 138 unsigned sample_rate, unsigned channels, pcm_sample_format_t format) 139 { 140 const long long frames = 141 pcm_sample_format_size_to_frames(size, channels, format); 142 return (frames * 1000000ULL) / sample_rate; 143 } 144 123 145 static inline const char * pcm_sample_format_str(pcm_sample_format_t format) 124 146 {
Note:
See TracChangeset
for help on using the changeset viewer.