void notify_samples_added(QObject* segment, uint64_t start_sample,
uint64_t end_sample);
+ void notify_min_max_changed(float min, float max);
+
Q_SIGNALS:
void samples_cleared();
void samples_added(QObject* segment, uint64_t start_sample,
uint64_t end_sample);
+ void min_max_changed(float min, float max);
+
private:
deque< shared_ptr<AnalogSegment> > segments_;
};
e0.length = sample_count_ / EnvelopeScaleFactor;
// Calculate min/max values in case we have too few samples for an envelope
+ const float old_min_value = min_value_, old_max_value = max_value_;
if (sample_count_ < EnvelopeScaleFactor) {
it = begin_raw_sample_iteration(0);
for (uint64_t i = 0; i < sample_count_; i++) {
*dest_ptr = sub_sample;
}
}
+
+ // Notify if the min or max value changed
+ if ((old_min_value != min_value_) || (old_max_value != max_value_))
+ owner_.min_max_changed(min_value_, max_value_);
}
} // namespace data
this, SLOT(on_samples_cleared()));
disconnect(data.get(), SIGNAL(samples_added(QObject*, uint64_t, uint64_t)),
this, SLOT(on_samples_added(QObject*, uint64_t, uint64_t)));
+
+ if (channel_type_ == AnalogChannel) {
+ shared_ptr<Analog> analog = analog_data();
+ assert(analog);
+
+ disconnect(analog.get(), SIGNAL(min_max_changed(float, float)),
+ this, SLOT(on_min_max_changed(float, float)));
+ }
}
data_ = data;
this, SLOT(on_samples_cleared()));
connect(data.get(), SIGNAL(samples_added(QObject*, uint64_t, uint64_t)),
this, SLOT(on_samples_added(QObject*, uint64_t, uint64_t)));
+
+ if (channel_type_ == AnalogChannel) {
+ shared_ptr<Analog> analog = analog_data();
+ assert(analog);
+
+ connect(analog.get(), SIGNAL(min_max_changed(float, float)),
+ this, SLOT(on_min_max_changed(float, float)));
+ }
}
}
samples_added(segment, start_sample, end_sample);
}
+void SignalBase::on_min_max_changed(float min, float max)
+{
+ (void)min;
+ (void)max;
+
+ // Restart conversion if one is enabled and uses an automatic threshold
+ if ((conversion_type_ != NoConversion) &&
+ (get_current_conversion_preset() == 0))
+ start_conversion();
+}
+
void SignalBase::on_capture_state_changed(int state)
{
if (state == Session::Running) {
- if (conversion_type_ != NoConversion) {
- // Restart conversion
- stop_conversion();
+ // Restart conversion if one is enabled
+ if (conversion_type_ != NoConversion)
start_conversion();
- }
}
}