Changeset e6bba8f in mainline
- Timestamp:
- 2012-07-17T08:56:21Z (12 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- cd8f19d
- Parents:
- ea6c838
- Location:
- uspace/lib/pcm
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/pcm/include/pcm/format.h
rea6c838 re6bba8f 69 69 return pcm_format_same(f, &AUDIO_FORMAT_ANY); 70 70 } 71 void pcm_format_silence(void *dst, size_t size, const pcm_format_t *f); 71 72 int pcm_format_convert_and_mix(void *dst, size_t dst_size, const void *src, 72 73 size_t src_size, const pcm_format_t *sf, const pcm_format_t *df); -
uspace/lib/pcm/src/format.c
rea6c838 re6bba8f 86 86 a->channels == b->channels && 87 87 a->sample_format == b->sample_format; 88 } 89 90 void pcm_format_silence(void *dst, size_t size, const pcm_format_t *f) 91 { 92 #define SET_NULL(type, endian, nullv) \ 93 do { \ 94 type *buffer = dst; \ 95 const size_t sample_count = size / sizeof(type); \ 96 for (unsigned i = 0; i < sample_count; ++i) { \ 97 buffer[i] = to((type)nullv, type, endian); \ 98 } \ 99 } while (0) 100 101 switch (f->sample_format) { 102 case PCM_SAMPLE_UINT8: 103 SET_NULL(uint8_t, le, INT8_MIN); break; 104 case PCM_SAMPLE_SINT8: 105 SET_NULL(int8_t, le, 0); break; 106 case PCM_SAMPLE_UINT16_LE: 107 SET_NULL(uint16_t, le, INT16_MIN); break; 108 case PCM_SAMPLE_SINT16_LE: 109 SET_NULL(int16_t, le, 0); break; 110 case PCM_SAMPLE_UINT16_BE: 111 SET_NULL(uint16_t, be, INT16_MIN); break; 112 case PCM_SAMPLE_SINT16_BE: 113 SET_NULL(int16_t, be, 0); break; 114 case PCM_SAMPLE_UINT32_LE: 115 SET_NULL(uint32_t, le, INT32_MIN); break; 116 case PCM_SAMPLE_SINT32_LE: 117 SET_NULL(int32_t, le, 0); break; 118 case PCM_SAMPLE_UINT32_BE: 119 SET_NULL(uint32_t, be, INT32_MIN); break; 120 case PCM_SAMPLE_SINT32_BE: 121 SET_NULL(int32_t, le, 0); break; 122 case PCM_SAMPLE_UINT24_32_LE: 123 case PCM_SAMPLE_SINT24_32_LE: 124 case PCM_SAMPLE_UINT24_32_BE: 125 case PCM_SAMPLE_SINT24_32_BE: 126 case PCM_SAMPLE_UINT24_LE: 127 case PCM_SAMPLE_SINT24_LE: 128 case PCM_SAMPLE_UINT24_BE: 129 case PCM_SAMPLE_SINT24_BE: 130 case PCM_SAMPLE_FLOAT32: 131 default: ; 132 } 133 #undef SET_NULL 88 134 } 89 135
Note:
See TracChangeset
for help on using the changeset viewer.