EchoMap 2026-07-25 6d3977c
An experimental cross-platform digital signal processing application for sound-source localisation.
Loading...
Searching...
No Matches
PartialProject.cpp
Go to the documentation of this file.
1
9
10#if defined(__EMSCRIPTEN__) || defined(__DOXYGEN__)
11
12#include "PartialProject.hpp"
13
15
16namespace echomap
17{
18
19PartialProject::PartialProject(
20 const std::string_view project_name
21) :
22 Project(project_name)
23{
24}
25
26PartialProject::~PartialProject() = default;
27
30)
31{
32 if (!factory->observe_signal().observe_source().has_value())
33 throw std::runtime_error("Attempted to defer load of a Signal with no external source.");
34
35 const auto& source = *factory->observe_signal().observe_source();
36
37 auto file_group_it = unloaded_signals.find(source.path);
38
39 if (file_group_it == unloaded_signals.end()) {
40 decltype(unloaded_signals)::mapped_type pair{{}, std::vector<std::unique_ptr<SignalFactory>>(source.channel)};
41 const auto [it, success] = unloaded_signals.emplace(source.path, std::move(pair));
42
43 if (!success)
44 throw std::runtime_error("Could not register VFS channel mappings.");
45
46 file_group_it = it;
47 }
48
49 auto& group_factories = file_group_it->second.second;
50
51 if (group_factories.size() < source.channel)
52 group_factories.resize(source.channel);
53
54 group_factories[source.channel - 1] = std::move(factory);
55}
56
58 const std::filesystem::path& external,
59 std::filesystem::path&& internal
60)
61{
62 const auto map_it = unloaded_signals.find(external);
63
64 if (map_it == unloaded_signals.end())
65 throw std::runtime_error(std::format("Provided VFS mapping for unknown path {}.", external.c_str()));
66
67 map_it->second.first.emplace(std::move(internal));
68}
69
70} // namespace echomap
71
72#endif // __EMSCRIPTEN__
PartialProject specification.
Wave file specification.
std::map< std::filesystem::path, std::pair< std::optional< std::filesystem::path >, std::vector< std::unique_ptr< SignalFactory > > > > unloaded_signals
Provides a mapping between stated paths of externally sourced signals, and paths in the WebAssembly V...
void indicate_unloaded_signal(std::unique_ptr< SignalFactory > &&factory)
Provide the factory for an unloaded Signal.
void add_vfs_mapping_for_unavailable_signal(const std::filesystem::path &external, std::filesystem::path &&internal)
Provide a VFS mapping for a previously indicated unloaded Signal.
T format(T... args)
The main EchoMap outermost namespace for all non-exported symbols.