pcm_utils: added inline function pcm_float_to_volume()

This commit is contained in:
Max Kellermann
2008-11-11 16:29:02 +01:00
parent 5ddde0aac7
commit ad77a3e0ac
2 changed files with 13 additions and 2 deletions

View File

@@ -36,6 +36,16 @@ struct pcm_convert_state {
int error;
};
/**
* Converts a float value (0.0 = silence, 1.0 = 100% volume) to an
* integer volume value (1000 = 100%).
*/
static inline int
pcm_float_to_volume(float volume)
{
return volume * 1000.0 + 0.5;
}
void pcm_volume(char *buffer, int bufferSize,
const struct audio_format *format,
int volume);