X-Git-Url: http://git.code-monkey.de/?p=pulseview.git;a=blobdiff_plain;f=pv%2Fdata%2Fanalogsegment.hpp;h=8dd6f5f189746ec903157c7563892ad2073f1170;hp=520f7168247222015896ae3deea7256cdfa115f6;hb=6f925ba9d6faf1077b73c5a5808259576081716a;hpb=efdec55aec1a137460fa362a381ed1904182bfed diff --git a/pv/data/analogsegment.hpp b/pv/data/analogsegment.hpp index 520f716..8dd6f5f 100644 --- a/pv/data/analogsegment.hpp +++ b/pv/data/analogsegment.hpp @@ -25,6 +25,10 @@ #include #include +#include + +using std::pair; + namespace AnalogSegmentTest { struct Basic; } @@ -32,8 +36,18 @@ struct Basic; namespace pv { namespace data { -class AnalogSegment : public Segment +class Analog; + +typedef struct { + uint64_t sample_index, chunk_num, chunk_offs; + uint8_t* chunk; + float* value; +} SegmentAnalogDataIterator; + +class AnalogSegment : public QObject, public Segment { + Q_OBJECT + public: struct EnvelopeSample { @@ -65,7 +79,7 @@ private: static const uint64_t EnvelopeDataUnit; public: - AnalogSegment(uint64_t samplerate, uint64_t expected_num_samples = 0); + AnalogSegment(Analog& owner, uint64_t samplerate); virtual ~AnalogSegment(); @@ -75,6 +89,12 @@ public: const float* get_samples(int64_t start_sample, int64_t end_sample) 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); + void get_envelope_section(EnvelopeSection &s, uint64_t start, uint64_t end, float min_length) const; @@ -84,8 +104,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; };