|
EchoMap 2026-07-25 6d3977c
An experimental cross-platform digital signal processing application for sound-source localisation.
|
The EchoMap maintains state for the application including WebGPU and Dear ImGui context, encapsulating initialisation, game loop, interaction, and clean-up. More...
#include <EchoMap.hpp>
Public Member Functions | |
| EchoMap () | |
| Initialise a EchoMap application instance. | |
| virtual void | run_event_loop ()=0 |
| Runs the platform-dependent event loop to manage and propagate interaction with the EchoMap application. | |
| virtual | ~EchoMap () noexcept |
| Clean up all persistent state registered by the application instance. | |
| void | change_active_project (std::unique_ptr< Project > new_project) noexcept |
| void | notify (const Notification ¬ification) |
| Submit a new Notification to the application queue. | |
| void | increment_forced_frames (unsigned int count=4) noexcept |
| Indicate to the renderer that the following frames should always be rendered, regardless of whether there are any new events to process. | |
| EchoMap (const EchoMap &)=delete | |
| EchoMap & | operator= (const EchoMap &)=delete |
| EchoMap (EchoMap &&)=delete | |
| EchoMap & | operator= (EchoMap &&)=delete |
Protected Member Functions | |
| auto | make_common_notification_visitors () |
| Produce an overload set for std::visit for all platform-independent Notification objects. | |
| virtual void | visit_notification (Notification ¬ification)=0 |
| Uses std::visit on the given notification to invoke the corresponding handler. | |
| void | render () noexcept |
| Perform a render cycle on the configured Surface and Device. | |
| void | setup_subscriptions () |
| Configure the core signals for the application instance. | |
| wgpu::Future | request_adapter () noexcept |
| Produce a WebGPU Future for requesting an Adapter. | |
| wgpu::Future | request_device () noexcept |
| Produce a WebGPU Future for requesting an accelerator device. | |
| void | setup_imgui () |
| Create a context for Dear ImGui and ImPlot, and configure the plain GLFW and WebGPU backends. | |
| void | setup_dockspace () |
| bool | handle_window_resize () noexcept |
| Check if the window has been resized compared with the stored dimensions, updating member variables and reconfiguring the WebGPU surface if necessary. | |
| void | process_notifications () |
| Handle any unconsumed Notification objects from the queue. | |
| void | process_worker_results () |
| Handle any unconsumed events from the Worker. | |
| void | raise_error (std::string_view message) |
| void | raise_error (std::string_view message, const std::runtime_error &exception) |
| void | handle_notification (const AddChannelMappingNotification ¬ification) const |
| void | handle_notification (const ModifySensorColourNotification ¬ification) const |
| void | handle_notification (const ModifySensorPositionNotification ¬ification) const |
| void | handle_notification (const ProjectSelectionCompleteNotification ¬ification) |
| void | handle_notification (const ClearErrorNotification ¬ification) |
| virtual void | handle_result (LoadProjectResult &&result) |
| virtual void | handle_result (LoadSignalFileResult &&result) |
Static Protected Member Functions | |
| static GLFWwindow * | create_window (int width, int height) |
| Create a new GLFW window of the specified dimensions from a static context. | |
| static void | configure_surface (const wgpu::Surface &surface, const wgpu::Device &device, const wgpu::SurfaceCapabilities &capabilities, std::uint32_t viewport_width, std::uint32_t viewport_height) noexcept |
| Configure a WebGPU Surface from a static context given metadata and Adapter capabilities. | |
Protected Attributes | |
| std::uint32_t | viewport_width = 1024 |
| std::uint32_t | viewport_height = 1024 |
| wgpu::Instance | instance |
| wgpu::Adapter | adapter |
| wgpu::Device | device |
| wgpu::Surface | surface |
| wgpu::SurfaceCapabilities | surface_capabilities |
| GLFWwindow * | window = nullptr |
| Worker | worker |
| Multi-threaded worker for scheduling heavy computation tasks. | |
| WorkerResultDespatcher | despatcher |
| Despatcher to manage Worker result channels. | |
| std::vector< sigc::scoped_connection > | connections |
| RAII lifetime manager for signal connections. | |
| std::vector< std::unique_ptr< IProjectPanel > > | panels |
| Individual display components. | |
| std::optional< ErrorModal > | error_modal |
| Persistent panel to indicate errors over all other panels. | |
| std::vector< Notification > | notification_queue |
| std::unique_ptr< Project > | project |
| Owning container for the active Project. | |
| std::unique_ptr< IPanel > | active_modal |
| The current active non-ErrorModal modal panel. | |
| ImGuiID | dockspace_id |
| bool | dockspace_configured = false |
| unsigned int | forced_frames = 0 |
Static Protected Attributes | |
| static constexpr auto | operation_timeout = std::numeric_limits<std::uint64_t>::max() |
The EchoMap maintains state for the application including WebGPU and Dear ImGui context, encapsulating initialisation, game loop, interaction, and clean-up.
Definition at line 34 of file EchoMap.hpp.
| echomap::EchoMap::EchoMap | ( | ) |
Initialise a EchoMap application instance.
Initialisation is a computationally substantial task. Context from all managed frameworks must be initialised (GLFW, WebGPU/Dawn, and Dear ImGui) and their components registered. Once the constructor has completed, the game loop can begin with run_event_loop.
| ConfigurationError | Some part of initialisation, described in the exception message, did not succeed. |
Definition at line 41 of file EchoMap.cpp.
|
virtualnoexcept |
Clean up all persistent state registered by the application instance.
Definition at line 91 of file EchoMap.cpp.
|
noexcept |
Definition at line 589 of file EchoMap.cpp.
|
staticprotectednoexcept |
Configure a WebGPU Surface from a static context given metadata and Adapter capabilities.
| surface | The Surface to configure. |
| device | The WebGPU Device on which the Surface will be displayed. |
| capabilities | Capabilities of the WebGPU Adapter and Instance. |
| viewport_width | Initial width of the Surface viewport, in pixels. |
| viewport_height | Initial height of the Surface viewport, in pixels. |
Definition at line 140 of file EchoMap.cpp.
|
staticprotected |
Create a new GLFW window of the specified dimensions from a static context.
| width | Initial width of the window, in pixels. |
| height | Initial height of the window, in pixels. |
| ConfigurationError | A GLFW initialisation step failed. |
Definition at line 118 of file EchoMap.cpp.
|
protected |
Definition at line 521 of file EchoMap.cpp.
|
protected |
Definition at line 555 of file EchoMap.cpp.
|
protected |
Definition at line 529 of file EchoMap.cpp.
|
protected |
Definition at line 537 of file EchoMap.cpp.
|
protected |
Definition at line 545 of file EchoMap.cpp.
|
protectedvirtual |
Definition at line 563 of file EchoMap.cpp.
|
protectedvirtual |
Definition at line 575 of file EchoMap.cpp.
|
protectednoexcept |
Check if the window has been resized compared with the stored dimensions, updating member variables and reconfiguring the WebGPU surface if necessary.
Definition at line 439 of file EchoMap.cpp.
|
noexcept |
Indicate to the renderer that the following frames should always be rendered, regardless of whether there are any new events to process.
The forced frame count stacks (as in a source) until the renderer drains it to zero (as in a sink). By default, we force four frames since most Dear ImGui components can fully render a four-frame cycle.
| count | The number of frames to force. |
Definition at line 622 of file EchoMap.cpp.
|
inlineprotected |
Produce an overload set for std::visit for all platform-independent Notification objects.
Definition at line 94 of file EchoMap.hpp.
| void echomap::EchoMap::notify | ( | const Notification & | notification | ) |
Submit a new Notification to the application queue.
Notifications are processed at the beginning of render cycles in a first-come first-served ordering.
| notification | The Notification to schedule. |
Definition at line 604 of file EchoMap.cpp.
|
protected |
Handle any unconsumed Notification objects from the queue.
Definition at line 470 of file EchoMap.cpp.
|
protected |
Handle any unconsumed events from the Worker.
Definition at line 492 of file EchoMap.cpp.
|
protected |
Definition at line 502 of file EchoMap.cpp.
|
protected |
Definition at line 511 of file EchoMap.cpp.
|
protectednoexcept |
Perform a render cycle on the configured Surface and Device.
A single render cycle requests all panels to render their state to the Surface, and provides an opportunity to submit any work to the GPU. Events are also received from GLFW and processed as required.
Definition at line 256 of file EchoMap.cpp.
|
protectednoexcept |
Produce a WebGPU Future for requesting an Adapter.
Definition at line 186 of file EchoMap.cpp.
|
protectednoexcept |
Produce a WebGPU Future for requesting an accelerator device.
Definition at line 208 of file EchoMap.cpp.
|
pure virtual |
Runs the platform-dependent event loop to manage and propagate interaction with the EchoMap application.
This function returns only once GLFW indicates that the window should close. Following closure, the event loop could be re-run, or the application could clean up by calling the destructor.
Implemented in echomap::EchoMapNative, and echomap::EchoMapWeb.
|
protected |
Definition at line 382 of file EchoMap.cpp.
|
protected |
Create a context for Dear ImGui and ImPlot, and configure the plain GLFW and WebGPU backends.
| ConfigurationError | A Dear ImGui backend could not be initialised. |
Definition at line 336 of file EchoMap.cpp.
|
protected |
Configure the core signals for the application instance.
This should be invoked during construction prior to any IPanel invocations as it takes the exclusive consumer role for several critical message classes.
Definition at line 166 of file EchoMap.cpp.
|
protectedpure virtual |
Uses std::visit on the given notification to invoke the corresponding handler.
This function is virtual, since the overload set can be platform-dependent in addition to the base handlers provided by make_common_notification_visitors.
| notification | The notification to visit. |
Implemented in echomap::EchoMapNative, and echomap::EchoMapWeb.
|
protected |
The current active non-ErrorModal modal panel.
Definition at line 246 of file EchoMap.hpp.
|
protected |
Definition at line 232 of file EchoMap.hpp.
|
protected |
RAII lifetime manager for signal connections.
Definition at line 240 of file EchoMap.hpp.
|
protected |
Despatcher to manage Worker result channels.
Definition at line 239 of file EchoMap.hpp.
|
protected |
Definition at line 233 of file EchoMap.hpp.
|
protected |
Definition at line 249 of file EchoMap.hpp.
|
protected |
Definition at line 248 of file EchoMap.hpp.
|
protected |
Persistent panel to indicate errors over all other panels.
Definition at line 243 of file EchoMap.hpp.
|
protected |
Definition at line 250 of file EchoMap.hpp.
|
protected |
Definition at line 231 of file EchoMap.hpp.
|
protected |
Definition at line 244 of file EchoMap.hpp.
|
staticconstexprprotected |
Definition at line 125 of file EchoMap.hpp.
|
protected |
Individual display components.
Definition at line 242 of file EchoMap.hpp.
|
protected |
Owning container for the active Project.
Definition at line 245 of file EchoMap.hpp.
|
protected |
Definition at line 234 of file EchoMap.hpp.
|
protected |
Definition at line 235 of file EchoMap.hpp.
|
protected |
Definition at line 229 of file EchoMap.hpp.
|
protected |
Definition at line 228 of file EchoMap.hpp.
|
protected |
Definition at line 236 of file EchoMap.hpp.
|
protected |
Multi-threaded worker for scheduling heavy computation tasks.
Definition at line 238 of file EchoMap.hpp.