EchoMap 2026-07-25 6d3977c
An experimental cross-platform digital signal processing application for sound-source localisation.
Loading...
Searching...
No Matches
SignalWaveformPanel.hpp
Go to the documentation of this file.
1
7
8#ifndef ECHOMAP_SIGNALWAVEFORMPANEL_HPP
9#define ECHOMAP_SIGNALWAVEFORMPANEL_HPP
10
11#include <implot.h>
12#include <sigc++/scoped_connection.h>
13
14#include <string>
15
17#include "IProjectPanel.hpp"
18
19namespace echomap
20{
21
24class Signal;
25class Worker;
26
33{
34public:
44 explicit SignalWaveformPanel(
45 Worker* parent_worker,
46 WorkerResultDespatcher& despatcher,
47 const Project* initial_project = nullptr
48 );
49
50 ~SignalWaveformPanel() noexcept override;
51
53 SignalWaveformPanel& operator=(const SignalWaveformPanel&) = delete;
54
56 SignalWaveformPanel& operator=(SignalWaveformPanel&&) noexcept = delete;
57
58 [[nodiscard]] const char* get_imgui_name() const noexcept override;
59
60 void draw() noexcept override;
61
62 void change_active_project(const Project* new_project) override;
63
64 static const char* get_imgui_stable_name() noexcept;
65
66private:
67 static constexpr float default_downsample_factor = 50.0f;
68
70 {
71 const Signal * signal;
72 };
73
74 static ImPlotPoint get_indexed_signal_point(
75 int index,
76 void* user_data
77 ) noexcept;
78
79 void handle_downsampled_result(DownsampleResult&& result);
80
81 void update_bounding_box(const Signal& signal) noexcept;
82 void update_bounding_box() noexcept;
83
93 const Signal* get_downsampled_signal(std::shared_ptr<Signal> signal);
94
109 std::unordered_map<id_type, std::unique_ptr<Signal>> downsample_cache;
110
117 ImPlotRect bounding_box;
118
119 std::string panel_name;
120 ImPlotSpec plotting_spec_2d;
121 Worker* parent_worker;
122 const Project* active_project = nullptr;
123 std::vector<sigc::scoped_connection> connections;
124};
125
126} // namespace echomap
127
128#endif // ECHOMAP_SIGNALWAVEFORMPANEL_HPP
IDAllocator specification.
IProjectPanel specification.
Denotes a completed for a downsampled Signal produced by a DownsampleTask job.
An IPanel which can receive updates to the application-wide active Project.
const Signal * get_downsampled_signal(std::shared_ptr< Signal > signal)
Retrieves a downsampled Signal from the cache.
const char * get_imgui_name() const noexcept override
Retrieves the name of the IPanel for Dear ImGui API functions.
SignalWaveformPanel(Worker *parent_worker, WorkerResultDespatcher &despatcher, const Project *initial_project=nullptr)
Create a new SignalWaveformPanel to display downsampled Signal waveforms in the time domain.
void draw() noexcept override
Draw the panel to the active rendering context.
ImPlotRect bounding_box
The maximum bounding box of an LTTB-downsampled wave form plot.
std::unordered_map< id_type, std::unique_ptr< Signal > > downsample_cache
The duplicated Signal objects, downsampled for visualisation.
void change_active_project(const Project *new_project) override
Updates the active Project being described by the IPanel.
A single channel of discretely sampled audio data.
Definition Signal.hpp:40
Manages channels for WorkerResult message routing.
A Worker provides an encapsulated thread-safe despatch model for submitting work and reviewing result...
Definition Worker.hpp:45
The main EchoMap outermost namespace for all non-exported symbols.
STL namespace.