| Maestro Audio Framework v 1.0 NXP Semiconductors

Functions
general_utils.h File Reference

This file provides general helper functions. More...

`#include <stdint.h>`

## Functions
int32_t | smallest_int (int32_t a, int32_t b)
| smallest_int More...
uint32_t | _transform_16_to_32 (void *src, uint32_t src_len, void *dst, uint32_t dst_len)
| Extend 16 bit per sample to 32bit per sample. More...
uint32_t | _transform_24_to_32 (void *src, uint32_t src_len, void *dst, uint32_t dst_len)
| Extend 24 bit per sample to 32bit per sample. More...
uint32_t | _transform_32_to_24 (void *src, uint32_t src_len, void *dst, uint32_t dst_len)
| Compress 32 bit per sample to 24 bit per sample. More...
uint32_t | _transform_32_to_16 (void *src, uint32_t src_len, void *dst, uint32_t dst_len)
| Compress 32 bit per sample to 16 bit per sample. More...
uint32_t | data_copy_32bits (void *src, uint32_t src_len, void *dst, uint32_t dst_len)
| Equivalent to a memcpy used with src and dest size validation to determine the amount of bytes to copy. More...
uint32_t | _interleave_16_to_32 (void *src, uint32_t src_len, void *dst, uint32_t dst_len)
| Used to interleave samples from two input buffers on an output buffer. More...
uint32_t | _interleave_24_to_32 (void *src, uint32_t src_len, void *dst, uint32_t dst_len)
| Used to interleave samples from two input buffers on an output buffer. More...
uint32_t | _interleave_32bits (void *src, uint32_t src_len, void *dst, uint32_t dst_len)
| Used to interleave samples from two input buffers on an output buffer. More...

## Function Documentation

## ◆ smallest_int()

int32_t smallest_int | ( | int32_t | a,
|  | int32_t | b
| ) |  |

Function to determine the smallest of two integers.

Parameters

  a | first integer
  b | second integer

Returns
  value of the smallest integer

## ◆ _transform_16_to_32()

uint32_t _transform_16_to_32 | ( | void * | src,
|  | uint32_t | src_len,
|  | void * | dst,
|  | uint32_t | dst_len
| ) |  |

Parameters

  src | [IN] 16bit sample's buffer
  src_len | [IN] Number of bytes in the input
  dst | [OUT] Output buffer where the 32-bit data is going to be written
  dst_len | [IN] Maximum num of bytes that should be written on the output

Returns
  uint32_t Number of bytes that were written in the destination buffer

This function uses src_len as the number byes and the number of bytes in dst_len to determine how many bytes will be copied in the output buffer dst. The return value will be the number in bytes that was copied to the out buffer

## ◆ _transform_24_to_32()

uint32_t _transform_24_to_32 | ( | void * | src,
|  | uint32_t | src_len,
|  | void * | dst,
|  | uint32_t | dst_len
| ) |  |

Parameters

  src | [IN] 24 bit sample's buffer
  src_len | [IN] Number of bytes in the input
  dst | [OUT] Output buffer where the 32-bit data is going to be written
  dst_len | [IN] Maximum num of bytes that should be written on the output

Returns
  uint32_t Number of bytes that were written in the destination buffer

This function uses src_len as the number byes and the number of bytes in dst_len to determine how many bytes will be copied in the output buffer dst. The return value will be the number in bytes that was copied to the out buffer

## ◆ _transform_32_to_24()

uint32_t _transform_32_to_24 | ( | void * | src,
|  | uint32_t | src_len,
|  | void * | dst,
|  | uint32_t | dst_len
| ) |  |

Parameters

  src | [IN] 32 bit sample's buffer
  src_len | [IN] Number of bytes in the input
  dst | [OUT] Output buffer where the 24-bit data is going to be written
  dst_len | [IN] Maximum num of bytes that should be written on the output

Returns
  uint32_t Number of bytes that were written in the destination buffer

This function uses src_len as the number byes and the number of bytes in dst_len to determine how many bytes will be copied in the output buffer dst. The return value will be the number in bytes that was copied to the out buffer

## ◆ _transform_32_to_16()

uint32_t _transform_32_to_16 | ( | void * | src,
|  | uint32_t | src_len,
|  | void * | dst,
|  | uint32_t | dst_len
| ) |  |

Parameters

  src | [IN] 32 bit sample's buffer
  src_len | [IN] Number of bytes in the input
  dst | [OUT] Output buffer where the 16-bit data is going to be written
  dst_len | [IN] Maximum num of bytes that should be written on the output

Returns
  uint32_t Number of bytes that were written in the destination buffer

This function uses src_len as the number byes and the number of bytes in dst_len to determine how many bytes will be copied in the output buffer dst. The return value will be the number in bytes that was copied to the out buffer

## ◆ data_copy_32bits()

uint32_t data_copy_32bits | ( | void * | src,
|  | uint32_t | src_len,
|  | void * | dst,
|  | uint32_t | dst_len
| ) |  |

Parameters

  src | [IN] 32 bit sample's buffer
  src_len | [IN] Number of bytes in the input
  dst | [OUT] Output buffer where the 32-bit data is going to be written
  dst_len | [IN] Maximum num of bytes that should be written on the output

Returns
  uint32_t Number of bytes that were written in the destination buffer

## ◆ _interleave_16_to_32()

uint32_t _interleave_16_to_32 | ( | void * | src,
|  | uint32_t | src_len,
|  | void * | dst,
|  | uint32_t | dst_len
| ) |  |

Parameters

  src | [IN] 16 bit sample's buffer
  src_len | [IN] Number of bytes in the input.
  dst | [OUT] Output buffer where the 32-bit data is going to be written
  dst_len | [IN] Maximum num of bytes that should be written on the output

Returns
  uint32_t Number of bytes that were written in the destination buffer

## ◆ _interleave_24_to_32()

uint32_t _interleave_24_to_32 | ( | void * | src,
|  | uint32_t | src_len,
|  | void * | dst,
|  | uint32_t | dst_len
| ) |  |

Parameters

  src | [IN] 24 bit sample's buffer
  src_len | [IN] Number of bytes in the input.
  dst | [OUT] Output buffer where the 32-bit data is going to be written
  dst_len | [IN] Maximum num of bytes that should be written on the output

Returns
  uint32_t Number of bytes that were written in the destination buffer

## ◆ _interleave_32bits()

uint32_t _interleave_32bits | ( | void * | src,
|  | uint32_t | src_len,
|  | void * | dst,
|  | uint32_t | dst_len
| ) |  |

Parameters

  src | [IN] 32 bit sample's buffer
  src_len | [IN] Number of bytes in the input. Applies to both input buffers
  dst | [OUT] Output buffer where the 32-bit data is going to be written
  dst_len | [IN] Maximum num of bytes that should be written on the output

Returns
  uint32_t Number of bytes that were written in the destination buffer