From: Soeren Apel Date: Sat, 27 May 2017 20:58:31 +0000 (+0200) Subject: Fix #958 by using new method that auto-converts analog samples X-Git-Tag: pulseview-0.4.0~69 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=303eec78f3c499cd30fc88b282aa1f336e82a806;p=pulseview.git Fix #958 by using new method that auto-converts analog samples --- diff --git a/pv/session.cpp b/pv/session.cpp index 31ca328d..eec1a051 100644 --- a/pv/session.cpp +++ b/pv/session.cpp @@ -20,6 +20,7 @@ #include #include +#include #include #include @@ -71,6 +72,7 @@ using std::recursive_mutex; using std::runtime_error; using std::shared_ptr; using std::string; +using std::unique_ptr; using std::unordered_set; using std::vector; @@ -975,12 +977,15 @@ void Session::feed_in_analog(shared_ptr analog) const vector> channels = analog->channels(); const unsigned int channel_count = channels.size(); const size_t sample_count = analog->num_samples() / channel_count; - const float *data = static_cast(analog->data_pointer()); bool sweep_beginning = false; + unique_ptr data(new float[analog->num_samples()]); + analog->get_data_as_float(data.get()); + if (signalbases_.empty()) update_signals(); + float *channel_data = data.get(); for (auto channel : channels) { shared_ptr segment; @@ -1014,7 +1019,7 @@ void Session::feed_in_analog(shared_ptr analog) assert(segment); // Append the samples in the segment - segment->append_interleaved_samples(data++, sample_count, + segment->append_interleaved_samples(channel_data++, sample_count, channel_count); }