Sound Bakery  v0.1.0
Open-source audio middleware for games
Loading...
Searching...
No Matches
effect.h
1#pragma once
2
3#include "sound_bakery/core/core_include.h"
4
5namespace sbk::engine
6{
7 class SB_CLASS effect_parameter_description final
8 {
9 REGISTER_REFLECTION(effect_parameter_description)
10
11 public:
13
15
16 sc_dsp_parameter m_parameter;
17 };
18
22 class SB_CLASS effect_description final : public sbk::core::database_object
23 {
24 REGISTER_REFLECTION(effect_description, database_object)
25
26 public:
27 effect_description() : sbk::core::database_object(), m_config() { set_dsp_type(SC_DSP_TYPE_LOWPASS); }
28
29 void set_dsp_type(sc_dsp_type type)
30 {
31 m_parameterDescriptions.clear();
32
33 m_config = sc_dsp_config_init(type);
34 BOOST_ASSERT(m_config.vtable != nullptr);
35
36 for (int i = 0; i < m_config.vtable->numParams; ++i)
37 {
38 m_parameterDescriptions.emplace_back(m_config.vtable->params[i]);
39 }
40 }
41
42 void set_dsp_clap(clap_plugin_factory* pluginFactory)
43 {
44 m_parameterDescriptions.clear();
45
46 m_config = sc_dsp_config_init_clap(pluginFactory);
47 BOOST_ASSERT(m_config.vtable != nullptr);
48
49 for (int i = 0; i < m_config.vtable->numParams; ++i)
50 {
51 m_parameterDescriptions.emplace_back(m_config.vtable->params[i]);
52 }
53 }
54
55 [[nodiscard]] std::vector<effect_parameter_description> get_parameters() const
56 {
57 return m_parameterDescriptions;
58 }
59 [[nodiscard]] const sc_dsp_config* get_config() const { return &m_config; }
60 [[nodiscard]] sc_dsp_type get_dsp_type() const { return m_config.type; }
61
62 private:
63 sc_dsp_config m_config;
64 std::vector<effect_parameter_description> m_parameterDescriptions;
65 };
66} // namespace sbk::engine
Base object type for any object that can exist in the editor/database. Holds an ID and name.
Definition database_object.h:12
Wraps a sc_dsp_config.
Definition effect.h:23
Defines a database object with a changeable property.
Definition parameter.h:18
sc_dsp_config SC_API sc_dsp_config_init(sc_dsp_type type)
Returns a valid sc_dsp_config object for the DSP type.
Definition sound_chef.c:1285
Definition sound_chef_common.h:168
Definition sound_chef_dsp.h:34