From: Soeren Apel Date: Sun, 16 Aug 2020 18:43:10 +0000 (+0200) Subject: MathSignal: Mark segments as complete X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=5eb9d1c43e387cb399b3582388cff1ab38973c70;p=pulseview.git MathSignal: Mark segments as complete --- diff --git a/pv/data/mathsignal.cpp b/pv/data/mathsignal.cpp index 20a41a4c..31424e39 100644 --- a/pv/data/mathsignal.cpp +++ b/pv/data/mathsignal.cpp @@ -92,8 +92,7 @@ MathSignal::MathSignal(pv::Session &session) : { set_name(QString(tr("Math%1")).arg(session_.get_next_signal_index(MathChannel))); - shared_ptr data(new data::Analog()); - set_data(data); + set_data(std::make_shared()); connect(&session_, SIGNAL(capture_state_changed(int)), this, SLOT(on_capture_state_changed(int))); @@ -338,7 +337,7 @@ void MathSignal::generation_proc() if (gen_interrupt_) return; - shared_ptr analog = dynamic_pointer_cast(data_); + shared_ptr analog = analog_data(); // Create initial analog segment shared_ptr output_segment = @@ -375,6 +374,8 @@ void MathSignal::generation_proc() if (samples_to_process == 0) { if (segment_id < session_.get_highest_segment_id()) { + analog->analog_segments().back()->set_complete(); + // Process next segment segment_id++; @@ -440,6 +441,11 @@ void MathSignal::on_capture_state_changed(int state) { if (state == Session::Running) begin_generation(); + + if (state == Session::Stopped) { + shared_ptr analog = analog_data(); + analog->analog_segments().back()->set_complete(); + } } void MathSignal::on_data_received()