]> sigrok.org Git - libsigrok.git/blobdiff - src/output/wav.c
SR_DF_ANALOG2 and sr_datafeed_analog2 renames.
[libsigrok.git] / src / output / wav.c
index cd0694ab8b2f0c722d655870c58f42f8d78b334d..507e0e77b53700ad2e9ac71cac01b3730a008e34 100644 (file)
@@ -236,8 +236,8 @@ static int receive(const struct sr_output *o, const struct sr_datafeed_packet *p
 {
        struct out_context *outc;
        const struct sr_datafeed_meta *meta;
+       const struct sr_datafeed_analog_old *analog_old;
        const struct sr_datafeed_analog *analog;
-       const struct sr_datafeed_analog2 *analog2;
        const struct sr_config *src;
        struct sr_channel *ch;
        GSList *l;
@@ -261,28 +261,28 @@ static int receive(const struct sr_output *o, const struct sr_datafeed_packet *p
                        outc->samplerate = g_variant_get_uint64(src->data);
                }
                break;
+       case SR_DF_ANALOG_OLD:
        case SR_DF_ANALOG:
-       case SR_DF_ANALOG2:
                if (!outc->header_done) {
                        *out = gen_header(o);
                        outc->header_done = TRUE;
                } else
                        *out = g_string_sized_new(512);
 
+               analog_old = packet->payload;
                analog = packet->payload;
-               analog2 = packet->payload;
 
-               if (packet->type == SR_DF_ANALOG) {
-                       num_samples = analog->num_samples;
-                       channels = analog->channels;
-                       num_channels = g_slist_length(analog->channels);
-                       data = analog->data;
+               if (packet->type == SR_DF_ANALOG_OLD) {
+                       num_samples = analog_old->num_samples;
+                       channels = analog_old->channels;
+                       num_channels = g_slist_length(analog_old->channels);
+                       data = analog_old->data;
                } else {
-                       num_samples = analog2->num_samples;
-                       channels = analog2->meaning->channels;
-                       num_channels = g_slist_length(analog2->meaning->channels);
+                       num_samples = analog->num_samples;
+                       channels = analog->meaning->channels;
+                       num_channels = g_slist_length(analog->meaning->channels);
                        data = g_malloc(sizeof(float) * num_samples * num_channels);
-                       ret = sr_analog_to_float(analog2, data);
+                       ret = sr_analog_to_float(analog, data);
                        if (ret != SR_OK)
                                return ret;
                }
@@ -297,7 +297,7 @@ static int receive(const struct sr_output *o, const struct sr_datafeed_packet *p
                }
 
                if (num_samples > outc->chanbuf_size) {
-                       if (realloc_chanbufs(o, analog->num_samples) != SR_OK)
+                       if (realloc_chanbufs(o, analog_old->num_samples) != SR_OK)
                                return SR_ERR_MALLOC;
                }
 
@@ -312,7 +312,7 @@ static int receive(const struct sr_output *o, const struct sr_datafeed_packet *p
                        for (j = 0; j < num_channels; j++) {
                                idx = chan_idx[j];
                                buf = outc->chanbuf[idx] + outc->chanbuf_used[idx]++ * 4;
-                               f = analog->data[i * num_channels + j];
+                               f = analog_old->data[i * num_channels + j];
                                if (outc->scale != 0.0)
                                        f /= outc->scale;
                                float_to_le(buf, f);