X-Git-Url: https://sigrok.org/gitweb/?p=pulseview.git;a=blobdiff_plain;f=pv%2Fdata%2Fanalogsegment.hpp;h=633170439b8b0b0cc40372b1c538e4ec38b7501e;hp=8dd6f5f189746ec903157c7563892ad2073f1170;hb=HEAD;hpb=6f925ba9d6faf1077b73c5a5808259576081716a diff --git a/pv/data/analogsegment.hpp b/pv/data/analogsegment.hpp index 8dd6f5f1..63317043 100644 --- a/pv/data/analogsegment.hpp +++ b/pv/data/analogsegment.hpp @@ -27,6 +27,7 @@ #include +using std::enable_shared_from_this; using std::pair; namespace AnalogSegmentTest { @@ -38,13 +39,7 @@ namespace data { class Analog; -typedef struct { - uint64_t sample_index, chunk_num, chunk_offs; - uint8_t* chunk; - float* value; -} SegmentAnalogDataIterator; - -class AnalogSegment : public QObject, public Segment +class AnalogSegment : public Segment, public enable_shared_from_this { Q_OBJECT @@ -79,21 +74,19 @@ private: static const uint64_t EnvelopeDataUnit; public: - AnalogSegment(Analog& owner, uint64_t samplerate); + AnalogSegment(Analog& owner, uint32_t segment_id, uint64_t samplerate); virtual ~AnalogSegment(); void append_interleaved_samples(const float *data, size_t sample_count, size_t stride); - const float* get_samples(int64_t start_sample, - int64_t end_sample) const; + float get_sample(int64_t sample_num) const; + void get_samples(int64_t start_sample, int64_t end_sample, float* dest) const; const pair get_min_max() const; - SegmentAnalogDataIterator* begin_sample_iteration(uint64_t start); - void continue_sample_iteration(SegmentAnalogDataIterator* it, uint64_t increase); - void end_sample_iteration(SegmentAnalogDataIterator* it); + float* get_iterator_value_ptr(SegmentDataIterator* it); void get_envelope_section(EnvelopeSection &s, uint64_t start, uint64_t end, float min_length) const;