Lines 498-507
internalPortAudioStream* PaHost_GetStreamRepresentation( PortAudioStream *stream
Link Here
|
498 |
#define PA_DITHER_SCALE (1.0f / ((1<<PA_DITHER_BITS)-1)) |
498 |
#define PA_DITHER_SCALE (1.0f / ((1<<PA_DITHER_BITS)-1)) |
499 |
long PaConvert_TriangularDither( void ) |
499 |
long PaConvert_TriangularDither( void ) |
500 |
{ |
500 |
{ |
501 |
static unsigned long previous = 0; |
501 |
static uint32 previous = 0; |
502 |
static unsigned long randSeed1 = 22222; |
502 |
static uint32 randSeed1 = 22222; |
503 |
static unsigned long randSeed2 = 5555555; |
503 |
static uint32 randSeed2 = 5555555; |
504 |
long current, highPass; |
504 |
int32 current, highPass; |
505 |
/* Generate two random numbers. */ |
505 |
/* Generate two random numbers. */ |
506 |
randSeed1 = (randSeed1 * 196314165) + 907633515; |
506 |
randSeed1 = (randSeed1 * 196314165) + 907633515; |
507 |
randSeed2 = (randSeed2 * 196314165) + 907633515; |
507 |
randSeed2 = (randSeed2 * 196314165) + 907633515; |
Lines 510-516
long PaConvert_TriangularDither( void )
Link Here
|
510 |
* Also shift an extra bit for the high pass filter. |
510 |
* Also shift an extra bit for the high pass filter. |
511 |
*/ |
511 |
*/ |
512 |
#define DITHER_SHIFT ((32 - PA_DITHER_BITS) + 1) |
512 |
#define DITHER_SHIFT ((32 - PA_DITHER_BITS) + 1) |
513 |
current = (((long)randSeed1)>>DITHER_SHIFT) + (((long)randSeed2)>>DITHER_SHIFT); |
513 |
current = (((int32)randSeed1)>>DITHER_SHIFT) + (((int32)randSeed2)>>DITHER_SHIFT); |
514 |
/* High pass filter to reduce audibility. */ |
514 |
/* High pass filter to reduce audibility. */ |
515 |
highPass = current - previous; |
515 |
highPass = current - previous; |
516 |
previous = current; |
516 |
previous = current; |