X-Git-Url: http://git.code-monkey.de/?a=blobdiff_plain;ds=sidebyside;f=pv%2Fdata%2Fanalogsegment.hpp;h=7c74e77678c6e5693f9465dd0bfd221b46c71c3d;hb=8c3397413149b87d2755494fe73186f27edab369;hp=38922f59b0f49b8a97e49b0990ce2cae0387a3d8;hpb=f3d66e52ed6b454ea7a0662d5e6367e230116a2b;p=pulseview.git
diff --git a/pv/data/analogsegment.hpp b/pv/data/analogsegment.hpp
index 38922f5..7c74e77 100644
--- a/pv/data/analogsegment.hpp
+++ b/pv/data/analogsegment.hpp
@@ -14,18 +14,21 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ * along with this program; if not, see .
*/
-#ifndef PULSEVIEW_PV_DATA_ANALOGSNAPSHOT_H
-#define PULSEVIEW_PV_DATA_ANALOGSNAPSHOT_H
+#ifndef PULSEVIEW_PV_DATA_ANALOGSEGMENT_HPP
+#define PULSEVIEW_PV_DATA_ANALOGSEGMENT_HPP
#include "segment.hpp"
#include
#include
+#include
+
+using std::pair;
+
namespace AnalogSegmentTest {
struct Basic;
}
@@ -33,8 +36,18 @@ struct Basic;
namespace pv {
namespace data {
+class Analog;
+
+typedef struct {
+ uint64_t sample_index, chunk_num, chunk_offs;
+ uint8_t* chunk;
+ float* value;
+} SegmentAnalogDataIterator;
+
class AnalogSegment : public Segment
{
+ Q_OBJECT
+
public:
struct EnvelopeSample
{
@@ -66,31 +79,40 @@ 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;
+ void get_samples(int64_t start_sample, int64_t end_sample, float* dest) 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;
private:
- void reallocate_envelope(Envelope &l);
+ void reallocate_envelope(Envelope &e);
void append_payload_to_envelope_levels();
private:
+ Analog& owner_;
+
struct Envelope envelope_levels_[ScaleStepCount];
+ float min_value_, max_value_;
+
friend struct AnalogSegmentTest::Basic;
};
} // namespace data
} // namespace pv
-#endif // PULSEVIEW_PV_DATA_ANALOGSNAPSHOT_H
+#endif // PULSEVIEW_PV_DATA_ANALOGSEGMENT_HPP