Move samples of int16_t format to sample_t, that is of type double

This prepares the correction of all levels
This commit is contained in:
Andreas Eversberg
2017-01-27 16:57:34 +01:00
parent 538a959128
commit 7ea3bc188d
74 changed files with 471 additions and 447 deletions

27
src/common/sample.c Normal file
View File

@@ -0,0 +1,27 @@
#include <stdint.h>
#include "sample.h"
void samples_to_int16(int16_t *spl, sample_t *samples, int length)
{
while (length--) {
if (*samples > 32767.0)
*spl = 32767;
else if (*samples < -32767.0)
*spl = -32767;
else
*spl = (uint16_t)(*samples);
samples++;
spl++;
}
}
void int16_to_samples(sample_t *samples, int16_t *spl, int length)
{
while (length--) {
*samples = (double)(*spl);
samples++;
spl++;
}
}