X-Git-Url: http://git.code-monkey.de/?a=blobdiff_plain;f=pv%2Fdata%2Fanalogsnapshot.h;h=9e2e782ae124838c336da09e55b96d3680582c0a;hb=8dbbc7f0b9ea59d0f0d62225772f8a56eee125f5;hp=8eec2797f1a4aa77b5945ccf31f2eef926600dce;hpb=fda5b6e0e0ebbe55f3d173051b8800293f87cd09;p=pulseview.git diff --git a/pv/data/analogsnapshot.h b/pv/data/analogsnapshot.h index 8eec279..9e2e782 100644 --- a/pv/data/analogsnapshot.h +++ b/pv/data/analogsnapshot.h @@ -26,18 +26,31 @@ #include #include +namespace AnalogSnapshotTest { +struct Basic; +} + namespace pv { 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; @@ -53,22 +66,30 @@ 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); void append_payload_to_envelope_levels(); private: - struct Envelope _envelope_levels[ScaleStepCount]; + struct Envelope envelope_levels_[ScaleStepCount]; + + friend struct AnalogSnapshotTest::Basic; +}; + } // namespace data } // namespace pv