X-Git-Url: https://sigrok.org/gitweb/?p=pulseview.git;a=blobdiff_plain;f=pv%2Fdata%2Fanalogsnapshot.h;h=9f0711f2d3e20ae3dde93df9562a7c56c9e65e7f;hp=59c43187788e4c231dc85d652f0cb849ed5f7a91;hb=9e587572b631aa81b1626ff55a21e660742ea2c0;hpb=340bc0a429a529af5348a7aaeff455ee258a86a6 diff --git a/pv/data/analogsnapshot.h b/pv/data/analogsnapshot.h index 59c43187..9f0711f2 100644 --- a/pv/data/analogsnapshot.h +++ b/pv/data/analogsnapshot.h @@ -27,7 +27,7 @@ #include namespace AnalogSnapshotTest { -class Basic; +struct Basic; } namespace pv { @@ -35,13 +35,22 @@ namespace data { class AnalogSnapshot : public Snapshot { -private: +public: struct EnvelopeSample { float min; float max; }; + struct EnvelopeSection + { + uint64_t start; + unsigned int scale; + uint64_t length; + EnvelopeSample *samples; + }; + +private: struct Envelope { uint64_t length; @@ -57,15 +66,19 @@ private: static const uint64_t EnvelopeDataUnit; public: - AnalogSnapshot(const sr_datafeed_analog &analog); + AnalogSnapshot(uint64_t expected_num_samples = 0); virtual ~AnalogSnapshot(); - void append_payload(const sr_datafeed_analog &analog); + 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; + void get_envelope_section(EnvelopeSection &s, + uint64_t start, uint64_t end, float min_length) const; + private: void reallocate_envelope(Envelope &l); @@ -74,7 +87,7 @@ private: private: struct Envelope _envelope_levels[ScaleStepCount]; - friend class AnalogSnapshotTest::Basic; + friend struct AnalogSnapshotTest::Basic; }; } // namespace data