core: svolume tests should generate realistic random volume data

assuming RAND_MAX is around 1<<31, rand() >> 1 generates large numbers as
random volume data; these likely causes saturated sample values after
applying the volume function -- not a good test
This commit is contained in:
Peter Meerwald 2012-01-12 17:20:05 +01:00 committed by Arun Raghavan
parent ee3e93c841
commit d103f3a97a
4 changed files with 4 additions and 4 deletions

View file

@ -151,7 +151,7 @@ static void run_test(void) {
memcpy(samples_orig, samples, sizeof(samples));
for (i = 0; i < CHANNELS; i++)
volumes[i] = PA_CLAMP_VOLUME(rand() >> 1);
volumes[i] = PA_CLAMP_VOLUME(rand() >> 15);
for (padding = 0; padding < PADDING; padding++, i++)
volumes[i] = volumes[padding];

View file

@ -272,7 +272,7 @@ static void run_test(void) {
memcpy(samples_orig, samples, sizeof(samples));
for (i = 0; i < CHANNELS; i++)
volumes[i] = PA_CLAMP_VOLUME(rand() >> 1);
volumes[i] = PA_CLAMP_VOLUME(rand() >> 15);
/* volumes[i] = 0x0000ffff; */
for (padding = 0; padding < PADDING; padding++, i++)
volumes[i] = volumes[padding];

View file

@ -75,7 +75,7 @@ static void run_test(void) {
memcpy(samples_orig, samples, sizeof(samples));
for (i = 0; i < CHANNELS; i++)
volumes[i] = PA_CLAMP_VOLUME(rand() >> 1);
volumes[i] = PA_CLAMP_VOLUME(rand() >> 15);
for (padding = 0; padding < PADDING; padding++, i++)
volumes[i] = volumes[padding];

View file

@ -282,7 +282,7 @@ static void run_test(void) {
memcpy(samples_orig, samples, sizeof(samples));
for (i = 0; i < CHANNELS; i++)
volumes[i] = PA_CLAMP_VOLUME(rand() >> 1);
volumes[i] = PA_CLAMP_VOLUME(rand() >> 15);
for (padding = 0; padding < PADDING; padding++, i++)
volumes[i] = volumes[padding];