mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1144087 - "Audio glitches on OpenBSD caused by rounding errors." r=kinetik
This commit is contained in:
parent
fca6d3b8ec
commit
157ac815f9
@ -4,6 +4,7 @@
|
||||
* This program is made available under an ISC-style license. See the
|
||||
* accompanying file LICENSE for details.
|
||||
*/
|
||||
#include <math.h>
|
||||
#include <poll.h>
|
||||
#include <pthread.h>
|
||||
#include <sndio.h>
|
||||
@ -49,9 +50,16 @@ float_to_s16(void *ptr, long nsamp)
|
||||
{
|
||||
int16_t *dst = ptr;
|
||||
float *src = ptr;
|
||||
int s;
|
||||
|
||||
while (nsamp-- > 0)
|
||||
*(dst++) = *(src++) * 32767;
|
||||
while (nsamp-- > 0) {
|
||||
s = lrintf(*(src++) * 32768);
|
||||
if (s < -32768)
|
||||
s = -32768;
|
||||
else if (s > 32767)
|
||||
s = 32767;
|
||||
*(dst++) = s;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
Loading…
Reference in New Issue
Block a user