+class IndexItem {
+public:
+ float max, min;
+};
+
+class IndexMark {
+public:
+ int64_t no, pos;
+ IndexMark() {}
+ IndexMark(int64_t n, int64_t p) { no = n; pos = p; }
+
+ bool operator==(IndexMark &v) { return v.no == no; }
+ bool operator >(IndexMark &v) { return v.no > no; }
+};
+
+class IndexChannel : public IndexItem {
+public:
+ IndexChannel(IndexState *state, int64_t length);
+ ~IndexChannel();
+
+ IndexState *state;
+ IndexItem *bfr, *inp;
+ int64_t length, size;
+ int zidx;
+
+ void alloc(int64_t sz) { bfr = inp = new IndexItem[(size=sz)+1]; }
+ int64_t used() { return inp - bfr; }
+ int64_t avail() { return size - used(); }
+ int64_t pos();
+ void put_sample(float v, int zoom) {
+ if( v > max ) max = v;
+ if( v < min ) min = v;
+ if( ++zidx >= zoom )
+ put_entry();
+ }
+ void put_entry();
+ void pad_data(int64_t pos);
+};
+
+class IndexChannels : public ArrayList<IndexChannel*> {
+public:
+ IndexChannels() {}
+ ~IndexChannels() { remove_all_objects(); }
+};
+
+
+class IndexEntry {
+public:
+ float *bfr;
+// offsets / sizes of channels in index buffer in floats
+ int64_t offset, size;
+ IndexEntry(float *bp, int64_t ofs, int64_t sz) {
+ bfr = bp; offset = ofs; size = sz;
+ }
+};
+
+class IndexEntries : public ArrayList<IndexEntry*> {
+public:
+ IndexEntries() {}
+ ~IndexEntries() { remove_all_objects(); }
+};
+
+class IndexMarks : public ArrayList<IndexMark> {
+public:
+ IndexMarks() {}
+ ~IndexMarks() {}
+ void add_mark(int64_t no, int64_t pos) { append(IndexMark(no, pos)); }
+ int find(int64_t no);
+};
+
+class IndexMarkers : public ArrayList<IndexMarks *> {
+public:
+ IndexMarkers() {}
+ ~IndexMarkers() { remove_all_objects(); }
+};
+