NAP
videoaudiocomponent.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 // Local Includes
8 #include "videoplayer.h"
9 #include "videoaudio.h"
10 
11 // External Includes
12 #include <audio/utility/safeptr.h>
13 #include <audio/component/audiocomponentbase.h>
14 
15 namespace nap
16 {
17 
18  namespace audio
19  {
20  // Forward Declares
21  class VideoAudioComponentInstance;
22 
28  {
29  RTTI_ENABLE(AudioComponentBase)
31 
32  public:
34 
35  // Properties
36  rtti::ObjectPtr<VideoPlayer> mVideoPlayer = nullptr;
37  int mChannelCount = 2;
38  bool mProcessAudio = true;
39  };
40 
41 
47  {
48  RTTI_ENABLE(AudioComponentBaseInstance)
49  public:
51 
52  // Initialize the component
53  bool init(utility::ErrorState& errorState) override;
54 
58  int getChannelCount() const override { return mNode->getChannelCount(); }
59 
64  OutputPin* getOutputForChannel(int channel) override { return &mNode->getOutput(channel); }
65 
66  private:
67  SafeOwner<VideoNode> mNode = nullptr;
68  VideoPlayer* mVideoPlayer = nullptr;
69 
74  void selectVideo(VideoPlayer& video);
75 
76  // Called when video selection changes
77  nap::Slot<VideoPlayer&> mVideoChangedSlot = { this, &VideoAudioComponentInstance::selectVideo };
78  };
79  }
80 }
nap::Slot
Slot.
Definition: signalslot.h:21
nap::rtti::ObjectPtr
Definition: objectptr.h:154
nap::audio::VideoAudioComponentInstance::getChannelCount
int getChannelCount() const override
Definition: videoaudiocomponent.h:58
nap::utility::ErrorState
Definition: errorstate.h:19
nap::audio::AudioComponentBaseInstance
Definition: audiocomponentbase.h:47
nap::audio::VideoAudioComponentInstance::VideoAudioComponentInstance
VideoAudioComponentInstance(EntityInstance &entity, Component &resource)
Definition: videoaudiocomponent.h:50
nap::audio::AudioComponentBase
Definition: audiocomponentbase.h:31
nap::audio::VideoAudioComponent::VideoAudioComponent
VideoAudioComponent()
Definition: videoaudiocomponent.h:33
nap::audio::SafeOwner
Definition: safeptr.h:25
nap::EntityInstance
Definition: entity.h:34
nap::audio::OutputPin
Definition: audiopin.h:204
nap::Component
Definition: component.h:151
nap::VideoPlayer
Definition: videoplayer.h:58
nap
Definition: templateapp.h:17
nap::audio::VideoAudioComponentInstance::getOutputForChannel
OutputPin * getOutputForChannel(int channel) override
Definition: videoaudiocomponent.h:64
nap::audio::VideoAudioComponent
Definition: videoaudiocomponent.h:27
nap::audio::VideoAudioComponentInstance
Definition: videoaudiocomponent.h:46