Changeset 5a6f362 in mainline for uspace/lib/pcm/src/format.c


Ignore:
Timestamp:
2013-04-04T15:39:00Z (11 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
5029c788
Parents:
76ea1b7
Message:

libpcm: Add doxygen

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/pcm/src/format.c

    r76ea1b7 r5a6f362  
    9090    unsigned frame, unsigned channel, const pcm_format_t *f);
    9191
     92/**
     93 * Compare PCM format attribtues.
     94 * @param a Format description.
     95 * @param b Format description.
     96 * @return True if a and b describe the same format, false otherwise.
     97 */
    9298bool pcm_format_same(const pcm_format_t *a, const pcm_format_t* b)
    9399{
     
    100106}
    101107
     108/**
     109 * Fill audio buffer with silence in the specified format.
     110 * @param dst Destination audio buffer.
     111 * @param size Size of the destination audio buffer.
     112 * @param f Pointer to the format description.
     113 */
    102114void pcm_format_silence(void *dst, size_t size, const pcm_format_t *f)
    103115{
     
    146158}
    147159
     160/**
     161 * Mix audio data of the same format and size.
     162 * @param dst Destination buffer
     163 * @param src Source buffer
     164 * @param size Size of both the destination and the source buffer
     165 * @param f Pointer to the format descriptor.
     166 * @return Error code.
     167 */
    148168int pcm_format_mix(void *dst, const void *src, size_t size, const pcm_format_t *f)
    149169{
    150170        return pcm_format_convert_and_mix(dst, size, src, size, f, f);
    151171}
     172
     173/**
     174 * Add and mix audio data.
     175 * @param dst Destination audio buffer
     176 * @param dst_size Size of the destination buffer
     177 * @param src Source audio buffer
     178 * @param src_size Size of the source buffer.
     179 * @param sf Pointer to the source format descriptor.
     180 * @param df Pointer to the destination format descriptor.
     181 * @return Error code.
     182 *
     183 * Buffers must contain entire frames. Destination buffer is always filled.
     184 * If there are not enough data in the source buffer silent data is assumed.
     185 */
    152186int pcm_format_convert_and_mix(void *dst, size_t dst_size, const void *src,
    153187    size_t src_size, const pcm_format_t *sf, const pcm_format_t *df)
     
    160194
    161195        const size_t dst_frame_size = pcm_format_frame_size(df);
    162         if ((src_size % dst_frame_size) != 0)
     196        if ((dst_size % dst_frame_size) != 0)
    163197                return EINVAL;
    164198
     
    226260}
    227261
    228 /** Converts all sample formats to float <-1,1> */
     262/**
     263 * Converts all sample formats to float <-1,1>
     264 * @param buffer Audio data
     265 * @param size Size of the buffer
     266 * @param frame Index of the frame to read
     267 * @param channel Channel within the frame
     268 * @param f Pointer to a format descriptor
     269 * @return Normalized sample <-1,1>, 0.0 if the data could not be read
     270 */
    229271static float get_normalized_sample(const void *buffer, size_t size,
    230272    unsigned frame, unsigned channel, const pcm_format_t *f)
Note: See TracChangeset for help on using the changeset viewer.