NAP
outputcomponent.h
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2  * License, v. 2.0. If a copy of the MPL was not distributed with this
3  * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
4 
5 #pragma once
6 
7 // Nap includes
8 #include <component.h>
9 #include <componentptr.h>
10 #include <audio/utility/safeptr.h>
11 
12 // Audio includes
13 #include <audio/component/audiocomponentbase.h>
14 
15 namespace nap
16 {
17  namespace audio
18  {
19  class OutputComponentInstance;
20 
24  class NAPAPI OutputComponent : public Component
25  {
26  RTTI_ENABLE(nap::Component)
27  DECLARE_COMPONENT(OutputComponent, OutputComponentInstance)
28 
29  public:
31  {}
32 
33  public:
34  // Properties
36 
42  std::vector<int> mChannelRouting;
43 
44  };
45 
46 
52  {
53  RTTI_ENABLE(nap::ComponentInstance)
54 
55  public:
56  OutputComponentInstance(EntityInstance& entity, Component& resource) : nap::ComponentInstance(entity, resource) {}
57 
58  // Initialize the component
59  bool init(utility::ErrorState& errorState) override;
60 
64  void setInput(AudioComponentBaseInstance& input);
65 
66  private:
67  std::vector<SafeOwner<Node>> mOutputs; // Nodes presenting the audio output to the node manager
68  nap::ComponentInstancePtr<AudioComponentBase> mInput = {this, &OutputComponent::mInput}; // Pointer to the component whose input will be sent to the output.
69 
70  AudioService* mAudioService = nullptr; // Pointer to the audio service the audio output will be sent to.
71  std::vector<int> mChannelRouting;
72  };
73 
74  }
75 }
nap::audio::OutputComponent::mInput
nap::ComponentPtr< AudioComponentBase > mInput
property: 'Input' The component whose audio output to route to the interface
Definition: outputcomponent.h:35
nap::audio::OutputComponent
Definition: outputcomponent.h:24
nap::utility::ErrorState
Definition: errorstate.h:19
nap::audio::AudioComponentBaseInstance
Definition: audiocomponentbase.h:47
nap::audio::OutputComponentInstance
Definition: outputcomponent.h:51
nap::audio::OutputComponent::OutputComponent
OutputComponent()
Definition: outputcomponent.h:30
nap::EntityInstance
Definition: entity.h:34
nap::ComponentInstancePtr
Definition: component.h:28
nap::ComponentInstance
Definition: component.h:43
nap::Component
Definition: component.h:151
nap::audio::OutputComponent::mChannelRouting
std::vector< int > mChannelRouting
property: 'Routing' the channels to output
Definition: outputcomponent.h:42
nap
Definition: templateapp.h:17
nap::audio::OutputComponentInstance::OutputComponentInstance
OutputComponentInstance(EntityInstance &entity, Component &resource)
Definition: outputcomponent.h:56
nap::ComponentPtr
Definition: component.h:31