outc = o->priv;
for (i = 0; i < outc->num_channels; i++) {
- if (!(outc->chanbuf[i] = g_try_realloc(outc->chanbuf[i], sizeof(float) * size))) {
+ if (!(outc->chanbuf[i] = g_try_realloc(outc->chanbuf[i], sizeof(float) * size))) {
sr_err("Unable to allocate enough output buffer memory.");
return SR_ERR;
}
*/
static void float_to_le(uint8_t *buf, float value)
{
- char *old;
+ uint8_t *old;
- old = (char *)&value;
+ old = (uint8_t *)&value;
#ifdef WORDS_BIGENDIAN
buf[0] = old[3];
buf[1] = old[2];
/* Nothing in all the buffers yet. */
size = -1;
break;
- } else
+ } else {
/* New high water mark. */
size = outc->chanbuf_used[i];
+ }
} else if (outc->chanbuf_used[i] != size) {
/* All channel buffers are not equally full yet. */
size = -1;
if (!outc->header_done) {
*out = gen_header(o);
outc->header_done = TRUE;
- } else
+ } else {
*out = g_string_sized_new(512);
+ }
analog = packet->payload;
num_samples = analog->num_samples;
idx = chan_idx[j];
buf = outc->chanbuf[idx] + outc->chanbuf_used[idx]++ * 4;
f = data[i * num_channels + j];
- if (outc->scale != 0.0)
+ if (outc->scale != 1.0)
f /= outc->scale;
float_to_le(buf, f);
}
static const struct sr_option *get_options(void)
{
if (!options[0].def)
- options[0].def = g_variant_ref_sink(g_variant_new_double(0.0));
+ options[0].def = g_variant_ref_sink(g_variant_new_double(1.0));
return options;
}
SR_PRIV struct sr_output_module output_wav = {
.id = "wav",
.name = "WAV",
- .desc = "Microsoft WAV file format",
+ .desc = "Microsoft WAV file format data",
.exts = (const char*[]){"wav", NULL},
.flags = 0,
.options = get_options,