EchoMap 2026-07-25 6d3977c
An experimental cross-platform digital signal processing application for sound-source localisation.
Loading...
Searching...
No Matches
echomap::EchoMapNative Class Reference

EchoMap application implementation for native (non-WebAssembly) platforms. More...

#include <EchoMapNative.hpp>

Inheritance diagram for echomap::EchoMapNative:
[legend]

Public Member Functions

void run_event_loop () override
 Runs the platform-dependent event loop to manage and propagate interaction with the EchoMap application.
Public Member Functions inherited from echomap::EchoMap
 EchoMap ()
 Initialise a EchoMap application instance.
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 &notification)
 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
EchoMapoperator= (const EchoMap &)=delete
 EchoMap (EchoMap &&)=delete
EchoMapoperator= (EchoMap &&)=delete

Protected Member Functions

void visit_notification (Notification &notification) override
 Uses std::visit on the given notification to invoke the corresponding handler.
Protected Member Functions inherited from echomap::EchoMap
auto make_common_notification_visitors ()
 Produce an overload set for std::visit for all platform-independent Notification objects.
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 &notification) const
void handle_notification (const ModifySensorColourNotification &notification) const
void handle_notification (const ModifySensorPositionNotification &notification) const
void handle_notification (const ProjectSelectionCompleteNotification &notification)
void handle_notification (const ClearErrorNotification &notification)
virtual void handle_result (LoadProjectResult &&result)
virtual void handle_result (LoadSignalFileResult &&result)

Private Member Functions

void handle_notification (RaiseFileChooserNotification &notification)

Additional Inherited Members

Static Protected Member Functions inherited from echomap::EchoMap
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 inherited from echomap::EchoMap
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< ErrorModalerror_modal
 Persistent panel to indicate errors over all other panels.
std::vector< Notificationnotification_queue
std::unique_ptr< Projectproject
 Owning container for the active Project.
std::unique_ptr< IPanelactive_modal
 The current active non-ErrorModal modal panel.
ImGuiID dockspace_id
bool dockspace_configured = false
unsigned int forced_frames = 0
Static Protected Attributes inherited from echomap::EchoMap
static constexpr auto operation_timeout = std::numeric_limits<std::uint64_t>::max()

Detailed Description

EchoMap application implementation for native (non-WebAssembly) platforms.

Definition at line 23 of file EchoMapNative.hpp.

Member Function Documentation

◆ handle_notification()

void echomap::EchoMapNative::handle_notification ( RaiseFileChooserNotification & notification)
private

Definition at line 55 of file EchoMapNative.cpp.

58{
59 if (active_modal != nullptr) {
60 LOG_WARN("Ignoring request to raise file chooser since there is an active modal.");
61 return;
62 }
63
65 this,
66 std::move(notification.success_callback),
67 std::move(notification.cancelled_callback)
68 );
69}
#define LOG_WARN(msg)
Logs an unformatted warning-level message using echomap::Logger::log.
Definition Logger.hpp:162
std::unique_ptr< IPanel > active_modal
The current active non-ErrorModal modal panel.
Definition EchoMap.hpp:246
T make_unique(T... args)

◆ run_event_loop()

void echomap::EchoMapNative::run_event_loop ( )
overridevirtual

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.

Implements echomap::EchoMap.

Definition at line 21 of file EchoMapNative.cpp.

22{
23 render();
24 instance.ProcessEvents();
25
26 while (glfwWindowShouldClose(window) == 0) {
27 if (forced_frames > 0) {
28 glfwPollEvents();
29 --forced_frames;
30 } else
31 glfwWaitEvents();
32
33 render();
34 instance.ProcessEvents();
35 }
36}
void render() noexcept
Perform a render cycle on the configured Surface and Device.
Definition EchoMap.cpp:256

◆ visit_notification()

void echomap::EchoMapNative::visit_notification ( Notification & notification)
overrideprotectedvirtual

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.

Parameters
notificationThe notification to visit.

Implements echomap::EchoMap.

Definition at line 38 of file EchoMapNative.cpp.

41{
43 // clang-format off
44
45 variant_helpers::Overloaded{
47 [this](RaiseFileChooserNotification& n) { handle_notification(n); },
48 },
49
50 // clang-format on
51 notification
52 );
53}
auto make_common_notification_visitors()
Produce an overload set for std::visit for all platform-independent Notification objects.
Definition EchoMap.hpp:94
T visit(T... args)

The documentation for this class was generated from the following files: