Sound Bakery  v0.1.0
Open-source audio middleware for games
Loading...
Searching...
No Matches
system.h
1#pragma once
2
3#include "sound_bakery/core/core_fwd.h"
4#include "sound_bakery/core/database/database_ptr.h"
5#include "sound_bakery/util/fmod_pointers.h"
6#include "spdlog/sinks/basic_file_sink.h"
7
8namespace SB::Core
9{
10 class Database;
11 class ObjectTracker;
12} // namespace SB::Core
13
14namespace SB::Editor
15{
16 class Project;
17} // namespace SB::Editor
18
19namespace SB::Engine
20{
21 class Bus;
22 class GameObject;
23 class System;
24
25 namespace Profiling
26 {
27 class VoiceTracker;
28 }
29
33 class SB_CLASS System final
34 {
35 REGISTER_REFLECTION(System)
36
37 public:
38 System();
39 ~System();
40
41 public:
42 static System* get();
43 static sc_system* getChef();
44
45 static System* create();
46 static void destroy();
47
48 static SB_RESULT init();
49 static SB_RESULT update();
50
54 static SB_RESULT openProject(const std::filesystem::path& projectFile);
55
56 static SB::Core::ObjectTracker* getObjectTracker();
57 static SB::Core::Database* getDatabase();
58 static SB::Editor::Project* getProject();
59
60 void onLoaded();
61
62 void createMasterBus();
63 const SB::Core::DatabasePtr<Bus>& getMasterBus() const { return m_masterBus; }
64 void setMasterBus(const SB::Core::DatabasePtr<Bus>& bus);
65
66 GameObject* getListenerGameObject() const;
67
68 std::shared_ptr<concurrencpp::thread_pool_executor> getBackgroundExecuter() const
69 {
70 return concurrenRuntime.background_executor();
71 }
72
73 std::shared_ptr<concurrencpp::manual_executor> getMainThreadExecutuer() const { return mainThreadExecuter; }
74
75 private:
76 SB::SystemPtr m_chefSystem;
77
78 std::unique_ptr<GameObject> m_listenerGameObject;
80
81 bool m_registeredReflection = false;
82
83 std::unique_ptr<SB::Editor::Project> m_project;
84 std::unique_ptr<SB::Core::Database> m_database;
85 std::unique_ptr<SB::Core::ObjectTracker> m_objectTracker;
86 std::unique_ptr<Profiling::VoiceTracker> m_voiceTracker;
87
88 concurrencpp::runtime concurrenRuntime;
89 std::shared_ptr<concurrencpp::manual_executor> mainThreadExecuter;
90
91 std::shared_ptr<spdlog::logger> logger;
92 };
93} // namespace SB::Engine
Definition database_ptr.h:23
Runtime lookup of objects, using their ID or name.
Definition database.h:11
Definition object_tracker.h:8
Definition project.h:60
Definition gameobject.h:13
Manager of the whole Sound Bakery.
Definition system.h:34
Object that manages the node graph, sounds, output etc.
Definition sound_chef_common.h:198