10#if defined(__EMSCRIPTEN__) || defined(__DOXYGEN__)
14#include <emscripten/emscripten.h>
25#ifndef __EMSCRIPTEN_PTHREADS__
26#warning "The Emscripten application will be single-threaded."
51void EchoMapWeb::handle_result(
56 LOG_WARN(
"Ignoring request to change active Project since there is an active modal.");
60 auto&& new_project = std::move(result).take_project();
62 if (!new_project->observe_unloaded_signals().empty()) {
67 change_active_project(std::move(new_project));
70void EchoMapWeb::handle_result(
74 Project* target =
nullptr;
78 if (
project !=
nullptr && result.get_project_id() ==
project->get_id())
83 if (target ==
nullptr) {
85 "Dropping LoadSignalFileResult, which was intended for the unavailable Project with ID {}.",
86 result.get_project_id()
94 for (
auto&& signals = std::move(result).take_signals();
auto signal : signals | std::views::as_rvalue)
95 target->add_signal(std::move(signal));
103void EchoMapWeb::handle_notification(
113void EchoMapWeb::handle_notification(
121 for (
auto&& [vfs_path, factories] :
unloaded_project->take_unloaded_factories()) {
123 if (!vfs_path.has_value())
124 throw std::runtime_error(
"Refusing CompleteProjectLoadNotification due to an incomplete VFS mapping.");
135void EchoMapWeb::handle_notification(
143 notification.external,
144 std::move(notification.internal)
146 }
catch (
const std::runtime_error&) {
147 throw IgnoredWarning(
149 "Dropping RegisterVFSMappingNotification since we don't need a mapping for {}.",
150 notification.external.c_str()
157 void*
const echomap_instance
160 auto* instance =
static_cast<EchoMapWeb*
>(echomap_instance);
169EchoMapWeb::EchoMapWeb() =
default;
171EchoMapWeb::~EchoMapWeb() =
default;
AllNotifications specification.
EchoMapWeb specification.
IProjectPanel specification.
IgnoredWarning specification.
LoadSignalFileTask specification.
EchoMap portable logger specification.
#define LOG_F_WARN(msg,...)
Logs a formatted warning-level message using echomap::Logger::log_f.
#define LOG_WARN(msg)
Logs an unformatted warning-level message using echomap::Logger::log.
IndividualUploadModal specification.
PartialProject specification.
Audio signal class specification.
static void render_shim(void *echomap_instance)
Invokes the renderer from a static context given an untyped mutable pointer to the EchoMap object ins...
void run_event_loop() override
Runs the platform-dependent event loop to manage and propagate interaction with the EchoMap applicati...
void visit_notification(Notification ¬ification) override
Uses std::visit on the given notification to invoke the corresponding handler.
std::unique_ptr< PartialProject > unloaded_project
Owning container for the unloaded Project.
std::unique_ptr< Project > project
Owning container for the active Project.
std::unique_ptr< IPanel > active_modal
The current active non-ErrorModal modal panel.
auto make_common_notification_visitors()
Produce an overload set for std::visit for all platform-independent Notification objects.
Worker worker
Multi-threaded worker for scheduling heavy computation tasks.
Denotes a loaded Project completed by a LoadProjectTask job.
std::variant< AddChannelMappingNotification, ModifySensorColourNotification, ModifySensorPositionNotification, ProjectSelectionCompleteNotification, ClearErrorNotification, RaiseFileChooserNotification, RegisterVFSMappingNotification, CompleteProjectLoadNotification, CancelProjectLoadNotification > Notification
A Notification is a trivial message sent exclusively to the EchoMap controller.
The main EchoMap outermost namespace for all non-exported symbols.
A notification indicating that a pending Project load should be cancelled.
A notification indicating that a pending Project is ready to be loaded.
A notification to indicate a new VFS mapping from an external source.
A helper type for succinctly specifying callable visitors over a variant alternative.