Sound Bakery  v0.1.0
Open-source audio middleware for games
Loading...
Searching...
No Matches
bus.h
1#pragma once
2
3#include "sound_bakery/node/node.h"
4
5namespace SB::Engine
6{
7 class NodeInstance;
8
9 class SB_CLASS Bus : public Node
10 {
11 REGISTER_REFLECTION(Bus, Node)
12
13 public:
14 Bus() : Node(), m_masterBus(false) {}
15
16 void onLoaded() override;
17
18 bool canAddChild(const SB::Core::DatabasePtr<NodeBase>& child) const override
19 {
20 if (child.lookup() && child->getType().is_derived_from<Bus>())
21 {
22 return NodeBase::canAddChild(child);
23 }
24 else
25 {
26 return false;
27 }
28 }
29
30 void setMasterBus(bool isMaster)
31 {
32 if (getType() == rttr::type::get<Bus>())
33 {
34 m_masterBus = isMaster;
35 }
36 }
37
38 bool isMasterBus() const { return m_masterBus; }
39
40 public:
41 void lock();
42 void unlock();
43 std::shared_ptr<NodeInstance> lockAndCopy();
44
45 protected:
46 std::shared_ptr<NodeInstance> m_busInstance;
47
48 private:
49 bool m_masterBus;
50 };
51} // namespace SB::Engine
Definition database_ptr.h:23
bool lookup() const
Find the live object referenced by the ID and store it.
Definition database_ptr.h:142
Definition bus.h:10
Root node that builds the core graph of sounds and busses.
Definition node.h:57