MPD

- Main Page
- Data Structures
- Files

- File List
- Globals

Enumerations | Functions

# src/pcm_volume.h File Reference

`#include "pcm_prng.h"`
`#include <stdint.h>`
`#include <stdbool.h>`

Go to the source code of this file.

## Enumerations
enum | { PCM_VOLUME_1 = 1024 }
## Functions
static int | pcm_float_to_volume (float volume)
| Converts a float value (0.0 = silence, 1.0 = 100% volume) to an integer volume value (1000 = 100%).
static int | pcm_volume_dither (void)
| Returns the next volume dithering number, between -511 and +511.
bool | pcm_volume (void *buffer, int length, const struct audio_format *format, int volume)
| Adjust the volume of the specified PCM buffer.

## Enumeration Type Documentation

anonymous enum

Enumerator:

  PCM_VOLUME_1 | this value means "100% volume"

Definition at line 28 of file pcm_volume.h.

## Function Documentation

static int pcm_float_to_volume | ( | float | volume | ) | `[inline, static]`

Converts a float value (0.0 = silence, 1.0 = 100% volume) to an integer volume value (1000 = 100%).

Definition at line 40 of file pcm_volume.h.

bool pcm_volume | ( | void * | buffer,
|  | int | length,
|  | const struct audio_format * | format,
|  | int | volume
| ) |  |

Adjust the volume of the specified PCM buffer.

Parameters:

  buffer | the PCM buffer
  length | the length of the PCM buffer
  format | the audio format of the PCM buffer
  volume | the volume between 0 and PCM_VOLUME_1

Returns:
  true on success, false if the audio format is not supported

static int pcm_volume_dither | ( | void |  | ) | `[inline, static]`

Returns the next volume dithering number, between -511 and +511.

This number is taken from a global PRNG, see pcm_prng().

Definition at line 50 of file pcm_volume.h.