+ /* Clear out the most significant bit of the sample */
+ devc->tmp_sample[devc->num_bytes - 1] &= 0x7f;
+ sr_spew("Expanded sample 1: 0x%.2x%.2x%.2x%.2x.",
+ devc->tmp_sample[3], devc->tmp_sample[2],
+ devc->tmp_sample[1], devc->tmp_sample[0]);
+
+ /* expand second sample */
+ memset(devc->tmp_sample2, 0, 4);
+ for (i = 0; i < 2; i++) {
+ if (((devc->flag_reg >> 2) & (1 << i)) == 0) {
+ /*
+ * This channel group was
+ * enabled, copy from received
+ * sample.
+ */
+ devc->tmp_sample2[i] = devc->sample[j++];
+ }
+ }
+ /* Clear out the most significant bit of the sample */
+ devc->tmp_sample2[devc->num_bytes - 1] &= 0x7f;
+ sr_spew("Expanded sample 2: 0x%.2x%.2x%.2x%.2x.",
+ devc->tmp_sample2[3], devc->tmp_sample2[2],
+ devc->tmp_sample2[1], devc->tmp_sample2[0]);
+
+ /*
+ * OLS sends its sample buffer backwards.
+ * store it in reverse order here, so we can dump
+ * this on the session bus later.
+ */
+ offset = (devc->limit_samples - devc->num_samples) * 4;
+ for (i = 0; i <= devc->rle_count; i++) {
+ memcpy(devc->raw_sample_buf + offset + (i * 8),
+ devc->tmp_sample2, 4);
+ memcpy(devc->raw_sample_buf + offset + (4 + (i * 8)),
+ devc->tmp_sample, 4);
+ }
+ memset(devc->sample, 0, 4);
+ devc->num_bytes = 0;
+ devc->rle_count = 0;