MPD
Functions
pcm_format.h File Reference
#include "audio_format.h"
#include <stdint.h>
#include <stddef.h>

Go to the source code of this file.

Functions

const int16_t * pcm_convert_to_16 (struct pcm_buffer *buffer, struct pcm_dither *dither, enum sample_format src_format, const void *src, size_t src_size, size_t *dest_size_r)
 Converts PCM samples to 16 bit.
 
const int32_t * pcm_convert_to_24 (struct pcm_buffer *buffer, enum sample_format src_format, const void *src, size_t src_size, size_t *dest_size_r)
 Converts PCM samples to 24 bit (32 bit alignment).
 
const int32_t * pcm_convert_to_32 (struct pcm_buffer *buffer, enum sample_format src_format, const void *src, size_t src_size, size_t *dest_size_r)
 Converts PCM samples to 32 bit.
 

Function Documentation

const int16_t* pcm_convert_to_16 ( struct pcm_buffer buffer,
struct pcm_dither dither,
enum sample_format  src_format,
const void *  src,
size_t  src_size,
size_t *  dest_size_r 
)

Converts PCM samples to 16 bit.

If the source format is 24 bit, then dithering is applied.

Parameters
buffera pcm_buffer object
dithera pcm_dither object for 24-to-16 conversion
bitsthe number of in the source buffer
srcthe source PCM buffer
src_sizethe size of #src in bytes
dest_size_rreturns the number of bytes of the destination buffer
Returns
the destination buffer
const int32_t* pcm_convert_to_24 ( struct pcm_buffer buffer,
enum sample_format  src_format,
const void *  src,
size_t  src_size,
size_t *  dest_size_r 
)

Converts PCM samples to 24 bit (32 bit alignment).

Parameters
buffera pcm_buffer object
bitsthe number of in the source buffer
srcthe source PCM buffer
src_sizethe size of #src in bytes
dest_size_rreturns the number of bytes of the destination buffer
Returns
the destination buffer
const int32_t* pcm_convert_to_32 ( struct pcm_buffer buffer,
enum sample_format  src_format,
const void *  src,
size_t  src_size,
size_t *  dest_size_r 
)

Converts PCM samples to 32 bit.

Parameters
buffera pcm_buffer object
bitsthe number of in the source buffer
srcthe source PCM buffer
src_sizethe size of #src in bytes
dest_size_rreturns the number of bytes of the destination buffer
Returns
the destination buffer