Commit 46fb23ef authored by Olivier Teulière's avatar Olivier Teulière

* modules/audio_output/waveout.c: Fixed a rounding issue

parent 26b6b8a1
......@@ -26,6 +26,7 @@
*****************************************************************************/
#include <string.h> /* strerror() */
#include <stdlib.h> /* calloc(), malloc(), free() */
#include <math.h> /* roundf() */
#include <vlc/vlc.h>
#include <vlc/aout.h>
......@@ -800,8 +801,11 @@ static int VolumeGet( aout_instance_t * p_aout, audio_volume_t * pi_volume )
#endif
i_waveout_vol &= 0xFFFF;
/* Force float computation, otherwise VolumeGet does not return the value
* which was set with VolumeSet, because of rounding issues */
*pi_volume = p_aout->output.i_volume =
i_waveout_vol * AOUT_VOLUME_MAX / 2 / 0xFFFF;
(audio_volume_t)roundf((float)i_waveout_vol * AOUT_VOLUME_MAX
/ 2.0 / 0xFFFF);
return 0;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment