17 struct JournalConfig {
26 static constexpr auto describe()
28 return std::make_tuple(
32 Reflect::member(
"disable_components", &JournalConfig::disable_components),
34 Reflect::member(
"include_components", &JournalConfig::include_components),
46 static constexpr auto describe()
48 return std::make_tuple(
145 for (
const auto& comp : component) {
157 for (
const auto& ctx : context) {
168 std::string journal_path(
const std::string& path)
170 namespace fs = std::filesystem;
171 if (fs::path(path).is_absolute())
174 return (fs::path(path).has_parent_path() ? root / path : root /
"data" /
"log" / path).string();
192 auto result = ser.
read<EngineConfig>(path);
195 "Failed to load config from {}: {}", path, ser.
last_error());
203 const auto& j = result->journal;
205 if (!j.severity.empty()) {
206 auto sev = Reflect::string_to_enum_case_insensitive<Journal::Severity>(j.severity);
211 "Unknown journal severity: {}", j.severity);
214 if (j.sink_to_console)
216 if (!j.log_file.empty())
218 for (
const auto&
name : j.disable_components) {
219 auto comp = Reflect::string_to_enum_case_insensitive<Journal::Component>(
name);
224 "Unknown journal component: {}",
name);
228 for (
const auto&
name : j.disable_contexts) {
229 auto ctx = Reflect::string_to_enum_case_insensitive<Journal::Context>(
name);
234 "Unknown journal context: {}",
name);
238 std::vector<Journal::Component> included_components;
239 for (
const auto&
name : j.include_components) {
240 auto comp = Reflect::string_to_enum_case_insensitive<Journal::Component>(
name);
242 included_components.push_back(*comp);
245 "Unknown journal component: {}",
name);
250 std::vector<Journal::Context> included_contexts;
251 for (
const auto&
name : j.include_contexts) {
252 auto ctx = Reflect::string_to_enum_case_insensitive<Journal::Context>(
name);
254 included_contexts.push_back(*ctx);
257 "Unknown journal context: {}",
name);
#define MF_ERROR(comp, ctx,...)
#define MF_WARN(comp, ctx,...)
std::vector< std::string > include_contexts
Core::GlobalNetworkConfig network
Core::GlobalStreamInfo stream
Core::GlobalGraphicsConfig graphics
std::vector< std::string > disable_contexts
std::vector< std::string > disable_components
Core::GlobalInputConfig input
std::vector< std::string > include_components
Core engine lifecycle and configuration API.
GlobalStreamInfo & get_stream_info()
Gets the current stream configuration.
void set_node_config(const Nodes::NodeConfig &config)
Sets the node processing configuration.
GlobalNetworkConfig & get_network_config()
Gets the current network configuration.
Nodes::NodeConfig & get_node_config()
Gets the current node processing configuration.
GlobalInputConfig & get_input_config()
Gets the current input configuration.
GlobalGraphicsConfig & get_graphics_config()
Gets the current graphics configuration.
std::optional< T > read(const std::string &path)
Read path and deserialize into T.
const std::string & last_error() const
Last error message, empty if no error.
Converts arbitrary C++ types to/from JSON strings and disk files.
void add_sink(std::unique_ptr< Sink > sink)
Add a log sink for output.
void set_component_includes(const std::vector< Component > &components)
Restrict logging to these components; an empty list includes all.
void set_component_filter(Component comp, bool enabled)
Enable or disable logging for a specific component.
void set_context_includes(const std::vector< Context > &contexts)
Restrict logging to these contexts; an empty list includes all.
static Archivist & instance()
Get the singleton instance of the Archivist.
void set_min_severity(Severity min_sev)
Set the minimum severity level for logging.
void set_context_filter(Context ctx, bool enabled)
Enable or disable logging for a specific context.
std::string project_root()
Core::GlobalGraphicsConfig & get_global_graphics_config()
Gets the graphics configuration from the default engine.
Nodes::NodeConfig & get_node_config()
void set_journal_component_filter(const std::vector< Journal::Component > &component, bool enabled)
Enables or disables logging for specific journal components.
Core::GlobalInputConfig & get_global_input_config()
Gets the input configuration from the default engine.
void set_journal_component_includes(const std::vector< Journal::Component > &components)
Restrict journal output to these components; an empty list includes all.
uint32_t get_buffer_size()
Gets the buffer size from the default engine.
void set_node_config(const Nodes::NodeConfig &config)
Sets the node configuration for the default engine.
bool load_config_from_file(const std::string &path)
Load engine configuration from a JSON file, applying any present fields to the pre-Init config struct...
void store_journal_entries(const std::string &file_name)
Stores journal entries to a file by adding a FileSink to the Archivist.
void set_journal_severity(Journal::Severity severity)
Sets the minimum severity level for journal entries to be logged.
void sink_journal_to_console()
Outputs journal entries to the console by adding a ConsoleSink to the Archivist NOTE: This records th...
void set_journal_context_filter(const std::vector< Journal::Context > &context, bool enabled)
Enables or disables logging for specific journal contexts.
uint32_t get_sample_rate()
Gets the sample rate from the default engine.
Core::GlobalStreamInfo & get_global_stream_info()
Gets the stream configuration from the default engine.
uint32_t get_num_out_channels()
Gets the number of output channels from the default engine.
Core::GlobalNetworkConfig & get_global_network_config()
Gets the network configuration from the default engine.
void set_journal_context_includes(const std::vector< Journal::Context > &contexts)
Restrict journal output to these contexts; an empty list includes all.
Globlal configuration for MayaFlux.
@ Configuration
Configuration and parameter updates.
@ API
MayaFlux/API Wrapper and convenience functions.
constexpr auto member(std::string_view key, T Class::*ptr)
bool is_engine_configured()
Checks if the default engine has currently accepted all configurations and initialized all managers.
bool is_configured()
Checks if the default engine has currently accepted all configurations and initialized all managers.
Core::Engine & get_context()
Gets the default engine instance.
Main namespace for the Maya Flux audio engine.
Configuration for the NetworkSubsystem.
uint32_t channels
Number of discrete channels in this set.
uint32_t buffer_size
Number of samples per processing block.
uint32_t sample_rate
Number of samples processed per second (Hz)
ChannelConfig output
Configuration for output signal channels.
Comprehensive configuration for digital audio stream processing.
Configuration settings for individual audio nodes.