- auto logic = context->create_logic_packet(data, length, unit_size);
- const string data = output_->receive(logic);
- if (output_stream_.is_open())
- output_stream_ << data;
- } catch (Error error) {
- error_ = tr("Error while saving.");
+
+ for (unsigned int i = 0; i < achannel_list.size(); i++) {
+ shared_ptr<sigrok::Channel> achannel = (achannel_list.at(i))->channel();
+ shared_ptr<data::AnalogSegment> asegment = asegment_list.at(i);
+
+ float *adata = new float[packet_len];
+ asegment->get_samples(start_sample_, start_sample_ + packet_len, adata);
+
+ auto analog = context->create_analog_packet(
+ vector<shared_ptr<sigrok::Channel> >{achannel},
+ (float *)adata, packet_len,
+ sigrok::Quantity::VOLTAGE, sigrok::Unit::VOLT,
+ vector<const sigrok::QuantityFlag *>());
+ const string adata_str = output_->receive(analog);
+
+ if (output_stream_.is_open())
+ output_stream_ << adata_str;
+
+ delete[] adata;
+ }
+
+ if (lsegment) {
+ const size_t data_size = packet_len * lunit_size;
+ uint8_t* ldata = new uint8_t[data_size];
+ lsegment->get_samples(start_sample_, start_sample_ + packet_len, ldata);
+
+ auto logic = context->create_logic_packet((void*)ldata, data_size, lunit_size);
+ const string ldata_str = output_->receive(logic);
+
+ if (output_stream_.is_open())
+ output_stream_ << ldata_str;
+
+ delete[] ldata;
+ }
+ } catch (Error& error) {
+ error_ = tr("Error while saving: ") + error.what();