Banuba SDK
effect_manager.hpp
Go to the documentation of this file.
1 /// \file
2 /// \addtogroup EffectPlayer
3 /// @{
4 ///
5 // AUTOGENERATED FILE - DO NOT MODIFY!
6 // This file generated by Djinni from effect_player.djinni
7 
8 #pragma once
9 
10 #include <bnb/utils/defs.hpp>
11 #include <cstdint>
12 #include <memory>
13 #include <string>
14 
15 namespace bnb { namespace interfaces {
16 
17 class effect;
18 class effect_activated_listener;
19 class effect_event_listener;
20 class error_listener;
21 class hint_listener;
22 struct effect_info;
23 
24 class BNB_EXPORT effect_manager {
25 public:
26  virtual ~effect_manager() {}
27 
28  /**
29  * Add callback to receive errors messages from Effect Player.
30  * Thread-safe. May be called from any thread
31  */
32  virtual void add_error_listener(const std::shared_ptr<error_listener> & error_listener) = 0;
33 
34  /**
35  * Remove callback to receive errors messages from Effect Player.
36  * Thread-safe. May be called from any thread
37  */
38  virtual void remove_error_listener(const std::shared_ptr<error_listener> & error_listener) = 0;
39 
40  /**
41  * Add callback to receive user-visible messages from effects.
42  * You should display them on UI.
43  * Thread-safe. May be called from any thread
44  */
45  virtual void add_hint_listener(const std::shared_ptr<hint_listener> & hint_listener) = 0;
46 
47  /**
48  * Remove callback to receive user-visible messages from effects.
49  * Thread-safe. May be called from any thread
50  */
51  virtual void remove_hint_listener(const std::shared_ptr<hint_listener> & hint_listener) = 0;
52 
53  /**
54  * Add callback to receive events from effect.
55  * Thread-safe. May be called from any thread
56  */
57  virtual void add_effect_event_listener(const std::shared_ptr<effect_event_listener> & effect_event_listener) = 0;
58 
59  /**
60  * Remove callback to receive events from effect.
61  * Thread-safe. May be called from any thread
62  */
63  virtual void remove_effect_event_listener(const std::shared_ptr<effect_event_listener> & effect_event_listener) = 0;
64 
65  /**
66  * Add callback to receive notifications on effect change.
67  * Thread-safe. May be called from any thread
68  */
69  virtual void add_effect_activated_listener(const std::shared_ptr<effect_activated_listener> & effect_activated_listener) = 0;
70 
71  /**
72  * Remove callback to receive notifications on effect change.
73  * Thread-safe. May be called from any thread
74  */
75  virtual void remove_effect_activated_listener(const std::shared_ptr<effect_activated_listener> & effect_activated_listener) = 0;
76 
77  /**
78  * load and activate effect sync
79  * MUST be called from the render thread
80  */
81  virtual std::shared_ptr<effect> load(const std::string & url) = 0;
82 
83  /**
84  * load effect async, activate in the draw() call when it will be ready
85  * Thread-safe. May be called from any thread
86  */
87  virtual std::shared_ptr<effect> load_async(const std::string & url) = 0;
88 
89  /**
90  * Get effect info. May be called before loading effect
91  * "render type" and "recognizer features" fields won't be filled
92  * Thread-safe. May be called from any thread
93  */
94  static effect_info get_effect_info(const std::string & url);
95 
96  /**
97  * Unload effect from cache. if no currently loading effect -
98  * works the same way as load(""); launches empty effect loading.
99  * MUST be called from the render thread
100  */
101  virtual void unload(const std::shared_ptr<effect> & effect) = 0;
102 
103  /**
104  * get active
105  * Thread-safe. May be called from any thread
106  */
107  virtual std::shared_ptr<effect> current() = 0;
108 
109  /**
110  * size in Mb, effects count
111  * Thread-safe. May be called from any thread
112  */
113  virtual void change_cache_quota(int32_t size, int32_t count) = 0;
114 
115  /**
116  * Forces cache reload on the next load/load_async call
117  * Thread-safe. May be called from any thread
118  */
119  virtual void force_cache_reload() = 0;
120 
121  /**
122  * Set effect audio volume.
123  * Thread-safe. May be called from any thread
124  * @param volume A value in range `[0, 1]`, where `1` means maximum volume.
125  */
126  virtual void set_effect_volume(float volume) = 0;
127 
128  /**
129  * Changes effect player render size, should be called on render thread.
130  * MUST be called from the render thread
131  */
132  virtual void set_effect_size(int32_t fx_width, int32_t fx_height) = 0;
133 };
134 
135 } } // namespace bnb::interfaces
136 /// @}
137 
bnb::interfaces::effect_manager::remove_effect_activated_listener
virtual void remove_effect_activated_listener(const std::shared_ptr< effect_activated_listener > &effect_activated_listener)=0
Remove callback to receive notifications on effect change.
bnb::interfaces::effect_manager
Definition: effect_manager.hpp:24
bnb::interfaces::effect_manager::add_hint_listener
virtual void add_hint_listener(const std::shared_ptr< hint_listener > &hint_listener)=0
Add callback to receive user-visible messages from effects.
bnb::interfaces::effect_manager::get_effect_info
static effect_info get_effect_info(const std::string &url)
Get effect info.
bnb::interfaces::effect_manager::current
virtual std::shared_ptr< effect > current()=0
get active Thread-safe.
bnb::interfaces::effect_manager::add_error_listener
virtual void add_error_listener(const std::shared_ptr< error_listener > &error_listener)=0
Add callback to receive errors messages from Effect Player.
bnb::interfaces::effect_manager::unload
virtual void unload(const std::shared_ptr< effect > &effect)=0
Unload effect from cache.
bnb::interfaces::effect_manager::remove_hint_listener
virtual void remove_hint_listener(const std::shared_ptr< hint_listener > &hint_listener)=0
Remove callback to receive user-visible messages from effects.
bnb::interfaces::effect_manager::set_effect_size
virtual void set_effect_size(int32_t fx_width, int32_t fx_height)=0
Changes effect player render size, should be called on render thread.
bnb::interfaces::error_listener
Interface to receive errors from EffectPlayer.
Definition: error_listener.hpp:19
bnb::interfaces::effect_manager::add_effect_event_listener
virtual void add_effect_event_listener(const std::shared_ptr< effect_event_listener > &effect_event_listener)=0
Add callback to receive events from effect.
bnb::interfaces::effect_activated_listener
Interface to receive notifications on effect change.
Definition: effect_activated_listener.hpp:16
bnb::interfaces::effect_manager::load
virtual std::shared_ptr< effect > load(const std::string &url)=0
load and activate effect sync MUST be called from the render thread
bnb::interfaces::effect_event_listener
Callback interface for effect events.
Definition: effect_event_listener.hpp:17
bnb::interfaces::effect_manager::set_effect_volume
virtual void set_effect_volume(float volume)=0
Set effect audio volume.
bnb::interfaces::hint_listener
Callback to receive "hints" (e.g.
Definition: hint_listener.hpp:19
bnb::interfaces::effect_manager::change_cache_quota
virtual void change_cache_quota(int32_t size, int32_t count)=0
size in Mb, effects count Thread-safe.
bnb::interfaces::effect_manager::add_effect_activated_listener
virtual void add_effect_activated_listener(const std::shared_ptr< effect_activated_listener > &effect_activated_listener)=0
Add callback to receive notifications on effect change.
bnb::interfaces::effect
Definition: effect.hpp:15
bnb::interfaces::effect_manager::load_async
virtual std::shared_ptr< effect > load_async(const std::string &url)=0
load effect async, activate in the draw() call when it will be ready Thread-safe.
bnb::interfaces::effect_manager::remove_effect_event_listener
virtual void remove_effect_event_listener(const std::shared_ptr< effect_event_listener > &effect_event_listener)=0
Remove callback to receive events from effect.
bnb::interfaces::effect_manager::force_cache_reload
virtual void force_cache_reload()=0
Forces cache reload on the next load/load_async call Thread-safe.
bnb::interfaces::effect_info
Definition: effect_info.hpp:18
bnb::interfaces::effect_manager::remove_error_listener
virtual void remove_error_listener(const std::shared_ptr< error_listener > &error_listener)=0
Remove callback to receive errors messages from Effect Player.