#define LOG_PREFIX "input/wav"
/* How many bytes at a time to process and send to the session bus. */
-#define CHUNK_SIZE 4096
+#define CHUNK_SIZE 4096
/* Minimum size of header + 1 8-bit mono PCM sample. */
#define MIN_DATA_CHUNK_OFFSET 45
s = in->buf->str + offset;
d = (char *)fdata;
- memset(fdata, 0, CHUNK_SIZE);
+ memset(fdata, 0, CHUNK_SIZE * sizeof(float));
total_samples = num_samples * inc->num_channels;
for (samplenum = 0; samplenum < total_samples; samplenum++) {
if (inc->fmt_code == WAVE_FORMAT_PCM_) {
d += inc->unitsize;
}
- sr_analog_init(&analog, &encoding, &meaning, &spec, 0);
+ /* TODO: Use proper 'digits' value for this device (and its modes). */
+ sr_analog_init(&analog, &encoding, &meaning, &spec, 2);
packet.type = SR_DF_ANALOG;
packet.payload = &analog;
analog.num_samples = num_samples;
return ret;
for (int i = 0; i < inc->num_channels; i++) {
- snprintf(channelname, 8, "CH%d", i + 1);
+ snprintf(channelname, sizeof(channelname), "CH%d", i + 1);
sr_channel_new(in->sdi, i, SR_CHANNEL_ANALOG, TRUE, channelname);
}