X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=pv%2Fdata%2Fanalogsegment.hpp;h=633170439b8b0b0cc40372b1c538e4ec38b7501e;hb=69e950969e45ddbf516069c28f72f5696c53af5d;hp=520f7168247222015896ae3deea7256cdfa115f6;hpb=efdec55aec1a137460fa362a381ed1904182bfed;p=pulseview.git diff --git a/pv/data/analogsegment.hpp b/pv/data/analogsegment.hpp index 520f7168..63317043 100644 --- a/pv/data/analogsegment.hpp +++ b/pv/data/analogsegment.hpp @@ -25,6 +25,11 @@ #include #include +#include + +using std::enable_shared_from_this; +using std::pair; + namespace AnalogSegmentTest { struct Basic; } @@ -32,8 +37,12 @@ struct Basic; namespace pv { namespace data { -class AnalogSegment : public Segment +class Analog; + +class AnalogSegment : public Segment, public enable_shared_from_this { + Q_OBJECT + public: struct EnvelopeSample { @@ -65,15 +74,19 @@ private: static const uint64_t EnvelopeDataUnit; public: - AnalogSegment(uint64_t samplerate, uint64_t expected_num_samples = 0); + 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; + + float* get_iterator_value_ptr(SegmentDataIterator* it); void get_envelope_section(EnvelopeSection &s, uint64_t start, uint64_t end, float min_length) const; @@ -84,8 +97,12 @@ private: void append_payload_to_envelope_levels(); private: + Analog& owner_; + struct Envelope envelope_levels_[ScaleStepCount]; + float min_value_, max_value_; + friend struct AnalogSegmentTest::Basic; };