MPD
Enumerations | Functions
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)
inlinestatic

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
bufferthe PCM buffer
lengththe length of the PCM buffer
formatthe audio 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  )
inlinestatic

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.