const float AnalogSegment::LogEnvelopeScaleFactor = logf(EnvelopeScaleFactor);
const uint64_t AnalogSegment::EnvelopeDataUnit = 64 * 1024; // bytes
-AnalogSegment::AnalogSegment(Analog& owner, uint64_t samplerate) :
- Segment(samplerate, sizeof(float)),
+AnalogSegment::AnalogSegment(Analog& owner, uint32_t segment_id, uint64_t samplerate) :
+ Segment(segment_id, samplerate, sizeof(float)),
owner_(owner),
min_value_(0),
max_value_(0)
static const uint64_t EnvelopeDataUnit;
public:
- AnalogSegment(Analog& owner, uint64_t samplerate);
+ AnalogSegment(Analog& owner, uint32_t segment_id, uint64_t samplerate);
virtual ~AnalogSegment();
// Create initial logic mux segment
shared_ptr<LogicSegment> output_segment =
- make_shared<LogicSegment>(*logic_mux_data_, logic_mux_unit_size_, 0);
+ make_shared<LogicSegment>(*logic_mux_data_, segment_id,
+ logic_mux_unit_size_, 0);
logic_mux_data_->push_segment(output_segment);
output_segment->set_samplerate(get_input_samplerate(0));
segment_id++;
output_segment =
- make_shared<LogicSegment>(*logic_mux_data_, logic_mux_unit_size_, 0);
+ make_shared<LogicSegment>(*logic_mux_data_, segment_id,
+ logic_mux_unit_size_, 0);
logic_mux_data_->push_segment(output_segment);
output_segment->set_samplerate(get_input_samplerate(segment_id));
const float LogicSegment::LogMipMapScaleFactor = logf(MipMapScaleFactor);
const uint64_t LogicSegment::MipMapDataUnit = 64 * 1024; // bytes
-LogicSegment::LogicSegment(pv::data::Logic& owner, unsigned int unit_size,
- uint64_t samplerate) :
- Segment(samplerate, unit_size),
+LogicSegment::LogicSegment(pv::data::Logic& owner, uint32_t segment_id,
+ unsigned int unit_size, uint64_t samplerate) :
+ Segment(segment_id, samplerate, unit_size),
owner_(owner),
last_append_sample_(0)
{
typedef pair<int64_t, bool> EdgePair;
public:
- LogicSegment(pv::data::Logic& owner, unsigned int unit_size, uint64_t samplerate);
+ LogicSegment(pv::data::Logic& owner, uint32_t segment_id,
+ unsigned int unit_size, uint64_t samplerate);
virtual ~LogicSegment();
const uint64_t Segment::MaxChunkSize = 10 * 1024 * 1024; /* 10MiB */
-Segment::Segment(uint64_t samplerate, unsigned int unit_size) :
+Segment::Segment(uint32_t segment_id, uint64_t samplerate, unsigned int unit_size) :
+ segment_id_(segment_id),
sample_count_(0),
start_time_(0),
samplerate_(samplerate),
return unit_size_;
}
+uint32_t Segment::segment_id() const
+{
+ return segment_id_;
+}
+
void Segment::set_complete()
{
is_complete_ = true;
static const uint64_t MaxChunkSize;
public:
- Segment(uint64_t samplerate, unsigned int unit_size);
+ Segment(uint32_t segment_id, uint64_t samplerate, unsigned int unit_size);
virtual ~Segment();
unsigned int unit_size() const;
+ uint32_t segment_id() const;
+
void set_complete();
bool is_complete() const;
void continue_raw_sample_iteration(SegmentRawDataIterator* it, uint64_t increase);
void end_raw_sample_iteration(SegmentRawDataIterator* it);
+ uint32_t segment_id_;
mutable recursive_mutex mutex_;
vector<uint8_t*> data_chunks_;
uint8_t* current_chunk_;
// Create the initial logic data segment if needed
if (logic_data->logic_segments().size() == 0) {
shared_ptr<LogicSegment> new_segment =
- make_shared<LogicSegment>(*logic_data.get(), 1, asegment->samplerate());
+ make_shared<LogicSegment>(*logic_data.get(), 0, 1, asegment->samplerate());
logic_data->push_segment(new_segment);
}
return;
}
- shared_ptr<LogicSegment> new_segment =
- make_shared<LogicSegment>(*logic_data.get(), 1, asegment->samplerate());
+ shared_ptr<LogicSegment> new_segment = make_shared<LogicSegment>(
+ *logic_data.get(), segment_id, 1, asegment->samplerate());
logic_data->push_segment(new_segment);
lsegment = logic_data->logic_segments().back().get();
// Create a new data segment
cur_logic_segment_ = make_shared<data::LogicSegment>(
- *logic_data_, logic->unit_size(), cur_samplerate_);
+ *logic_data_, logic_data_->get_segment_count(),
+ logic->unit_size(), cur_samplerate_);
logic_data_->push_segment(cur_logic_segment_);
signal_new_segment();
// Create a segment, keep it in the maps of channels
segment = make_shared<data::AnalogSegment>(
- *data, cur_samplerate_);
+ *data, data->get_segment_count(), cur_samplerate_);
cur_analog_segments_[channel] = segment;
// Push the segment into the analog data.