更新三缓冲

This commit is contained in:
2026-08-24 08:12:20 +08:00
parent db251b5abf
commit d6c1db9d06
26 changed files with 1099 additions and 259 deletions
+7 -8
View File
@@ -152,8 +152,7 @@ std::unique_ptr<detail::Renderable_Descriptor> make_axis_component<Time_Axis_Obj
Prop_Field<&Time_Axis::Prop::estimated_label_width_px, "estimated_label_width_px", "Estimated time label width.">,
Prop_Field<&Time_Axis::Prop::format, "format", "Time label format.">,
Prop_Field<&Time_Axis::Prop::newest_at_start, "newest_at_start", "Places the newest time at the range origin.">,
State_Field<Time_Axis, &Time_Axis::State::next_tick, "next_tick", "Next allocated time tick.">,
State_Field<Time_Axis, &Time_Axis::State::samples, "samples", "Published time sample window.">>(
State_Field<Time_Axis, &Time_Axis::State::next_tick, "next_tick", "Next allocated time tick.">>(
std::move(id), std::move(label), "axis", axis);
}
using Json = nlohmann::json;
@@ -292,7 +291,7 @@ nlohmann::json generate_2d_data(Object& object, const Json& input) {
std::vector<Frequency_Trace_Sample> samples(count);
for (std::size_t index = 0; index < count; ++index)
samples[index] = {static_cast<Plot_Time_Tick>(index * tick_step), distribution(engine)};
object.template set<&Frequency_Trace::Prop::samples>(std::move(samples));
for (const auto& sample : samples) object.append_sample(sample.tick, sample.value);
generated_count = count;
} else if constexpr (std::same_as<Definition, Sweep_Spectrum>) {
const auto block_count = generator_count(input, "block_count", 65'536);
@@ -306,7 +305,7 @@ nlohmann::json generate_2d_data(Object& object, const Json& input) {
std::ranges::copy_n(complete.begin() + block * width, width, blocks[block].begin());
object.template set<&Sweep_Spectrum::Prop::bins_per_block>(width);
object.template set<&Sweep_Spectrum::Prop::block_count>(block_count);
object.template set<&Sweep_Spectrum::Prop::blocks>(std::move(blocks));
for (auto& block : blocks) object.append_block(block);
generated_count = block_count * width;
} else if constexpr (std::same_as<Definition, Afterglow>) {
const auto row_count = generator_count(input, "history_count", 4096);
@@ -318,7 +317,7 @@ nlohmann::json generate_2d_data(Object& object, const Json& input) {
const auto noise_stddev = generator_number(input, "noise_stddev");
for (std::size_t row = 0; row < row_count; ++row)
generate_spectral_row(spectra[row], row, signal_count, minimum, maximum, noise_stddev, engine);
object.template set<&Afterglow::Prop::spectra>(std::move(spectra));
for (auto& spectrum : spectra) object.append_spectrum(spectrum);
generated_count = row_count * width;
} else if constexpr (std::same_as<Definition, Waterfall>) {
const auto row_count = generator_count(input, "row_count", 4096);
@@ -335,7 +334,7 @@ nlohmann::json generate_2d_data(Object& object, const Json& input) {
rows.push_back({static_cast<Plot_Time_Tick>(row), std::move(row_values)});
}
object.template set<&Waterfall::Prop::frequency_bin_count>(width);
object.template set<&Waterfall::Prop::rows>(std::move(rows));
for (auto& row : rows) object.append_row(row.tick, row.values);
generated_count = row_count * width;
} else if constexpr (std::same_as<Definition, Constellation_Diagram>) {
const auto count = generator_count(input, "point_count");
@@ -346,7 +345,7 @@ nlohmann::json generate_2d_data(Object& object, const Json& input) {
const auto submitted = monotonic_milliseconds();
for (std::size_t index = 0; index < count; ++index)
points[index] = {{i_distribution(engine), q_distribution(engine)}, submitted};
object.template set<&Constellation_Diagram::Prop::points>(std::move(points));
for (const auto& point : points) object.append_point(point.point);
generated_count = count;
} else if constexpr (std::same_as<Definition, Selection_Rectangle_Overlay>) {
const auto count = generator_count(input, "region_count");
@@ -653,7 +652,7 @@ std::shared_ptr<Plot> make_sweep_spectrum_plot(asio::any_io_executor executor) {
const auto& state = raw->template read_prop<Sweep_Spectrum::Base_Tag>();
const std::size_t block_count = std::max<std::size_t>(1, state.block_count);
const std::size_t bins_per_block = std::max<std::size_t>(1, state.bins_per_block);
const std::size_t block_index = state.blocks.size() < block_count ? state.blocks.size() : state.next_block_index % block_count;
const std::size_t block_index = static_cast<std::size_t>(event.sequence % block_count);
std::vector<double> values(bins_per_block);
for (std::size_t i = 0; i < values.size(); ++i) {
const auto sweep_index = block_index * values.size() + i;