X-Git-Url: http://git.code-monkey.de/?a=blobdiff_plain;f=pv%2Fdata%2Fanalogsnapshot.h;h=59c43187788e4c231dc85d652f0cb849ed5f7a91;hb=340bc0a429a529af5348a7aaeff455ee258a86a6;hp=a45391849220332b892faa9ed3eaa79df30a4df6;hpb=d37583678256450d7eb646213d0b9e170a427933;p=pulseview.git diff --git a/pv/data/analogsnapshot.h b/pv/data/analogsnapshot.h index a453918..59c4318 100644 --- a/pv/data/analogsnapshot.h +++ b/pv/data/analogsnapshot.h @@ -26,18 +26,55 @@ #include #include +namespace AnalogSnapshotTest { +class Basic; +} + namespace pv { namespace data { class AnalogSnapshot : public Snapshot { +private: + struct EnvelopeSample + { + float min; + float max; + }; + + struct Envelope + { + uint64_t length; + uint64_t data_length; + EnvelopeSample *samples; + }; + +private: + static const unsigned int ScaleStepCount = 10; + static const int EnvelopeScalePower; + static const int EnvelopeScaleFactor; + static const float LogEnvelopeScaleFactor; + static const uint64_t EnvelopeDataUnit; + public: AnalogSnapshot(const sr_datafeed_analog &analog); + virtual ~AnalogSnapshot(); + void append_payload(const sr_datafeed_analog &analog); const float* get_samples(int64_t start_sample, int64_t end_sample) const; + +private: + void reallocate_envelope(Envelope &l); + + void append_payload_to_envelope_levels(); + +private: + struct Envelope _envelope_levels[ScaleStepCount]; + + friend class AnalogSnapshotTest::Basic; }; } // namespace data