MPD 0.17~git
Enumerations | Functions
src/pcm_volume.h File Reference
#include "pcm_prng.h"
#include "audio_format.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 float pcm_volume_to_float (int volume)
static int pcm_volume_dither (void)
 Returns the next volume dithering number, between -511 and +511.
bool pcm_volume (void *buffer, size_t length, enum sample_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 29 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 41 of file pcm_volume.h.

bool pcm_volume ( void *  buffer,
size_t  length,
enum sample_format  format,
int  volume 
)

Adjust the volume of the specified PCM buffer.

Parameters:
bufferthe PCM buffer
lengththe length of the PCM buffer
formatthe sample format of the PCM buffer
volumethe 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 57 of file pcm_volume.h.

static float pcm_volume_to_float ( int  volume) [inline, static]

Definition at line 47 of file pcm_volume.h.