Sound Bakery  v0.1.0
Open-source audio middleware for games
Loading...
Searching...
No Matches
voice.h
1#pragma once
2
3#include "sound_bakery/core/core_include.h"
4#include "sound_bakery/voice/node_instance.h"
5
6namespace SB::Engine
7{
8 class Container;
9 class GameObject;
10 class NodeInstance;
11
16 class SB_CLASS Voice : public SB::Core::Object
17 {
18 public:
19 Voice() = delete;
20 Voice(GameObject* owningObject) : m_owningGameObject(owningObject) {}
21
22 public:
23 void playContainer(Container* container);
24 void update();
25
26 public:
27 bool playingContainer(Container* container) const noexcept;
28
29 const std::vector<std::unique_ptr<NodeInstance>>& getVoices() const noexcept;
30
31 std::size_t voices() const;
32
33 NodeInstance* voice(std::size_t index) const;
34
35 bool isPlaying() const;
36
37 GameObject* getOwningGameObject() const { return m_owningGameObject; }
38
39 private:
40 GameObject* m_owningGameObject = nullptr;
41 SB::Core::DatabasePtr<Container> m_playingContainer;
42
43 std::vector<std::unique_ptr<NodeInstance>> m_voiceInstances;
44 };
45} // namespace SB::Engine
Definition database_ptr.h:23
Simple base Object that all Sound Bakery objects should inherit from.
Definition object.h:33
Base container type. Inherited types include sounds, random, sequence etc.
Definition container.h:49
Definition gameobject.h:13
NodeInstances represent runtime versions of Nodes, either containers or busses.
Definition node_instance.h:104
A runtime graph of nodes and busses, playing a sound or many.
Definition voice.h:17