cwAudioDeviceAlsa.cpp : Prevent wrapping on 32 bit audio output.

This commit is contained in:
kevin 2022-03-20 10:14:37 -04:00
parent 7d4e6fde6c
commit d59054bc7e

View File

@ -605,7 +605,11 @@ namespace cw
int* dp = (int*)obuf; int* dp = (int*)obuf;
while( sp < ep ) while( sp < ep )
*dp++ = (int)(*sp++ * 0x7fffffff); {
device::sample_t v = *sp++;
v = ((v > 1 ? 1 : v) < -1 ? -1 : v);
*dp++ = (int)(v * 0x7fffffff);
}
//*dp++ = (rand() - (RAND_MAX/2)) * 2; //*dp++ = (rand() - (RAND_MAX/2)) * 2;
} }