MPD

- Main Page
- Data Structures
- Files

- File List
- Globals

Functions

# src/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:

  buffer | a pcm_buffer object
  dither | a pcm_dither object for 24-to-16 conversion
  bits | the number of in the source buffer
  src | the source PCM buffer
  src_size | the size of #src in bytes
  dest_size_r | returns 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:

  buffer | a pcm_buffer object
  bits | the number of in the source buffer
  src | the source PCM buffer
  src_size | the size of #src in bytes
  dest_size_r | returns 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:

  buffer | a pcm_buffer object
  bits | the number of in the source buffer
  src | the source PCM buffer
  src_size | the size of #src in bytes
  dest_size_r | returns the number of bytes of the destination buffer

Returns:
  the destination buffer